query-15b274278aad4d6fe2287ced8a82bf6f

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 bd: <http://www.bigdata.com/rdf#>
#title:Distribuzione biblioteche per tipologia in Italia. layers (color coded)
#defaultView:Map{"hide":"?rgb"}
SELECT DISTINCT ?item ?itemLabel ?itemDescription ?coord ?layer ?rgb WHERE {
  {?item wdt:P31/wdt:P279* wd:Q7075} .
  ?item wdt:P17 wd:Q38; wdt:P791 ?isil.
  OPTIONAL { ?item wdt:P31 wd:Q7075 . BIND("biblioteche" as ?layer) BIND("FF0000" as ?rgb) }
  OPTIONAL { ?item wdt:P31 wd:Q2326815 . BIND("comunali" as ?layer) BIND("00CC00" as ?rgb) } .
  OPTIONAL { ?item wdt:P31 wd:Q1076099 . BIND("scolastiche" as ?layer) BIND("FFFF33" as ?rgb) }
  OPTIONAL { ?item wdt:P31 wd:Q28564 . BIND("pubbliche" as ?layer) BIND("B266FF" as ?rgb) }
 OPTIONAL { ?item wdt:P31 wd:Q385994 . BIND("specializzate" as ?layer) BIND("66FFB2" as ?rgb) } 
 OPTIONAL { ?item wdt:P31 wd:Q105763925 . BIND("conservazione" as ?layer) BIND("FF9933" as ?rgb) } .
 OPTIONAL { ?item wdt:P31 wd:Q1622062 . BIND("universitarie" as ?layer) BIND("3333FF" as ?rgb) } .

  BIND(IF(!BOUND(?rgb),"6600CC",?rgb) as ?rgb) # covers cases not dealt with by the OPTIONALs above
   ?item wdt:P625 ?coord 
  FILTER ((xsd:integer(SUBSTR(STR(?item),33))) < 113610669) . 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "it, en". }
  }

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?coord"):::projected v2("?isil") v1("?item"):::projected v5("?layer"):::projected v5("?rgb"):::projected a1((" ")) c9(["wd:Q2326815"]):::iri c11(["wd:Q28564"]):::iri c10(["wd:Q1076099"]):::iri c12(["wd:Q385994"]):::iri c19(["it, en"]):::literal c5(["wd:Q7075"]):::iri c7(["wd:Q38"]):::iri c17(["bd:serviceParam"]):::iri c14(["wd:Q1622062"]):::iri c13(["wd:Q105763925"]):::iri f0[["http://www.w3.org/2001/XMLSchema#integer(substring(str(?item),'33^^xsd:integer')) < '113610669^^xsd:integer'"]] f0 --> v1 v1 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c5 v1 --"wdt:P17"--> c7 v1 --"wdt:P791"--> v2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P31".-> c5 bind1[/"'biblioteche'"/] bind1 --as--o v5 bind2[/"'FF0000'"/] bind2 --as--o v5 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P31".-> c9 bind3[/"'comunali'"/] bind3 --as--o v5 bind4[/"'00CC00'"/] bind4 --as--o v5 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P31".-> c10 bind5[/"'scolastiche'"/] bind5 --as--o v5 bind6[/"'FFFF33'"/] bind6 --as--o v5 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P31".-> c11 bind7[/"'pubbliche'"/] bind7 --as--o v5 bind8[/"'B266FF'"/] bind8 --as--o v5 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P31".-> c12 bind9[/"'specializzate'"/] bind9 --as--o v5 bind10[/"'66FFB2'"/] bind10 --as--o v5 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P31".-> c13 bind11[/"'conservazione'"/] bind11 --as--o v5 bind12[/"'FF9933'"/] bind12 --as--o v5 end subgraph optional6["(optional)"] style optional6 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P31".-> c14 bind13[/"'universitarie'"/] bind13 --as--o v5 bind14[/"'3333FF'"/] bind14 --as--o v5 end bind15[/"if(not bound(?rgb),'6600CC',?rgb)"/] v5 --o bind15 bind15 --as--o v5 v1 --"wdt:P625"--> v5 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c17 --"wikibase:language"--> c19 end