query-f836495d70751d9cc9093ab966217b8d

rq turtle/ttl

Re: Rimuovere vecchi indirizziÈ una cosa un po' complicata con una query SPARQL; dovessi farlo opterei probabilmente per un controllo uno ad uno con un bot. Una risposta parziale però la puoi avere con questa query:

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel (SAMPLE(?new) as ?address) WHERE {

  ?item wdt:P17 wd:Q38 .
  ?item wdt:P2186 ?wlmid .
  ?item p:P969 ?old_statement .
  ?old_statement ps:P969 ?old .
  MINUS {
   ?old_statement ?pq_qual ?pq_obj .
   ?qual wikibase:qualifier ?pq_qual .
  }
  ?item p:P6375 ?new_statement .
  ?new_statement ps:P6375 ?new .
  MINUS {
   ?new_statement ?pq_qual_n ?pq_obj_n .
   ?qual_n wikibase:qualifier ?pq_qual_n .
  }
  FILTER(LANG(?new) = 'it')
  FILTER(?old = STR(?new))
  SERVICE wikibase:label { bd:serviceParam wikibase:language "it" . }
} GROUP BY ?item ?itemLabel
HAVING (COUNT(?old) = 1 && COUNT(?new) = 1)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v13("?_anon_42b5416610844a34809f33a099ae9de1144740") v14("?_anon_42b5416610844a34809f33a099ae9de1144741") v15("?address") v3("?item"):::projected v2("?new"):::projected v9("?new_statement") v1("?old") v5("?old_statement") v7("?pq_obj") v11("?pq_obj_n") v6("?pq_qual") v10("?pq_qual_n") v8("?qual") v12("?qual_n") v4("?wlmid") a1((" ")) a2((" ")) c2(["it"]):::literal c4(["wd:Q38"]):::iri c12(["bd:serviceParam"]):::iri f0[[" = '1^^xsd:integer' = '1^^xsd:integer'"]] f0 --> a1 f0 --> a2 f1[["?old = str(?new)"]] f1 --> v1 f1 --> v2 f2[["?new = 'it'"]] f2 --> v2 v3 --"p:direct/P17"--> c4 v3 --"p:direct/P2186"--> v4 v3 --"p:P969"--> v5 v5 --"p:statement/P969"--> v1 subgraph minus3["MINUS"] style minus3 stroke-width:6px,fill:pink,stroke:red; v5 -->v6--> v7 v8 --"wikibase:qualifier"--> v6 end v3 --"p:P6375"--> v9 v9 --"p:statement/P6375"--> v2 subgraph minus4["MINUS"] style minus4 stroke-width:6px,fill:pink,stroke:red; v9 -->v10--> v11 v12 --"wikibase:qualifier"--> v10 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c12 --"wikibase:language"--> c2 end bind8[/"count(?old)"/] v1 --o bind8 bind8 --as--o v13 bind9[/"count(?new)"/] v2 --o bind9 bind9 --as--o v14 bind10[/"sample(?new)"/] v2 --o bind10 bind10 --as--o v15