query-389735d156929060c73933afbebaa5b9
Mapping Russian federal subjects). (Q915)Perm and (Q105002)Berezniki is what I got so far. The issue is that the query goes too deep in selecting some administrative divisions (hence the different shades of green), while others are not selected at all (like ThisI'm trying to create a locator map of the administrative divisions of Russian federal subjects by using Mapframe/Maplink. This is the query:
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 schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?id
(if(BOUND(?link),
concat('[[', substr(str(?link),31,500), '|', ?idLabel, ']]'),
?idLabel)
as ?title)
WHERE {
{ ?id wdt:P31/wdt:P279* wd:Q192287.
?id wdt:P131 wd:Q5400. }
SERVICE wikibase:label {
bd:serviceParam wikibase:language 'en' .
?id rdfs:label ?idLabel .
}
OPTIONAL {?link schema:about ?id.
?link schema:isPartOf <https://en.wikipedia.org/> . }
} GROUP BY ?id ?link ?idLabel ?hexcolor ?idhexcolor
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?id"):::projected
v2("?idLabel"):::projected
v3("?link"):::projected
v4("?title")
a1((" "))
c9(["en"]):::literal
c13([https://en.wikipedia.org/]):::iri
c7(["bd:serviceParam"]):::iri
c3(["wd:Q192287"]):::iri
c5(["wd:Q5400"]):::iri
v1 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c3
v1 --"wdt:P131"--> c5
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
v1 --"rdfs:label"--> v2
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."schema:about".-> v1
v3 --"schema:isPartOf"--> c13
end
bind0[/"if(bound(?link),concat('#91;#91;',substring(str(?link),'31^^xsd:integer','500^^xsd:integer'),'|',?idLabel,'#93;#93;'),?idLabel)"/]
v3 --o bind0
v2 --o bind0
bind0 --as--o v4