use of org.apache.jena.sparql.engine.main.solver.SolverRX4 in project jena by apache.
the class SolverRX method find.
private static Iterator<BindingNodeId> find(BindingNodeId bnid, NodeTupleTable nodeTupleTable, Node xGraphNode, Triple xPattern, boolean anyGraph, Predicate<Tuple<NodeId>> filter, ExecutionContext execCxt) {
NodeTable nodeTable = nodeTupleTable.getNodeTable();
Binding input = bnid.isEmpty() ? BindingFactory.empty() : new BindingTDB(bnid, nodeTable);
Triple tPattern = Substitute.substitute(xPattern, input);
Node graphNode = Substitute.substitute(xGraphNode, input);
Node tGraphNode = anyGraph ? Quad.unionGraph : graphNode;
// graphNode is ANY for union graph and null for default graph.
// Var to ANY, Triple Term to ANY.
Node g = (graphNode == null) ? null : nodeTopLevel(graphNode);
Node s = nodeTopLevel(tPattern.getSubject());
Node p = nodeTopLevel(tPattern.getPredicate());
Node o = nodeTopLevel(tPattern.getObject());
Tuple<Node> patternTuple = (g == null) ? TupleFactory.create3(s, p, o) : TupleFactory.create4(g, s, p, o);
Iterator<Quad> dsgIter = accessData(patternTuple, nodeTupleTable, anyGraph, filter, execCxt);
Iterator<Binding> matched = Iter.iter(dsgIter).map(dQuad -> SolverRX4.matchQuad(input, dQuad, tGraphNode, tPattern)).removeNulls();
return convFromBinding(matched, nodeTable);
}
use of org.apache.jena.sparql.engine.main.solver.SolverRX4 in project jena by apache.
the class SolverRX method find.
private static Iterator<BindingNodeId> find(BindingNodeId bnid, NodeTupleTable nodeTupleTable, Node xGraphNode, Triple xPattern, boolean anyGraph, Predicate<Tuple<NodeId>> filter, ExecutionContext execCxt) {
NodeTable nodeTable = nodeTupleTable.getNodeTable();
Binding input = bnid.isEmpty() ? BindingFactory.empty() : new BindingTDB(bnid, nodeTable);
Triple tPattern = Substitute.substitute(xPattern, input);
Node graphNode = Substitute.substitute(xGraphNode, input);
Node tGraphNode = anyGraph ? Quad.unionGraph : graphNode;
// graphNode is ANY for union graph and null for default graph.
// Var to ANY, Triple Term to ANY.
Node g = (graphNode == null) ? null : nodeTopLevel(graphNode);
Node s = nodeTopLevel(tPattern.getSubject());
Node p = nodeTopLevel(tPattern.getPredicate());
Node o = nodeTopLevel(tPattern.getObject());
Tuple<Node> patternTuple = (g == null) ? TupleFactory.create3(s, p, o) : TupleFactory.create4(g, s, p, o);
Iterator<Quad> dsgIter = accessData(patternTuple, nodeTupleTable, anyGraph, filter, execCxt);
Iterator<Binding> matched = Iter.iter(dsgIter).map(dQuad -> SolverRX4.matchQuad(input, dQuad, tGraphNode, tPattern)).removeNulls();
return convFromBinding(matched, nodeTable);
}
Aggregations