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

   ### Version
   
   5.0.0-SNAPSHOT
   
   ### What happened?
   
   The following snippet is supposed to append "XXX" to all variable names.
   However, as can be seen from the output, the node transform is not performed 
on OpService instances, which breaks the query after transform.
   
   The class that would need to be updated is 
[org.apache.jena.sparql.graph.NodeTransformOp](https://github.com/apache/jena/blob/175212fe91d8dc0956c1998b02725037ab6645a6/jena-arq/src/main/java/org/apache/jena/sparql/graph/NodeTransformOp.java#L45).
   
   ```java
   public class Test {
       public static void main(String[] args) {
           String queryStr = String.join("\n",
                   "SELECT * {",
                   "  BIND(<http://dbpedia.org/sparql> AS ?service)",
                   "  SERVICE ?service {",
                   "    <https://dbpedia.org/page/RDF_query_language> ?p ?o",
                   "  }",
                   "}");
           Query beforeQuery = QueryFactory.create(queryStr);
           Op beforeOp = Algebra.compile(beforeQuery);
           Op afterOp = NodeTransformLib.transform(n -> n.isVariable() ? 
Var.alloc(n.getName() + "XXX") : n, beforeOp);
           Query afterQuery = OpAsQuery.asQuery(afterOp);
   
           System.out.println(afterQuery);
       }
   }
   ```
   
   ```sparql
   SELECT  *
   WHERE
     { BIND(<http://dbpedia.org/sparql> AS ?serviceXXX)
       SERVICE ?service    # <- Transformation was not applied!
         { <https://dbpedia.org/page/RDF_query_language>
                     ?pXXX  ?oXXX}
     }
   ```
   
   
   ### Relevant output and stacktrace
   
   _No response_
   
   ### Are you interested in making a pull request?
   
   Maybe


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