query-9dce32c343b462a0d39e54f2956f35a0
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX psn: <http://www.wikidata.org/prop/statement/value-normalized/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?country ?countryLabel ?countryArea
WHERE {
{
SELECT DISTINCT *
WHERE {
# Instances (P31) of country (Q3624078), sovereign state (Q183366), or disputed territory (Q15634554).
VALUES ?countryclass {wd:Q3624078 wd:Q183366 wd:Q15634554 }
?country wdt:P31 ?countryclass .
# the psn: prefix to normalize the values to a common unit of area (meters, in this case)
?country p:P2046 ?statement .
?statement psn:P2046/wikibase:quantityAmount ?countryArea .
#?statement pq:P518 wd:Q2872203.
?statement a wikibase:BestRank.
}
} SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . }
} ORDER BY ASC(?countryLabel)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?country"):::projected
v5("?countryArea"):::projected
v1("?countryLabel"):::projected
v2("?countryclass")
v4("?statement")
a1((" "))
c8(["bd:serviceParam"]):::iri
c6(["wikibase:BestRank"]):::iri
c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal
bind0[/VALUES ?countryclass/]
bind0-->v2
bind00(["wd:Q3624078"])
bind00 --> bind0
bind01(["wd:Q183366"])
bind01 --> bind0
bind02(["wd:Q15634554"])
bind02 --> bind0
v3 --"p:direct/P31"--> v2
v3 --"p:P2046"--> v4
v4 --"p:statement/value-normalized/P2046"--> a1
a1 --"wikibase:quantityAmount"--> v5
v4 --"a"--> c6
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end