query-0b3af51f8c53d23eb6d28f28c97dbe54
Tot de Catalunya SELECT ?item ?itemLabel ?tipus ?lat ?lon ?mun ?idescat WHERE { ?item wdt:P17 wd:Q29. ?item wdt:P131 wd:Q5705. ?item wdt:P31 ?tipus. OPTIONAL { ?item p:P625 ?coordinate . ?coordinate psv:P625 ?coordinate_node . ?coordinate_node wikibase:geoLatitude ?lat . ?coordinate_node wikibase:geoLongitude ?lon . } OPTIONAL { ?item wdt:P131 ?mun. ?mun wdt:P4335 ?idescat. ?mun wdt:P31 wd:Q33146843.} SERVICE wikibase:label { bd:serviceParam wikibase:language "ca,oc,en,es,pl,sv,ceb" . } }
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 psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#Tot de Catalunya
SELECT ?item ?itemLabel ?tipus ?lat ?lon ?mun ?idescat
WHERE {
?item wdt:P17 wd:Q29.
?item wdt:P131* wd:Q5705.
?item wdt:P31 ?tipus.
OPTIONAL {
?item p:P625 ?coordinate .
?coordinate psv:P625 ?coordinate_node .
?coordinate_node wikibase:geoLatitude ?lat .
?coordinate_node wikibase:geoLongitude ?lon .
}
OPTIONAL {
?item wdt:P131* ?mun.
?mun wdt:P4335 ?idescat.
?mun wdt:P31 wd:Q33146843.}
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ca,oc,en,es,pl,sv,ceb" .
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?coordinate")
v4("?coordinate_node")
v8("?idescat"):::projected
v1("?item"):::projected
v5("?lat"):::projected
v6("?lon"):::projected
v7("?mun"):::projected
v2("?tipus"):::projected
c4(["wd:Q5705"]):::iri
c11(["wd:Q33146843"]):::iri
c15(["ca,oc,en,es,pl,sv,ceb"]):::literal
c2(["wd:Q29"]):::iri
c13(["bd:serviceParam"]):::iri
v1 --"p:direct/P17"--> c2
v1 --"p:direct/P131"--> c4
v1 --"p:direct/P31"--> v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:P625".-> v3
v3 --"p:statement/value/P625"--> v4
v4 --"wikibase:geoLatitude"--> v5
v4 --"wikibase:geoLongitude"--> v6
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P131".-> v7
v7 --"p:direct/P4335"--> v8
v7 --"p:direct/P31"--> c11
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c13 --"wikibase:language"--> c15
end