sparql-examples

A set of SPARQL examples

View the Project on GitHub Adafede/sparql-examples

wd_chemicals_melting_point

rq turtle/ttl

Chemicals with melting point 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 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 melting point and their units.
SELECT ?item ?inchikey ?melting_point ?unit ?unitLabel WHERE {
    ?item wdt:P235 ?inchikey.
    ?item p:P2101 ?statement.
    ?statement ps:P2101 ?melting_point.
    ?statement psv:P2101/wikibase:quantityUnit ?unit.
    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("?melting_point"):::projected 
  v3("?statement")
  v5("?unit"):::projected 
  a1((" "))
  c7([http://www.bigdata.com/rdf#serviceParam]):::iri 
  c9(["#91;AUTO_LANGUAGE#93;,mul,en"]):::literal 
  v1 --"p:direct/P235"-->  v2
  v1 --"p:P2101"-->  v3
  v3 --"p:statement/P2101"-->  v4
  v3 --"p:statement/value/P2101"-->  a1
  a1 --"wikibase:quantityUnit"-->  v5
  subgraph s1["http://wikiba.se/ontology#label"]
    style s1 stroke-width:4px;
    c7 --"wikibase:language"-->  c9
  end