use of org.apache.jena.sparql.expr.ExprTransform in project jena by apache.
the class QueryTransformOps method transform.
/** Transform a query based on a mapping from {@link Var} variable to replacement {@link Node}. */
public static Query transform(Query query, Map<Var, ? extends Node> substitutions) {
ElementTransform eltrans = new ElementTransformSubst(substitutions);
NodeTransform nodeTransform = new NodeTransformSubst(substitutions);
ExprTransform exprTrans = new ExprTransformNodeElement(nodeTransform, eltrans);
return transform(query, eltrans, exprTrans);
}
use of org.apache.jena.sparql.expr.ExprTransform in project jena by apache.
the class Transformer method transformSkipService.
/** Transform an algebra expression except skip (leave alone) any OpService nodes */
public static Op transformSkipService(Transform opTransform, ExprTransform exprTransform, Op op, OpVisitor beforeVisitor, OpVisitor afterVisitor) {
if (true) {
// XXX XXX Better work with Walker.
if (opTransform == null)
opTransform = new TransformCopy();
if (exprTransform == null)
exprTransform = new ExprTransformCopy();
Transform transform2 = new TransformSkipService(opTransform);
transform2 = opTransform;
ApplyTransformVisitor atv = new ApplyTransformVisitor(transform2, exprTransform, false, beforeVisitor, afterVisitor);
return Walker.transformSkipService(op, atv, beforeVisitor, afterVisitor);
}
Transform transform = new TransformSkipService(opTransform);
return Transformer.transform(transform, exprTransform, op, beforeVisitor, afterVisitor);
// // OLD
// // Simplest way but still walks the OpService subtree (and throws away the
// // transformation).
// Transform transform = new TransformSkipService(opTransform) ;
// return Transformer.transform(transform, exprTransform, op, beforeVisitor, afterVisitor) ;
}
use of org.apache.jena.sparql.expr.ExprTransform in project jena by apache.
the class UpdateTransformOps method transform.
/** Transform an {@link Update} based on a mapping from {@link Var} variable to replacement {@link Node}. */
public static Update transform(Update update, Map<Var, Node> substitutions) {
ElementTransform eltrans = new ElementTransformSubst(substitutions);
NodeTransform nodeTransform = new NodeTransformSubst(substitutions);
ExprTransform exprTrans = new ExprTransformNodeElement(nodeTransform, eltrans);
return transform(update, eltrans, exprTrans);
}
use of org.apache.jena.sparql.expr.ExprTransform in project jena by apache.
the class UpdateTransformOps method transform.
/** Transform an {@link UpdateRequest} based on a mapping from {@link Var} variable to replacement {@link Node}. */
public static UpdateRequest transform(UpdateRequest update, Map<Var, Node> substitutions) {
ElementTransform eltrans = new ElementTransformSubst(substitutions);
NodeTransform nodeTransform = new NodeTransformSubst(substitutions);
ExprTransform exprTrans = new ExprTransformNodeElement(nodeTransform, eltrans);
return transform(update, eltrans, exprTrans);
}
use of org.apache.jena.sparql.expr.ExprTransform in project jena by apache.
the class NodeTransformLib method transform.
/** Do a node->node conversion of an Op - return original BGP for "no change" */
public static Op transform(NodeTransform nodeTransform, Op op) {
Transform opTransform = new NodeTransformOp(nodeTransform);
ExprTransform exprTransform = new NodeTransformExpr(nodeTransform);
return Transformer.transform(opTransform, exprTransform, op);
}
Aggregations