Project:SPARQL/examples

From Chemical Compounds of Interest
Revision as of 15:48, 7 August 2024 by Egonw (talk | contribs) (Egonw moved page Project:SPARQL/examples to Project:SPARQL/Examples)
Jump to navigation Jump to search

Compound Lists

The VHP4Safety compounds

PREFIX wd: <https://compoundcloud.wikibase.cloud/entity/>
PREFIX wdt: <https://compoundcloud.wikibase.cloud/prop/direct/>

SELECT ?cmp ?cmpLabel ?typeLabel ?pubchem ?cas ?wikidata ?toxbank
       (GROUP_CONCAT(DISTINCT ?roleLabel; separator=", ") AS ?roles)
WHERE {
  ?cmp wdt:P21 wd:Q2059 ; wdt:P1 ?type .
  OPTIONAL { ?cmp wdt:P13 ?pubchem }
  OPTIONAL { ?cmp wdt:P4 ?toxbank }
  OPTIONAL { ?cmp wdt:P5 ?wikidata }
  OPTIONAL { ?cmp wdt:P23 ?cas }
  OPTIONAL { ?cmp wdt:P17 ?role . ?role rdfs:label ?roleLabel }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} GROUP BY ?typeLabel ?cmp ?cmpLabel ?pubchem ?wikidata ?toxbank ?cas

Try it!