query-25ddbf9c6b72dda4a1ba7b669c12e3d8
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX psn: <http://www.wikidata.org/prop/statement/value-normalized/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?normal ?deprecated ?diff ?unitLabel WHERE {
?item p:P2044 ?statement.
?statement psn:P2044 ?statement_psn .
?statement_psn wikibase:quantityAmount ?normal .
?statement_psn wikibase:quantityUnit ?unit .
?statement wikibase:rank wikibase:NormalRank .
{?statement prov:wasDerivedFrom ?statement0 .
?statement0 pr:P143 ?normal_ref .
filter (?normal_ref!=wd:Q837615) }
UNION
{ filter not exists { ?statement prov:wasDerivedFrom ?statement0 . } }
?item p:P2044 ?statement1 .
?statement1 psn:P2044 ?statement1_psn .
?statement1_psn wikibase:quantityAmount ?deprecated .
?statement1 wikibase:rank wikibase:DeprecatedRank .
?statement1 prov:wasDerivedFrom ?statement2 .
?statement2 pr:P143 wd:Q837615 .
bind(?normal - ?deprecated as ?diff)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v10("?deprecated"):::projected
v12("?diff"):::projected
v1("?item"):::projected
v4("?normal"):::projected
v6("?normal_ref")
v2("?statement")
v7("?statement0")
v8("?statement1")
v9("?statement1_psn")
v11("?statement2")
v3("?statement_psn")
v5("?unit")
c7(["wd:Q837615"]):::iri
c10(["wikibase:DeprecatedRank"]):::iri
c6(["wikibase:NormalRank"]):::iri
c12(["bd:serviceParam"]):::iri
c14(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v1 --"p:P2044"--> v2
v2 --"p:statement/value-normalized/P2044"--> v3
v3 --"wikibase:quantityAmount"--> v4
v3 --"wikibase:quantityUnit"--> v5
v2 --"wikibase:rank"--> c6
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"prov:wasDerivedFrom"--> e0v2
e0v1("?statement"):::projected
e0v2("?statement0"):::projected
end
f0--EXISTS--> f0e0
f0 --> v2
f0 --> c8
f0 --> v7
v2 --"prov:wasDerivedFrom"--> v7
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
f1[["?normal_ref != 'wd:Q837615'"]]
f1 --> v6
v2 --"prov:wasDerivedFrom"--> v7
v7 --"p:reference/P143"--> v6
end
union0r <== or ==> union0l
end
v1 --"p:P2044"--> v8
v8 --"p:statement/value-normalized/P2044"--> v9
v9 --"wikibase:quantityAmount"--> v10
v8 --"wikibase:rank"--> c10
v8 --"prov:wasDerivedFrom"--> v11
v11 --"p:reference/P143"--> c7
bind2[/"?normal - ?deprecated"/]
v4 --o bind2
v10 --o bind2
bind2 --as--o v12
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c12 --"wikibase:language"--> c14
end