org.ontoware.rdf2go.model.impl
Class DelegatingModelSet

java.lang.Object
  extended by org.ontoware.rdf2go.model.impl.AbstractModelSetImpl
      extended by org.ontoware.rdf2go.model.impl.DelegatingModelSet
All Implemented Interfaces:
java.lang.Iterable<Statement>, ClosableIterable<Statement>, Commitable, FindableModelSet, Lockable, ModelSet, ModelSetAddRemove, ModelSetIO, ModelValueFactory, NamespaceSupport, ReificationSupport, Sparqlable
Direct Known Subclasses:
NotifyingModelSetLayer

public class DelegatingModelSet
extends AbstractModelSetImpl
implements ModelSet

Author:
grimnes, voelkel

Field Summary
protected  ModelSet baseModelSet
           
 
Constructor Summary
DelegatingModelSet(ModelSet baseModelSet)
           
 
Method Summary
 boolean addModel(Model model)
           
 void addModel(Model model, URI contextURI)
          subclasses should overwrite this for performance reasons
 void addModelSet(ModelSet modelSet)
           
 BlankNode addReificationOf(Statement statement)
           
 Resource addReificationOf(Statement statement, Resource resource)
           
 void addStatement(Statement statement)
           
 void close()
           
 void commit()
           
 boolean containsModel(URI contextURI)
           
 boolean containsStatements(UriOrVariable contextURI, ResourceOrVariable subject, UriOrVariable predicate, NodeOrVariable object)
           
 BlankNode createBlankNode(java.lang.String internalID)
           
 QuadPattern createQuadPattern(UriOrVariable context, ResourceOrVariable subject, UriOrVariable predicate, NodeOrVariable object)
           
 URI createURI(java.lang.String uriString)
           
 void deleteReification(Resource reificationResource)
           
 ClosableIterator<Statement> findStatements(UriOrVariable contextURI, ResourceOrVariable subject, UriOrVariable predicate, NodeOrVariable object)
           
 java.util.Collection<Resource> getAllReificationsOf(Statement statement)
           
 Model getDefaultModel()
           
 ModelSet getDelegatedModelSet()
           
 Model getModel(URI contextURI)
           
 ClosableIterator<Model> getModels()
           
 ClosableIterator<URI> getModelURIs()
           
 java.lang.String getNamespace(java.lang.String prefix)
           
 java.util.Map<java.lang.String,java.lang.String> getNamespaces()
           
 java.lang.Object getUnderlyingModelImplementation()
          Deprecated. 
 java.lang.Object getUnderlyingModelSetImplementation()
           
 boolean hasReifications(Statement stmt)
           
 boolean isEmpty()
          sublcasses should override this method for performance
 boolean isOpen()
           
 void open()
           
 ClosableIterable<Statement> queryConstruct(java.lang.String query, java.lang.String querylanguage)
           
 QueryResultTable querySelect(java.lang.String query, java.lang.String querylanguage)
           
 void readFrom(java.io.InputStream in)
           
 void readFrom(java.io.InputStream in, Syntax syntax)
           
 void readFrom(java.io.InputStream reader, Syntax syntax, java.lang.String baseURI)
           
 void readFrom(java.io.Reader in)
           
 void readFrom(java.io.Reader in, Syntax syntax)
           
 void readFrom(java.io.Reader in, Syntax syntax, java.lang.String baseURI)
           
 boolean removeModel(URI contextURI)
           
 void removeNamespace(java.lang.String prefix)
           
 void removeStatement(Statement statement)
           
 void setAutocommit(boolean autocommit)
           
 void setNamespace(java.lang.String prefix, java.lang.String namespaceURI)
           
 long size()
           
 boolean sparqlAsk(java.lang.String query)
           
 ClosableIterable<Statement> sparqlConstruct(java.lang.String query)
           
 ClosableIterable<Statement> sparqlDescribe(java.lang.String query)
           
 QueryResultTable sparqlSelect(java.lang.String queryString)
           
 void update(DiffReader diff)
           
 void writeTo(java.io.OutputStream out)
           
 void writeTo(java.io.OutputStream out, Syntax syntax)
           
 void writeTo(java.io.Writer out)
           
 void writeTo(java.io.Writer out, Syntax syntax)
           
 
