Hi Rolf,
The query looks fine from my perspective, for whatever that is worth,
and I won't be offended if my opinion is given little stock.
I do have three comments.
1) If you always know you only want results from AAT, you can stipulate
the skos:ConceptScheme:
?subject skos:inScheme <
http://vocab.getty.edu/aat/> .
That will further reduce the result set.
2) The REGEX FILTER is interesting. Adding the above condition
(scheme=AAT) winnows the results to one, and it is the one in which you
are interested. That makes the FILTER seem unnecessary but its presence
ensures that the searched word is found in the prefLabel of the chosen
language. Compare this query to yours (note the slight difference in
spelling between the term being searched and the term being filtered).
SELECT * WHERE {
?subject luc:term "crystal*" .
?subject skos:inScheme <
http://vocab.getty.edu/aat/> .
OPTIONAL {?subject xl:prefLabel [dct:language gvp_lang:nl;
xl:literalForm ?term]}
OPTIONAL {?subject gvp:broaderPreferred ?broader .
?broader xl:prefLabel [dct:language gvp_lang:nl;
xl:literalForm ?broaderterm]}
OPTIONAL {?subject skos:scopeNote [dct:language gvp_lang:nl;
rdf:value ?scope_note_nl]}
OPTIONAL {?subject xl:prefLabel [dct:language gvp_lang:nl;
rdfs:comment ?comment]}
OPTIONAL {?subject xl:prefLabel [dct:language gvp_lang:nl;
gvp:estStart ?estStart]}
OPTIONAL {?subject xl:prefLabel [dct:language gvp_lang:nl;
gvp:estEnd ?estEnd]}
filter regex(?term, '^crystol', 'i')
}
ORDER BY ?term
LIMIT 12
I'd keep the FILTER for now. It is applied (or should be) after the
base results have been collected so the performance hit should be
negligible, assuming the number of hits is small enough. Moreover, the
FILTER seems paramount to what you hope to achieve - it not only ensures
the searched term is in the prefLabel of the chosen language but it also
performs a left-anchor match on the prefLabel, which the luc:term search
does not guarantee (for the field).
3) At this time, I do not see a reason why the skosxl:prefLabel
condition should be OPTIONAL at all. The presence of the FILTER in your
query means that if the prefLabel does not contain the searched string,
then no results/rows will be returned.
While on the topic of labels, your query also does not search alternate
labels. What if the term being searched matches on an alternative label?
The below query adds such a feature; it looks also at the altLabel
values for a possible match with the searched term. I had to make the
query return a specific set of variables and added the DISTINCT term to
remove duplicate hits.
SELECT DISTINCT ?subject ?pref_term ?broader ?broaderterm ?scope_note_nl
?comment ?estStart ?estEnd
WHERE {
?subject luc:term "crystol*" .
?subject skos:inScheme <
http://vocab.getty.edu/aat/> .
?subject xl:prefLabel [dct:language gvp_lang:nl; xl:literalForm
?pref_term] .
OPTIONAL {?subject xl:altLabel [dct:language gvp_lang:nl;
xl:literalForm ?alt_term]}
FILTER ( REGEX(?pref_term, '^crystol', 'i') || REGEX(?alt_term,
'^crystol', 'i') ) .
OPTIONAL {?subject gvp:broaderPreferred ?broader .
?broader xl:prefLabel [dct:language gvp_lang:nl;
xl:literalForm ?broaderterm]}
OPTIONAL {?subject skos:scopeNote [dct:language gvp_lang:nl;
rdf:value ?scope_note_nl]}
OPTIONAL {?subject xl:prefLabel [dct:language gvp_lang:nl;
rdfs:comment ?comment]}
OPTIONAL {?subject xl:prefLabel [dct:language gvp_lang:nl;
gvp:estStart ?estStart]}
OPTIONAL {?subject xl:prefLabel [dct:language gvp_lang:nl;
gvp:estEnd ?estEnd]}
}
ORDER BY ?pref_term
LIMIT 12
HTH,
Kevin
> --
> You received this message because you are subscribed to the Google
> Groups "Getty Vocabularies as Linked Open Data" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
gettyvocablo...@googlegroups.com
> <mailto:
gettyvocablo...@googlegroups.com>.
> To post to this group, send email to
gettyv...@googlegroups.com
> <mailto:
gettyv...@googlegroups.com>.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/gettyvocablod/dec3ef1e-9304-47c5-b255-67bc6567e8b9%40googlegroups.com
> <
https://groups.google.com/d/msgid/gettyvocablod/dec3ef1e-9304-47c5-b255-67bc6567e8b9%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit
https://groups.google.com/d/optout.