On 02/09/14 23:49, Miguel Bento Alves wrote:
Hi Andy,
&n is illegal SPARQL, ok, but that does not means that can be used to
refer a outer variable? The symbol “&” can appear in a SPARQL command
(excepting in a String)?
If yo udo it that way, then you must replace the &n before passing the
string to the SPARQL parser otherwise it won't parse.
An alternative is to replace occurrence of a named variable, ?n
It depends on the details of "refer to an outer variable" means.
If it is that the outer variable can have a number of values then it's
either a join of the results of the query and a table of values from the
rest of the rule matching or it's a repeated execution with different
values of ?n.
Straight substitution of ?n for a string value, passing to the parser
and executing is close but can end up in different results depending on
whether ?n is used nested inside the query, either unprojected from a
subquery (it's a different variable) or in nested OPTIONALs
(substitution can violates bottom-up execution semantics).
It's easier to let the execution engine worry about this.
You can use an initial binding for repeated execution. That avoids the
nested different definition problems. Or add a VALUES clause to the query.
and the symbol “$”?
BTW, I almost finished the development of an engine to evaluate rules
that combines rules terms with sparql commands. To finish, I only
need to define the special char to make reference to outer variables
(for now, and to develop the engine, I'm using a non-valid char).
Miguel
Andy