Methods inherited from class org.ontoware.rdf2go.model.impl.AbstractModelSetImpl
addAll, addStatement, contains, countStatements, createBlankNode, createDatatypeLiteral, createLanguageTagLiteral, createPlainLiteral, createStatement, createStatement, dump, findStatements, isLocked, isValidURI, iterator, lock, newRandomUniqueURI, removeAll, removeAll, removeStatement, removeStatements, removeStatements, serialize, unlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.ontoware.rdf2go.model.ModelSet
createStatement, dump, removeAll
 
Methods inherited from interface org.ontoware.rdf2go.model.ModelSetIO
serialize
 
Methods inherited from interface org.ontoware.rdf2go.model.FindableModelSet
contains, countStatements, findStatements
 
Methods inherited from interface org.ontoware.rdf2go.model.ModelSetAddRemove
addAll, addStatement, removeAll, removeStatement, removeStatements, removeStatements
 
Methods inherited from interface org.ontoware.aifbcommons.collection.ClosableIterable
iterator
 
Methods inherited from interface org.ontoware.rdf2go.model.Lockable
isLocked, lock, unlock
 
Methods inherited from interface org.ontoware.rdf2go.model.ModelValueFactory
createBlankNode, createDatatypeLiteral, createLanguageTagLiteral, createPlainLiteral, createStatement, isValidURI, newRandomUniqueURI
 

Field Detail

baseModelSet

protected ModelSet baseModelSet
Constructor Detail

DelegatingModelSet

public DelegatingModelSet(ModelSet baseModelSet)
Method Detail

addModel

public boolean addModel(Model model)
Specified by:
addModel in interface ModelSet
Overrides:
addModel in class AbstractModelSetImpl

addStatement

public void addStatement(Statement statement)
                  throws ModelRuntimeException
Specified by:
addStatement in interface ModelSetAddRemove
Throws:
ModelRuntimeException

close

public void close()
Specified by:
close in interface ModelSet

containsStatements

public boolean containsStatements(UriOrVariable contextURI,
                                  ResourceOrVariable subject,
                                  UriOrVariable predicate,
                                  NodeOrVariable object)
                           throws ModelRuntimeException
Specified by:
containsStatements in interface FindableModelSet
Overrides:
containsStatements in class AbstractModelSetImpl
Throws:
ModelRuntimeException

createQuadPattern

public QuadPattern createQuadPattern(UriOrVariable context,
                                     ResourceOrVariable subject,
                                     UriOrVariable predicate,
                                     NodeOrVariable object)
Specified by:
createQuadPattern in interface FindableModelSet

createURI

public URI createURI(java.lang.String uriString)
              throws ModelRuntimeException
Specified by:
createURI in interface ModelSet
Specified by:
createURI in interface ModelValueFactory
Overrides:
createURI in class AbstractModelSetImpl
Throws:
ModelRuntimeException

findStatements

public ClosableIterator<Statement> findStatements(UriOrVariable contextURI,
                                                  ResourceOrVariable subject,
                                                  UriOrVariable predicate,
                                                  NodeOrVariable object)
                                           throws ModelRuntimeException
Specified by:
findStatements in interface FindableModelSet
Overrides:
findStatements in class AbstractModelSetImpl
Throws:
ModelRuntimeException

getDefaultModel

public Model getDefaultModel()
Specified by:
getDefaultModel in interface ModelSet

getDelegatedModelSet

public ModelSet getDelegatedModelSet()
Returns:
the modelset to which this instances delegates everything.

getModel

public Model getModel(URI contextURI)
Specified by:
getModel in interface ModelSet

getModels

public ClosableIterator<Model> getModels()
Specified by:
getModels in interface ModelSet

getModelURIs

public ClosableIterator<URI> getModelURIs()
Specified by:
getModelURIs in interface ModelSet

getUnderlyingModelImplementation

@Deprecated
public java.lang.Object getUnderlyingModelImplementation()
Deprecated. 


getUnderlyingModelSetImplementation

public java.lang.Object getUnderlyingModelSetImplementation()
Specified by:
getUnderlyingModelSetImplementation in interface ModelSet

isOpen

public boolean isOpen()
Specified by:
isOpen in interface ModelSet

open

public void open()
Specified by:
open in interface ModelSet

queryConstruct

public ClosableIterable<Statement> queryConstruct(java.lang.String query,
                                                  java.lang.String querylanguage)
                                           throws QueryLanguageNotSupportedException,
                                                  MalformedQueryException,
                                                  ModelRuntimeException
