Re: SPARQL Evaluation Model

Hi Tim,

You could maybe check out chapter 6 of this book I wrote, which mixes 
examples with formal defs and notes on aspects that I found to have 
commonly confounded students in a course I teach:

https://link.springer.com/book/10.1007/978-3-030-51580-5

I cannot share a link here to a free version as Springer holds the 
rights, but if you get pay-walled, and if you like, drop me a mail and I 
can share author preprints.


It's worth noting that with examples you can only get a gist of the 
coastline. If you would like a more formal treatment, you can also check 
out Section 3 of this paper:

https://aidanhogan.com/docs/sparql_semantics_canonicalisation.pdf

It makes some small divergences from the standard for formal 
elegance/sanity, but we tried to keep it as close to the standard as 
possible.

Best,
Aidan

On 2023-03-27 13:29, James Anderson wrote:
> if you want to understand evaluation order, sparql.org is your friend:
> 
>      http://www.sparql.org/query-validator.html
> 
> select the "SPARQL algebra" output and approach the output as if it were written in something like lisp.
> 
> 
> 
>> On 27. Mar 2023, at 16:10, Tim McIver <tim@timmciver.com> wrote:
>>
>> Miguel,
>> Yes, I have not read through the spec but I will try to do that.  Ideally, I'd love to see a book that describes the behavior with examples.
>> Thanks,
>> Tim
>> On 3/27/23 08:45, Miguel wrote:
>>> Hello Tim,
>>> the reference document is the W3C recommendation [1].
>>> The semantics of SPARQL are formally defined in two steps: first transforming a textual SPARQL query to a "SPARQL algebra expression", then applying the operational semantics defined on the SPARQL algebra.
>>>  From the transformation step (specifically the part in [2]) comes the fact, often surprising to newcomers, that the order in which clauses are used in a query is indeed important and that some operators are applied incrementally on the pattern defined "above" them.
>>>
>>> Cheers,
>>> Miguel
>>>
>>> [1] https://www.w3.org/TR/sparql11-query/
>>> [2] https://www.w3.org/TR/sparql11-query/#sparqlTranslateGraphPatterns
>>>
>>> On Mon, Mar 27, 2023 at 1:51 PM Tim McIver <tim@timmciver.com> wrote:
>>> Hello,
>>> Where can I find information about SPARQL's evaluation model?  I've read most of "Learning SPARQL" but I've encountered several surprising results from queries that I've written from what I've learned there.  One of these surprises prompted this question on this mailing list which made me realize that I actually don't understand SPARQL's evaluation model at all and I can't seem to find anything written about it.  I don't believe "Learning SPARQL" discussed the effect that, for example, moving a BIND call would have on the results (if I'm mistaken, please let me know where the book discusses this).
>>> Thanks,
>>> Tim
> 
> ---
> james anderson | james@dydra.com | https://dydra.com
> 
> 
> 

Received on Tuesday, 28 March 2023 19:35:08 UTC