use of org.apache.jena.sparql.algebra.Op in project jena by apache.
the class ApplyTransformVisitor method visit.
@Override
public void visit(OpFilter opFilter) {
Op subOp = null;
if (opFilter.getSubOp() != null)
subOp = pop(opStack);
ExprList ex = opFilter.getExprs();
if (ex == null || ex.isEmpty()) {
// No expressions.
// Doesn't normally happen but this code is safe in these cases.
push(opStack, opFilter.apply(opTransform, subOp));
return;
}
// ex2 is the same length as ex.
ExprList ex2 = collect(ex);
OpFilter f = opFilter;
if (ex != ex2 || opFilter.getSubOp() != subOp) {
f = OpFilter.filterAlways(ex2, subOp);
// If we removed a layer of filter, then subOp needs changing
// else f-subOp is subOp anyway.
subOp = f.getSubOp();
}
push(opStack, f.apply(opTransform, subOp));
}
use of org.apache.jena.sparql.algebra.Op in project jena by apache.
the class ApplyTransformVisitor method visit.
@Override
public void visit(ExprFunctionOp funcOp) {
ExprList x = null;
if (funcOp.getArgs() != null)
x = collect(funcOp.getArgs());
Op op = pop(opStack);
Expr e = funcOp.apply(exprTransform, x, op);
push(exprStack, e);
}
use of org.apache.jena.sparql.algebra.Op in project jena by apache.
the class ApplyTransformVisitor method visit2.
@Override
public void visit2(Op2 op) {
Op left = null;
Op right = null;
// Must do right-left because the pushes onto the stack were left-right.
if (op.getRight() != null)
right = pop(opStack);
if (op.getLeft() != null)
left = pop(opStack);
Op opX = op.apply(opTransform, left, right);
push(opStack, opX);
}
use of org.apache.jena.sparql.algebra.Op in project jena by apache.
the class WalkerVisitor method visitN.
@Override
public void visitN(OpN op) {
before(op);
for (Iterator<Op> iter = op.iterator(); iter.hasNext(); ) {
Op sub = iter.next();
sub.visit(this);
}
if (opVisitor != null)
op.visit(opVisitor);
after(op);
}
use of org.apache.jena.sparql.algebra.Op in project jena by apache.
the class GraphSPARQLService method graphBaseFind.
// @Override
// public Capabilities getCapabilities()
// {
// if (capabilities == null)
// capabilities = new AllCapabilities()
// { @Override public boolean handlesLiteralTyping() { return false; } };
// return capabilities;
// }
@Override
protected ExtendedIterator<Triple> graphBaseFind(Triple m) {
Node s = m.getMatchSubject();
Var sVar = null;
if (s == null) {
sVar = Var.alloc("s");
s = sVar;
}
Node p = m.getMatchPredicate();
Var pVar = null;
if (p == null) {
pVar = Var.alloc("p");
p = pVar;
}
Node o = m.getMatchObject();
Var oVar = null;
if (o == null) {
oVar = Var.alloc("o");
o = oVar;
}
Triple triple = new Triple(s, p, o);
// Evaluate as an algebra expression
BasicPattern pattern = new BasicPattern();
pattern.add(triple);
Op op = new OpBGP(pattern);
// return WrappedIterator.createNoRemove(triples.iterator()) ;
return null;
}
Aggregations