query-3e048567b1adc8523ae3cb7366a05f11
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX p: <http://www.wikidata.org/prop/>
select ?item where {
?item p:P91 [
prov:wasDerivedFrom ?ref
] .
?ref pr:P143 [] .
filter not exists {
?item p:P91 [
prov:wasDerivedFrom ?ref2
]
filter (?ref2 != ?ref )
filter not exists { ?ref2 pr:P143 [] } .
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?item"):::projected
v2("?ref")
v1("?ref2")
a4((" "))
a1((" "))
a3((" "))
a2((" "))
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0f0[["not "]]
subgraph e0f0e0e0["Exists Clause"]
e0e0v1 --"p:reference/P143"--> e0e0a1
e0e0v1("?ref2"):::projected
e0e0a1((" ")):::projected
end
e0f0--EXISTS--> e0f0e0e0
e0f0 --> e0v1
e0f0 --> e0c1
e0f0 --> e0a1
e0v1 --"p:reference/P143"--> e0a1
e0f1[["?ref2 != ?ref"]]
e0f1 --> e0v1
e0f1 --> e0v2
e0a2 --"prov:wasDerivedFrom"--> e0v1
e0v3 --"p:P91"--> e0a2
e0v3("?item"):::projected
e0v2("?ref"):::projected
e0v1("?ref2"):::projected
e0a1((" ")):::projected
e0a2((" ")):::projected
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> c1
f0 --> a1
f0 --> v2
f0 --> a2
f0 --> c2
f0 --> v3
f0 --> c3
f1[["not "]]
subgraph f1e1["Exists Clause"]
e1v1 --"p:reference/P143"--> e1a1
e1v1("?ref2"):::projected
e1a1((" ")):::projected
end
f1--EXISTS--> f1e1
f1 --> v1
f1 --> c1
f1 --> a1
v1 --"p:reference/P143"--> a1
f2[["?ref2 != ?ref"]]
f2 --> v1
f2 --> v2
a2 --"prov:wasDerivedFrom"--> v1
v3 --"p:P91"--> a2
a3 --"prov:wasDerivedFrom"--> v2
v3 --"p:P91"--> a3
v2 --"p:reference/P143"--> a4