- From: Seaborne, Andy <andy.seaborne@hp.com>
- Date: Tue, 22 Aug 2006 17:32:58 +0100
- To: andy.seaborne@hp.com
- CC: Eric Prud'hommeaux <eric@w3.org>, dawg mailing list <public-rdf-dawg@w3.org>
>
> Data:
> :x :p "45"^^:dtype .
>
> Query:
> ASK { OPTIONAL { :x :p ?v . FILTER ( ?v < "67"^^:dtype ) }
> FILTER (bound(?v))
>
>
Typo : that should be "not bound" (!bound(?v))
---------------
More fully: if the data is:
== Data 1:
@prefix : <http://example/> .
:x1 :p "45"^^:dtype .
== Query 1:
PREFIX : <http://example/>
SELECT ?x {
?x :p ?w .
OPTIONAL { ?x :p ?v . FILTER ( ?v < "67"^^:dtype ) }
FILTER (!bound(?v))
}
-------
| x |
=======
| :x1 |
-------
Optional RHS fails (error on comparison), ?v2 is not bound so the second
filter passes.
But with a known datatype (or learn datatype :dtype is datatype xsd:integer
with a different IRI):
== Data 2:
@prefix : <http://example/> .
:x1 :p 45 .
== Query:
PREFIX : <http://example/>
SELECT ?x {
?x :p ?w .
OPTIONAL { ?x :p ?v . FILTER ( ?v < 67 ) }
FILTER (!bound(?v))
}
-----
| x |
=====
-----
The filter in the OPTIONAL is now true, ?v is bound and hence the second
filter fails.
Andy
Received on Tuesday, 22 August 2006 16:34:31 UTC