Re: BNODE(string) and joins

Hi,

your quoted definition of the BNODE function with respect to the distinctiveness over different solutions mappings is exactly what causes me headaches when it comes to joins. What happens when two different solution mappings get merged? Here's an example:

```sparql
SELECT * 
WHERE {
  {
    ...
    BIND (bnode("foo") AS ?b1)
  }
  {
    ...
    BIND (bnode("foo") AS ?b2)
  }
  BIND (bnode("foo") AS ?b3)
}
```

What should be the value of `b3`?

Agree, that this might be an edge case which rarely happens, but I want to get it right anyway. 

Kind regards,
Marcel Otto

> On 5. Oct 2018, at 11:10, Rob Vesse <rvesse@dotnetrdf.org> wrote:
> 
> Marcel
> 
> It would help to have example queries that demonstrate what you are talking about because it wasn't clear to me from the description
> 
> Generally speaking SPARQL evaluation is defined to be bottom up so any variables introduced by functions e.g. BNODE should already have been calculated and materialised at the point any joins take place upon them.
> 
> More specifically with regards to BNode the spec [1] says the following:
> 
>  If the form with a simple literal is used, every call results in distinct blank nodes for 
>  different simple literals, and the same blank node for calls with the same simple literal 
>  within expressions for one solution mapping.
> 
> i.e. every blank node generated is distinct, except in the case of the function being applied with the same literal multiple times on the same solution mapping
> 
> So if you have two sub-groups each applying BNode over their solutions you should have two distinct sets of blank nodes.  There might be query structures where the nature of the query could generate some overlapping blank nodes but I would think these would be rare unless I am misinterpreting the specification.
> 
> Regards,
> 
> Rob Vesse
> 
> [1] https://www.w3.org/TR/sparql11-query/#func-bnode
> 
> On 04/10/2018, 22:42, "Marcel Otto" <marcelotto.de@googlemail.com> wrote:
> 
>    Hi,
> 
>    I'm implementing a SPARQL engine in Elixir ([1], [2]). Currently, I'm implementing the interpretation of group graph patterns and have the following question an the handling of blank nodes generated with `BNODE(string)`. When performing the merge of two solutions for a `join`, which of the two merged solutions should the merged solution be based on with respect to `BNODE(string)`? For example, let's say I have two sub groups using the `BNODE(string)` function to generate bnodes for the same string, which would result due to the locality of the `BNODE` function different bnodes. So, when the `BNODE` function is now called in the outer group above the two subgroups, again with the same string, what bnode should be returned? 
> 
>    Kind regards,
>    Marcel Otto
> 
>    [1] https://github.com/marcelotto/sparql-ex
>    [2] https://lists.w3.org/Archives/Public/public-lod/2018Sep/att-0035/00-part - announcement about the whole project on the public-lod mailing list
> 
> 
> 
> 
> 
> 

Received on Friday, 5 October 2018 15:08:57 UTC