SELECT DISTINCT ?subject ?label ?broader ?scope_note_nlWHERE { ?subject luc:term "weef*"; a gvp:Concept. OPTIONAL {?subject xl:prefLabel|xl:altLabel [dct:language gvp_lang:nl; xl:literalForm ?label]} OPTIONAL {?subject gvp:broaderGeneric ?broader]} OPTIONAL {?subject skos:scopeNote [dct:language gvp_lang:nl; rdf:value ?scope_note_nl]} }ORDER BY ?term
SELECT DISTINCT ?subject ?label ?blabel ?scope_note_nl
WHERE {
?subject luc:term "weef*"; a gvp:Concept.
OPTIONAL {?subject xl:prefLabel|xl:altLabel [dct:language gvp_lang:nl; xl:literalForm ?label]}
OPTIONAL {?subject gvp:broaderGeneric ?broader. ?broader xl:prefLabel|xl:altLabel [dct:language gvp_lang:nl; xl:literalForm ?blabel]}
OPTIONAL {?subject skos:scopeNote [dct:language gvp_lang:nl; rdf:value ?scope_note_nl]}
}
ORDER BY ?term
Rolf,
SELECT DISTINCT ?subject ?label ?broaderlabel ?scope_note_nl
WHERE {
?subject luc:term "weef*"; a gvp:Concept.
OPTIONAL {?subject xl:prefLabel|xl:altLabel [dct:language gvp_lang:nl; xl:literalForm ?label]}
OPTIONAL {?subject gvp:broaderGeneric ?broader . ?broader xl:prefLabel|xl:altLabel [dct:language gvp_lang:nl; xl:literalForm ?broaderlabel]}
OPTIONAL {?subject skos:scopeNote [dct:language gvp_lang:nl; rdf:value ?scope_note_nl]}
}
Best wishes,
Richard
--
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.
To post to this group, send email to gettyv...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gettyvocablod/e016945d-e4a5-4826-be69-0cae2c428758%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Rolf!1. Have you read the doc to learn the shape of the data? I know it's big (100p) but there's a very useful Overview diagram
2. Don't use DISTINCT if you can help it. It kills performance on large result sets (even if you set a LIMIT)
3. You wrote in email "the term, its preferred term (if any), its broader terms(s), related term(s), equivalent term(s), source (ie the source of this term), scope note and term ID". So you're getting a bunch of data for each concept.The query with a bunch of optionals as Gregg wrote has a defect: if a concept has 5 labels and 3 broaders, it will return 15 rows (Cartesian product). As you add cols, that Cartesian product will cause a combinatorial explosion.Consider a different approach: get just concept IDs, then fetch the semantic resource for each one (HTTP GET on the semantic URL, see Semantic Resolution for details).This will return "all data about concept" as documented at http://vocab.getty.edu/doc/#Per-Entity_Exports, http://vocab.getty.edu/doc/queries/#All_Data_For_Subject.
If that's too much data for you, consider a CONSTRUCT UNION query: use the one given as example and simplify it.Keep in mind that wildcard properties (?p1...?pD) return all direct statements at the respective node.
Hope to help! V
construct {
?x a skos:Concept;
skos:prefLabel ?label;
skos:inScheme ???;
skos:broader ?broader.
?broader a skos:Concept;
skos:inScheme ???;
skos:prefLabel ?broaderLabel.
} where {
?x # see FTS sample queries
?x xl:prefLabel [dct:language gvp_lang:nl; xl:literalForm ?label].
optional {
?x gvp:broaderPreferred ?broader.
?broader xl:prefLabel [dct:language gvp_lang:nl; xl:literalForm ?broaderLabel].
}
}