Cristiano Bianchi <c.bi...@keepthinking.it> writes:
We are trying to use the ULAN and TGN queries, following the successful use of AAT - but struggling.
In both cases we want to search the term/label only, not full text and sort by relevance. We are doing autocomplete - so partial strings should be ok (e.g. picass for picasso)
ULAN
In ULAN I'd like to search for Picasso and get the great Pablo first (if possible). If not, happy to settle on alphabetical sorting. The only way we can think of is the FULL TEXT search, but that searches all fields. Is there a way to only search the Term field?
select ?Subject ?Term ?Parents ?Descr ?ScopeNote ?Type (coalesce(?Type1,?Type2) as ?ExtraType) {
?Subject luc:term "picasso"; skos:inScheme ulan: ;a ?typ.
?typ rdfs:subClassOf gvp:Subject; rdfs:label ?Type.
filter (?typ != gvp:Subject)
optional {?Subject gvp:placeTypePreferred [gvp:prefLabelGVP [xl:literalForm ?Type1]]}
optional {?Subject gvp:agentTypePreferred [gvp:prefLabelGVP [xl:literalForm ?Type2]]}
optional {?Subject gvp:prefLabelGVP [xl:literalForm ?Term]}
optional {?Subject gvp:parentStringAbbrev ?Parents}
optional {?Subject foaf:focus/gvp:biographyPreferred/schema:description ?Descr}
optional {?Subject skos:scopeNote [dct:language gvp_lang:en; rdf:value ?ScopeNote]}}
ORDER BY (fn:lower-case(str(?Term)))
TGN
Similarly, if I use the below to search for London, I get anything that has London anywhere and if I don't use order by I get my London as the last Term, together with lots of others that I do not really need (e.g. Barking and Dagenham). I'd like to search the Term only.
?Subject luc:term "london"; skos:inScheme tgn: ;a ?typ. ?typ rdfs:subClassOf gvp:Subject; rdfs:label ?Type. filter (?typ != gvp:Subject) optional {?Subject gvp:placeTypePreferred [gvp:prefLabelGVP [xl:literalForm ?Type1]]} optional {?Subject gvp:agentTypePreferred [gvp:prefLabelGVP [xl:literalForm ?Type2]]} optional {?Subject gvp:prefLabelGVP [xl:literalForm ?Term]} optional {?Subject gvp:parentStringAbbrev ?Parents} optional {?Subject foaf:focus/gvp:biographyPreferred/schema:description ?Descr} optional {?Subject skos:scopeNote [dct:language gvp_lang:en; rdf:value ?ScopeNote]}} ORDER BY (fn:lower-case(str(?Term)))
Can you please help!?
luc:term ' "picasso*" ' # returns 15, same as "picasso"
luc:term ' "picass*" ' # returns nothing because there's nobody named "picass"select ?Subject ?Term ?Parents ?Descr ?ScopeNote ?Type (coalesce(?Type1,?Type2) as ?ExtraType) { ?Subject luc:term "picass*"; skos:inScheme ulan: ; a ?typ; gvp:prefLabelGVP [xl:literalForm ?Term]. filter (regex(?Term,"picass","i")) ?typ rdfs:subClassOf gvp:Subject; rdfs:label ?Type. filter (?typ != gvp:Subject) optional {?Subject gvp:placeTypePreferred [gvp:prefLabelGVP [xl:literalForm ?Type1]]} optional {?Subject gvp:agentTypePreferred [gvp:prefLabelGVP [xl:literalForm ?Type2]]} optional {?Subject gvp:parentStringAbbrev ?Parents} optional {?Subject foaf:focus/gvp:biographyPreferred/schema:description ?Descr} optional {?Subject skos:scopeNote [dct:language gvp_lang:en; rdf:value ?ScopeNote]}}ORDER BY (fn:lower-case(str(?Term)))