01: /*
02: * LICENSE INFORMATION
03: * Copyright 2005-2007 by FZI (http://www.fzi.de).
04: * Licensed under a BSD license (http://www.opensource.org/licenses/bsd-license.php)
05: * <OWNER> = Max Völkel
06: * <ORGANIZATION> = FZI Forschungszentrum Informatik Karlsruhe, Karlsruhe, Germany
07: * <YEAR> = 2007
08: *
09: * Project information at http://semweb4j.org/rdf2go
10: */
11: package org.ontoware.rdf2go.model.impl;
12:
13: import org.ontoware.rdf2go.exception.ModelRuntimeException;
14: import org.ontoware.rdf2go.model.ModelRemovePatterns;
15: import org.ontoware.rdf2go.model.TriplePattern;
16: import org.ontoware.rdf2go.model.node.NodeOrVariable;
17: import org.ontoware.rdf2go.model.node.ResourceOrVariable;
18: import org.ontoware.rdf2go.model.node.UriOrVariable;
19:
20: /**
21: * The implementation first searches for all matching triples, copies them to
22: * memory and then removes them. This is very inefficient. Please override!
23: *
24: * @author voelkel
25: *
26: */
27: public abstract class AbstractModelRemovePatterns extends
28: AbstractModelAddRemove implements ModelRemovePatterns {
29:
30: public void removeStatements(TriplePattern triplePattern)
31: throws ModelRuntimeException {
32: ModelAddRemoveMemoryImpl toBeRemoved = new ModelAddRemoveMemoryImpl();
33: toBeRemoved.addAll(this .findStatements(triplePattern));
34: this .removeAll(toBeRemoved.iterator());
35: }
36:
37: public void removeStatements(ResourceOrVariable subject,
38: UriOrVariable predicate, NodeOrVariable object)
39: throws ModelRuntimeException {
40: ModelAddRemoveMemoryImpl toBeRemoved = new ModelAddRemoveMemoryImpl();
41: toBeRemoved.addAll(this.findStatements(subject, predicate,
42: object));
43: this.removeAll(toBeRemoved.iterator());
44: }
45:
46: }
|