@Override public boolean containsGraph(Node graphNode) { if ( namedGraphs.containsKey(graphNode) ) // Empty graph may or may not count. // If they don't, need to override this method. return true ; return _containsGraph(graphNode) ; }
@Override public final Graph getDefaultGraph() { if ( ! caching ) return _createDefaultGraph() ; synchronized(this) { if ( defaultGraph == null ) defaultGraph = _createDefaultGraph() ; } return defaultGraph ; }
@Override public final void removeGraph(Node graphName) { deleteAny(graphName, Node.ANY, Node.ANY, Node.ANY) ; synchronized(this) { namedGraphs.remove(graphName) ; } }
@Override public void addGraph(Node graphName, Graph graph) { removeGraph(graphName) ; GraphUtil.addInto(getGraph(graphName), graph) ; }
public static Iterator<Quad> findInSpecificNamedGraph(DatasetGraphCaching dsg, Node g, Node s, Node p, Node o) { return triples2quadsDftGraph(dsg.getGraph(g).find(s, p, o)) ; } }
public static void addToDftGraph(DatasetGraphCaching dsg, Node s, Node p, Node o) { dsg.getDefaultGraph().add(new Triple(s,p,o)) ; }
public static Iterator<Quad> findInAnyNamedGraphs(DatasetGraphCaching dsg, Node s, Node p, Node o) { Iterator<Node> iter = dsg.listGraphNodes() ; Iterator<Quad> quads = null ; for ( ; iter.hasNext() ; ) { Node gn = iter.next() ; quads = Iter.append(quads, findInSpecificNamedGraph(dsg, gn, s, p, o)) ; } return quads ; }
@Override public synchronized void close() { if ( closed ) return ; closed = true ; defaultGraph = null ; namedGraphs.clear() ; _close() ; super.close() ; }
@Override public final Graph getGraph(Node graphNode) { if ( ! caching ) return _createNamedGraph(graphNode) ; synchronized(this) { // MRSW - need to create and update the cache atomically. Graph graph = namedGraphs.get(graphNode) ; if ( graph == null ) { graph = _createNamedGraph(graphNode) ; namedGraphs.put(graphNode, graph) ; } return graph ; } }
@Override public void addGraph(Node graphName, Graph graph) { removeGraph(graphName) ; getGraph(graphName).getBulkUpdateHandler().add(graph) ; }
public static void addToNamedGraph(DatasetGraphCaching dsg, Node g, Node s, Node p, Node o) { dsg.getGraph(g).add(new Triple(s,p,o)) ; }
public static void deleteFromDftGraph(DatasetGraphCaching dsg, Node s, Node p, Node o) { dsg.getDefaultGraph().delete(new Triple(s,p,o)) ; }
public static Iterator<Quad> findInAnyNamedGraphs(DatasetGraphCaching dsg, Node s, Node p, Node o) { Iterator<Node> iter = dsg.listGraphNodes() ; Iterator<Quad> quads = null ; for ( ; iter.hasNext() ; ) { Node gn = iter.next() ; quads = Iter.append(quads, findInSpecificNamedGraph(dsg, gn, s, p, o)) ; } return quads ; }
@Override public void close() { synchronized(this) { if ( closed ) return ; closed = true ; defaultGraph = null ; namedGraphs.clear() ; _close() ; super.close() ; } }
@Override public final Graph getGraph(Node graphNode) { if ( ! caching ) return _createNamedGraph(graphNode) ; synchronized(this) { // MRSW - need to create and update the cache atomically. Graph graph = namedGraphs.get(graphNode) ; if ( graph == null ) { graph = _createNamedGraph(graphNode) ; namedGraphs.put(graphNode, graph) ; } return graph ; } }
public static Iterator<Quad> findInSpecificNamedGraph(DatasetGraphCaching dsg, Node g, Node s, Node p, Node o) { return triples2quadsDftGraph(dsg.getGraph(g).find(s, p, o)) ; } }
public static void addToDftGraph(DatasetGraphCaching dsg, Node s, Node p, Node o) { dsg.getDefaultGraph().add(new Triple(s,p,o)) ; }
@Override public final Graph getDefaultGraph() { if ( ! caching ) return _createDefaultGraph() ; synchronized(this) { if ( defaultGraph == null ) defaultGraph = _createDefaultGraph() ; } return defaultGraph ; }
@Override public boolean containsGraph(Node graphNode) { if ( namedGraphs.containsKey(graphNode) ) // Empty graph may or may not count. // If they don't, need to override this method. return true ; return _containsGraph(graphNode) ; }
@Override public final void removeGraph(Node graphName) { deleteAny(graphName, Node.ANY, Node.ANY, Node.ANY) ; synchronized(this) { namedGraphs.remove(graphName) ; } }