Saturday, December 02, 2006

Breaking Project

SPARQL Basic Graph Pattern Matching Andy writes, "Example data:
  :a :p 1 .
:a :p 2 .
Example query pattern:
 { ?x :p [] }
How many answers? Blank nodes are existential variables in RDF; named variables (the regular ?x ones) are universal variables. Queries don't return the binding of an existential; queries can return the binding of a named variable and the bound value of a named variables can be passed to other parts of the query (FILTERs, OPTIONALs etc) via the algebra.

In the absence of a DISTINCT in the query, are the solutions to this pattern:
  • 1 : ?x = :a
  • 2 : ?x = :a , ?x = :a
  • Either 1 or 2
"
I would say there is a fourth option here, see this example, which would be:
  • { { ?x:subject = :a, p1:predicate1 = :p, o1:object1 = 1 } , { ?x:subject = :a, p1:predicate1 = :p, o1:object = 2 } }
The DAWG test case, rdfSemantics-bNode-type-var, redefines the meaning of project.

If you keep track of where the variable were bound you can still count the distinct instances without redefining project.

No comments: