Aklakan opened a new issue, #2924:
URL: https://github.com/apache/jena/issues/2924

   ### Version
   
   5.3.0-SNAPSHOT
   
   ### What happened?
   
   The first query reveals a bug where an unexpected  exception is raised in 
`BindingBuilder.checkAdd`: `Attempt to reassign ?s from 1 to 1`. The issue is 
in `QueryIterLateral` which just adds the lhs and rhs binding to the builder 
although they may have variables in common.
   
   ```sparql
   SELECT * {
       BIND(1 AS ?s)
       LATERAL {
           BIND(?s AS ?x)
           LATERAL {
               BIND(?s AS ?y)
           }
       }
   }
   ```
   
   My proposed solution in the PR is to add a check whether bindings are 
compatible on their common variables.
   
   
   The second query fails a scope check in `SyntaxVarScope.checkLATERAL` when 
tables (or binds) are involved and I am not sure if this behavior is intended 
or not. This might be more related to the concepts of SEP-0007 rather than the 
Jena implementation.
   
   ```sparql
   SELECT * {
       BIND(1 AS ?x)
       LATERAL {
           VALUES ?x { 1 2 }
       }
   }
   ```
   
   I don't think that such a query should be invalid because this would 
generally prevent materialization of graph pattern into a `VALUES` block.
   I.e. IMHO it should be possible to substitute `... LATERAL { graph-pattern 
}` with a corresponding `... LATERAL { VALUES { materialized-graph-pattern } }`.
   
   
   
   ### Relevant output and stacktrace
   
   _No response_
   
   ### Are you interested in making a pull request?
   
   Yes


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to