use of org.apache.jena.sparql.core.BasicPattern in project jena by apache.
the class OpExecutor method execute.
// ---- All the cases
protected QueryIterator execute(OpBGP opBGP, QueryIterator input) {
BasicPattern pattern = opBGP.getPattern();
QueryIterator qIter = stageGenerator.execute(pattern, input, execCxt);
if (hideBNodeVars)
qIter = new QueryIterDistinguishedVars(qIter, execCxt);
return qIter;
}
use of org.apache.jena.sparql.core.BasicPattern 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;
}
use of org.apache.jena.sparql.core.BasicPattern in project jena by apache.
the class NodeTransformOp method transform.
@Override
public Op transform(OpQuadPattern opQuadPattern) {
// The internal representation is (graph, BGP)
BasicPattern bgp2 = NodeTransformLib.transform(transform, opQuadPattern.getBasicPattern());
Node g2 = opQuadPattern.getGraphNode();
g2 = transform.apply(g2);
if (g2 == opQuadPattern.getGraphNode() && bgp2 == opQuadPattern.getBasicPattern())
return super.transform(opQuadPattern);
return new OpQuadPattern(g2, bgp2);
}
use of org.apache.jena.sparql.core.BasicPattern in project jena by apache.
the class TransformReorder method transform.
/**
* Transforms BGPs with the reordering
*/
@Override
public Op transform(OpBGP opBGP) {
BasicPattern pattern = opBGP.getPattern();
if (pattern.size() < 2)
return opBGP;
BasicPattern pattern2 = reorder.reorder(pattern);
return new OpBGP(pattern2);
}
use of org.apache.jena.sparql.core.BasicPattern in project jena by apache.
the class TransformMergeBGPs method transform.
@Override
public Op transform(OpJoin opJoin, Op left, Op right) {
BasicPattern p1 = asBGP(left);
BasicPattern p2 = asBGP(right);
if (p1 != null && p2 != null) {
BasicPattern p = merge(p1, p2);
return new OpBGP(p);
}
return super.transform(opJoin, left, right);
}
Aggregations