001: /*
002: * LICENSE INFORMATION
003: * Copyright 2005-2007 by FZI (http://www.fzi.de).
004: * Licensed under a BSD license (http://www.opensource.org/licenses/bsd-license.php)
005: * <OWNER> = Max Völkel
006: * <ORGANIZATION> = FZI Forschungszentrum Informatik Karlsruhe, Karlsruhe, Germany
007: * <YEAR> = 2007
008: *
009: * Project information at http://semweb4j.org/rdf2go
010: */
011: package org.ontoware.rdf2go.model;
012:
013: import java.util.Iterator;
014:
015: import org.ontoware.aifbcommons.collection.ClosableIterable;
016: import org.ontoware.rdf2go.exception.ModelRuntimeException;
017: import org.ontoware.rdf2go.model.node.Node;
018: import org.ontoware.rdf2go.model.node.Resource;
019: import org.ontoware.rdf2go.model.node.URI;
020:
021: /**
022: * Can remove statements and apply diffs in one atomic operation.
023: * @author voelkel
024: */
025: public interface ModelAddRemove extends ClosableIterable<Statement>,
026: ModelWriter, Lockable {
027:
028: //////////////
029: // diffing
030:
031: /**
032: * Apply the changes given by this diff <emph>in one atomic operation</emph>
033: *
034: * Implementations must check that all statements to be removed are still in
035: * the Model. Otherwise an exception is thrown.
036: *
037: * First all triples to be removed are removed, then triples to be added are added.
038: *
039: * @param diff
040: * @throws ModelRuntimeException
041: */
042: void update(DiffReader diff) throws ModelRuntimeException;
043:
044: /**
045: * @param statements
046: * @return a Diff between this model and the statements given in the iterator
047: * @throws ModelRuntimeException
048: */
049: Diff getDiff(Iterator<? extends Statement> statements)
050: throws ModelRuntimeException;
051:
052: /**
053: * Removes all statements from this model.
054: *
055: * @throws ModelRuntimeException
056: */
057: void removeAll() throws ModelRuntimeException;
058:
059: /**
060: * Removes all statements contained in 'other' from this model =
061: * 'difference'
062: *
063: * @param other
064: * another RDF2GO model
065: * @throws ModelRuntimeException
066: */
067: void removeAll(Iterator<? extends Statement> statements)
068: throws ModelRuntimeException;
069:
070: ///////////////////
071: // remove
072:
073: /**
074: * remove a (subject, property ,object)-statement from the model
075: *
076: * @param subject
077: * URI or Object (= blankNode)
078: * @param predicate
079: * @param object
080: * URI or String (=plainLiteral) or BlankNode (=blankNode) or
081: * TypedLiteral or LanguageTagLiteral
082: * @throws ModelRuntimeException
083: */
084: void removeStatement(Resource subject, URI predicate, Node object)
085: throws ModelRuntimeException;
086:
087: void removeStatement(Resource subject, URI predicate, String literal)
088: throws ModelRuntimeException;
089:
090: /**
091: * remove a (subject, property ,literal, language tag)-statement from the
092: * model
093: *
094: * @param subject
095: * @param predicate
096: * @param literal
097: * @param languageTag
098: * @throws ModelRuntimeException
099: */
100: void removeStatement(Resource subject, URI predicate,
101: String literal, String languageTag)
102: throws ModelRuntimeException;
103:
104: /**
105: * remove a (subject, property ,literal, datatype)-statement from the model
106: *
107: * datatype often is an uri for a xml schema datatype (xsd)
108: *
109: * @param subject
110: * @param predicate
111: * @param literal
112: * @param datatypeURI
113: * @throws ModelRuntimeException
114: */
115: void removeStatement(Resource subject, URI predicate,
116: String literal, URI datatypeURI)
117: throws ModelRuntimeException;
118:
119: /**
120: * remove a rdf2go-statement from the model
121: *
122: * @param statement
123: * @throws ModelRuntimeException
124: */
125: void removeStatement(Statement statement)
126: throws ModelRuntimeException;
127:
128: void removeStatement(String subjectURIString, URI predicate,
129: String literal) throws ModelRuntimeException;
130:
131: /**
132: * remove a (subject, property ,literal, language tag)-statement from the
133: * model
134: *
135: * @param subject
136: * @param predicate
137: * @param literal
138: * @param languageTag
139: * @throws ModelRuntimeException
140: */
141: void removeStatement(String subjectURIString, URI predicate,
142: String literal, String languageTag)
143: throws ModelRuntimeException;
144:
145: /**
146: * remove a (subject, property ,literal, datatype)-statement from the model
147: *
148: * datatype often is an uri for a xml schema datatype (xsd)
149: *
150: * @param subject
151: * @param predicate
152: * @param literal
153: * @param datatypeURI
154: * @throws ModelRuntimeException
155: */
156: void removeStatement(String subjectURIString, URI predicate,
157: String literal, URI datatypeURI)
158: throws ModelRuntimeException;
159:
160: }
|