Re: Same Results with Empty Group Pattern

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.

Received on Friday, 14 March 2008 04:34:35 UTC