query-16dd63c338a76d7eac2b7ee61b6996dc
Austrian Municipalities "named after" Austrian Chancellors or Vice-Chancellors SELECT DISTINCT ?Ortsname ?coords ?OrganwalterLabel WITH { SELECT DISTINCT ?Name ?Organwalter WHERE { { VALUES ?kanzler { wd:Q1006398 wd:Q692110 } ?Organwalter wdt:P39 ?kanzler; wdt:P735 ?Vorname; wdt:P734 ?Nachname. ?Vorname rdfs:label ?VornameLabel. ?Nachname rdfs:label ?NachnameLabel. FILTER((LANG(?VornameLabel)) = "de") FILTER((LANG(?NachnameLabel)) = "de") BIND(?VornameLabel AS ?Name) } UNION { VALUES ?kanzler { wd:Q1006398 wd:Q692110 } ?Organwalter wdt:P39 ?kanzler; wdt:P735 ?Vorname; wdt:P734 ?Nachname. ?Vorname rdfs:label ?VornameLabel. ?Nachname rdfs:label ?NachnameLabel. FILTER((LANG(?VornameLabel)) = "de") FILTER((LANG(?NachnameLabel)) = "de") BIND(?NachnameLabel AS ?Name) } } }AS %kanzlernames WITH { SELECT DISTINCT ?Ortsname ?coords WHERE { { SELECT * WHERE { ?item (wdt:P31/(wdt:P279*)) wd:Q667509. } } { SELECT * WHERE { ?item wdt:P17 wd:Q40. } } { SELECT * WHERE { ?item rdfs:label ?Ortsname; wdt:P625 ?coords. FILTER((LANG(?Ortsname)) = "de") } } } } AS %austrianplaces WHERE { INCLUDE %kanzlernames INCLUDE %austrianplaces FILTER(REGEX(?Ortsname, ?Name) ) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
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#>
# Austrian Municipalities "named after" Austrian Chancellors or Vice-Chancellors
SELECT DISTINCT ?Ortsname ?coords ?OrganwalterLabel WHERE { {
SELECT DISTINCT ?Name ?Organwalter WHERE {
{
VALUES ?kanzler {
wd:Q1006398
wd:Q692110
}
?Organwalter wdt:P39 ?kanzler;
wdt:P735 ?Vorname;
wdt:P734 ?Nachname.
?Vorname rdfs:label ?VornameLabel.
?Nachname rdfs:label ?NachnameLabel.
FILTER((LANG(?VornameLabel)) = "de")
FILTER((LANG(?NachnameLabel)) = "de")
BIND(?VornameLabel AS ?Name)
}
UNION
{
VALUES ?kanzler {
wd:Q1006398
wd:Q692110
}
?Organwalter wdt:P39 ?kanzler;
wdt:P735 ?Vorname;
wdt:P734 ?Nachname.
?Vorname rdfs:label ?VornameLabel.
?Nachname rdfs:label ?NachnameLabel.
FILTER((LANG(?VornameLabel)) = "de")
FILTER((LANG(?NachnameLabel)) = "de")
BIND(?NachnameLabel AS ?Name)
}
}
} {
SELECT DISTINCT ?Ortsname ?coords WHERE {
{ SELECT * WHERE { ?item (wdt:P31/(wdt:P279*)) wd:Q667509. } }
{ SELECT * WHERE { ?item wdt:P17 wd:Q40. } }
{
SELECT * WHERE {
?item rdfs:label ?Ortsname;
wdt:P625 ?coords.
FILTER((LANG(?Ortsname)) = "de")
}
}
} } FILTER(REGEX(?Ortsname, ?Name) )
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}