1

Please excuse the (possible) triviality of the question. I want to confirm that my understanding of the SPARQL specification is correct.

I imagine joining in SPARQL based on blank RDF nodes works just fine, i.e., when the join variable(s) of two graph patterns is mapped to a blank node in the solution, the join still works as expected.

Assume the dataset:

<http://www.example.com/s1> <http://www.example.com/p> _:a . 
_:a <http://www.example.com/p> <http://www.example.com/s2> .

And the query:

SELECT * WHERE{
    {SELECT ?x1 ?z1 WHERE{
        ?x1 ?y1 ?z1
    }}
    {SELECT ?z1 ?z2 WHERE{
        ?z1 ?y2 ?z2
    }}     
}

The query should return the following result (tried it with GraphDB):

?x1 | ?z1 | ?z2
<http://www.example.com/s1> | _:a | <http://www.example.com/s2>

That means that the solution form the first subquery:

    ?x1 | ?z1
    <http://www.example.com/s1> | _:a 

And the solution form the second subquery:

    ?z1 | ?z2
    _:a | <http://www.example.com/s2>

Are joined correctly based on the mapping of the variable ?z1 (_:a).

Stanislav Kralin
  • 11,070
  • 4
  • 35
  • 58
Median Hilal
  • 1,483
  • 9
  • 17

0 Answers0