[redland-dev] SPARQL graph pattern with triple with 3 uris

Dave Beckett dave at dajobe.org
Wed May 7 15:20:02 BST 2008


Michael Stahl wrote:
> 
> it seems that if i write a triple with 3 uris like this:
> <uri:foo> <uri:bar> <uri:baz>.
> in a SPARQL query, it will return no results, even if such a triple is 
> in the graph.
> 
> 
> pResults: 29a98; not finished
> count: 4
> pResults: 29af8; not finished
> count: 2
> pResults: 299d8; not finished
> count: 2
> pResults: 29ad8; not finished
> count: 2
> librdf warning URI file:///home/ms216673/rdf/:1 - Variable s was 
> selected but is unused in the query.
> librdf warning URI file:///home/ms216673/rdf/:1 - Variable p was 
> selected but is unused in the query.
> librdf warning URI file:///home/ms216673/rdf/:1 - Variable o was 
> selected but is unused in the query.
> pResults: 29b28; is finished
> count: 0
> pResults: 29bc8; is finished
> count: 0
> 
> 
> see attached program: queries 1-4 seem to work
> query 5 returns no result, but should return one result with nulls
> query 6 returns no result, but should return 2 results.

Those are rather wierd queries in that the first one binds no variables
and both have constant triple patterns.  So the query engine has a bug
in this area but it's probably not been sene before

> 
> here is the output of the same queries with Sesame 2.0:
> 
> 
> SELECT ?s ?p ?o FROM <uri:context> WHERE { ?foo ?bar ?baz . ?s ?p ?o. }
> result: uri:baz uri:foo uri:bar
> result: uri:bar uri:baz uri:foo
> result: uri:baz uri:foo uri:bar
> result: uri:bar uri:baz uri:foo
> end results.
> 
> SELECT ?s ?p ?o FROM <uri:context> WHERE { <uri:foo> ?bar ?baz . ?s ?p 
> ?o. }
> result: uri:baz uri:foo uri:bar
> result: uri:bar uri:baz uri:foo
> end results.
> 
> SELECT ?s ?p ?o FROM <uri:context> WHERE { <uri:foo> <uri:bar> ?baz . ?s 
> ?p ?o. }
> result: uri:baz uri:foo uri:bar
> result: uri:bar uri:baz uri:foo
> end results.
> 
> SELECT ?s ?p ?o FROM <uri:context> WHERE { <uri:foo> ?bar <uri:baz> . ?s 
> ?p ?o. }
> result: uri:baz uri:foo uri:bar
> result: uri:bar uri:baz uri:foo
> end results.
> 
> SELECT ?s ?p ?o FROM <uri:context> WHERE { <uri:foo> <uri:bar> <uri:baz>. }
> result: <null> <null> <null>
> end results.
> 
> SELECT ?s ?p ?o FROM <uri:context> WHERE { <uri:foo> <uri:bar> 
> <uri:baz>. ?s ?p ?o. }
> result: uri:baz uri:foo uri:bar
> result: uri:bar uri:baz uri:foo
> end results.
> 
> 
> oh, and serializing the result of a query does not seem to work either 
> (see FIXME in attached file).

Looks like you are using an old URI for the XML result format, I changed it
to
     unsigned char SXML[]
         = "http://www.w3.org/TR/2006/WD-rdf-sparql-XMLres-20070614/";

and I get sparql xml results out (this depends on the version of rasqal).

It might be the documentation is giving the wrong url somewhere.

Dave


More information about the redland-dev mailing list