org.openrdf.rdf2go
Class RepositoryModel
java.lang.Object
org.ontoware.rdf2go.model.impl.AbstractModelWriter
org.ontoware.rdf2go.model.impl.AbstractModelAddRemove
org.ontoware.rdf2go.model.impl.AbstractModelRemovePatterns
org.ontoware.rdf2go.model.impl.AbstractModel
org.ontoware.rdf2go.model.impl.AbstractLockingModel
org.openrdf.rdf2go.RepositoryModel
- All Implemented Interfaces:
- java.lang.Iterable<Statement>, ClosableIterable<Statement>, Commitable, FindableModel, Lockable, Model, ModelAddRemove, ModelIO, ModelRemovePatterns, ModelValueFactory, ModelWriter, NamespaceSupport, QueryableModel, ReificationSupport, Sparqlable
public class RepositoryModel
- extends AbstractLockingModel
- implements Model
Implementation of the RDF2Go model interface for an OpenRDF Repository.
Note that RepositoryModel and RepositoryModelSet only work well together
because they both keep their RepositoryConnections in auto-commit mode. This
cannot be changed by the user. Do mass-updates using update(Diff),
addAll(Iterator) or removeAll(Iterator), then the current
connection will be used in non-autocommit mode and commited, including a
rollback when it fails.
|
Method Summary |
void |
addAll(java.util.Iterator<? extends Statement> iterator)
|
void |
addStatement(Resource subject,
URI predicate,
Node object)
|
protected void |
assertModel()
|
void |
close()
Closes the Connection to the wrapper Repository. |
void |
commit()
|
BlankNode |
createBlankNode()
|
BlankNode |
createBlankNode(java.lang.String internalID)
|
void |
dump()
|
void |
finalize()
Makes sure that the Connection to the wrapped Repository has been closed. |
ClosableIterator<Statement> |
findStatements(ResourceOrVariable subject,
UriOrVariable predicate,
NodeOrVariable object)
|
URI |
getContextURI()
|
java.lang.String |
getNamespace(java.lang.String prefix)
|
java.util.Map<java.lang.String,java.lang.String> |
getNamespaces()
|
org.openrdf.model.URI |
getOpenRDFContextURI()
Returns the context as a OpenRDF URI. |
static org.openrdf.rio.RDFFormat |
getRDFFormat(Syntax syntax)
Resolves a RDF2Go Syntax to an OpenRDF RDFFormat. |
java.lang.Object |
getUnderlyingModelImplementation()
|
boolean |
isIsomorphicWith(Model other)
|
boolean |
isLocked()
|
boolean |
isOpen()
|
boolean |
isValidURI(java.lang.String uriString)
|
ClosableIterator<Statement> |
iterator()
|
void |
lock()
Locking a RepositoryModel disables auto-commit mode and starts a new
transaction, which is left open until this RepositoryModel is unlocked. |
void |
open()
|
void |
readFrom(java.io.InputStream stream)
|
void |
readFrom(java.io.InputStream stream,
org.openrdf.rio.RDFFormat format,
java.lang.String baseURI)
|
void |
readFrom(java.io.InputStream stream,
Syntax syntax)
|
void |
readFrom(java.io.InputStream stream,
Syntax syntax,
java.lang.String baseURI)
|
void |
readFrom(java.io.Reader reader)
|
void |
readFrom(java.io.Reader reader,
org.openrdf.rio.RDFFormat format,
java.lang.String baseURL)
|
void |
readFrom(java.io.Reader reader,
Syntax syntax)
|
void |
readFrom(java.io.Reader reader,
Syntax syntax,
java.lang.String baseURI)
|
void |
removeAll()
|
void |
removeAll(java.util.Iterator<? extends Statement> iterator)
|
void |
removeNamespace(java.lang.String prefix)
|
void |
removeStatement(Resource subject,
URI predicate,
Node object)
|
void |
rollback()
|
void |
setAutocommit(boolean autocommit)
|
void |
setNamespace(java.lang.String prefix,
java.lang.String namespaceURI)
|
void |
setUnderlyingModelImplementation(java.lang.Object object)
|
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 |
unlock()
Ends the locking status, committing all changed that have been made since
this RepositoryModel was locked and switching back to auto-commit mode. |
void |
update(Diff diff)
|
void |
update(DiffReader diff)
|
void |
writeTo(java.io.OutputStream stream)
|
void |
writeTo(java.io.OutputStream stream,
Syntax syntax)
|
void |
writeTo(org.openrdf.rio.RDFWriter writer)
|
void |
writeTo(java.io.Writer writer)
|
void |
writeTo(java.io.Writer writer,
Syntax syntax)
|
| Methods inherited from class org.ontoware.rdf2go.model.impl.AbstractModel |
addModel, addReificationOf, addReificationOf, addStatement, addStatement, addStatement, addStatement, addStatement, addStatement, addStatement, contains, contains, contains, countStatements, createDatatypeLiteral, createLanguageTagLiteral, createPlainLiteral, createStatement, createTriplePattern, createURI, deleteReification, findStatements, getAllReificationsOf, getDiff, getProperty, hasReifications, isEmpty, newRandomUniqueURI, queryConstruct, querySelect, removeStatement, removeStatement, removeStatement, removeStatement, removeStatement, removeStatement, removeStatement, removeStatements, removeStatements, serialize, setProperty |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_CONTEXT
public static final java.lang.String DEFAULT_CONTEXT
- See Also:
- Constant Field Values
DEFAULT_OPENRDF_CONTEXT
public static final org.openrdf.model.URI DEFAULT_OPENRDF_CONTEXT
repository
protected org.openrdf.repository.Repository repository
connection
protected org.openrdf.repository.RepositoryConnection connection
valueFactory
protected org.openrdf.model.ValueFactory valueFactory
context
protected URI context
RepositoryModel
public RepositoryModel(org.openrdf.repository.Repository repository)
throws ModelRuntimeException
- Throws:
ModelRuntimeException
RepositoryModel
public RepositoryModel(URI context,
org.openrdf.repository.Repository repository)
throws ModelRuntimeException
- Throws:
ModelRuntimeException
getOpenRDFContextURI
public org.openrdf.model.URI getOpenRDFContextURI()
- Returns the context as a OpenRDF URI.
open
public void open()
- Specified by:
open in interface Model- Overrides:
open in class AbstractModel
isOpen
public boolean isOpen()
throws ModelRuntimeException
- Specified by:
isOpen in interface Model- Overrides:
isOpen in class AbstractModel
- Throws:
ModelRuntimeException
close
public void close()
- Closes the Connection to the wrapper Repository.
- Specified by:
close in interface Model- Overrides:
close in class AbstractModel
createBlankNode
public BlankNode createBlankNode()
- Specified by:
createBlankNode in interface ModelValueFactory
createBlankNode
public BlankNode createBlankNode(java.lang.String internalID)
- Specified by:
createBlankNode in interface ModelValueFactory
isValidURI
public boolean isValidURI(java.lang.String uriString)
- Specified by:
isValidURI in interface ModelValueFactory
addStatement
public void addStatement(Resource subject,
URI predicate,
Node object)
throws ModelRuntimeException
- Specified by:
addStatement in interface ModelWriter- Specified by:
addStatement in class AbstractModelAddRemove
- Throws:
ModelRuntimeException
removeAll
public void removeAll(java.util.Iterator<? extends Statement> iterator)
throws ModelRuntimeException
- Specified by:
removeAll in interface ModelAddRemove- Overrides:
removeAll in class AbstractModel
- Throws:
ModelRuntimeException
removeAll
public void removeAll()
throws ModelRuntimeException
- Specified by:
removeAll in interface ModelAddRemove- Overrides:
removeAll in class AbstractModel
- Throws:
ModelRuntimeException
addAll
public void addAll(java.util.Iterator<? extends Statement> iterator)
throws ModelRuntimeException
- Specified by:
addAll in interface ModelWriter- Overrides:
addAll in class AbstractModel
- Throws:
ModelRuntimeException
removeStatement
public void removeStatement(Resource subject,
URI predicate,
Node object)
throws ModelRuntimeException
- Specified by:
removeStatement in interface ModelAddRemove- Specified by:
removeStatement in class AbstractModelAddRemove
- Throws:
ModelRuntimeException
findStatements
public ClosableIterator<Statement> findStatements(ResourceOrVariable subject,
UriOrVariable predicate,
NodeOrVariable object)
throws ModelRuntimeException
- Specified by:
findStatements in interface FindableModel
- Throws:
ModelRuntimeException
sparqlAsk
public boolean sparqlAsk(java.lang.String query)
throws ModelRuntimeException
- Specified by:
sparqlAsk in interface Sparqlable- Overrides:
sparqlAsk in class AbstractModel
- Throws:
ModelRuntimeException
sparqlDescribe
public ClosableIterable<Statement> sparqlDescribe(java.lang.String query)
throws ModelRuntimeException
- Specified by:
sparqlDescribe in interface Sparqlable
- Throws:
ModelRuntimeException
sparqlConstruct
public ClosableIterable<Statement> sparqlConstruct(java.lang.String query)
throws ModelRuntimeException
- Specified by:
sparqlConstruct in interface Sparqlable
- Throws:
ModelRuntimeException
sparqlSelect
public QueryResultTable sparqlSelect(java.lang.String queryString)
throws ModelRuntimeException
- Specified by:
sparqlSelect in interface Sparqlable
- Throws:
ModelRuntimeException
iterator
public ClosableIterator<Statement> iterator()
- Specified by:
iterator in interface java.lang.Iterable<Statement>- Specified by:
iterator in interface ClosableIterable<Statement>
getUnderlyingModelImplementation
public java.lang.Object getUnderlyingModelImplementation()
- Specified by:
getUnderlyingModelImplementation in interface Model- Overrides:
getUnderlyingModelImplementation in class AbstractModel
setUnderlyingModelImplementation
public void setUnderlyingModelImplementation(java.lang.Object object)
size
public long size()
throws ModelRuntimeException
- Specified by:
size in interface Model- Overrides:
size in class AbstractModel
- Throws:
ModelRuntimeException
getContextURI
public URI getContextURI()
- Specified by:
getContextURI in interface Model
isLocked
public boolean isLocked()
- Specified by:
isLocked in interface Lockable
lock
public void lock()
throws LockException
- Locking a RepositoryModel disables auto-commit mode and starts a new
transaction, which is left open until this RepositoryModel is unlocked.
- Specified by:
lock in interface Lockable
- Throws:
LockException
unlock
public void unlock()
- Ends the locking status, committing all changed that have been made since
this RepositoryModel was locked and switching back to auto-commit mode.
- Specified by:
unlock in interface Lockable
rollback
public void rollback()
dump
public void dump()
- Specified by:
dump in interface Model
readFrom
public void readFrom(java.io.InputStream stream)
throws java.io.IOException,
ModelRuntimeException
- Specified by:
readFrom in interface ModelIO
- Throws:
java.io.IOException
ModelRuntimeException
readFrom
public void readFrom(java.io.InputStream stream,
Syntax syntax)
throws java.io.IOException,
ModelRuntimeException
- Specified by:
readFrom in interface ModelIO- Overrides:
readFrom in class AbstractModel
- Throws:
java.io.IOException
ModelRuntimeException
readFrom
public void readFrom(java.io.InputStream stream,
Syntax syntax,
java.lang.String baseURI)
throws java.io.IOException,
ModelRuntimeException
- Specified by:
readFrom in interface ModelIO- Overrides:
readFrom in class AbstractModel
- Throws:
java.io.IOException
ModelRuntimeException
readFrom
public void readFrom(java.io.Reader reader,
Syntax syntax,
java.lang.String baseURI)
throws ModelRuntimeException,
java.io.IOException
- Specified by:
readFrom in interface ModelIO- Overrides:
readFrom in class AbstractModel
- Throws:
ModelRuntimeException
java.io.IOException
readFrom
public void readFrom(java.io.InputStream stream,
org.openrdf.rio.RDFFormat format,
java.lang.String baseURI)
throws java.io.IOException,
ModelRuntimeException
- Throws:
java.io.IOException
ModelRuntimeException
readFrom
public void readFrom(java.io.Reader reader)
throws java.io.IOException,
ModelRuntimeException
- Specified by:
readFrom in interface ModelIO
- Throws:
java.io.IOException
ModelRuntimeException
readFrom
public void readFrom(java.io.Reader reader,
Syntax syntax)
throws java.io.IOException,
ModelRuntimeException
- Specified by:
readFrom in interface ModelIO
- Throws:
java.io.IOException
ModelRuntimeException
readFrom
public void readFrom(java.io.Reader reader,
org.openrdf.rio.RDFFormat format,
java.lang.String baseURL)
throws java.io.IOException,
ModelRuntimeException
- Throws:
java.io.IOException
ModelRuntimeException
writeTo
public void writeTo(java.io.OutputStream stream)
throws java.io.IOException,
ModelRuntimeException
- Specified by:
writeTo in interface ModelIO
- Throws:
java.io.IOException
ModelRuntimeException
writeTo
public void writeTo(java.io.OutputStream stream,
Syntax syntax)
throws java.io.IOException,
ModelRuntimeException
- Specified by:
writeTo in interface ModelIO- Overrides:
writeTo in class AbstractModel
- Throws:
java.io.IOException
ModelRuntimeException
writeTo
public void writeTo(java.io.Writer writer)
throws ModelRuntimeException
- Specified by:
writeTo in interface ModelIO
- Throws:
ModelRuntimeException
writeTo
public void writeTo(java.io.Writer writer,
Syntax syntax)
throws ModelRuntimeException
- Specified by:
writeTo in interface ModelIO
- Throws:
ModelRuntimeException
getRDFFormat
public static org.openrdf.rio.RDFFormat getRDFFormat(Syntax syntax)
throws ModelRuntimeException
- Resolves a RDF2Go Syntax to an OpenRDF RDFFormat.
- Parameters:
syntax - The RDF2Go Syntax to resolve.
- Returns:
- A RDFFormat for the specified syntax.
- Throws:
ModelRuntimeException - When the Syntax could not be resolved to a RDFFormat.
writeTo
public void writeTo(org.openrdf.rio.RDFWriter writer)
throws ModelRuntimeException
- Throws:
ModelRuntimeException
commit
public void commit()
- Specified by:
commit in interface Commitable- Overrides:
commit in class AbstractModel
setAutocommit
public void setAutocommit(boolean autocommit)
- Specified by:
setAutocommit in interface Commitable- Overrides:
setAutocommit in class AbstractModel
finalize
public void finalize()
throws java.lang.Throwable
- Makes sure that the Connection to the wrapped Repository has been closed.
- Overrides:
finalize in class java.lang.Object
- Throws:
java.lang.Throwable
assertModel
protected void assertModel()
- Overrides:
assertModel in class AbstractModel
isIsomorphicWith
public boolean isIsomorphicWith(Model other)
- Specified by:
isIsomorphicWith in interface Model
update
public void update(Diff diff)
throws ModelRuntimeException
- Specified by:
update in interface ModelAddRemove- Overrides:
update in class AbstractModelAddRemove
- Throws:
ModelRuntimeException
update
public void update(DiffReader diff)
throws ModelRuntimeException
- Specified by:
update in interface ModelAddRemove- Overrides:
update in class AbstractLockingModel
- Throws:
ModelRuntimeException
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
Copyright © 2001-2008 FZI. All Rights Reserved.