query-2816ac52bbdf76eb2b33348bce71de25
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 schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#villages with tewiki or enwiki articles but without wikidata in OSM in a specific district
#defaultView:Map
SELECT DISTINCT ?2011censuscode ?wd_label_village ?wd_label_village_te ?wd_qid_village ?wd_loc_village ?wd_label_mandal ?wd_qid_mandal WHERE {
wd:Q110714862 wdt:P150 ?mandal.
?village wdt:P131 ?mandal;
(wdt:P31/(wdt:P279*)) wd:Q56436498;
wdt:P625 ?wd_loc_village.
BIND(?mandal AS ?wd_mandal)
OPTIONAL { ?village wdt:P5578 ?2011censuscode. }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en".
?village rdfs:label ?wd_label_village.
?wd_mandal rdfs:label ?wd_label_mandal.
}
OPTIONAL {
?village rdfs:label ?wd_label_village_te.
FILTER((LANG(?wd_label_village_te)) = "te")
}
OPTIONAL {
?article schema:about ?village;
schema:isPartOf <https://te.wikipedia.org/>;
schema:name ?page_titleTE.
}
OPTIONAL {
?article schema:about ?village;
schema:isPartOf <https://en.wikipedia.org/>;
schema:name ?page_titleEN.
}
FILTER((BOUND(?page_titleEN))|| (BOUND(?page_titleTE)))
BIND(REPLACE(STR(?village), "^.*/([^/]*)$", "$1") AS ?wd_qid_village)
BIND(REPLACE(STR(?wd_mandal), "^.*/([^/]*)$", "$1") AS ?wd_qid_mandal)
}
ORDER BY (?2011censuscode) (?wd_label_mandal) (?wd_label_village)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?2011censuscode"):::projected
v11("?article")
v7("?mandal")
v4("?page_titleEN")
v5("?page_titleTE")
v8("?village")
v2("?wd_label_mandal"):::projected
v3("?wd_label_village"):::projected
v6("?wd_label_village_te"):::projected
v9("?wd_loc_village"):::projected
v10("?wd_mandal")
v13("?wd_qid_mandal"):::projected
v12("?wd_qid_village"):::projected
a1((" "))
c13(["en"]):::literal
c17([https://te.wikipedia.org/]):::iri
c19([https://en.wikipedia.org/]):::iri
c11(["bd:serviceParam"]):::iri
c7(["wd:Q56436498"]):::iri
c2(["wd:Q110714862"]):::iri
f0[["(bound(?page_titleEN) || bound(?page_titleTE))"]]
f0 --> v4
f0 --> v5
c2 --"wdt:P150"--> v7
v8 --"wdt:P131"--> v7
v8 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c7
v8 --"wdt:P625"--> v9
bind1[/"?mandal"/]
v7 --o bind1
bind1 --as--o v10
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v8 -."wdt:P5578".-> v1
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c13
v8 --"rdfs:label"--> v3
v10 --"rdfs:label"--> v2
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v8 -."rdfs:label".-> v6
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v11 -."schema:about".-> v8
v11 --"schema:isPartOf"--> c17
v11 --"schema:name"--> v5
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v11 -."schema:about".-> v8
v11 --"schema:isPartOf"--> c19
v11 --"schema:name"--> v4
end
bind2[/"replace(str(?village),'^.*/(#91;^/#93;*)$','$1')"/]
v8 --o bind2
bind2 --as--o v12
bind3[/"replace(str(?wd_mandal),'^.*/(#91;^/#93;*)$','$1')"/]
v10 --o bind3
bind3 --as--o v13