Hello,
I was working through some of the spec to get a better understanding of
translating queries to SPARQL algebra and had a question about the eleventh
example in section 18.2.3
(http://www.w3.org/TR/2013/REC-sparql11-query-20130321/#sparqlAlgebraExamples).
The example is
{ ?s :p ?v . {} BIND (2*?v AS ?v2) }
and the given translation to SPARQL algebra is
Join(
BGP(?s :p ?v), ?v2, 2*?v) ,
Extend({}, ?v2, 2*?v)
)
I am having a hard time seeing how to get that translation. From my
understanding, I am starting with a GroupGraphPattern so I look to the
relevant box in section 18.2.2.6. I believe my GroupGraphPattern has three
elements: the triple pattern, the empty GroupGraphPattern, and the BIND clause.
I set G equal to the Join identity. Now I enter the For loop by first setting
E equal to the triple pattern. At the end of the first loop, I just have
G=BGP(?s :p ?v). At the start of the second loop, I set E equal to {}. That
satisfies the last If statement so I set A equal to Translate({}). That should
give me A equal to the Join identity. Then G=Join( BGP(?s :p ?v, (the join
identity) ). So, at the end of the second loop, I just have G=BGP(?s :p ?v).
At the start of the third loop, I set E equal to the BIND clause. That
satisfies the third If statement, so I set G equal to Extend(BGP(?s :p ?v),
?v2, 2*?v). That's the end of the For loop so I end up with
Extend( BGP(?s :p ?v), ?v2, 2*?v )
as the result. I believe the above translation gives solution mappings
different from those coming from the translation provided in the spec. In
fact, I believe the translation found in the spec would give solution mappings
to the pattern
{
{}
BIND(2*?v AS ?v2)
?s :p ?v
}
Any insight you can provide is much appreciated. If this is not the proper
forum for such a question, then please accept my apologies (and maybe let me
know where I should be asking :)).
Rory