query-1f77d145bd22d2909445afa04a10fa9d
Could anyone please provide a query that lists items with P91 statements, which are P143-“sourced”
select ?item where { ?item p:P91 [ prov:wasDerivedFrom ?ref ] . ?ref pr:P143 [] filter not exists { ?ref ?prop [] . filter (?prop != pr:P143)} . }
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/>
# Could anyone please provide a query that lists items with P91 statements, which are P143-“sourced”
select ?item where {
?item p:P91 [
prov:wasDerivedFrom ?ref
] .
?ref pr:P143 []
filter not exists { ?ref ?prop [] . filter (?prop != pr:P143)} .
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?item"):::projected
v1("?prop")
v2("?ref")
a3((" "))
a1((" "))
a2((" "))
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0f0[["?prop != 'p:reference/P143'"]]
e0f0 --> e0v1
e0v2 -->e0v1--> e0a1
e0v1("?prop"):::projected
e0v2("?ref"):::projected
e0a1((" ")):::projected
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> v2
f0 --> a1
f1[["?prop != 'p:reference/P143'"]]
f1 --> v1
v2 -->v1--> a1
a2 --"prov:wasDerivedFrom"--> v2
v3 --"p:P91"--> a2
v2 --"p:reference/P143"--> a3