query-632c3953872c07d49764f294001e9061
SPARQL for duplicate imagesI was working lately with the following query:
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item1 ?item1Label ?item2 ?item2Label ?image
{
?item1 wdt:P31 wd:Q3305213 .
?item2 wdt:P31 wd:Q3305213 .
?item1 wdt:P18 ?image .
?item2 wdt:P18 ?image .
FILTER(?item1 != ?item2) .
MINUS {?item1 p:P18/pq:P518 [] } .
MINUS {?item2 p:P18/pq:P518 [] } .
MINUS {?item1 p:P18/pq:P180 [] } .
MINUS {?item2 p:P18/pq:P180 [] } .
SERVICE wikibase:label { bd:serviceParam wikibase:language "en,en" } .
}
order by ?image
LIMIT 500
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?image"):::projected
v2("?item1"):::projected
v3("?item2"):::projected
a2((" "))
a4((" "))
a6((" "))
a8((" "))
a1((" "))
a3((" "))
a5((" "))
a7((" "))
c2(["wd:Q3305213"]):::iri
c8(["bd:serviceParam"]):::iri
c10(["en,en"]):::literal
f0[["?item1 != ?item2"]]
f0 --> v2
f0 --> v3
v2 --"p:direct/P31"--> c2
v3 --"p:direct/P31"--> c2
v2 --"p:direct/P18"--> v1
v3 --"p:direct/P18"--> v1
subgraph minus1["MINUS"]
style minus1 stroke-width:6px,fill:pink,stroke:red;
v2 --"p:P18"--> a1
a1 --"p:qualifier/P518"--> a2
end
subgraph minus2["MINUS"]
style minus2 stroke-width:6px,fill:pink,stroke:red;
v3 --"p:P18"--> a3
a3 --"p:qualifier/P518"--> a4
end
subgraph minus3["MINUS"]
style minus3 stroke-width:6px,fill:pink,stroke:red;
v2 --"p:P18"--> a5
a5 --"p:qualifier/P180"--> a6
end
subgraph minus4["MINUS"]
style minus4 stroke-width:6px,fill:pink,stroke:red;
v3 --"p:P18"--> a7
a7 --"p:qualifier/P180"--> a8
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end