Specified by:
queryConstruct in interface Sparqlable
Throws:
QueryLanguageNotSupportedException
MalformedQueryException
ModelRuntimeException

querySelect

public QueryResultTable querySelect(java.lang.String query,
                                    java.lang.String querylanguage)
                             throws QueryLanguageNotSupportedException,
                                    MalformedQueryException,
                                    ModelRuntimeException
Specified by:
querySelect in interface Sparqlable
Throws:
QueryLanguageNotSupportedException
MalformedQueryException
ModelRuntimeException

readFrom

public void readFrom(java.io.InputStream in)
              throws java.io.IOException,
                     ModelRuntimeException
Specified by:
readFrom in interface ModelSetIO
Throws:
java.io.IOException
ModelRuntimeException

readFrom

public void readFrom(java.io.InputStream in,
                     Syntax syntax)
              throws java.io.IOException,
                     ModelRuntimeException,
                     SyntaxNotSupportedException
Specified by:
readFrom in interface ModelSetIO
Overrides:
readFrom in class AbstractModelSetImpl
Throws:
java.io.IOException
ModelRuntimeException
SyntaxNotSupportedException

readFrom

public void readFrom(java.io.Reader in)
              throws java.io.IOException,
                     ModelRuntimeException
Specified by:
readFrom in interface ModelSetIO
Throws:
java.io.IOException
ModelRuntimeException

readFrom

public void readFrom(java.io.Reader in,
                     Syntax syntax)
              throws java.io.IOException,
                     ModelRuntimeException,
                     SyntaxNotSupportedException
Specified by:
readFrom in interface ModelSetIO
Overrides:
readFrom in class AbstractModelSetImpl
Throws:
java.io.IOException
ModelRuntimeException
SyntaxNotSupportedException

removeStatement

public void removeStatement(Statement statement)
                     throws ModelRuntimeException
Specified by:
removeStatement in interface ModelSetAddRemove
Throws:
ModelRuntimeException

size

public long size()
          throws ModelRuntimeException
Specified by:
size in interface ModelSet
Throws:
ModelRuntimeException

sparqlAsk

public boolean sparqlAsk(java.lang.String query)
                  throws ModelRuntimeException,
                         MalformedQueryException
Specified by:
sparqlAsk in interface Sparqlable
Overrides:
sparqlAsk in class AbstractModelSetImpl
Throws:
ModelRuntimeException
MalformedQueryException

sparqlConstruct

public ClosableIterable<Statement> sparqlConstruct(java.lang.String query)
                                            throws ModelRuntimeException,
                                                   MalformedQueryException
Specified by:
sparqlConstruct in interface Sparqlable
Throws:
ModelRuntimeException
MalformedQueryException

sparqlDescribe

public ClosableIterable<Statement> sparqlDescribe(java.lang.String query)
                                           throws ModelRuntimeException
Specified by:
sparqlDescribe in interface Sparqlable
Throws:
ModelRuntimeException

sparqlSelect

public QueryResultTable sparqlSelect(java.lang.String queryString)
                              throws MalformedQueryException,
                                     ModelRuntimeException
Specified by:
sparqlSelect in interface Sparqlable
Throws:
MalformedQueryException
ModelRuntimeException

update

public void update(DiffReader diff)
            throws ModelRuntimeException
Specified by:
update in interface ModelSetAddRemove
Overrides:
update in class AbstractModelSetImpl
Throws:
ModelRuntimeException - if the ModelSet is locked

writeTo

public void writeTo(java.io.OutputStream out)
             throws java.io.IOException,
                    ModelRuntimeException
Specified by:
writeTo in interface ModelSetIO
Throws:
java.io.IOException
ModelRuntimeException

writeTo

public void writeTo(java.io.OutputStream out,
                    Syntax syntax)
             throws java.io.IOException,
                    ModelRuntimeException,
                    SyntaxNotSupportedException
Specified by:
writeTo in interface ModelSetIO
Overrides:
writeTo in class AbstractModelSetImpl
Throws:
java.io.IOException
ModelRuntimeException
SyntaxNotSupportedException

writeTo

public void writeTo(java.io.Writer out)
             throws java.io.IOException,
                    ModelRuntimeException
Specified by:
writeTo in interface ModelSetIO
Throws:
java.io.IOException
ModelRuntimeException

