[redland-dev] query range in SPARQL

Seaborne, Andy andy.seaborne at hp.com
Thu Oct 5 09:58:41 UTC 2006


The query has:

{ (?s di:x ?x) . (?s di:y ?y) . }

but in SPARQL triple patterns aren't delimited by ().  Unfortunately, in
SPARQL, () are RDF lists and your query really looks like:


PREFIX  di: <http://python.openspace.nl/di#>
PREFIX  rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> # Added for
clarity

SELECT  ?s ?x ?y
WHERE
  { _:b0  rdf:first  ?s ;
          rdf:rest   _:b1 .
    _:b1  rdf:first  di:x ;
          rdf:rest   _:b2 .
    _:b2  rdf:first  ?x ;
          rdf:rest   rdf:nil .
    _:b3  rdf:first  ?s ;
          rdf:rest   _:b4 .
    _:b4  rdf:first  di:y ;
          rdf:rest   _:b5 .
    _:b5  rdf:first  ?y ;
          rdf:rest   rdf:nil .
  }

which may not be what you intended.

If the () are removed, then the query is:

PREFIX  di: <http://python.openspace.nl/di#>

SELECT  ?s ?x ?y
WHERE
  { ?s  di:x  ?x ;
        di:y  ?y .
  }

http://www.sparql.org/validator.html

	Andy

-------- Original Message --------
> From: Andre Meyer <>
> Date: 4 October 2006 19:25
> 
> That's a good one!!! Hope this works for all kinds of functions one
> might want to use. 
> 
> Nevertheless, I still can't manage to query properly. Trying to use
the
> Python example I got the attached file, which finds nothing, with or
> without filter.  
> 
> thanks
> Andre


More information about the redland-dev mailing list