query-0f5a6cb12ea7e40d0363370c5f08f654

rq turtle/ttl

How many members come from the Bundesländer?

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?aLabel (COUNT (DISTINCT ?p) AS ?number)
WHERE { 
  {
    SELECT ?a ?p
    WHERE {  
      ?p wdt:P463 wd:Q105757481 . 
      OPTIONAL {
      ?p wdt:P159/wdt:P131*|wdt:P131+ ?a .
      ?a  wdt:P31 wd:Q1221156 .
      }
    }
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de" . }
} GROUP BY ?aLabel
ORDER BY DESC(?number)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?a") v4("?number") v2("?p"):::projected a1((" ")) c10(["de"]):::literal c8(["bd:serviceParam"]):::iri c2(["wd:Q105757481"]):::iri c6(["wd:Q1221156"]):::iri v2 --"wdt:P463"--> c2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v2 -."wdt:P131".-> v3 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P159"--> a1 a1 --"wdt:P131"--> v3 end union0r <== or ==> union0l end v3 --"wdt:P31"--> c6 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end bind1[/"count(?p)"/] v2 --o bind1 bind1 --as--o v4