accurator/commit
Extended field definition with more detailed source defenition.
author | Chris Dijkshoorn |
---|---|
Mon Mar 28 17:26:50 2016 +0200 | |
committer | Chris Dijkshoorn |
Mon Mar 28 17:26:50 2016 +0200 | |
commit | d89f787bd3c33c97d2adcf9578a635ae5f68f235 |
tree | 00a4524f1b57b3eb93bab52e69af53be60ba903f |
parent | 8a4c89dc057ffcd5a914e39ff11c712d56b9e1b1 |
Diff style: patch stat
diff --git a/lib/accurator/annotation.pl b/lib/accurator/annotation.pl index 641af45..60fe9d1 100644 --- a/lib/accurator/annotation.pl +++ b/lib/accurator/annotation.pl @@ -104,10 +104,17 @@ get_source(Uri, Locale, Source) :- rdfs_list_to_prolog_list(RdfList, SourceList), maplist(extract_literal(Locale), SourceList, Source), !. get_source(Uri, _Locale, Source) :- - rdf_has(Uri, auis:source, literal(Source)), !. + rdf_has(Uri, auis:source, SourceUri), + rdf_is_resource(SourceUri), !, + findall(PredicateLabel-Literal, + ( rdf(SourceUri, Predicate, literal(Literal)), + iri_xml_namespace(Predicate, _, PredicateLabel)), + Properties), + dict_pairs(Source, elements, Properties). extract_literal(Locale, literal(lang(Locale, Literal)), Literal) :- !. extract_literal(_Locale, literal(lang(en, Literal)), Literal) :- !. +extract_literal(_Locale, literal(Literal), Literal) :- !. %% annotations(+Type, +Uri, -Metadata) % diff --git a/rdf/domain/bible/ui/fields.ttl b/rdf/domain/bible/ui/fields.ttl index 8efcc8e..7b95b46 100644 --- a/rdf/domain/bible/ui/fields.ttl +++ b/rdf/domain/bible/ui/fields.ttl @@ -8,10 +8,10 @@ abibui:smallBibleUI a auis:AnnotationUI ; dcterms:title "Bible annotation UI"@en; auis:wholeFields ( - abibui:ICBibleTheme + abibui:ICBibleTheme ); auis:fragmentFields ( - abibui:BibleCharacter + abibui:BibleCharacter ) . abibui:emotionUI a auis:AnnotationUI ; @@ -27,14 +27,22 @@ abibui:ICBibleTheme a auis:DropdownField ; rdfs:label "Thema"@nl ; dcterms:comment "add the Biblical theme"@en ; dcterms:comment "voeg het bijbelse thema toe"@nl ; - auis:source "/api/autocomplete?q={query}&filter={\"scheme\":\"http://accurator.nl/bible%23BiblicalThemeConceptScheme\"}" . + auis:source abibui:ICBibleThemeSource . + +abibui:ICBibleThemeSource a auis:AlternativesSource ; + auis:api "/api/autocomplete" ; + auis:filterScheme "http://accurator.nl/bible%23BiblicalThemeConceptScheme" . abibui:BibleCharacter a auis:DropdownField ; rdfs:label "Biblical person"@en ; rdfs:label "Bijbels persoon"@nl ; dcterms:comment "add the biblical person"@en ; dcterms:comment "voeg de bijbelse persoon toe"@nl ; - auis:source "/api/autocomplete?q={query}&filter={\"scheme\":\"http://accurator.nl/bible%23BiblicalFigureConceptScheme\"}&labelrank=['http://www.w3.org/2000/01/rdf-schema%23label'-1]" . + auis:source abibui:BibleCharacterSource . + +abibui:BibleCharacterSource a auis:AlternativesSource ; + auis:api "/api/autocomplete/all" ; + auis:filterScheme "http://accurator.nl/bible%23BiblicalFigureConceptScheme" . abibui:Emotion a auis:SelectField ; rdfs:label "Emotie"@nl ; diff --git a/rdf/ui/labels_schema.ttl b/rdf/ui/labels_schema.ttl index a4bca3b..feff7c8 100644 --- a/rdf/ui/labels_schema.ttl +++ b/rdf/ui/labels_schema.ttl @@ -79,6 +79,10 @@ auis:hasSelectOption a rdf:Property ; rdfs:label "Has select option" ; rdfs:comment "Property linking a selectfield and its options."@en . +auis:AlternativesSource a rdfs:Class ; + rdfs:label "Source of annotation alternatives" ; + rdfs:comment "Source of annotation alternatives, e.g. dropdown alternatives."@en . + auis:source a rdf:Property ; rdfs:label "Has source" ; rdfs:comment "The source of data for an input field."@en . diff --git a/web/js/components/field.js b/web/js/components/field.js index 40157bc..cdada6d 100644 --- a/web/js/components/field.js +++ b/web/js/components/field.js @@ -62,15 +62,13 @@ Field.prototype.initDropdown = function() { // three sitations for obtaining and adding alternatives array if(this.source instanceof Array) { // 1. source is an array containing alternatives for dropdown - console.log("alternatives array ", this.source); addDropdown(this.source); - } else if (this.source.api === "/api/autocomple/all") { - // console.log("promised all alternatives"); + } else if (this.source.api === "/api/autocomplete/all") { // // 2. all alternatives should be obtained - // this.getAllAlternatives(this.source) - // .then(function(alternativesArray){ - // addDropdown(alternativesArray); - // }); + this.getAllAlternatives(this.source) + .then(function(alternativesArray){ + addDropdown(alternativesArray); + }); } else if (this.source.api === "/api/autocomple") { // console.log("promised all alternatives"); // 3. event listener should be placed and alternatives are obtained on trigger