@Override public void httpDelete(Node graphName) { Graph ng = dataset.getGraph(graphName) ; if ( ng == null ) return ; dataset.removeGraph(graphName) ; // clearGraph(ng) ; }
@Override public void removeGraph(Node graphName) { getW().removeGraph(graphName); }
@Override public Dataset removeNamedModel(String uri) { checkGraphName(uri) ; Node n = NodeFactory.createURI(uri) ; dsg.removeGraph(n) ; return this; }
protected void execDropClear(UpdateDropClear update, Node g, boolean isClear) { if ( !alwaysSilent ) { if ( g != null && !datasetGraph.containsGraph(g) && !update.isSilent() ) error("No such graph: " + g); } if ( isClear ) { if ( g == null || datasetGraph.containsGraph(g) ) graph(datasetGraph, g).clear(); } else datasetGraph.removeGraph(g); }
/** Remove the target graph */ protected static void gsDrop(DatasetGraph dsg, Target target, boolean isSilent) { if ( target.isDefault() ) dsg.getDefaultGraph().clear(); else dsg.removeGraph(target.getGraph()); }
@Override public Dataset replaceNamedModel(String uri, Model model) { // Assumes single writer. checkGraphName(uri) ; Node n = NodeFactory.createURI(uri) ; dsg.removeGraph(n) ; dsg.addGraph(n, model.getGraph() ) ; return this; }
/** Delete a graph. This removes the storage choice and looses the setup. * The default graph is cleared, not removed. */ protected void deleteGraph(HttpAction action) { DatasetGraph dsg = decideDataset(action); Target target = determineTarget(dsg, action) ; if ( target.isDefault ) clearGraph(target) ; else action.getActiveDSG().removeGraph(target.graphName) ; }
/** Delete a graph. This removes the storage choice and looses the setup. * The default graph is cleared, not removed. */ protected void deleteGraph(HttpAction action) { DatasetGraph dsg = decideDataset(action); Target target = determineTarget(dsg, action) ; if ( target.isDefault ) clearGraph(target) ; else action.getActiveDSG().removeGraph(target.graphName) ; }
@Test(expected = UnsupportedOperationException.class) public void noDeletingGraphs() { emptyDsg().removeGraph(null); }
@SuppressWarnings("deprecation") @Override protected final long writeOutput(Writer writer) { if (this.g.size() == 0) return 0; RDFDataMgr.write(writer, this.g, RDFWriterRegistry.defaultSerialization(this.getRdfLanguage())); // Clear the dataset graph @SuppressWarnings("unchecked") List<Node> graphNames = IteratorUtils.toList(this.g.listGraphNodes()); for (Node graphName : graphNames) { this.g.removeGraph(graphName); } this.g.getDefaultGraph().clear(); return this.g.size(); }
@SuppressWarnings("deprecation") @Override protected final long writeOutput(Writer writer) { if (this.g.size() == 0) return 0; RDFDataMgr.write(writer, this.g, RDFWriterRegistry.defaultSerialization(this.getRdfLanguage())); // Clear the dataset graph @SuppressWarnings("unchecked") List<Node> graphNames = IteratorUtils.toList(this.g.listGraphNodes()); for (Node graphName : graphNames) { this.g.removeGraph(graphName); } this.g.getDefaultGraph().clear(); return this.g.size(); }