Community-curated SPARQL example queries for multiple life-science endpoints.
Give translations of the Disease Ontology term DOID:399. The English term needs to exist, which it is, because the Disease Ontology is an ontology in the English language. It will return the translations from the term existing as Wikidata label, based on the language tag
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?English ?language ?label WHERE {
?disease wdt:P699 "DOID:399";
rdfs:label ?English;
rdfs:label ?label .
BIND(LANG(?label) as ?languageCode)
?wdLanguage wdt:P424 ?languageCode;
rdfs:label ?language .
FILTER EXISTS {?wdLanguage wdt:P31?/wdt:P279+ wd:Q17376908}
FILTER (LANG(?English)="en")
FILTER (LANG(?language)="en")
} ORDER BY ?language
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?English"):::projected
v4("?disease")
v5("?label"):::projected
v1("?language"):::projected
v6("?languageCode")
v3("?wdLanguage")
a1((" "))
c4(["wd:Q17376908"]):::iri
c6(["DOID:399"]):::literal
f0[["?language = 'en'"]]
f0 --> v1
f1[["?English = 'en'"]]
f1 --> v2
f2[[" "]]
subgraph f2e0["Exists Clause"]
subgraph unione00[" Union "]
subgraph unione00l[" "]
style unione00l fill:#abf,stroke-dasharray: 3 3;
e0v1 --"wdt:P31"--> e0a1
end
subgraph unione00r[" "]
style unione00r fill:#abf,stroke-dasharray: 3 3;
end
unione00r <== or ==> unione00l
end
e0a1 --"wdt:P279"--> e0c3
e0v1("?wdLanguage"):::projected
e0a1((" ")):::projected
e0c3(["wd:Q17376908"]):::iri
end
f2--EXISTS--> f2e0
f2 --> v3
f2 --> a1
f2 --> c2
f2 --> c3
f2 --> c4
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P31"--> a1
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
end
union0r <== or ==> union0l
end
a1 --"wdt:P279"--> c4
v4 --"wdt:P699"--> c6
v4 --"rdfs:label"--> v2
v4 --"rdfs:label"--> v5
bind3[/"?label"/]
v5 --o bind3
bind3 --as--o v6
v3 --"wdt:P424"--> v6
v3 --"rdfs:label"--> v1