Project:SPARQL/examples

From Chemical Compounds of Interest
Revision as of 15:45, 7 August 2024 by Egonw (talk | contribs) (Created page with "# List the VHP4Safety compounds <sparql> 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 { ?cm...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
  1. List 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