writeTo

public void writeTo(java.io.Writer out,
                    Syntax syntax)
             throws java.io.IOException,
                    ModelRuntimeException,
                    SyntaxNotSupportedException
Specified by:
writeTo in interface ModelSetIO
Overrides:
writeTo in class AbstractModelSetImpl
Throws:
java.io.IOException
ModelRuntimeException
SyntaxNotSupportedException

isEmpty

public boolean isEmpty()
Description copied from class: AbstractModelSetImpl
sublcasses should override this method for performance

Specified by:
isEmpty in interface ModelSet
Overrides:
isEmpty in class AbstractModelSetImpl

containsModel

public boolean containsModel(URI contextURI)
Specified by:
containsModel in interface ModelSet

removeModel

public boolean removeModel(URI contextURI)
Specified by:
removeModel in interface ModelSet

createBlankNode

public BlankNode createBlankNode(java.lang.String internalID)
Specified by:
createBlankNode in interface ModelValueFactory
Overrides:
createBlankNode in class AbstractModelSetImpl

commit

public void commit()
Specified by:
commit in interface Commitable

setAutocommit

public void setAutocommit(boolean autocommit)
Specified by:
setAutocommit in interface Commitable

addReificationOf

public Resource addReificationOf(Statement statement,
                                 Resource resource)
Specified by:
addReificationOf in interface ReificationSupport
Overrides:
addReificationOf in class AbstractModelSetImpl

addReificationOf

public BlankNode addReificationOf(Statement statement)
Specified by:
addReificationOf in interface ReificationSupport
Overrides:
addReificationOf in class AbstractModelSetImpl

deleteReification

public void deleteReification(Resource reificationResource)
Specified by:
deleteReification in interface ReificationSupport
Overrides:
deleteReification in class AbstractModelSetImpl

getAllReificationsOf

public java.util.Collection<Resource> getAllReificationsOf(Statement statement)
Specified by:
getAllReificationsOf in interface ReificationSupport
Overrides:
getAllReificationsOf in class AbstractModelSetImpl

hasReifications

public boolean hasReifications(Statement stmt)
Specified by:
hasReifications in interface ReificationSupport
Overrides:
hasReifications in class AbstractModelSetImpl

readFrom

public void readFrom(java.io.InputStream reader,
                     Syntax syntax,
                     java.lang.String baseURI)
              throws java.io.IOException,
                     ModelRuntimeException,
                     SyntaxNotSupportedException
Specified by:
readFrom in interface ModelSetIO
Throws:
java.io.IOException
ModelRuntimeException
SyntaxNotSupportedException

readFrom

public void readFrom(java.io.Reader in,
                     Syntax syntax,
                     java.lang.String baseURI)
              throws java.io.IOException,
                     ModelRuntimeException,
                     SyntaxNotSupportedException
Specified by:
readFrom in interface ModelSetIO
Throws:
java.io.IOException
ModelRuntimeException
SyntaxNotSupportedException

getNamespace

public java.lang.String getNamespace(java.lang.String prefix)
Specified by:
getNamespace in interface NamespaceSupport

getNamespaces

public java.util.Map<java.lang.String,java.lang.String> getNamespaces()
Specified by:
getNamespaces in interface NamespaceSupport

removeNamespace

public void removeNamespace(java.lang.String prefix)
Specified by:
removeNamespace in interface NamespaceSupport

setNamespace

public void setNamespace(java.lang.String prefix,
                         java.lang.String namespaceURI)
                  throws java.lang.IllegalArgumentException
Specified by:
setNamespace in interface NamespaceSupport
Throws:
java.lang.IllegalArgumentException

addModel

public void addModel(Model model,
                     URI contextURI)
              throws ModelRuntimeException
Description copied from class: AbstractModelSetImpl
subclasses should overwrite this for performance reasons

Specified by:
addModel in interface ModelSet
Overrides:
addModel in class AbstractModelSetImpl
Throws:
ModelRuntimeException

addModelSet

public void addModelSet(ModelSet modelSet)
                 throws ModelRuntimeException
Specified by:
addModelSet in interface ModelSet
Overrides:
addModelSet in class AbstractModelSetImpl
Throws:
ModelRuntimeException


Copyright © 2005-2008 FZI - Forschungszentrum Informatik | Karlsruhe | Germany. All Rights Reserved.