W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > July to September 2006

Re: adding dawg:monotonicity and extensible data types to SPARQL query

From: Seaborne, Andy <andy.seaborne@hp.com>
Date: Tue, 22 Aug 2006 17:32:58 +0100
Message-ID: <44EB31BA.7090003@hp.com>
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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:27 GMT