sparql-examples

A set of SPARQL examples

View the Project on GitHub Adafede/sparql-examples

wd_chemicals_solubility

rq turtle/ttl

Chemicals with solubility, solvent, temperature and their units.

Use at


PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX pqv: <http://www.wikidata.org/prop/qualifier/value/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#title: Chemicals with solubility, solvent, temperature and their units.
SELECT ?item ?inchikey ?solubility ?solvent ?solventLabel ?temperature ?unit_temperature ?unit_temperatureLabel ?unit_solubility ?unit_solubilityLabel WHERE {
    ?item wdt:P235 ?inchikey.
    ?item p:P2177 ?statement.
    ?statement ps:P2177 ?solubility.
    ?statement pq:P2178 ?solvent.
    OPTIONAL {
        ?statement pq:P2076 ?temperature.
        ?statement pqv:P2076/wikibase:quantityUnit ?unit_temperature.
    }
    ?statement psv:P2177/wikibase:quantityUnit ?unit_solubility.
    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("?inchikey"):::projected 
  v1("?item"):::projected 
  v4("?solubility"):::projected 
  v5("?solvent"):::projected 
  v3("?statement")
  v6("?temperature"):::projected 
  v8("?unit_solubility"):::projected 
  v7("?unit_temperature"):::projected 
  a1((" "))
  a2((" "))
  c10([http://www.bigdata.com/rdf#serviceParam]):::iri 
  c12(["#91;AUTO_LANGUAGE#93;,mul,en"]):::literal 
  v1 --"p:direct/P235"-->  v2
  v1 --"p:P2177"-->  v3
  v3 --"p:statement/P2177"-->  v4
  v3 --"p:qualifier/P2178"-->  v5
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v3 -."p:qualifier/P2076".->  v6
    v3 --"p:qualifier/value/P2076"-->  a1
    a1 --"wikibase:quantityUnit"-->  v7
  end
  v3 --"p:statement/value/P2177"-->  a2
  a2 --"wikibase:quantityUnit"-->  v8
  subgraph s1["http://wikiba.se/ontology#label"]
    style s1 stroke-width:4px;
    c10 --"wikibase:language"-->  c12
  end