query-1246aa17b3b49172001b7cb967129fcc
PropertiesDisease Ontology ID (P699)subclass of (P279)drug or therapy used for treatment (P2176)
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?item ?itemLabel ?rgb ?link
WHERE
{
VALUES ?toggle { true false }
?disease wdt:P699 ?doid;
wdt:P279+ wd:Q18123741;
wdt:P2176 ?drug.
?drug rdfs:label ?drugLabel.
FILTER(LANG(?drugLabel) = "en").
?disease rdfs:label ?diseaseLabel.
FILTER(LANG(?diseaseLabel) = "en").
BIND(IF(?toggle,?disease,?drug) AS ?item).
BIND(IF(?toggle,?diseaseLabel,?drugLabel) AS ?itemLabel).
BIND(IF(?toggle,"FFA500","7FFF00") AS ?rgb).
BIND(IF(?toggle,"",?disease) AS ?link).
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?disease")
v1("?diseaseLabel")
v5("?doid")
v6("?drug")
v2("?drugLabel")
v7("?item"):::projected
v8("?itemLabel"):::projected
v10("?link"):::projected
v9("?rgb"):::projected
v3("?toggle")
c4(["wd:Q18123741"]):::iri
f0[["?diseaseLabel = 'en'"]]
f0 --> v1
f1[["?drugLabel = 'en'"]]
f1 --> v2
bind2[/VALUES ?toggle/]
bind2-->v3
bind20(["true^^xsd:boolean"])
bind20 --> bind2
bind21(["false^^xsd:boolean"])
bind21 --> bind2
v4 --"wdt:P699"--> v5
v4 --"wdt:P279"--> c4
v4 --"wdt:P2176"--> v6
v6 --"rdfs:label"--> v2
v4 --"rdfs:label"--> v1
bind3[/"if(?toggle,?disease,?drug)"/]
v3 --o bind3
v4 --o bind3
v6 --o bind3
bind3 --as--o v7
bind4[/"if(?toggle,?diseaseLabel,?drugLabel)"/]
v3 --o bind4
v1 --o bind4
v2 --o bind4
bind4 --as--o v8
bind5[/"if(?toggle,'FFA500','7FFF00')"/]
v3 --o bind5
bind5 --as--o v9
bind6[/"if(?toggle,'',?disease)"/]
v3 --o bind6
v4 --o bind6
bind6 --as--o v10