query-0c90f2af193f99eff54847ec94c9cf5a

rq turtle/ttl

Transport infrastructure

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?point ?pointLabel ?class1 ?class1Label (COUNT(DISTINCT ?class) AS ?classes) (MIN(?instances) AS ?min) (MAX(?instances) AS ?max) (SUM(?instances) AS ?sum) WHERE {
  {
    SELECT DISTINCT ?point ?class1 ?class (COUNT(DISTINCT ?instance) AS ?instances) WHERE {
      VALUES ?point {wd:Q228332}
      #VALUES ?point {wd:Q548662 wd:Q55488 wd:Q55678}
      #VALUES ?point {wd:928830 wd:Q1248784 wd:Q2298537 wd:Q20202390 wd:Q87979897}
      OPTIONAL {?class1 wdt:P279 ?point.
                ?subclass wdt:P279* ?class1.}
      BIND(COALESCE(?subclass, ?point) AS ?class)
      #OPTIONAL {?class ?property ?value.}
      #?property rdf:type owl:DatatypeProperty.
      OPTIONAL {?instance wdt:P31 ?class.}
    }
    GROUP BY ?point ?class1 ?class
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
GROUP BY ?point ?pointLabel ?class1 ?class1Label
ORDER BY CONCAT(STR(?point), "  ", IF(BOUND(?class1), STR(?class1Label), " "))

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?class"):::projected v2("?class1"):::projected v3("?class1Label"):::projected v8("?classes") v6("?instance") v7("?instances"):::projected v10("?max") v9("?min") v4("?point"):::projected v4("?subclass") v11("?sum") c6(["bd:serviceParam"]):::iri c8(["en"]):::literal bind0[/VALUES ?point/] bind0-->v4 bind00(["wd:Q228332"]) bind00 --> bind0 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P279".-> v4 v4 --"wdt:P279"--> v2 end bind1[/"?subclass?point"/] v4 --o bind1 v4 --o bind1 bind1 --as--o v5 subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v6 -."wdt:P31".-> v5 end bind3[/"count(?instance)"/] v6 --o bind3 bind3 --as--o v7 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c6 --"wikibase:language"--> c8 end bind8[/"count(?class)"/] v5 --o bind8 bind8 --as--o v8 bind9[/"min(?instances)"/] v7 --o bind9 bind9 --as--o v9 bind10[/"max(?instances)"/] v7 --o bind10 bind10 --as--o v10 bind11[/"sum(?instances)"/] v7 --o bind11 bind11 --as--o v11