query-d98971b5748921d716be805799ffac47

rq turtle/ttl

Jc86035

Use at

PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT ?x WHERE {
  ?x p:P179 ?statement .
  {
    ?statement ps:P179 ?a; pq:P155 ?y .
    FILTER NOT EXISTS {
      ?y p:P179 [ ps:P179 ?a; pq:P156 ?x ].
    }
  } UNION {
    ?statement ps:P179 ?a; pq:P156 ?y .
    FILTER NOT EXISTS {
      ?y p:P179 [ ps:P179 ?a; pq:P155 ?x ].
    }
  }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?a") v2("?statement") v1("?x"):::projected v4("?y") a1((" ")) a2((" ")) v1 --"p:P179"--> v2 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; f0[["not "]] subgraph f0e0["Exists Clause"] e0a1 --"p:statement/P179"--> e0v1 e0a1 --"p:qualifier/P155"--> e0v2 e0v3 --"p:P179"--> e0a1 e0v1("?a"):::projected e0v2("?x"):::projected e0v3("?y"):::projected e0a1((" ")):::projected end f0--EXISTS--> f0e0 f0 --> a2 f0 --> c2 f0 --> v3 f0 --> c4 f0 --> v1 f0 --> v4 f0 --> c1 a2 --"p:statement/P179"--> v3 a2 --"p:qualifier/P155"--> v1 v4 --"p:P179"--> a2 v2 --"p:statement/P179"--> v3 v2 --"p:qualifier/P156"--> v4 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; f1[["not "]] subgraph f1e1["Exists Clause"] e1a1 --"p:statement/P179"--> e1v1 e1a1 --"p:qualifier/P156"--> e1v2 e1v3 --"p:P179"--> e1a1 e1v1("?a"):::projected e1v2("?x"):::projected e1v3("?y"):::projected e1a1((" ")):::projected end f1--EXISTS--> f1e1 f1 --> a1 f1 --> c2 f1 --> v3 f1 --> c3 f1 --> v1 f1 --> v4 f1 --> c1 a1 --"p:statement/P179"--> v3 a1 --"p:qualifier/P156"--> v1 v4 --"p:P179"--> a1 v2 --"p:statement/P179"--> v3 v2 --"p:qualifier/P155"--> v4 end union0r <== or ==> union0l end