query-580df3577730bdaeaf151a8d7465663d
French départements with Name, Wikidata ID, OSM relation ID, and ISO 3166-2 code SELECT ?name (?item as ?wikidata) ?osm ?code WHERE { ?item wdt:P31 wd:Q6465; # French départements wdt:P300 ?code. # with ISO 3166-2 code OPTIONAL { ?item wdt:P402 ?osm. } # OSM relation if available SERVICE wikibase:label { bd:serviceParam wikibase:language "fr". ?item rdfs:label ?name. } }
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 bd: <http://www.bigdata.com/rdf#>
#French départements with Name, Wikidata ID, OSM relation ID, and ISO 3166-2 code
SELECT ?name (?item as ?wikidata) ?osm ?code WHERE {
?item wdt:P31 wd:Q6465; # French départements
wdt:P300 ?code. # with ISO 3166-2 code
OPTIONAL { ?item wdt:P402 ?osm. } # OSM relation if available
SERVICE wikibase:label {
bd:serviceParam wikibase:language "fr".
?item rdfs:label ?name.
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?code"):::projected
v1("?item"):::projected
v4("?name"):::projected
v3("?osm"):::projected
v5("?wikidata")
c6(["bd:serviceParam"]):::iri
c2(["wd:Q6465"]):::iri
c8(["fr"]):::literal
v1 --"wdt:P31"--> c2
v1 --"wdt:P300"--> v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P402".-> v3
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c6 --"wikibase:language"--> c8
v1 --"rdfs:label"--> v4
end
bind0[/"?item"/]
v1 --o bind0
bind0 --as--o v5