query-32b7c50a5d9f964146c57a170af8f039
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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?place ?placeLabel
(GROUP_CONCAT(DISTINCT ?p31label;SEPARATOR=", ") AS ?instances)
(GROUP_CONCAT(DISTINCT ?p361label;SEPARATOR=", ") AS ?part_ofs)
WHERE {
?place wdt:P37 wd:Q9027.
OPTIONAL { ?place wdt:P31 ?p31 . }
OPTIONAL { ?place wdt:P361 ?p361 . }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "sv,fi,en".
?place rdfs:label ?placeLabel .
?p31 rdfs:label ?p31label .
?p361 rdfs:label ?p361label .
}
}
GROUP BY ?place ?placeLabel
ORDER BY STR(?placeLabel)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?instances")
v3("?p31")
v5("?p31label"):::projected
v4("?p361")
v6("?p361label"):::projected
v8("?part_ofs")
v2("?place"):::projected
v1("?placeLabel"):::projected
c8(["sv,fi,en"]):::literal
c2(["wd:Q9027"]):::iri
c6(["bd:serviceParam"]):::iri
v2 --"wdt:P37"--> c2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P31".-> v3
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P361".-> v4
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c6 --"wikibase:language"--> c8
v2 --"rdfs:label"--> v1
v3 --"rdfs:label"--> v5
v4 --"rdfs:label"--> v6
end
bind2[/"?p31label"/]
v5 --o bind2
bind2 --as--o v7
bind3[/"?p361label"/]
v6 --o bind3
bind3 --as--o v8