query-733e004fb6f1a911ea3c818994f99353

rq turtle/ttl

Propertiesinstance of (P31)subclass of (P279)located in the administrative territorial entity (P131)area (P2046)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX psn: <http://www.wikidata.org/prop/statement/value-normalized/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?federalState ?federalStateLabel (AVG(?areaInSquareKilometres) AS ?averageAreaInSquareKilometres) (COUNT(?areaInSquareKilometres)/COUNT(*) AS ?ratioWithArea) WHERE {
  ?district wdt:P31/wdt:P279* wd:Q15630827;
            wdt:P131* ?federalState.
  OPTIONAL { ?district p:P2046/psn:P2046/wikibase:quantityAmount ?areaInSquareMetres. }
  ?federalState wdt:P31 wd:Q1221156.
  BIND(?areaInSquareMetres/1000000 AS ?areaInSquareKilometres).
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de". }
}
GROUP BY ?federalState ?federalStateLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?_anon_d00291b7e9a143df8ec0be8c8ebd714c54901"):::projected v6("?_anon_d00291b7e9a143df8ec0be8c8ebd714c54902"):::projected v4("?areaInSquareKilometres"):::projected v3("?areaInSquareMetres") v7("?averageAreaInSquareKilometres") v1("?district") v2("?federalState"):::projected v8("?ratioWithArea") a1((" ")) a2((" ")) a3((" ")) c12(["de"]):::literal c10(["bd:serviceParam"]):::iri c3(["wd:Q15630827"]):::iri c8(["wd:Q1221156"]):::iri v1 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c3 v1 --"p:direct/P131"--> v2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P2046".-> a2 a2 --"p:statement/value-normalized/P2046"--> a3 a3 --"wikibase:quantityAmount"--> v3 end v2 --"p:direct/P31"--> c8 bind0[/"?areaInSquareMetres / '1000000^^xsd:integer'"/] v3 --o bind0 bind0 --as--o v4 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end bind4[/"count(?areaInSquareKilometres)"/] v4 --o bind4 bind4 --as--o v5 bind5[/"count(*)"/] bind5 --as--o v6 bind6[/"average(?areaInSquareKilometres)"/] v4 --o bind6 bind6 --as--o v7 bind7[/" / "/] null --o bind7 null --o bind7 bind7 --as--o v8