query-9d80d26f62e5afe5c4058579b718f61e

rq turtle/ttl

TODO

Use at

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#>
SELECT DISTINCT ?item ?itemLabel ?typeLabel ?location ?locationLabel ?dedicatee ?dedicateeLabel
WHERE
{
  ?item wdt:P31 ?type .
  ?type wdt:P279* wd:Q4989906 . # Super class is monument. That includes statues
  ?item wdt:P825 ?dedicatee .
  ?item wdt:P276 ? / wdt:P131? / wdt:P17 wd:Q38 . # Location? / administrative unit? / country Italy
  OPTIONAL { ?item wdt:P276 ?loc . } # Location
  OPTIONAL { ?item wdt:P131 ?adm . } # Administrative area
  BIND (COALESCE(?loc, ?adm) AS ?location)
  ?dedicatee wdt:P21 wd:Q6581072 .
  MINUS { ?item wd:P195 ?collection . } # Not in a collection (museum or other)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?adm") v7("?collection") v3("?dedicatee"):::projected v1("?item"):::projected v4("?loc") v6("?location"):::projected v2("?type") a1((" ")) a2((" ")) c3(["wd:Q4989906"]):::iri c10(["wd:Q6581072"]):::iri c8(["wd:Q38"]):::iri c13(["bd:serviceParam"]):::iri c15(["#91;AUTO_LANGUAGE#93;,en"]):::literal v1 --"wdt:P31"--> v2 v2 --"wdt:P279"--> c3 v1 --"wdt:P825"--> v3 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P276"--> a1 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; end union0r <== or ==> union0l end subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; a1 --"wdt:P131"--> a2 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; end union1r <== or ==> union1l end a2 --"wdt:P17"--> c8 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P276".-> v4 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P131".-> v5 end bind0[/"?loc?adm"/] v4 --o bind0 v5 --o bind0 bind0 --as--o v6 v3 --"wdt:P21"--> c10 subgraph minus1["MINUS"] style minus1 stroke-width:6px,fill:pink,stroke:red; v1 --"wd:P195"--> v7 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c13 --"wikibase:language"--> c15 end