query-a9100c0577142a6d9424bdb8e2b6933b

rq turtle/ttl

TODO

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 psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map                                                  # set the output visualisation
SELECT DISTINCT ?item ?itemLabel ?coord ?layer WHERE {            # put ?coord & ?layer in this select          
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". 
   }
  {
    SELECT DISTINCT ?item ?coord ?numericQuantity ?layer WHERE {  # put ?coord ?layer in this select
      OPTIONAL {?item wdt:P625 ?coord.}                           # get the coord
      ?item p:P31 ?statement0.
      ?statement0 (ps:P31/(wdt:P279*)) wd:Q483110.
      ?item p:P1083 ?statement1.
      ?statement1 (psv:P1083/wikibase:quantityAmount) ?numericQuantity.
      FILTER(?numericQuantity > "25000"^^xsd:decimal)
      ?item p:P1619 ?statement_2.
      ?statement_2 psv:P1619 ?statementValue_2.
      ?statementValue_2 wikibase:timeValue ?P1619_2.
      MINUS {
        ?item p:P3999 ?statement_3.
        ?statement_3 psv:P3999 ?statementValue_3.
        ?statementValue_3 wikibase:timeValue ?P3999_3.
      }
      ?item p:P625 ?statement4.
      ?statement4 (ps:P625) _:anyValueP625.
      bind(if(?numericQuantity >100000,"100k+",                     # assign numeric ranges
        if(?numericQuantity >90000,"90k+",
        if(?numericQuantity >80000,"80k+",
        if(?numericQuantity >70000,"70k+",
        if(?numericQuantity >60000,"60k+",
        if(?numericQuantity >50000,"50k+",
        if(?numericQuantity >40000,"40k+",
        if(?numericQuantity >30000,"30k+",
        if(?numericQuantity >20000,"20k+",
        if(?numericQuantity >10000,"10k+",
        if(?numericQuantity >10000,"0k+",""))))))))))) as ?layer)
    }
  }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v8("?P1619_2") v11("?P3999_3") v3("?coord"):::projected v2("?item"):::projected v13("?layer"):::projected v1("?numericQuantity") v4("?statement0") v5("?statement1") v12("?statement4") v7("?statementValue_2") v10("?statementValue_3") v6("?statement_2") v9("?statement_3") a3((" ")) a1((" ")) a2((" ")) c2(["bd:serviceParam"]):::iri c4(["#91;AUTO_LANGUAGE#93;"]):::literal c10(["wd:Q483110"]):::iri subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c2 --"wikibase:language"--> c4 end f0[["?numericQuantity > '25000^^xsd:decimal'"]] f0 --> v1 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P625".-> v3 end v2 --"p:P31"--> v4 v4 --"p:statement/P31"--> a1 a1 --"p:direct/P279"--> c10 v2 --"p:P1083"--> v5 v5 --"p:statement/value/P1083"--> a2 a2 --"wikibase:quantityAmount"--> v1 v2 --"p:P1619"--> v6 v6 --"p:statement/value/P1619"--> v7 v7 --"wikibase:timeValue"--> v8 subgraph minus1["MINUS"] style minus1 stroke-width:6px,fill:pink,stroke:red; v2 --"p:P3999"--> v9 v9 --"p:statement/value/P3999"--> v10 v10 --"wikibase:timeValue"--> v11 end v2 --"p:P625"--> v12 v12 --"p:statement/P625"--> a3 bind2[/"if(?numericQuantity > '100000^^xsd:integer','100k+',if(?numericQuantity > '90000^^xsd:integer','90k+',if(?numericQuantity > '80000^^xsd:integer','80k+',if(?numericQuantity > '70000^^xsd:integer','70k+',if(?numericQuantity > '60000^^xsd:integer','60k+',if(?numericQuantity > '50000^^xsd:integer','50k+',if(?numericQuantity > '40000^^xsd:integer','40k+',if(?numericQuantity > '30000^^xsd:integer','30k+',if(?numericQuantity > '20000^^xsd:integer','20k+',if(?numericQuantity > '10000^^xsd:integer','10k+',if(?numericQuantity > '10000^^xsd:integer','0k+','')))))))))))"/] v1 --o bind2 bind2 --as--o v13