001: /**
002: *
003: */package org.ontoware.rdf2go.model.impl;
004:
005: import java.io.IOException;
006: import java.io.InputStream;
007: import java.io.OutputStream;
008: import java.io.Reader;
009: import java.io.Writer;
010: import java.net.URL;
011: import java.util.Collection;
012:
013: import org.ontoware.aifbcommons.collection.ClosableIterable;
014: import org.ontoware.aifbcommons.collection.ClosableIterator;
015: import org.ontoware.rdf2go.exception.MalformedQueryException;
016: import org.ontoware.rdf2go.exception.ModelRuntimeException;
017: import org.ontoware.rdf2go.exception.QueryLanguageNotSupportedException;
018: import org.ontoware.rdf2go.exception.SyntaxNotSupportedException;
019: import org.ontoware.rdf2go.model.DiffReader;
020: import org.ontoware.rdf2go.model.Model;
021: import org.ontoware.rdf2go.model.ModelSet;
022: import org.ontoware.rdf2go.model.QuadPattern;
023: import org.ontoware.rdf2go.model.QueryResultTable;
024: import org.ontoware.rdf2go.model.Statement;
025: import org.ontoware.rdf2go.model.Syntax;
026: import org.ontoware.rdf2go.model.node.BlankNode;
027: import org.ontoware.rdf2go.model.node.NodeOrVariable;
028: import org.ontoware.rdf2go.model.node.Resource;
029: import org.ontoware.rdf2go.model.node.ResourceOrVariable;
030: import org.ontoware.rdf2go.model.node.URI;
031: import org.ontoware.rdf2go.model.node.UriOrVariable;
032:
033: /**
034: * @author grimnes, voelkel
035: *
036: */
037: public class DelegatingModelSet extends AbstractModelSetImpl implements
038: ModelSet {
039:
040: protected ModelSet baseModelSet;
041:
042: public DelegatingModelSet(ModelSet baseModelSet) {
043: this .baseModelSet = baseModelSet;
044: }
045:
046: @Override
047: public boolean addModel(Model model) {
048: return this .baseModelSet.addModel(model);
049: }
050:
051: public void addStatement(Statement statement)
052: throws ModelRuntimeException {
053: this .baseModelSet.addStatement(statement);
054: }
055:
056: public void close() {
057: this .baseModelSet.close();
058: }
059:
060: @Override
061: public boolean containsStatements(UriOrVariable contextURI,
062: ResourceOrVariable subject, UriOrVariable predicate,
063: NodeOrVariable object) throws ModelRuntimeException {
064: return this .baseModelSet.containsStatements(contextURI,
065: subject, predicate, object);
066: }
067:
068: public QuadPattern createQuadPattern(UriOrVariable context,
069: ResourceOrVariable subject, UriOrVariable predicate,
070: NodeOrVariable object) {
071: return this .baseModelSet.createQuadPattern(context, subject,
072: predicate, object);
073: }
074:
075: @Override
076: public URI createURI(String uriString) throws ModelRuntimeException {
077: return this .baseModelSet.createURI(uriString);
078: }
079:
080: @Override
081: public ClosableIterator<Statement> findStatements(
082: UriOrVariable contextURI, ResourceOrVariable subject,
083: UriOrVariable predicate, NodeOrVariable object)
084: throws ModelRuntimeException {
085: return this .baseModelSet.findStatements(contextURI, subject,
086: predicate, object);
087: }
088:
089: public Model getDefaultModel() {
090: return this .baseModelSet.getDefaultModel();
091: }
092:
093: /**
094: * @return the modelset to which this instances delegates everything.
095: */
096: public ModelSet getDelegatedModelSet() {
097: return this .baseModelSet;
098: }
099:
100: public Model getModel(URI contextURI) {
101: return this .baseModelSet.getModel(contextURI);
102: }
103:
104: public ClosableIterator<Model> getModels() {
105: return this .baseModelSet.getModels();
106: }
107:
108: public ClosableIterator<URI> getModelURIs() {
109: return this .baseModelSet.getModelURIs();
110: }
111:
112: @Deprecated
113: public Object getUnderlyingModelImplementation() {
114: return this .baseModelSet.getUnderlyingModelSetImplementation();
115: }
116:
117: public Object getUnderlyingModelSetImplementation() {
118: return this .baseModelSet.getUnderlyingModelSetImplementation();
119: }
120:
121: public boolean isOpen() {
122: return this .baseModelSet.isOpen();
123: }
124:
125: public void open() {
126: this .baseModelSet.open();
127: }
128:
129: public ClosableIterable<Statement> queryConstruct(String query,
130: String querylanguage)
131: throws QueryLanguageNotSupportedException,
132: MalformedQueryException, ModelRuntimeException {
133: return this .baseModelSet.queryConstruct(query, querylanguage);
134: }
135:
136: public QueryResultTable querySelect(String query,
137: String querylanguage)
138: throws QueryLanguageNotSupportedException,
139: MalformedQueryException, ModelRuntimeException {
140: return this .baseModelSet.querySelect(query, querylanguage);
141: }
142:
143: public void readFrom(InputStream in) throws IOException,
144: ModelRuntimeException {
145: this .baseModelSet.readFrom(in);
146: }
147:
148: @Override
149: public void readFrom(InputStream in, Syntax syntax)
150: throws IOException, ModelRuntimeException,
151: SyntaxNotSupportedException {
152: this .baseModelSet.readFrom(in, syntax);
153: }
154:
155: public void readFrom(Reader in) throws IOException,
156: ModelRuntimeException {
157: this .baseModelSet.readFrom(in);
158: }
159:
160: @Override
161: public void readFrom(Reader in, Syntax syntax) throws IOException,
162: ModelRuntimeException, SyntaxNotSupportedException {
163: this .baseModelSet.readFrom(in, syntax);
164: }
165:
166: public void removeStatement(Statement statement)
167: throws ModelRuntimeException {
168: this .baseModelSet.removeStatement(statement);
169: }
170:
171: public long size() throws ModelRuntimeException {
172: return this .baseModelSet.size();
173: }
174:
175: public boolean sparqlAsk(String query)
176: throws ModelRuntimeException, MalformedQueryException {
177: return this .baseModelSet.sparqlAsk(query);
178: }
179:
180: public ClosableIterable<Statement> sparqlConstruct(String query)
181: throws ModelRuntimeException, MalformedQueryException {
182: return this .baseModelSet.sparqlConstruct(query);
183: }
184:
185: public ClosableIterable<Statement> sparqlDescribe(String query)
186: throws ModelRuntimeException {
187: return this .baseModelSet.sparqlDescribe(query);
188: }
189:
190: public QueryResultTable sparqlSelect(String queryString)
191: throws MalformedQueryException, ModelRuntimeException {
192: return this .baseModelSet.sparqlSelect(queryString);
193: }
194:
195: @Override
196: public void update(DiffReader diff) throws ModelRuntimeException {
197: this .baseModelSet.update(diff);
198: }
199:
200: public void writeTo(OutputStream out) throws IOException,
201: ModelRuntimeException {
202: this .baseModelSet.writeTo(out);
203: }
204:
205: @Override
206: public void writeTo(OutputStream out, Syntax syntax)
207: throws IOException, ModelRuntimeException,
208: SyntaxNotSupportedException {
209: this .baseModelSet.writeTo(out, syntax);
210: }
211:
212: public void writeTo(Writer out) throws IOException,
213: ModelRuntimeException {
214: this .baseModelSet.writeTo(out);
215: }
216:
217: @Override
218: public void writeTo(Writer out, Syntax syntax) throws IOException,
219: ModelRuntimeException, SyntaxNotSupportedException {
220: this .baseModelSet.writeTo(out, syntax);
221: }
222:
223: public boolean isEmpty() {
224: return baseModelSet.isEmpty();
225: }
226:
227: public boolean containsModel(URI contextURI) {
228: return baseModelSet.containsModel(contextURI);
229: }
230:
231: public boolean removeModel(URI contextURI) {
232: return baseModelSet.removeModel(contextURI);
233: }
234:
235: public BlankNode createBlankNode(String internalID) {
236: return baseModelSet.createBlankNode(internalID);
237: }
238:
239: public void commit() {
240: baseModelSet.commit();
241: }
242:
243: public void setAutocommit(boolean autocommit) {
244: baseModelSet.setAutocommit(autocommit);
245: }
246:
247: public Resource createReficationOf(Statement statement,
248: Resource resource) {
249: return baseModelSet.createReficationOf(statement, resource);
250: }
251:
252: public BlankNode createReficationOf(Statement statement) {
253: return baseModelSet.createReficationOf(statement);
254: }
255:
256: public void deleteReification(Resource reificationResource) {
257: baseModelSet.deleteReification(reificationResource);
258: }
259:
260: public Collection<Resource> getAllReificationsOf(Statement statement) {
261: return baseModelSet.getAllReificationsOf(statement);
262: }
263:
264: public boolean hasReifications(Statement stmt) {
265: return baseModelSet.hasReifications(stmt);
266: }
267:
268: public void readFrom(InputStream reader, Syntax syntax, URL baseURI)
269: throws IOException, ModelRuntimeException,
270: SyntaxNotSupportedException {
271: baseModelSet.readFrom(reader, syntax, baseURI);
272: }
273:
274: public void readFrom(Reader in, Syntax syntax, URL baseURI)
275: throws IOException, ModelRuntimeException,
276: SyntaxNotSupportedException {
277: baseModelSet.readFrom(in, syntax, baseURI);
278: }
279:
280: }
|