query-04672b2e6a07fd4453d2b736b496add3
The 193 United Nations member states
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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX v: <http://www.wikidata.org/prop/statement/>
SELECT ?state ?code ?stateLabel (GROUP_CONCAT(DISTINCT(?capitalName);separator="; ") AS ?capitals) (GROUP_CONCAT(DISTINCT(?continentName);separator="; ") AS ?continents) ?start WHERE {
?state p:P463 ?memberBlock .
?memberBlock v:P463 wd:Q1065 .
?memberBlock pq:P580 ?start .
#?memberBlock pq:P582 ?end .
FILTER NOT EXISTS {?memberBlock pq:P582 ?end} .
?state wdt:P36 ?capital . ?capital rdfs:label ?capitalName . FILTER(lang(?capitalName) = "de") .
?state wdt:P30 ?continent . ?continent rdfs:label ?continentName . FILTER(lang(?continentName) = "de") .
OPTIONAL{?state wdt:P298 ?code}
SERVICE wikibase:label{bd:serviceParam wikibase:language "de"}
}
GROUP BY ?state ?stateLabel ?start ?code
ORDER BY ?start ?stateLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?capital")
v4("?capitalName"):::projected
v11("?capitals")
v10("?code"):::projected
v9("?continent")
v3("?continentName"):::projected
v12("?continents")
v6("?end")
v5("?memberBlock")
v1("?start"):::projected
v7("?state"):::projected
v2("?stateLabel"):::projected
c1(["de"]):::literal
c12(["bd:serviceParam"]):::iri
c5(["wd:Q1065"]):::iri
f0[["?continentName = 'de'"]]
f0 --> v3
f1[["?capitalName = 'de'"]]
f1 --> v4
f2[["not "]]
subgraph f2e0["Exists Clause"]
e0v1 --"p:qualifier/P582"--> e0v2
e0v2("?end"):::projected
e0v1("?memberBlock"):::projected
end
f2--EXISTS--> f2e0
f2 --> v5
f2 --> c2
f2 --> v6
v5 --"p:qualifier/P582"--> v6
v7 --"p:P463"--> v5
v5 --"p:statement/P463"--> c5
v5 --"p:qualifier/P580"--> v1
v7 --"p:direct/P36"--> v8
v8 --"rdfs:label"--> v4
v7 --"p:direct/P30"--> v9
v9 --"rdfs:label"--> v3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v7 -."p:direct/P298".-> v10
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c12 --"wikibase:language"--> c1
end
bind5[/"?capitalName"/]
v4 --o bind5
bind5 --as--o v11
bind6[/"?continentName"/]
v3 --o bind6
bind6 --as--o v12