query-9f808bcaecce6219e037d686a4e9dda8

rq turtle/ttl

count of streets of France by cities (WIP) SELECT DISTINCT (COUNT(?city) AS ?count) ?city ?cityLabel WHERE { ?item wdt:P31 wd:Q79007; wdt:P17 wd:Q142. ?item wdt:P131 ?city. SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en". ?city rdfs:label ?cityLabel. } } GROUP BY ?city ?cityLabel ORDER BY DESC(xsd:integer(?count))

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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#>
# count of streets of France by cities (WIP) 
SELECT DISTINCT (COUNT(?city) AS ?count) ?city ?cityLabel WHERE {
  ?item wdt:P31 wd:Q79007; wdt:P17 wd:Q142.
  ?item wdt:P131 ?city.
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "fr,en".
    ?city rdfs:label ?cityLabel.
  }
}
GROUP BY ?city ?cityLabel
ORDER BY DESC(xsd:integer(?count))

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?city"):::projected v4("?cityLabel"):::projected v5("?count") v2("?item") c7(["bd:serviceParam"]):::iri c2(["wd:Q79007"]):::iri c9(["fr,en"]):::literal c4(["wd:Q142"]):::iri v2 --"wdt:P31"--> c2 v2 --"wdt:P17"--> c4 v2 --"wdt:P131"--> v3 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 v3 --"rdfs:label"--> v4 end bind1[/"count(?city)"/] v3 --o bind1 bind1 --as--o v5