/** node used for the RDF merge of named graphs */ // public static boolean isQuadUnionGraph(Node node) // { // return node.equals(unionGraph) ; // } // public boolean isUnionGraph() { return isUnionGraph(graph) ; }
/** node used for the RDF merge of named graphs */ // public static boolean isQuadUnionGraph(Node node) // { // return node.equals(unionGraph) ; // } // public boolean isUnionGraph() { return isUnionGraph(graph) ; }
/** Is this quad pattern explicitly naming the union graph? */ public boolean isUnionGraph() { return Quad.isUnionGraph(graphNode) ; }
/** Is this quad pattern explicitly naming the union graph? */ public boolean isUnionGraph() { return Quad.isUnionGraph(graphNode) ; }
protected static final boolean isUnionGraph(Node gn) { return Quad.isUnionGraph(gn) ; }
/** @deprecated use Quad.isUnionGraph */ @Deprecated public static boolean isQuadUnionGraph(Node node) { return isUnionGraph(node) ; }
@Override public boolean containsGraph(Node graphNode) { if ( Quad.isUnionGraph(graphNode) ) return true ; if ( Quad.isDefaultGraphExplicit(graphNode)) return true ; return super.containsGraph(graphNode) ; }
public static boolean containsGraph(DatasetGraph dsg, Node gn) { // [[DynDS]] if ( Quad.isDefaultGraph(gn)) return true ; if ( Quad.isUnionGraph(gn)) return true ; return dsg.containsGraph(gn) ; }
public static Graph getGraph(DatasetGraph dsg, Node gn) { // [[DynDS]] if ( gn == null ) return dsg.getDefaultGraph() ; if ( Quad.isDefaultGraph(gn) ) // Explicit or generated. return dsg.getDefaultGraph() ; if ( Quad.isUnionGraph(gn)) return unionGraph(dsg) ; return dsg.getGraph(gn) ; }
@Override protected ExtendedIterator<Triple> graphBaseFind(Node s, Node p, Node o) { Node g = graphNode(gn) ; Iterator<Triple> iter = GLib.quads2triples(dsg.find(g, s, p, o)) ; if ( Quad.isUnionGraph(gn) ) return graphUnionFind(s, p, o) ; return WrappedIterator.createNoRemove(iter) ; }
@Override public Graph getGraph(Node graphNode) { if ( Quad.isUnionGraph(graphNode) ) { if ( unionGraph == null ) unionGraph = GraphOps.unionGraph(super.getWrapped()) ; return unionGraph ; } if ( Quad.isDefaultGraphExplicit(graphNode)) return getDefaultGraph() ; return super.getGraph(graphNode) ; } }
@Override public Iterator<Quad> findNG(Node g, Node s, Node p , Node o) { Iterator<Quad> qIter ; if ( Quad.isUnionGraph(g)) qIter = findInAnyNamedGraphs(s, p, o) ; else if ( ! isWildcard(g) ) qIter = findInSpecificNamedGraph(g, s, p, o) ; else qIter = findInAnyNamedGraphs(s, p, o) ; if ( qIter == null ) return Iter.nullIterator() ; return qIter ; }
@Override public void performDelete( Triple t ) { Node g = graphNode(gn) ; if ( Quad.isUnionGraph(g) ) throw new GraphViewException("Can't update the default union graph of a dataset") ; Node s = t.getSubject() ; Node p = t.getPredicate() ; Node o = t.getObject() ; dsg.delete(g, s, p, o) ; }
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 ; }
@Override public void performAdd( Triple t ) { Node g = graphNode(gn) ; if ( Quad.isUnionGraph(g) ) throw new GraphViewException("Can't update the default union graph of a dataset") ; Node s = t.getSubject() ; Node p = t.getPredicate() ; Node o = t.getObject() ; dsg.add(g, s, p, o) ; }
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) ; }
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) ; }