query-cadd6c36df5bb11858522c66c70a57a4
Myst
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?item ?property ?value ?unit ?qualifier ?qualifier_value ?qualifier_unit
WHERE
{
VALUES ?item { wd:Q658 }
VALUES ?property { wd:P2054 }
?property wikibase:claim ?claim .
?property wikibase:statementValue ?statementValue .
# Get amount and unit for the statement
?item ?claim ?statement .
?statement ?statementValue [wikibase:quantityAmount ?value; wikibase:quantityUnit ?unit] .
# Get qualifiers
OPTIONAL
{
{
# Get simple values for qualifiers which are not of type quantity
?statement ?pq ?qualifier_value .
?qualifier wikibase:qualifier ?pq .
?qualifier wikibase:propertyType ?qualifer_property_type .
FILTER (?qualifer_property_type != wikibase:Quantity)
}
UNION
{
# Get amount and unit for qualifiers of type quantity
?statement ?pqv [wikibase:quantityAmount ?qualifier_value; wikibase:quantityUnit ?qualifier_unit] .
?qualifier wikibase:qualifierValue ?pqv .
}
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?claim")
v1("?item"):::projected
v9("?pq")
v13("?pqv")
v2("?property"):::projected
v8("?qualifer_property_type")
v11("?qualifier"):::projected
v12("?qualifier_unit"):::projected
v10("?qualifier_value"):::projected
v5("?statement")
v4("?statementValue")
v7("?unit"):::projected
v6("?value"):::projected
a1((" "))
a2((" "))
bind0[/VALUES ?item/]
bind0-->v1
bind00(["wd:Q658"])
bind00 --> bind0
bind1[/VALUES ?property/]
bind1-->v2
bind10(["wd:P2054"])
bind10 --> bind1
v2 --"wikibase:claim"--> v3
v2 --"wikibase:statementValue"--> v4
v1 -->v3--> v5
a1 --"wikibase:quantityAmount"--> v6
a1 --"wikibase:quantityUnit"--> v7
v5 -->v4--> a1
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
a2 -."wikibase:quantityAmount".-> v10
a2 --"wikibase:quantityUnit"--> v12
v5 -->v13--> a2
v11 --"wikibase:qualifierValue"--> v13
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
f2[["?qualifer_property_type != 'wikibase:Quantity'"]]
f2 --> v8
v5 -->v9--> v10
v11 --"wikibase:qualifier"--> v9
v11 --"wikibase:propertyType"--> v8
end
union0r <== or ==> union0l
end
end