Re: Issue 1 - ToMultiSet

On 07/07/2016 03:14 AM, james anderson wrote:
> good morning;
> 
>> On 2016-07-07, at 11:27, Andy Seaborne <andy@apache.org
>> <mailto:andy@apache.org>> wrote:
>>
>> On the first point:
>>
>> [[
>> Problem 1: Some uses of EXISTS are undefined
>>
>> exists is only defined for graph patterns, but in
>> SELECT ?x WHERE {
>> ?x :p :c .
>> FILTER EXISTS { SELECT ?y { ?y :q :c . } } }
>> the argument to exists ends up being a ToMultiSet, which is not listed under
>> "Graph Pattern" in the table of SPARQL algebra symbols.
>> ]]
>>
>> This isn't specific to EXISTS. It's about anywhere a sub-SELECT is used.  {
>> ... } is a graph pattern group and results in a join. The arguments to join
>> are teh evaluation of a graph patterns - multisets.
>>
>> Looking at it use in "18.2.2.6 Translate Graph Patterns [1] (right at the
>> end of the section), the last example of "18.2.3 Examples of Mapped Graph
>> Patterns" [2] and "18.2.4.3 VALUES" [3], using is join shows it in the same
>> light as the other graph patterns.
>>
>> Therefore, I think we can address this with an entry in the
>> https://www.w3.org/2013/sparql-errata
>>
>> Draft:
>>
>> [[
>> query-errata-N:
>>
>> "Section 18.2 Translation to the SPARQL Algebra" intro (end):
>>
>> ToMultiSet can be used where a graph pattern is mentioned below because
>> the outcome of evaluating a graph pattern is a multiset.
>> ]]
>>
>> ToMultiSet has the same result type the same as the other graph patterns but
>> it is also a solution modifier (acts on a solution sequence).
>>
>>    Andy
>>
>>
>> [1]
>> https://www.w3.org/TR/sparql11-query/#sparqlTranslateGraphPatterns
>> [2]
>> https://www.w3.org/TR/sparql11-query/#sparqlAlgebraExamples
>> [3]
>> https://www.w3.org/TR/sparql11-query/#sparqlAlgebraFinalValues
>>
> 
> -1
> 
> if the issue is that, as per 18.6, the exists definition is in terms of the
> symbols specified in the 18.2 abstract algebra table for “graph pattern”,
> [125,125]->[53] permit a subselect, and 18.2.2.6 indicates that a subselect is
> rewritten to a ToMultiset, but ToMultiset is missing in the 18.2 table, rather
> than to reiterate in a note something which already follows from the algebra -
> as described above, it would be more specific and easier to follow, to either
> - extend the 18.2 table, or
> - change the definition of exists itself to permit as arguments those abstract
> forms which the operator is to combine.
> 
> .best regards, from berlin,
> ---
> james anderson | james@dydra.com <mailto:james@dydra.com> | http://dydra.com

I think that Andy's solution is acceptable as a starting point.

It might have been better to have had ToMultiSet in the Graph Pattern column
of the table, but even though ToMultiSet is not really a solution modifier and
thus should be in the Graph Pattern column.  However, most errata should be
about making the smallest change required to fix a problem, and Andy's
suggested errata does this.

However, Andy's suggested errata is not sufficient because multisets also need
to be allowed as Graph Patterns.  Multisets show up in the SPARQL algebra as
the translation on inline data and thus need to be accommodated as well.


So I suggest

Draft:

[[
query-errata-N:

"Section 18.2 Translation to the SPARQL Algebra" intro (end):

ToMultiSet can be used where a graph pattern is mentioned below because the
outcome of evaluating a graph pattern is a multiset.

Multisets of solution mappings are elements of the SPARQL algebra.  Multisets
of solution mappings count as graph patterns.
]]


I note that this problem does not just affect EXISTS, but affects just about
every construct because of the wording

P, P1, P2 : graph patterns

near the beginning of 18.6.

peter

PS:  I do note that the translation to the SPARQL algebra is defined in a
somewhat sloppy manner that makes it hard to determine exactly what is
supposed to result.  I don't think that there are any problems that arise from
this sloppiness but the translation needs some attention if there ever is a
next version of SPARQL.

Received on Thursday, 7 July 2016 12:12:50 UTC