A set of SPARQL examples
Chemical classes taxonomy.
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX hint: <http://www.bigdata.com/queryHints#>
#title: Chemical classes taxonomy
SELECT * WHERE {
VALUES ?instance {
wd:Q15711994 # group of isomeric entities
wd:Q17339814 # group or class of chemical substances
wd:Q47154513 # structural class of chemical entities
wd:Q55640599 # group of chemical entities
wd:Q56256173 # class of chemical entities with similar applications or functions
wd:Q56256178 # class of chemical entities with similar source or occurrence
wd:Q55662456 # group of ortho, meta, para isomers
wd:Q59199015 # group of stereoisomers
wd:Q72070508 # group or class of chemical entities
wd:Q74892521 # imprecise class of chemical entities
}
?class wdt:P31 ?instance. hint:Prior hint:runFirst true.
OPTIONAL { ?class wdt:P279 ?parent. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?class"):::projected
v1("?instance"):::projected
v3("?parent"):::projected
c2([http://www.bigdata.com/queryHints#Prior]):::iri
c7([http://www.bigdata.com/rdf#serviceParam]):::iri
c4(["true^^xsd:boolean"]):::literal
c9(["#91;AUTO_LANGUAGE#93;,mul,en"]):::literal
bind0[/VALUES ?instance/]
bind0-->v1
bind00(["wd:Q15711994"])
bind00 --> bind0
bind01(["wd:Q17339814"])
bind01 --> bind0
bind02(["wd:Q47154513"])
bind02 --> bind0
bind03(["wd:Q55640599"])
bind03 --> bind0
bind04(["wd:Q56256173"])
bind04 --> bind0
bind05(["wd:Q56256178"])
bind05 --> bind0
bind06(["wd:Q55662456"])
bind06 --> bind0
bind07(["wd:Q59199015"])
bind07 --> bind0
bind08(["wd:Q72070508"])
bind08 --> bind0
bind09(["wd:Q74892521"])
bind09 --> bind0
v2 --"wdt:P31"--> v1
c2 --http://www.bigdata.com/queryHints#runFirst--> c4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P279".-> v3
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end