org.ontoware.rdf2go.model.impl
Class AbstractModelSetImpl

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

public abstract class AbstractModelSetImpl
extends java.lang.Object
implements ModelSet


Constructor Summary
AbstractModelSetImpl()
           
 
Method Summary
 void addAll(java.util.Iterator<? extends Statement> statement)
           
 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(URI context, Resource subject, URI predicate, Node object)
           
 boolean contains(Statement s)
           
 boolean containsStatements(UriOrVariable contextURI, ResourceOrVariable subject, UriOrVariable predicate, NodeOrVariable object)
           
 long countStatements(QuadPattern pattern)
           
 BlankNode createBlankNode()
           
 BlankNode createBlankNode(java.lang.String internalID)
           
 DatatypeLiteral createDatatypeLiteral(java.lang.String literal, URI datatypeURI)
           
 LanguageTagLiteral createLanguageTagLiteral(java.lang.String literal, java.lang.String langugeTag)
           
 PlainLiteral createPlainLiteral(java.lang.String literal)
           
 Statement createStatement(Resource subject, URI predicate, Node object)
           
 Statement createStatement(URI context, Resource subject, URI predicate, Node object)
           
 URI createURI(java.lang.String uriString)
           
 void deleteReification(Resource reificationResource)
           
 void dump()
           
 ClosableIterator<Statement> findStatements(QuadPattern pattern)
          Inefficient: Looks into each model and asks to match the triplepattern part of the quad pattern.
 ClosableIterator<Statement> findStatements(UriOrVariable contextURI, ResourceOrVariable subject, UriOrVariable predicate, NodeOrVariable object)
           
 java.util.Collection<Resource> getAllReificationsOf(Statement statement)
           
 boolean hasReifications(Statement statement)
           
 boolean isEmpty()
          sublcasses should override this method for performance
 boolean isLocked()
           
 boolean isValidURI(java.lang.String uriString)
           
 ClosableIterator<Statement> iterator()
           
 void lock()
           
 URI newRandomUniqueURI()
           
 void readFrom(java.io.InputStream in, Syntax syntax)
           
 void readFrom(java.io.Reader in, Syntax syntax)
           
 void removeAll()
           
 void removeAll(java.util.Iterator<? extends Statement> statement)
           
 void removeStatement(URI context, Resource subject, URI predicate, Node object)
           
 void removeStatements(QuadPattern quadPattern)
           
 void removeStatements(UriOrVariable context, ResourceOrVariable subject, UriOrVariable predicate, NodeOrVariable object)
           
 java.lang.String serialize(Syntax syntax)
           
 boolean sparqlAsk(java.lang.String query)
           
 void unlock()
           
 void update(DiffReader diff)
           
 void writeTo(java.io.OutputStream out, Syntax syntax)
           
 void writeTo(java.io.Writer writer, Syntax syntax)
           
 
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
close, containsModel, getDefaultModel, getModel, getModels, getModelURIs, getUnderlyingModelSetImplementation, isOpen, open, removeModel, size
 
Methods inherited from interface org.ontoware.rdf2go.model.Sparqlable
queryConstruct, querySelect, sparqlConstruct, sparqlDescribe, sparqlSelect
 
Methods inherited from interface org.ontoware.rdf2go.model.ModelSetIO
readFrom, readFrom, readFrom, readFrom, writeTo, writeTo
 
Methods inherited from interface org.ontoware.rdf2go.model.FindableModelSet
createQuadPattern
 
Methods inherited from interface org.ontoware.rdf2go.model.ModelSetAddRemove
addStatement, removeStatement
 
Methods inherited from interface org.ontoware.rdf2go.model.Commitable
commit, setAutocommit
 
Methods inherited from interface org.ontoware.rdf2go.model.NamespaceSupport
getNamespace, getNamespaces, removeNamespace, setNamespace
 

Constructor Detail

AbstractModelSetImpl

public AbstractModelSetImpl()
Method Detail

dump

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

removeAll

public void removeAll()
               throws ModelRuntimeException
Specified by:
removeAll in interface ModelSet
Throws:
ModelRuntimeException

createStatement

public Statement createStatement(URI context,
                                 Resource subject,
                                 URI predicate,
                                 Node object)
Specified by:
createStatement in interface ModelSet

readFrom

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

readFrom

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

writeTo

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

writeTo

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

serialize

public java.lang.String serialize(Syntax syntax)
                           throws SyntaxNotSupportedException
Specified by:
serialize in interface ModelSetIO
Throws:
SyntaxNotSupportedException

