Same Results with Empty Group Pattern

I (and Arjohn) have recently been looking into identity of SPARQL
operations and working out if SPARQL is consistent with an (untyped)
relational algebra (and possibly any algebra for that matter).

It has definitions including:
U - universal relation - a relation with no attributes but contains
all possible tuples of applicable type.
0 - empty relation - the empty relation (no attributes no tuples).
A - a relation.

And defines identities as:
A + 0 = A * U = A
A + U = U
A * 0 = 0

Where + is union and * is join.  So join and union give different
results when the same relation (either 0 or U).

Now reading the SPARQL document I get the impression that the empty
group pattern ({}) is equivalent to the empty relation - which has no
attributes and no tuples ("one solution that does not bind any
variables").  The other interpretation is that it is the universal
relation.  Either way I think one of the operations in SPARQL is
inconsistent with either interpretation.

If you do:
select distinct ?s ?p ?o
where {
  {?s ?p ?o} . {}
}

You get all triples back - which is the result of A * U.

On the other hand:
select distinct ?s ?p ?o
where {
  {?s ?p ?o} union {}
}

Again, you get all triples back - which is the result of A + 0.

Shouldn't one of these return {} and not A?  And what is {} equivalent to?

I was using Twinkle 2.0 to test these results (and reading the specification).

Received on Friday, 14 March 2008 02:07:25 UTC