private QueryIterator specialcase(Node gn, Op subOp, QueryIterator input) { if ( true ) return null ; if ( gn == Quad.defaultGraphIRI || gn == Quad.defaultGraphNodeGenerated ) { ExecutionContext cxt2 = new ExecutionContext(execCxt, execCxt.getDataset().getDefaultGraph()) ; return execute(subOp, cxt2) ; } if ( gn == Quad.unionGraph ) {} /* Bad if ( gn == Quad.tripleInQuad ) {} */ return null ; }
public FunctionEnvBase(ExecutionContext execCxt) { this(execCxt.getContext(), execCxt.getActiveGraph(), execCxt.getDataset()) ; execContext = execCxt ; }
public FunctionEnvBase(ExecutionContext execCxt) { this(execCxt.getContext(), execCxt.getActiveGraph(), execCxt.getDataset()) ; execContext = execCxt ; }
@Override protected QueryIterator nextStage(Binding outerBinding) { DatasetGraph ds = getExecContext().getDataset() ; // Is this closed? Iterator<Node> graphNameNodes = makeSources(ds, outerBinding, opGraph.getNode()); // List<Node> x = Iter.toList(graphNameNodes) ; // graphNameNodes = x.iterator() ; // System.out.println(x) ; QueryIterator current = new QueryIterGraphInner( outerBinding, graphNameNodes, opGraph, getExecContext()) ; return current ; }
@Override protected QueryIterator nextStage(Binding outerBinding) { DatasetGraph ds = getExecContext().getDataset() ; // Is this closed? Iterator<Node> graphNameNodes = makeSources(ds, outerBinding, opGraph.getNode()); // List<Node> x = Iter.toList(graphNameNodes) ; // graphNameNodes = x.iterator() ; // System.out.println(x) ; QueryIterator current = new QueryIterGraphInner( outerBinding, graphNameNodes, opGraph, getExecContext()) ; return current ; }
static Table evalDS(OpDatasetNames opDSN, Evaluator evaluator) { Node graphNode = opDSN.getGraphNode() ; if ( graphNode.isURI() ) { if ( evaluator.getExecContext().getDataset().containsGraph(graphNode) ) { return new TableUnit() ; } else // WRONG { return new TableEmpty() ; } } if ( ! Var.isVar(graphNode) ) throw new ARQInternalErrorException("OpDatasetNames: Not a URI or variable: "+graphNode) ; DatasetGraph dsg = evaluator.getExecContext().getDataset() ; Iterator<Node> iter = dsg.listGraphNodes() ; List<Binding> list = new ArrayList<Binding>((int)dsg.size()) ; for ( ; iter.hasNext(); ) { Node gn = iter.next(); Binding b = BindingFactory.binding(Var.alloc(graphNode), gn) ; list.add(b) ; } QueryIterator qIter = new QueryIterPlainWrapper(list.iterator(), evaluator.getExecContext()) ; return TableFactory.create(qIter) ; }
private QueryIterator specialcase(Node gn, Op subOp, QueryIterator input) { // This is a placeholder for code to specially handle explicitly named // default graph and union graph. if (Quad.isDefaultGraph(gn)) { ExecutionContext cxt2 = new ExecutionContext(execCxt, execCxt.getDataset().getDefaultGraph()) ; return execute(subOp, input, cxt2) ; } if ( Quad.isUnionGraph(gn) ) Log.warn(this, "Not implemented yet: union default graph in general OpExecutor") ; // Bad news -- if ( Lib.equals(gn, Quad.tripleInQuad) ) {} return null ; }
static Table evalDS(OpDatasetNames opDSN, Evaluator evaluator) { Node graphNode = opDSN.getGraphNode() ; if ( graphNode.isURI() ) { if ( evaluator.getExecContext().getDataset().containsGraph(graphNode) ) { return new TableUnit() ; } else // WRONG { return new TableEmpty() ; } } if ( ! Var.isVar(graphNode) ) throw new ARQInternalErrorException("OpDatasetNames: Not a URI or variable: "+graphNode) ; DatasetGraph dsg = evaluator.getExecContext().getDataset() ; Iterator<Node> iter = dsg.listGraphNodes() ; List<Binding> list = new ArrayList<Binding>((int)dsg.size()) ; for ( ; iter.hasNext(); ) { Node gn = iter.next(); Binding b = BindingFactory.binding(Var.alloc(graphNode), gn) ; list.add(b) ; } QueryIterator qIter = new QueryIterPlainWrapper(list.iterator(), evaluator.getExecContext()) ; return TableFactory.create(qIter) ; }
protected static QueryIterator buildIterator(Binding binding, Node graphNode, OpGraph opGraph, ExecutionContext outerCxt) { if ( !graphNode.isURI() && !graphNode.isBlank() ) // e.g. variable bound to a literal or blank node. throw new ARQInternalErrorException("QueryIterGraphInner.buildIterator: Not a URI or balnk node: "+graphNode) ; // Think about avoiding substitution. // If the subpattern does not involve the vars from the binding, avoid the substitute. Op op = QC.substitute(opGraph.getSubOp(), binding) ; // We can't just use DatasetGraph.getGraph because it may "auto-create" graphs. // Use the containsGraph function. boolean syntheticGraph = ( Quad.isDefaultGraph(graphNode) || Quad.isUnionGraph(graphNode) ) ; if ( ! syntheticGraph && ! outerCxt.getDataset().containsGraph(graphNode) ) return null ; Graph g = outerCxt.getDataset().getGraph(graphNode) ; // And the contains was true??!!!!!! if ( g == null ) return null ; //throw new ARQInternalErrorException(".containsGraph was true but .getGraph is null") ; ExecutionContext cxt2 = new ExecutionContext(outerCxt, g) ; QueryIterator subInput = QueryIterSingleton.create(binding, cxt2) ; return QC.execute(op, subInput, cxt2) ; }
Graph graph = execCxt.getDataset().getGraph(opGraph.getNode()) ; if ( graph == null ) for ( Iterator<Node> iter = execCxt.getDataset().listGraphNodes() ; iter.hasNext() ; ) Graph graph = execCxt.getDataset().getGraph(gn) ; ExecutionContext execCxt2 = new ExecutionContext(execCxt, graph) ; Evaluator e2 = EvaluatorFactory.create(execCxt2) ;
Graph graph = execCxt.getDataset().getGraph(opGraph.getNode()) ; if ( graph == null ) for ( Iterator<Node> iter = execCxt.getDataset().listGraphNodes() ; iter.hasNext() ; ) Graph graph = execCxt.getDataset().getGraph(gn) ; ExecutionContext execCxt2 = new ExecutionContext(execCxt, graph) ; Evaluator e2 = EvaluatorFactory.create(execCxt2) ;
protected static QueryIterator buildIterator(Binding binding, Node graphNode, OpGraph opGraph, ExecutionContext outerCxt) { if ( !graphNode.isURI() ) // e.g. variable bound to a literal or blank node. // Alow this? throw new ARQInternalErrorException("QueryIterGraphInner.buildIterator") ; //return null ; // TODO Think about avoiding substitution. // If the subpattern does not involve the vars from the binding, avoid the substitute. Op op = QC.substitute(opGraph.getSubOp(), binding) ; Graph g = outerCxt.getDataset().getGraph(graphNode) ; if ( g == null ) return null ; ExecutionContext cxt2 = new ExecutionContext(outerCxt, g) ; QueryIterator subInput = QueryIterSingleton.create(binding, cxt2) ; return QC.execute(op, subInput, cxt2) ; }
protected QueryIterator execute(OpQuadPattern quadPattern, QueryIterator input) { // Convert to BGP forms to execute in this graph-centric engine. if (quadPattern.isDefaultGraph() && execCxt.getActiveGraph() == execCxt.getDataset().getDefaultGraph()) { // Note we tested that the containing graph was the dataset's // default graph. // Easy case. OpBGP opBGP = new OpBGP(quadPattern.getBasicPattern()) ; return execute(opBGP, input) ; } // Not default graph - (graph .... ) OpBGP opBGP = new OpBGP(quadPattern.getBasicPattern()) ; OpGraph op = new OpGraph(quadPattern.getGraphNode(), opBGP) ; return execute(op, input) ; }
@Override protected QueryIterator nextStage(Binding binding) { DatasetGraph ds = super.getExecContext().getDataset() ; Node n = Substitute.substitute(node, binding) ; String uri = n.getURI(); if ( ds.containsGraph(n) ) return IterLib.result(binding, getExecContext()) ; // DO NOT LOOK AT THIS CODE Model m = FileManager.get().loadModel(uri) ; Graph g = m.getGraph() ; ds.addGraph(n, g) ; return IterLib.result(binding, getExecContext()) ; }
DatasetGraph ds = cxt.getDataset() ; BasicPattern pattern = opQuad.getBasicPattern() ; for ( Iterator<Node> graphNodes = cxt.getDataset().listGraphNodes() ; graphNodes.hasNext(); ) Graph g = cxt.getDataset().getGraph(gn) ; Binding b = BindingFactory.binding(BindingRoot.create(), gVar, gn) ; ExecutionContext cxt2 = new ExecutionContext(cxt, g) ;
DatasetGraph ds = cxt.getDataset() ; BasicPattern pattern = opQuad.getBasicPattern() ; for ( Iterator<Node> graphNodes = cxt.getDataset().listGraphNodes() ; graphNodes.hasNext(); ) Graph g = cxt.getDataset().getGraph(gn) ; Binding b = BindingFactory.binding(BindingRoot.create(), gVar, gn) ; ExecutionContext cxt2 = new ExecutionContext(cxt, g) ;
protected QueryIterator execute(OpQuadPattern quadPattern, QueryIterator input) { // Convert to BGP forms to execute in this graph-centric engine. if ( quadPattern.isDefaultGraph() && execCxt.getActiveGraph() == execCxt.getDataset().getDefaultGraph() ) { // Note we tested that the containing graph was the dataset's default graph. // Easy case. OpBGP opBGP = new OpBGP(quadPattern.getBasicPattern()) ; return execute(opBGP, input) ; } if ( Quad.isUnionGraph(quadPattern.getGraphNode()) ) Log.warn(this, "Not implemented yet: quad/union default graph in general OpExecutor") ; // Not default graph - (graph .... ) OpBGP opBGP = new OpBGP(quadPattern.getBasicPattern()) ; OpGraph op = new OpGraph(quadPattern.getGraphNode(), opBGP) ; return execute(op, input) ; }