query-fbaf4dd9c06486db88abb54363100d45
TODO
Use at
- https://query.wikidata.org/sparql
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 (lista ridotta)
#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("222222" as ?rgb) }
OPTIONAL { ?item wdt:P31 wd:Q28564 . BIND("pubbliche" as ?layer) BIND("000000" as ?rgb) }
OPTIONAL { ?item wdt:P31 wd:Q385994 . BIND("specializzate" as ?layer) BIND("FFFFFF" as ?rgb) }
OPTIONAL { ?item wdt:P31 wd:Q105763925 . BIND("conservazione" as ?layer) BIND("00FF00" as ?rgb) } .
OPTIONAL { ?item wdt:P31 wd:Q1622062. BIND("universitarie" as ?layer) BIND("0000FF" as ?rgb) } .
OPTIONAL { ?item wdt:P31 wd:Q106231131. BIND("scolastiche" as ?layer) BIND("888888" as ?rgb) } .
BIND(IF(!BOUND(?rgb),"444444",?rgb) as ?rgb) # covers cases not dealt with by the OPTIONALs above
?item wdt:P625 ?coord
FILTER ((xsd:integer(SUBSTR(STR(?item),33))) < 113086038) .
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
c10(["wd:Q28564"]):::iri
c11(["wd:Q385994"]):::iri
c19(["it, en"]):::literal
c5(["wd:Q7075"]):::iri
c7(["wd:Q38"]):::iri
c14(["wd:Q106231131"]):::iri
c17(["bd:serviceParam"]):::iri
c13(["wd:Q1622062"]):::iri
c12(["wd:Q105763925"]):::iri
f0[["http://www.w3.org/2001/XMLSchema#integer(substring(str(?item),'33^^xsd:integer')) < '113086038^^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[/"'222222'"/]
bind4 --as--o v5
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P31".-> c10
bind5[/"'pubbliche'"/]
bind5 --as--o v5
bind6[/"'000000'"/]
bind6 --as--o v5
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P31".-> c11
bind7[/"'specializzate'"/]
bind7 --as--o v5
bind8[/"'FFFFFF'"/]
bind8 --as--o v5
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P31".-> c12
bind9[/"'conservazione'"/]
bind9 --as--o v5
bind10[/"'00FF00'"/]
bind10 --as--o v5
end
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P31".-> c13
bind11[/"'universitarie'"/]
bind11 --as--o v5
bind12[/"'0000FF'"/]
bind12 --as--o v5
end
subgraph optional6["(optional)"]
style optional6 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P31".-> c14
bind13[/"'scolastiche'"/]
bind13 --as--o v5
bind14[/"'888888'"/]
bind14 --as--o v5
end
bind15[/"if(not bound(?rgb),'444444',?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