afs commented on code in PR #3254: URL: https://github.com/apache/jena/pull/3254#discussion_r2160316691
########## jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprFunctionOp.java: ########## @@ -53,11 +68,46 @@ public Expr getArg(int i) { @Override public Op getGraphPattern() { return op; } - public Element getElement() { return element; } + public Element getElement() { + if (element == null) { + element = OpAsQuery.asElement(op); + } + return element; + } @Override public int numArgs() { return 0; } + @Override + public Expr copySubstitute(Binding binding) { + Op op2 = Substitute.substitute(getGraphPattern(), binding) ; Review Comment: `applyNodeTransform` works on expressions. `Substitute.substitute(getGraphPattern(), ...)` works on `Op`s. Until (NOT)EXISTS came along, graph patterns and expressions were quite separate and the code reflects that. But EXISTS moves between these two worlds. `Substitute` is likely going to be somewhat revised by the work in RDF & SPARQL Working Group on EXISTS. But there is no point revising until a degree of stability (see also `LATERAL`). ########## jena-arq/src/test/java/org/apache/jena/sparql/expr/TestExprFunctionOp_NodeTransform.java: ########## @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jena.sparql.expr; + +import static org.junit.Assert.assertEquals; + +import org.apache.jena.sparql.algebra.Algebra; +import org.apache.jena.sparql.algebra.Op; +import org.apache.jena.sparql.algebra.walker.Walker; +import org.apache.jena.sparql.core.Var; +import org.apache.jena.sparql.graph.NodeTransform; +import org.apache.jena.sparql.graph.NodeTransformLib; +import org.apache.jena.sparql.syntax.Element; +import org.apache.jena.sparql.util.ExprUtils; +import org.junit.Assert; +import org.junit.Test; + +public class TestExprFunctionOp_NodeTransform { Review Comment: Needs to go into `TS_Expr`. ########## jena-arq/src/test/java/org/apache/jena/sparql/expr/TestExprFunctionOp_ExprTransform.java: ########## @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jena.sparql.expr; + +import static org.junit.Assert.assertEquals; + +import org.apache.jena.sparql.algebra.walker.Walker; +import org.apache.jena.sparql.expr.TestExprFunctionOp_NodeTransform.ExprFunctionOpValidator; +import org.apache.jena.sparql.util.ExprUtils; +import org.junit.Assert; +import org.junit.Test; + +public class TestExprFunctionOp_ExprTransform { Review Comment: Needs to go into `TS_Expr`. -- 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: pr-unsubscr...@jena.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@jena.apache.org For additional commands, e-mail: pr-h...@jena.apache.org