cluster_search/commit
Set rijksui as default, made annotating result optional.
author | Chris Dijkshoorn |
---|---|
Tue Sep 16 16:45:02 2014 +0200 | |
committer | Chris Dijkshoorn |
Tue Sep 16 16:45:02 2014 +0200 | |
commit | c0e74dcd96727eef14cf5c7ecb66400a80b23b85 |
tree | dcec3b84b9be64b6ef7b3651a9a86d65f6cf445d |
parent | 0c4cffc846a1961ded2ee1bca5daf3052a9892ed |
Diff style: patch stat
diff --git a/config-available/cluster_search.pl b/config-available/cluster_search.pl index ef2232b..38203e5 100644 --- a/config-available/cluster_search.pl +++ b/config-available/cluster_search.pl @@ -9,5 +9,7 @@ :- rdf_attach_library(cluster_search(rdf)). :- rdf_load_library('cluster-search-ui-schema'). :- rdf_load_library('cluster-search-schema'). +:- rdf_load_library('rijksmuseum-search-ui'). +:- rdf_load_library('bird-search-ui'). :- use_module(api(cluster_search)). diff --git a/lib/cluster_search/settings.pl b/lib/cluster_search/settings.pl index 8e7a5c8..c1c12f5 100644 --- a/lib/cluster_search/settings.pl +++ b/lib/cluster_search/settings.pl @@ -44,3 +44,5 @@ 'Cache graph search results'). :- setting(search:graphSearchCacheSize, nonneg, 50, 'Maximum searches kept in cache (0 is unbound)'). +:- setting(search:annotate, boolean, false, + 'Indicate the possibility of annotating search result.'). diff --git a/lib/cluster_search/web_ui.pl b/lib/cluster_search/web_ui.pl index 3cebc55..973476c 100644 --- a/lib/cluster_search/web_ui.pl +++ b/lib/cluster_search/web_ui.pl @@ -27,20 +27,15 @@ The ui variables are retrieved from rdf (e.g. rdf/rijksmuseum_ui.ttl). :- use_module(library(http/http_open)). :- use_module(library('http/http_dispatch')). :- use_module(library(semweb/rdf_db)). -:- use_module(library('semweb/rdf_library')). :- use_module(library(cluster_search/settings)). :- use_module(cliopatria(components/label)). :- use_module(library(cluster_search/search_statistics)). :- use_module(applications(annotation)). -:- set_setting_default(search:ui, bui:birdUI). :- set_setting_default(thumbnail:thumbnail_size, size(350,300)). :- set_setting_default(thumbnail:medium_size, size(1280,1024)). :- set_setting_default(search:image_filter, all). -% load rdf info ui -:- rdf_load_library('bird-search-ui'). - %% web(+Request) is det. % % If query is given, generate results page, fron page otherwise. @@ -120,27 +115,14 @@ content(results, Options) --> content(result, Options) --> {option(uri(Uri), Options), - query_title(Uri, Title), - AnnotationUI = 'http://semanticweb.cs.vu.nl/annotate/nicheAccuratorBirdDemoUi', - %get_anfields(AnnotationUI, [], [], AnnotationFields), % TODO: Check if lists can be empty - AnnotationFields = [ - 'http://semanticweb.cs.vu.nl/annotate/example#IOCCommonNameAnnotation', - 'http://semanticweb.cs.vu.nl/annotate/example#IOCScientificNameAnnotation'], - get_metafields(AnnotationUI, [], MetadataFields), % TODO: Check if lists can be empty - AnnotationOptions = [ - target(Uri), - ui(AnnotationUI), - title(Title), - user('http://invenit.user.nl/'), - annotation_fields(AnnotationFields), - metadata_fields(MetadataFields) - ], - %image_url(Uri, ImageUrl), + setting(search:annotate, Annotate), + (Annotate + -> get_annotation_options(Uri, AnnotationOrImage) + ; get_image_options(Uri, AnnotationOrImage) + ), findall([Predicate, Object], rdf(Uri, Predicate, Object), Metadata) - %atomic_list_concat(['annotate?target=', Uri], FrameUrl) }, - html([%img([src(ImageUrl), class('img-responsive'), alt('Image')]), - \annotation_page_body(AnnotationOptions), + html([\result_page_body(Annotate, AnnotationOrImage), div([class('row'), id('metadata')],div([class('well well-sm')],dl(class('dl-horizontal'), \metadata(Metadata)))) ]). @@ -207,6 +189,24 @@ content(analytics, _) --> content(results, Options) --> results_page(cluster, Options). +get_annotation_options(Uri, AnnotationOptions) :- + AnnotationUI = 'http://semanticweb.cs.vu.nl/annotate/nicheAccuratorBirdDemoUi', + AnnotationFields = [ + 'http://semanticweb.cs.vu.nl/annotate/example#IOCCommonNameAnnotation', + 'http://semanticweb.cs.vu.nl/annotate/example#IOCScientificNameAnnotation'], + get_metafields(AnnotationUI, [], MetadataFields), + query_title(Uri, Title), + AnnotationOptions = [ + target(Uri), + ui(AnnotationUI), + title(Title), + user('http://invenit.user.nl/'), + annotation_fields(AnnotationFields), + metadata_fields(MetadataFields) + ]. + +get_image_options(Uri, ImageUrl) :- + image_url(Uri, ImageUrl). %analytics_html --> % html({|html|| % <!-- The 2 Buttons for the user to interact with --> @@ -313,6 +313,11 @@ title(analytics, _) --> concat(Title, ' Statistics', TitleStatistics)}, html(title(TitleStatistics)). +result_page_body(true, AnnotationOptions) --> + annotation_page_body(AnnotationOptions). +result_page_body(false, ImageUrl) --> + html(img([src(ImageUrl), class('img-responsive'), alt('Image')])). + %% query_title(+Uri, -Title) % % Retrieve the tile of a uri, ignoring the language tag.