Re: Same Results with Empty Group Pattern

Andrew Newman wrote:
> On 14/03/2008, Lee Feigenbaum <lee@thefigtrees.net> wrote:
>>  Andrew Newman wrote:
>>  This is, I suppose, the set containing the empty relation. I'm not sure
>>  which, if either, of U and 0 above this is equivalent to. Part of my
>>  confusion is because I'm not sure whether the A, U, and 0 relations you
>>  speak of above are (in SPARQL terms) solutions or sets of solutions.
>>
> 
> I don't think there is any important difference in what we are talking
> about.  Even if we're talking about bags rather than sets the
> identities are the same (a Union u = u, a Intersect 0 = 0).
> 
>>  > 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.
>>
>>
>> I don't think that is correct behavior. I believe the results of the
>>  above query should be (forgive the lack of rigor in my notation)
>>  set-union({?s ?p ?o}, {}) which is the solution set containing one
>>  solution per triple in the default graph unioned with one solution
>>  containing no bindings.
>>
> 
> Yes, my mistake, the correct answer is all the triples plus the empty
> group pattern.  The problem remains though.
> 
> When used in join, {} gives a result like it's the identity (acting
> like U) but operates differently in union.  If we go back to the +/*
> notation it's:
> A * {} = A
> A + {} = B (where B is as defined as above, A set-union {})
> 
> By the definition you gave above {} still seems like it is 0 but
> operates like U with respect to join.  A universal solution set maybe
> written like {{0}} (where the 0 in this case is the nullary
> tuple/solution - containing all values) or maybe {{RDF-T}} and 0
> (empty solution set) written as {{}}.
> 
>>From an implementation perspective, identity is handy to do shortcuts
> during evaluating the results.  I take it that if {} isn't an identity
> then it can't be used as a shortcut.
> 
> And I shouldn't call anything triples either - sorry if that's confusing.


Could it be that there is some confusion in use of {} (SPARQL syntax) is not 
the same as {} (set notation).

Section 12.3[1] tries to get his straight.

"""
Write μ0 for the mapping such that dom(μ0) is the empty set.

Write Ω0 for the multiset consisting of exactly the empty mapping μ0, with 
cardinality 1. This is the join identity.
"""

(This email is UTF-8 - that's μ/mu and Ω/Omega)

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

Sticking to set-notation

0 = {}
1 = {{}}

{{}} is the set of one solution, a solution is a set of pairs, in this case 
the empty set.

A UNION 0 = A
A JOIN 1 = A

In SPARQL syntax {} are not set markers.  The empty group is defined to have 
one solution and that solution has no bindings.  So it's {{}} in set terms - 
that's what is meant by "one solution that does not bind any variables" and is 
more formally written in 12.3.  It is not the empty set - the set of no 
solutions which would be the empty relation.

c.f. 0 = {}, succ(0) = {{}} = 1

Andrew - if this is not the case, could we work on a concrete example, maybe 
the one Lee used or was that your understanding.

 Andy

[1] http://www.w3.org/TR/rdf-sparql-query/#BasicGraphPattern



> 

-- 
Hewlett-Packard Limited
Registered Office: Cain Road, Bracknell, Berks RG12 1HN
Registered No: 690597 England

Received on Friday, 14 March 2008 16:07:24 UTC