containsStatements

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

addStatement

public void addStatement(URI context,
                         Resource subject,
                         URI predicate,
                         Node object)
                  throws ModelRuntimeException
Specified by:
addStatement in interface ModelSetAddRemove
Throws:
ModelRuntimeException

addAll

public void addAll(java.util.Iterator<? extends Statement> statement)
            throws ModelRuntimeException
Specified by:
addAll in interface ModelSetAddRemove
Throws:
ModelRuntimeException

removeStatement

public void removeStatement(URI context,
                            Resource subject,
                            URI predicate,
                            Node object)
                     throws ModelRuntimeException
Specified by:
removeStatement in interface ModelSetAddRemove
Throws:
ModelRuntimeException

removeAll

public void removeAll(java.util.Iterator<? extends Statement> statement)
               throws ModelRuntimeException
Specified by:
removeAll in interface ModelSetAddRemove
Throws:
ModelRuntimeException

removeStatements

public void removeStatements(QuadPattern quadPattern)
                      throws ModelRuntimeException
Specified by:
removeStatements in interface ModelSetAddRemove
Throws:
ModelRuntimeException

removeStatements

public void removeStatements(UriOrVariable context,
                             ResourceOrVariable subject,
                             UriOrVariable predicate,
                             NodeOrVariable object)
                      throws ModelRuntimeException
Specified by:
removeStatements in interface ModelSetAddRemove
Throws:
ModelRuntimeException

createBlankNode

public BlankNode createBlankNode()
Specified by:
createBlankNode in interface ModelValueFactory

createBlankNode

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

createURI

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

isValidURI

public boolean isValidURI(java.lang.String uriString)
Specified by:
isValidURI in interface ModelValueFactory

createPlainLiteral

public PlainLiteral createPlainLiteral(java.lang.String literal)
Specified by:
createPlainLiteral in interface ModelValueFactory

createLanguageTagLiteral

public LanguageTagLiteral createLanguageTagLiteral(java.lang.String literal,
                                                   java.lang.String langugeTag)
                                            throws ModelRuntimeException
Specified by:
createLanguageTagLiteral in interface ModelValueFactory
Throws:
ModelRuntimeException

createDatatypeLiteral

public DatatypeLiteral createDatatypeLiteral(java.lang.String literal,
                                             URI datatypeURI)
                                      throws ModelRuntimeException
Specified by:
createDatatypeLiteral in interface ModelValueFactory
Throws:
ModelRuntimeException

createStatement

public Statement createStatement(Resource subject,
                                 URI predicate,
                                 Node object)
Specified by:
createStatement in interface ModelValueFactory

newRandomUniqueURI

public URI newRandomUniqueURI()
Specified by:
newRandomUniqueURI in interface ModelValueFactory

isLocked

public boolean isLocked()
Specified by:
isLocked in interface Lockable

lock

public void lock()
          throws LockException
Specified by:
lock in interface Lockable
Throws:
LockException

unlock

public void unlock()
Specified by:
unlock in interface Lockable

contains

public boolean contains(Statement s)
                 throws ModelRuntimeException
Specified by:
contains in interface FindableModelSet
Throws:
ModelRuntimeException

countStatements

public long countStatements(QuadPattern pattern)
                     throws ModelRuntimeException
Specified by:
countStatements in interface FindableModelSet
Throws:
ModelRuntimeException

findStatements

public ClosableIterator<Statement> findStatements(QuadPattern pattern)
                                           throws ModelRuntimeException
Inefficient: Looks into each model and asks to match the triplepattern part of the quad pattern.

Specified by:
findStatements in interface FindableModelSet
Throws:
ModelRuntimeException

findStatements

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

iterator

public ClosableIterator<Statement> iterator()
Specified by:
iterator in interface java.lang.Iterable<Statement>
Specified by:
iterator in interface ClosableIterable<Statement>

addModel

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

addModelSet

public void addModelSet(ModelSet modelSet)
Specified by:
addModelSet in interface ModelSet

update

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

isEmpty

public boolean isEmpty()
sublcasses should override this method for performance

Specified by:
isEmpty in interface ModelSet

sparqlAsk

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

addReificationOf

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

addReificationOf

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

hasReifications

public boolean hasReifications(Statement statement)
Specified by:
hasReifications in interface ReificationSupport

getAllReificationsOf

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

deleteReification

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

addModel

public void addModel(Model model,
                     URI contextURI)
subclasses should overwrite this for performance reasons

Specified by:
addModel in interface ModelSet


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