use of org.apache.jena.sparql.algebra.op.OpAssign in project jena by apache.
the class TransformExtendCombine method transform.
@Override
public Op transform(OpAssign opAssign, Op subOp) {
if (subOp instanceof OpAssign) {
// If a variable is assigned twice, don't do anything.
// (assign (?x 2) (assign (?x 1) op)) => leave alone.
// This is the safest option in a rare case.
// It would be OK if addAll does a replacement without checking
// but having it check and complain about duplicates adds robustness.
// In OpExtend, it's actually illegal.
OpAssign x = (OpAssign) subOp;
VarExprList outerVarExprList = opAssign.getVarExprList();
// Copy
VarExprList innerVarExprList = new VarExprList(x.getVarExprList());
Op r = OpAssign.assign(x.getSubOp(), innerVarExprList);
// This contains an "if already (assign)" test.
r = OpAssign.assign(r, outerVarExprList);
return r;
}
return super.transform(opAssign, subOp);
}
Aggregations