Re: Another attempt...

On 18/03/2008, Lee Feigenbaum <lee@thefigtrees.net> wrote:
> Hi Andrew,
>
>  I think that you still might be confusing curly-brace SPARQL syntax with
>  curly-brace set notation. They're two very different things that
>  (unfortunately?) use the same character. I've tried to clarify inline below.
>

You're right I do find the SPARQL syntax confusing.

>  But if I were defining it, I'd say that a group pattern is a pair
>  consisting of a set of zero or more graph patterns and a set of zero or
>  more filter expressions. The empty group graph pattern then, is ({}, {})
>  - an empty set of graph patterns and an empty set of filters. For
>  simplicity, I'll omit the filters from the rest of this discussion, so
>  the empty graph pattern is indeed empty: {}.
>

I'm not sure how it's a set - because it seems as if in SPARQL you
collecting them all.  For example I can write in SPARQL syntax:

SELECT ?x
WHERE { {} UNION {} UNION {} UNION {} }

If it were a set when SPARQL was being evaluated there would be 1
result but it returns 3.  It would also be 1 if SPARQL had the idea of
identity too.  It's like if 0 for + collected results ie. 2 + 2 + 0 +
0 = 4 + 0 + 0.

>  I don't think the test suite is explicit in the proper result set for
>  projecting a variable that is not in the query. By my reading of the
>  spec, projection (http://www.w3.org/TR/rdf-sparql-query/#modProjection
>  and http://www.w3.org/TR/rdf-sparql-query/#defn_algProjection) should
>  not introduce new variables into the output solution set.
>

It certainly is puzzling - I would think it's an error at parse time -
trying to project a variable that isn't in the WHERE clause.  For
example, a query like:
select ?x
where {
 {?s ?p ?o}
}

It returns n results (where n is the number of matches) where ?x is unbound.

So I hadn't thought that perhaps this was an error/ambiguity in the
output solution rather than an indication that it's acting like the
universal set.  Even more confusing...

> I'm not versed enough to label things universal or empty relations, but
>  the evaluation of a SPARQL UNION is defined as the multiset-union of the
>  evaluation of the two branches of the UNION. So:
>
>  { A } UNION { { } }
>
>  is multiset-union(eval(A), {{}}) -- that is, add the one empty solution
>  to the solutions from evaluating A.
>

It's just very odd behavior - and a bit inexplicable - especially the
multiple union of {{}}.

>  > The added confusion is that I don't understand the current SPARQL
>  > result of UNIONing {} in SPARQL as you end up with something that is
>  > neither a usual result nor an identity but a combination of the two
>  > (which is where the conversation started).  It seems to be
>  > correct/valid to keep collecting these empty sets (unless you
>  > eliminate them with a distinct), what does that mean?
>
> I don't understand the question - maybe a test case would clarify?
>

Hopefully the query at the top of this response is good enough.  It's
a bit hard to work out now, though, where the problem lies.  Is it the
result serialization, the graph pattern syntax and/or the definition
of the empty graph pattern?

Received on Tuesday, 18 March 2008 04:46:16 UTC