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

   The following query works as expected:
   ```
   BASE <https://foo.bar/> SELECT ?x { BIND(IRI('baz') AS ?x) }"
   ```
   
   ```
   -------------------------
   | x                     |
   =========================
   | <https://foo.bar/baz> |
   -------------------------
   ```
   
   However, using the same graph pattern in the following update request ...
   ```
   BASE <https://foo.bar/> INSERT { ?x ?x ?x } WHERE { BIND(IRI('baz') AS ?x) }
   CONSTRUCT WHERE { ?s ?p ?o }
   ```
   
   ... yields a result that suggests that the the base IRI was ignored:
   ```
   <file:///tmp/baz>  <file:///tmp/baz>  <file:///tmp/baz> .
   ```
   
   The [sparql update spec](https://www.w3.org/TR/sparql11-update/) does not 
say anything about the IRI function so my assumption is that the behavior 
should be consistent with that for querying. As a consequence, the issue is 
with the behavior of Jena.
   
   The reason is that the `E_IRI` function is only implemented to extract the 
base IRI from a currently running query - it lacks the logic to work with 
update requests.
   
   ```
   class E_IRI {
       @Override
       public NodeValue eval(NodeValue v, FunctionEnv env)
       { 
           String baseIRI = null ;
           if ( env.getContext() != null )
           {
               Query query = 
(Query)env.getContext().get(ARQConstants.sysCurrentQuery) ;
               if ( query != null )
                   baseIRI = query.getBaseURI() ;
           }
           return NodeFunctions.iri(v, baseIRI) ;
       }
   }
   ```
   
   UpdateRequest and Query both implement Prologue - so maybe 
`ARQConstants.sysCurrentQuery` could be changed to 
ARQConstants.sysCurrent*Prologue*?


-- 
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