query-1763b2a9e8d3f4230595a4cb5798bf99
added before 2016-10 SELECT ?country ?countryLabel (count() AS ?count) WHERE { ?city wdt:P31/wdt:P279 wd:Q515 . # find instances of subclasses of city ?city p:P6 ?statement . # with a P6 (head of goverment) statement ?statement ps:P6 ?mayor . # ... that has the value ?mayor ?mayor wdt:P21 wd:Q6581072 . # ... where the ?mayor has P21 (sex or gender) female FILTER NOT EXISTS { ?statement pq:P582 ?x } # ... but the statement has no P582 (end date) qualifier ?city wdt:P17 ?country . # Also find the country of the city
# If available, get the "ru" label of the country, use "en" as fallback:
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ru,en" .
}
} GROUP BY ?country ?countryLabel ORDER BY DESC(?count) LIMIT 100 added before 2016-10 SELECT ?country ?countryLabel (count() AS ?count) WHERE { ?city wdt:P31/wdt:P279 wd:Q515 . # find instances of subclasses of city ?city p:P6 ?statement . # with a P6 (head of goverment) statement ?statement ps:P6 ?mayor . # ... that has the value ?mayor ?mayor wdt:P21 wd:Q6581072 . # ... where the ?mayor has P21 (sex or gender) female FILTER NOT EXISTS { ?statement pq:P582 ?x } # ... but the statement has no P582 (end date) qualifier ?city wdt:P17 ?country . # Also find the country of the city
# If available, get the "ru" label of the country, use "en" as fallback:
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ru,en" .
}
} GROUP BY ?country ?countryLabel ORDER BY DESC(?count) LIMIT 100 added before 2016-10 SELECT ?country ?countryLabel (count() AS ?count) WHERE { ?city wdt:P31/wdt:P279 wd:Q515 . # find instances of subclasses of city ?city p:P6 ?statement . # with a P6 (head of goverment) statement ?statement ps:P6 ?mayor . # ... that has the value ?mayor ?mayor wdt:P21 wd:Q6581072 . # ... where the ?mayor has P21 (sex or gender) female FILTER NOT EXISTS { ?statement pq:P582 ?x } # ... but the statement has no P582 (end date) qualifier ?city wdt:P17 ?country . # Also find the country of the city
# If available, get the "ru" label of the country, use "en" as fallback:
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ru,en" .
}
} GROUP BY ?country ?countryLabel ORDER BY DESC(?count) LIMIT 100 added before 2016-10 SELECT ?country ?countryLabel (count() AS ?count) WHERE { ?city wdt:P31/wdt:P279 wd:Q515 . # find instances of subclasses of city ?city p:P6 ?statement . # with a P6 (head of goverment) statement ?statement ps:P6 ?mayor . # ... that has the value ?mayor ?mayor wdt:P21 wd:Q6581072 . # ... where the ?mayor has P21 (sex or gender) female FILTER NOT EXISTS { ?statement pq:P582 ?x } # ... but the statement has no P582 (end date) qualifier ?city wdt:P17 ?country . # Also find the country of the city
# If available, get the "ru" label of the country, use "en" as fallback:
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ru,en" .
}
} GROUP BY ?country ?countryLabel ORDER BY DESC(?count) LIMIT 100 added before 2016-10 SELECT ?country ?countryLabel (count() AS ?count) WHERE { ?city wdt:P31/wdt:P279 wd:Q515 . # find instances of subclasses of city ?city p:P6 ?statement . # with a P6 (head of goverment) statement ?statement ps:P6 ?mayor . # ... that has the value ?mayor ?mayor wdt:P21 wd:Q6581072 . # ... where the ?mayor has P21 (sex or gender) female FILTER NOT EXISTS { ?statement pq:P582 ?x } # ... but the statement has no P582 (end date) qualifier ?city wdt:P17 ?country . # Also find the country of the city
# If available, get the "ru" label of the country, use "en" as fallback:
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ru,en" .
}
} GROUP BY ?country ?countryLabel ORDER BY DESC(?count) LIMIT 100 added before 2016-10 SELECT ?country ?countryLabel (count() AS ?count) WHERE { ?city wdt:P31/wdt:P279 wd:Q515 . # find instances of subclasses of city ?city p:P6 ?statement . # with a P6 (head of goverment) statement ?statement ps:P6 ?mayor . # ... that has the value ?mayor ?mayor wdt:P21 wd:Q6581072 . # ... where the ?mayor has P21 (sex or gender) female FILTER NOT EXISTS { ?statement pq:P582 ?x } # ... but the statement has no P582 (end date) qualifier ?city wdt:P17 ?country . # Also find the country of the city
# If available, get the "ru" label of the country, use "en" as fallback:
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ru,en" .
}
} GROUP BY ?country ?countryLabel ORDER BY DESC(?count) LIMIT 100 added before 2016-10 SELECT ?country ?countryLabel (count() AS ?count) WHERE { ?city wdt:P31/wdt:P279 wd:Q515 . # find instances of subclasses of city ?city p:P6 ?statement . # with a P6 (head of goverment) statement ?statement ps:P6 ?mayor . # ... that has the value ?mayor ?mayor wdt:P21 wd:Q6581072 . # ... where the ?mayor has P21 (sex or gender) female FILTER NOT EXISTS { ?statement pq:P582 ?x } # ... but the statement has no P582 (end date) qualifier ?city wdt:P17 ?country . # Also find the country of the city
# If available, get the "ru" label of the country, use "en" as fallback:
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ru,en" .
}
} GROUP BY ?country ?countryLabel ORDER BY DESC(?count) LIMIT 100 added before 2016-10 SELECT ?country ?countryLabel (count() AS ?count) WHERE { ?city wdt:P31/wdt:P279 wd:Q515 . # find instances of subclasses of city ?city p:P6 ?statement . # with a P6 (head of goverment) statement ?statement ps:P6 ?mayor . # ... that has the value ?mayor ?mayor wdt:P21 wd:Q6581072 . # ... where the ?mayor has P21 (sex or gender) female FILTER NOT EXISTS { ?statement pq:P582 ?x } # ... but the statement has no P582 (end date) qualifier ?city wdt:P17 ?country . # Also find the country of the city
# If available, get the "ru" label of the country, use "en" as fallback:
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ru,en" .
}
} GROUP BY ?country ?countryLabel ORDER BY DESC(?count) LIMIT 100 added before 2016-10 SELECT ?country ?countryLabel (count() AS ?count) WHERE { ?city wdt:P31/wdt:P279 wd:Q515 . # find instances of subclasses of city ?city p:P6 ?statement . # with a P6 (head of goverment) statement ?statement ps:P6 ?mayor . # ... that has the value ?mayor ?mayor wdt:P21 wd:Q6581072 . # ... where the ?mayor has P21 (sex or gender) female FILTER NOT EXISTS { ?statement pq:P582 ?x } # ... but the statement has no P582 (end date) qualifier ?city wdt:P17 ?country . # Also find the country of the city
# If available, get the "ru" label of the country, use "en" as fallback:
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ru,en" .
}
} GROUP BY ?country ?countryLabel ORDER BY DESC(?count) LIMIT 100 added before 2016-10 SELECT ?country ?countryLabel (count() AS ?count) WHERE { ?city wdt:P31/wdt:P279 wd:Q515 . # find instances of subclasses of city ?city p:P6 ?statement . # with a P6 (head of goverment) statement ?statement ps:P6 ?mayor . # ... that has the value ?mayor ?mayor wdt:P21 wd:Q6581072 . # ... where the ?mayor has P21 (sex or gender) female FILTER NOT EXISTS { ?statement pq:P582 ?x } # ... but the statement has no P582 (end date) qualifier ?city wdt:P17 ?country . # Also find the country of the city
# If available, get the "ru" label of the country, use "en" as fallback:
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ru,en" .
}
} GROUP BY ?country ?countryLabel ORDER BY DESC(?count) LIMIT 100
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#added before 2016-10
SELECT ?country ?countryLabel (count(*) AS ?count)
WHERE
{
?city wdt:P31/wdt:P279* wd:Q515 . # find instances of subclasses of city
?city p:P6 ?statement . # with a P6 (head of goverment) statement
?statement ps:P6 ?mayor . # ... that has the value ?mayor
?mayor wdt:P21 wd:Q6581072 . # ... where the ?mayor has P21 (sex or gender) female
FILTER NOT EXISTS { ?statement pq:P582 ?x } # ... but the statement has no P582 (end date) qualifier
?city wdt:P17 ?country . # Also find the country of the city
# If available, get the "ru" label of the country, use "en" as fallback:
SERVICE wikibase:label {
bd:serviceParam wikibase:language "ru,en" .
}
}
GROUP BY ?country ?countryLabel
ORDER BY DESC(?count)
LIMIT 100
Query found at
- https://www.wikidata.org/wiki/User:Duesentrieb/WDQL
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/en
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/es
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/fr
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/hy
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/ja
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/nl
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/sv
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/tr
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/uk
- https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries/examples/advanced/zh