- From: Rajendran Appavu <apprajen@in.ibm.com>
- Date: Mon, 1 Oct 2012 09:40:47 +0530
- To: public-rdf-dawg-comments@w3.org
While running the conformance tests for SPARQL 1.1 on our implementation, I came across this test case for VALUES whose expected result is different from what I was expecting and wanted to clarify it with you. data07.ttl @prefix : <http://example.org/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . :a foaf:name "Alan" . :a foaf:mbox "alan@example.org" . :b foaf:name "Bob" . :b foaf:mbox "bob@example.org" . :c foaf:name "Alice" . :c foaf:mbox "alice@example.org" . :a foaf:knows :b . :b foaf:knows :c . values07.rq SELECT ?s ?o1 ?o2 { ?s ?p1 ?o1 OPTIONAL { ?s foaf:knows ?o2 } } VALUES (?o2) { (:b) } The expected result by the test is: ---------------------------------------------------------------------------- | s | o1 | o2 | ============================================================================ | <http://example.org/a> | <http://example.org/b> | <http://example.org/b> | -> 1 | <http://example.org/a> | "alan@example.org" | <http://example.org/b> | -> 2 | <http://example.org/a> | "Alan" | <http://example.org/b> | -> 3 | <http://example.org/c> | "alice@example.org" | <http://example.org/b> | -> 4 | <http://example.org/c> | "Alice" | <http://example.org/b> | -> 5 ---------------------------------------------------------------------------- By the definitions for OPTIONAL in section 6 of the spec ( http://www.w3.org/TR/sparql11-query/#optionals) I was expecting: ---------------------------------------------------------------------------- | s | o1 | o2 | ============================================================================ | <http://example.org/a> | "Alan" | <http://example.org/b> | | <http://example.org/a> | "alan@example.org" | <http://example.org/b> | | <http://example.org/a> | <http://example.org/b> | <http://example.org/b> | | <http://example.org/c> | "Alice" | | | <http://example.org/c> | "alice@example.org" | | | <http://example.org/b> | "Bob" | | | <http://example.org/b> | <http://example.org/c> | | | <http://example.org/b> | "bob@example.org" | | ---------------------------------------------------------------------------- In section 6 we have : [... if the optional part does not match, it creates no bindings but does not eliminate the solution. ...] By this I was hoping we will not filter any matching records and records related to "Bob" will also appear. But the expected result by the test case seem to vary with this. In section 6.2 on Constraints in Optional Pattern Matching, for the example we have: [ .. No price appears for the book with title "SPARQL Tutorial" because the optional graph pattern did not lead to a solution involving the variable " price". ] By this I was hoping the variable "o2" will not be bound for the records related to "Alice". But from the expected result, "o2" is bound and says "Alice" knows "Bob" (rows 4 & 5), though the data does not say that. Could you please clarify? Thanks, Rajendran.
Received on Monday, 1 October 2012 08:27:04 UTC