@Override public ClosableIterator<Model> getModels() { return this.baseModelSet.getModels(); }
private void triple(Resource subject, URI predicate, Node object, String graph) { final URI context = graph == null ? null : sinkModel.createURI(graph); sinkModel.addStatement(context, subject, predicate, object); }
@Override public ModelSet open() { this.baseModelSet.open(); return this; }
private void triple(String s, String p, String value, String datatype, String language, String graph) { Node object = null; if (language != null) { object = sinkModel.createLanguageTagLiteral(value, language); } else if (datatype != null) { object = sinkModel.createDatatypeLiteral(value, sinkModel.createURI(datatype)); } else { object = sinkModel.createPlainLiteral(value); } triple(sinkModel.createURI(s), sinkModel.createURI(p), object, graph); }
/** * Copy data from the source modelset to the target modelset. Iterates * through all named models of the source and adds each to the target. If a * named graph already exists in the target, the data will be added to it, * target models will not be replaced. * * @param source the source, data from here is taken * @param target the target, data will be put here. * @throws ModelRuntimeException if the copying process has an error */ public static void copy(ModelSet source, ModelSet target) throws ModelRuntimeException { for(Iterator<? extends Model> i = source.getModels(); i.hasNext();) { Model m = i.next(); m.open(); Model tm = target.getModel(m.getContextURI()); tm.open(); copy(m, tm); } // copy default model Model m = source.getDefaultModel(); m.open(); Model tm = target.getDefaultModel(); tm.open(); copy(m, tm); }
@Override public URI createURI(String uriString) throws ModelRuntimeException { return this.baseModelSet.createURI(uriString); }
@Override public void addStatement(Statement statement) throws ModelRuntimeException { this.baseModelSet.addStatement(statement); }
public void addModel(Model model, URI contextURI) throws ModelRuntimeException { baseModelSet.addModel(model, contextURI); }
@Override public Resource addReificationOf(Statement statement, Resource resource) { return this.baseModelSet.addReificationOf(statement, resource); }
@Override public boolean containsModel(URI contextURI) { return this.baseModelSet.containsModel(contextURI); }
public void commit() { baseModelSet.commit(); }
@Override public void close() { this.baseModelSet.close(); }
@Override public void addModelSet(ModelSet modelSet) throws ModelRuntimeException { this.baseModelSet.addModelSet(modelSet); }
/** * Remove data that is listed in the source modelset from the target * modelset. Iterates through all named models of the source and removes the * listed triples from the target. * * @param source the source, data from here is evaluated * @param target the target, data contained in source and target are removed * from here * @throws ModelRuntimeException if the deleting process has an error */ public static void removeFrom(ModelSet source, ModelSet target) throws ModelRuntimeException { // remove ClosableIterator<? extends Model> it = source.getModels(); while(it.hasNext()) { Model m = it.next(); ClosableIterator<Statement> modelIt = m.iterator(); target.getModel(m.getContextURI()).removeAll(modelIt); modelIt.close(); } it.close(); // remove stuff contained in default model ClosableIterator<Statement> modelIt = source.getDefaultModel().iterator(); target.getDefaultModel().removeAll(modelIt); modelIt.close(); }
@Override public URI createURI(String uriString) throws ModelRuntimeException { return this.baseModelSet.createURI(uriString); }
public void addStatement(Statement statement) throws ModelRuntimeException { this.baseModelSet.addStatement(statement); }
@Override public void addModel(Model model, URI contextURI) throws ModelRuntimeException { this.baseModelSet.addModel(model, contextURI); }
@Override public BlankNode addReificationOf(Statement statement) { return this.baseModelSet.addReificationOf(statement); }
public boolean containsModel(URI contextURI) { return baseModelSet.containsModel(contextURI); }
@Override @Deprecated public void commit() { this.baseModelSet.commit(); }