- From: james anderson <james@dydra.com>
- Date: Fri, 25 Nov 2016 23:48:27 +0000
- To: public-sparql-exists@w3.org
good morning;
> On 2016-11-25, at 21:58, Peter F. Patel-Schneider <pfpschneider@gmail.com> wrote:
>
> Here are some interesting examples of EXISTS that need to be considered.
;;; given a dataset which has the following content,
* (run-sparql "select * where {{<http://test.org/s> ?p ?o} union { graph ?g {<http://test.org/s> ?p ?o} } }"
:repository-id "james/test")
((#S(SPOCQ:UNBOUND-VARIABLE :NAME NIL) "o" <http://test.org/p>)
(<http://test.org/g> "o" <http://test.org/p>)
(<http://test.org/g2> "o2" <http://test.org/p>))
(?::|g| ?::|o| ?::|p|)
;;; with queries corrected and adapted to that data, are these the results to be expected?
* (run-sparql "
prefix : <http://test.org/>
SELECT ?x WHERE {
?x :p 'o' .
FILTER ( EXISTS {
FILTER ( ?x = :s )
} )
}
"
:repository-id "james/test")
((<http://test.org/s>))
(?::|x|)
* (run-sparql "
prefix : <http://test.org/>
SELECT ?x WHERE {
?x :p 'o' .
FILTER ( EXISTS {
SELECT (?y as ?x) WHERE {
?y :p 'o' .
}
} )
}
"
:repository-id "james/test")
((<http://test.org/s>))
(?::|x|)
* (run-sparql "
prefix : <http://test.org/>
SELECT ?x WHERE {
?x :p 'o' .
FILTER ( EXISTS {
?x :p 'o' . MINUS { graph :g2 { ?x :p 'o2' . } }
} )
}
"
:repository-id "james/test")
NIL
(?::|x|)
* (run-sparql "
prefix : <http://test.org/>
SELECT * WHERE {
:s :p 'o' . MINUS { :s :p 'o' . }
}
"
:repository-id "james/test")
NIL
NIL
* (run-sparql "
prefix : <http://test.org/>
SELECT ?x WHERE {
?x :p 'o' .
FILTER ( EXISTS {
:s :p 'o' . MINUS { :s :p 'o' . }
} )
}
"
:repository-id "james/test")
NIL
(?::|x|)
---
james anderson | james@dydra.com | http://dydra.com
Received on Friday, 25 November 2016 23:49:02 UTC