From tom at westslope.org Mon Aug 13 10:51:16 2018 From: tom at westslope.org (Tom Beers) Date: Mon, 13 Aug 2018 15:51:16 +0100 Subject: [redland-dev] Example from the specification failing Message-ID: I am not a SPARQL expert by any means, so apologies if what seems like a bug turns out to be misuse on my part. Using rdfproc 1.0.17 for Debian Stretch I run the following (the second query from https://www.w3.org/TR/rdf-sparql-query/#alternatives ): ``` rdfproc --contexts --new test add "_:a" "http://purl.org/dc/elements/1.0/title" "SPARQL Query Language Tutorial" rdfproc --contexts test add "_:a" "http://purl.org/dc/elements/1.0/creator" "Alice" rdfproc --contexts test add "_:b" "http://purl.org/dc/elements/1.1/title" "SPARQL Protocol Tutorial" rdfproc --contexts test add "_:b" "http://purl.org/dc/elements/1.1/creator" "Bob" rdfproc --contexts test add "_:c" "http://purl.org/dc/elements/1.0/title" "SPARQL" rdfproc --contexts test add "_:c" "http://purl.org/dc/elements/1.1/title" "SPARQL (updated)" rdfproc --contexts test query sparql - "SELECT ?x ?y WHERE  { { ?book ?x } UNION { ?book ?y } }" ``` This gives: ``` result: [, x="SPARQL Query Language Tutorial"] result: [, x="SPARQL"] result: [] result: [] ``` Notice the lack of `y` bindings. I have tried these examples with a version compiled from the GitHub sources and got the same results. I also tried this with the C library, and it seems to be `librdf_query_results_get_binding_value` that is failing, although I'm not sure. Also, FWIW, here's the experiment that made me notice this in the first place: ``` rdfproc --contexts --new test add s:1 o:readBy i:1 c:1 rdfproc --contexts test add s:1 o:writtenBy i:1 c:2 rdfproc --contexts test add s:3 o:writtenBy i:1 c:3 rdfproc --contexts test add s:3 o:readBy i:1 c:4 rdfproc --contexts test add s:3 o:removedBy i:1 c:5 rdfproc --contexts test query sparql - "SELECT * WHERE { FILTER(?subject IN (, , ))   { GRAPH ?read_context { ?subject ?read_object } } UNION  { GRAPH ?write_context { ?subject ?write_object } } }" ``` Executing the above returns: ``` result: [, subject=, read_context=, read_object=, write_context=] result: [, subject=, read_context=, read_object=, write_context=] result: [, subject=, read_context=] result: [, subject=, read_context=] ``` Notice `write_context` is wrong in the first two, `read_context` is wrong in the second two (`` is showing up despite not being asked for), `write_object` is missing from the first two, and `read_object` is missing from the second two. I'd like to finish this though with a huge thanks for librdf and co, they've been a great help.