Can somebody, please help me write a SPARQL query, which would select all currently living politicians, whose political institutions are from a country within the EU?
Currently I have 3 queries, but I don't know how to combine them
The first one checks for people who are living, whose occupation is politician and/or who are a member of a political party
SELECT DISTINCT ?politician ?politicianLabel
WHERE {
?politician wdt:P106 wd:Q82955 .
FILTER NOT EXISTS {?politician wdt:P570|wdt:P509|wdt:P20 ?o}
OPTIONAL {
?politician wdt:P102 ?membership .
}
FILTER NOT EXISTS {?politician wdt:P570|wdt:P509|wdt:P20 ?o}
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
}
The second one shows all EU countries
SELECT ?country ?countryLabel
WHERE {
?country wdt:P463 wd:Q458
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
}
And the third one finds parties from a specific country
SELECT ?party
WHERE {
?party wdt:P31 wd:Q7278
?party wdt:17 #EU Countries#
}
But How can I combine these queries? Can somebody help?
Thank you