public class DelegatingModel extends AbstractModel implements Model
model| Modifier | Constructor and Description |
|---|---|
protected |
DelegatingModel()
Please set model!
|
|
DelegatingModel(Model model) |
| Modifier and Type | Method and Description |
|---|---|
void |
addAll(Iterator<? extends Statement> other)
Add all statements contained in 'other' to this model = 'union'
|
void |
addModel(Model model)
subclasses should overwrite this for performance reasons
|
void |
addStatement(Resource subject,
URI predicate,
Node object)
adds a (subject, property ,object)-statement to this model
|
void |
addStatement(Resource subject,
URI predicate,
String literal)
adds a (subject, property, literal)-statement to the model.
|
void |
addStatement(Resource subject,
URI predicate,
String literal,
String languageTag)
adds a (subject, property, liteal, language-tag)-statement to the model.
|
void |
addStatement(Resource subject,
URI predicate,
String literal,
URI datatypeURI)
adds a (subject, property, literal ,datatype)-statement to the model.
|
void |
addStatement(Statement statement)
adds a statement to this model
|
void |
addStatement(String subjectURIString,
URI predicate,
String literal)
adds a (subject, property, literal)-statement to the model.
|
void |
addStatement(String subjectURIString,
URI predicate,
String literal,
String languageTag)
adds a (subject, property, liteal, language-tag)-statement to the model.
|
void |
addStatement(String subjectURIString,
URI predicate,
String literal,
URI datatypeURI)
adds a (subject, property, literal, data-type)-statement to the model.
|
void |
close()
Close connection to defined, underlying implementation
|
void |
commit()
Deprecated.
|
boolean |
contains(ResourceOrVariable subject,
UriOrVariable predicate,
NodeOrVariable object)
Convenience method.
|
BlankNode |
createBlankNode()
Create (but do not add) a new blank node
|
BlankNode |
createBlankNode(String internalID)
Create a new blank node with the given internal ID.
|
URI |
createURI(String uriString)
The model must create URIs it would accept itself.
|
void |
dump()
Dumps the whole content of the model via System.out
|
ClosableIterator<Statement> |
findStatements(ResourceOrVariable subject,
UriOrVariable predicate,
NodeOrVariable object)
get all statements in the model with this subject, predicate and object.
|
ClosableIterator<Statement> |
findStatements(TriplePattern pattern)
Convenience method.
|
URI |
getContextURI() |
Model |
getDelegatedModel() |
Diff |
getDiff(Iterator<? extends Statement> other)
Computes a Diff by using HashSets.
|
String |
getNamespace(String prefix) |
Map<String,String> |
getNamespaces()
Get all namespaces as a map of prefix to namespace.
|
Object |
getProperty(URI propertyURI)
Note: This is a property of the model, not an RDF property
|
Object |
getUnderlyingModelImplementation() |
boolean |
isEmpty()
sublcasses should override this method for performance
|
boolean |
isIsomorphicWith(Model other)
Two models can be equal even if they do not contain the same statements.
|
boolean |
isLocked() |
boolean |
isOpen() |
boolean |
isValidURI(String uriString)
CHecks URI for syntax errors.
|
ClosableIterator<Statement> |
iterator()
Returns an iterator over a set of elements of type T.
|
void |
lock()
Tries to obtain a lock.
|
URI |
newRandomUniqueURI()
Implementations are free to choose if their semantics are unique within
the this model, the ModelSet, or unique in the universe
|
Model |
open()
Open connection to defined, unterlying implementation.
|
ClosableIterable<Statement> |
queryConstruct(String query,
String querylanguage)
Throws an exception if the syntax is not SPARQL
|
QueryResultTable |
querySelect(String query,
String querylanguage)
Throws an exception if the syntax is not SPARQL
|
void |
readFrom(InputStream in)
Read from InputStream assuming to read an RDF/XML stream.
|
void |
readFrom(InputStream reader,
Syntax syntax)
Throws an exception if the syntax is not RDF/XML.
|
void |
readFrom(InputStream reader,
Syntax syntax,
String baseURI)
Note: Subclasses are encouraged to overwrite this.
Throws an exception if the syntax is not RDF/XML.
|
void |
readFrom(Reader r)
Read from Reader assuming in UTF8 encoding.
|
void |
readFrom(Reader reader,
Syntax syntax)
Reads assuming the given syntax.
|
void |
readFrom(Reader in,
Syntax syntax,
String baseURI)
Note: Subclasses are encouraged to overwrite this.
Throws an exception if the syntax is not RDF/XML.
|
void |
removeAll()
Removes all statements from this model.
|
void |
removeAll(Iterator<? extends Statement> other)
Removes all statements contained in 'other' from this model =
'difference'
|
void |
removeNamespace(String prefix)
Throws no exception if the prefix was not present.
|
void |
removeStatement(Resource subject,
URI predicate,
Node object)
remove a (subject, property ,object)-statement from the model
|
void |
removeStatement(Resource subject,
URI predicate,
String literal) |
void |
removeStatement(Resource subject,
URI predicate,
String literal,
String languageTag)
remove a (subject, property ,literal, language tag)-statement from the
model
|
void |
removeStatement(Resource subject,
URI predicate,
String literal,
URI datatypeURI)
remove a (subject, property ,literal, datatype)-statement from the model
datatype often is an uri for a xml schema datatype (xsd)
|
void |
removeStatement(Statement statement)
remove a rdf2go-statement from the model
|
void |
removeStatement(String subjectURIString,
URI predicate,
String literal) |
void |
removeStatement(String subjectURIString,
URI predicate,
String literal,
String languageTag)
remove a (subject, property ,literal, language tag)-statement from the
model
|
void |
removeStatement(String subjectURIString,
URI predicate,
String literal,
URI datatypeURI)
remove a (subject, property ,literal, datatype)-statement from the model
datatype often is an uri for a xml schema datatype (xsd)
|
void |
removeStatements(ResourceOrVariable subject,
UriOrVariable predicate,
NodeOrVariable object)
remove a (subject, property ,object)-statement from the model
|
void |
setAutocommit(boolean autocommit)
Deprecated.
|
protected void |
setDelegatedModel(Model model) |
void |
setNamespace(String prefix,
String namespaceURI) |
void |
setProperty(URI propertyURI,
Object value)
Add an arbitrary property, this will not be persisted and is only
available at runtime.
|
long |
size()
This is a really slow implementation, please override.
|
boolean |
sparqlAsk(String query)
SPARQL ask queries
|
ClosableIterable<Statement> |
sparqlConstruct(String query) |
ClosableIterable<Statement> |
sparqlDescribe(String query)
Iterator must be auto-close, i.e.
|
QueryResultTable |
sparqlSelect(String queryString)
returns results for SPARQL Select queries, as supported by underlying
implementation.
|
void |
unlock()
Removes a lock.
|
void |
update(DiffReader diff)
Implementations with support for transactions should use them instead of
this implementation.
|
void |
writeTo(OutputStream out)
Writing an RDF/XML stream in UTF8 encoding
|
void |
writeTo(OutputStream out,
Syntax syntax)
Throws an exception if the syntax is not known
|
void |
writeTo(Writer w)
Writing an RDF/XML stream in UTF8 encoding
|
void |
writeTo(Writer writer,
Syntax syntax)
Write the model to the passed writer, using the passed syntax.
|
addReificationOf, addReificationOf, assertModel, contains, contains, countStatements, createDatatypeLiteral, createLanguageTagLiteral, createPlainLiteral, createStatement, createTriplePattern, deleteReification, getAllReificationsOf, hasReifications, removeStatements, serializeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateDatatypeLiteral, createLanguageTagLiteral, createPlainLiteral, createStatementremoveStatementsforEach, spliteratorcontains, contains, countStatements, createTriplePatternaddReificationOf, addReificationOf, deleteReification, getAllReificationsOf, hasReificationsprotected DelegatingModel()
public DelegatingModel(Model model)
public void addAll(Iterator<? extends Statement> other) throws ModelRuntimeException
ModelWriteraddAll in interface ModelWriteraddAll in class AbstractModelother - another RDF2GO modelModelRuntimeException - if there is either an error with the
underlying model or an IOExceptionpublic void addStatement(Resource subject, URI predicate, Node object) throws ModelRuntimeException
ModelWriteraddStatement in interface ModelWriteraddStatement in class AbstractModelAddRemovesubject - of the statementpredicate - of the statementobject - of the statementModelRuntimeException - if there is either an error with the
underlying model or an IOExceptionpublic void addStatement(Resource subject, URI predicate, String literal) throws ModelRuntimeException
ModelWriteraddStatement in interface ModelWriteraddStatement in class AbstractModelsubject - of the statementpredicate - of the statementliteral - of the statement. A PlainLiteral will be created.ModelRuntimeException - if there is either an error with the
underlying model or an IOExceptionpublic void addStatement(Resource subject, URI predicate, String literal, String languageTag) throws ModelRuntimeException
ModelWriteraddStatement in interface ModelWriteraddStatement in class AbstractModelsubject - URI or Object (= blankNode)predicate - of the statementliteral - main part of literal value of the statementlanguageTag - RDF language tagModelRuntimeException - if there is either an error with the
underlying model or an IOExceptionpublic void addStatement(Resource subject, URI predicate, String literal, URI datatypeURI) throws ModelRuntimeException
ModelWriteraddStatement in interface ModelWriteraddStatement in class AbstractModelsubject - of the statementpredicate - of the statementliteral - main part of the literal of the statementdatatypeURI - for the datatype part of the literalModelRuntimeException - if there is either an error with the
underlying model or an IOExceptionpublic void addStatement(Statement statement) throws ModelRuntimeException
ModelWriteraddStatement in interface ModelWriteraddStatement in class AbstractModelstatement - the statement to addModelRuntimeException - if there is either an error with the
underlying model or an IOExceptionpublic void addStatement(String subjectURIString, URI predicate, String literal) throws ModelRuntimeException
ModelWriteraddStatement in interface ModelWriteraddStatement in class AbstractModelsubjectURIString - interpreted as URI of the statementpredicate - of the statementliteral - for the PlainLiteralModelRuntimeException - if there is either an error with the
underlying model or an IOExceptionpublic void addStatement(String subjectURIString, URI predicate, String literal, String languageTag) throws ModelRuntimeException
ModelWriteraddStatement in interface ModelWriteraddStatement in class AbstractModelsubjectURIString - interpreted as a URIpredicate - of the statementliteral - main part of the LanguageTagLiterallanguageTag - RDF language tag of the LanguageTagLiteralModelRuntimeException - if there is either an error with the
underlying model or an IOExceptionpublic void addStatement(String subjectURIString, URI predicate, String literal, URI datatypeURI) throws ModelRuntimeException
ModelWriteraddStatement in interface ModelWriteraddStatement in class AbstractModelsubjectURIString - interpreted as URI of the statementpredicate - of the statementliteral - for the DatatypeLiteraldatatypeURI - for the DatatypeLiteralModelRuntimeException - if there is either an error with the
underlying model or an IOExceptionpublic void close()
AbstractModelclose in interface Modelclose in class AbstractModel@Deprecated public void commit()
AbstractModelcommit in interface Commitablecommit in class AbstractModelpublic boolean contains(ResourceOrVariable subject, UriOrVariable predicate, NodeOrVariable object) throws ModelRuntimeException
AbstractModelcontains in interface FindableModelcontains in class AbstractModelsubject - defined or a Variable, e.g. Variable.ANYpredicate - defined or a Variable, e.g. Variable.ANYobject - defined or a Variable, e.g. Variable.ANYModelRuntimeException - most often caused by underlying
IOException, if anypublic BlankNode createBlankNode()
ModelValueFactorycreateBlankNode in interface ModelValueFactorypublic BlankNode createBlankNode(String internalID)
ModelValueFactorycreateBlankNode in interface ModelValueFactorypublic URI createURI(String uriString) throws ModelRuntimeException
ModelValueFactorycreateURI in interface ModelValueFactorycreateURI in class AbstractModelModelRuntimeExceptionpublic void dump()
Modelpublic ClosableIterator<Statement> findStatements(ResourceOrVariable subject, UriOrVariable predicate, NodeOrVariable object) throws ModelRuntimeException
FindableModelfindStatements in interface FindableModelsubject - URI or Object (= blankNode) or Variablepredicate - URI or Variableobject - URI or String (=plainLiteral) or BlankNode (=blankNode) or
TypedLiteral or LanguageTagLiteral or VariableModelRuntimeException - most often caused by underlying
IOException, if anypublic ClosableIterator<Statement> findStatements(TriplePattern pattern) throws ModelRuntimeException
AbstractModelfindStatements in interface FindableModelfindStatements in class AbstractModelpattern - to be matchedModelRuntimeException - most often caused by underlying
IOException, if anypublic URI getContextURI()
getContextURI in interface Modelpublic Model getDelegatedModel()
public Diff getDiff(Iterator<? extends Statement> other) throws ModelRuntimeException
AbstractModelgetDiff in interface ModelAddRemovegetDiff in class AbstractModelModelRuntimeExceptionpublic Object getProperty(URI propertyURI)
AbstractModelgetProperty in interface ModelgetProperty in class AbstractModelpropertyURI - used as a property name to get the model propertypublic Object getUnderlyingModelImplementation()
getUnderlyingModelImplementation in interface ModelgetUnderlyingModelImplementation in class AbstractModelpublic boolean isEmpty()
AbstractModelisEmpty in interface ModelisEmpty in class AbstractModelpublic boolean isIsomorphicWith(Model other)
ModelisIsomorphicWith in interface Modelpublic boolean isLocked()
public boolean isOpen()
isOpen in interface ModelisOpen in class AbstractModelpublic boolean isValidURI(String uriString)
ModelValueFactoryisValidURI in interface ModelValueFactorypublic ClosableIterator<Statement> iterator()
ClosableIterablepublic void lock()
throws LockException
Lockablelock in interface LockableLockException - if already lockedpublic URI newRandomUniqueURI()
ModelValueFactorynewRandomUniqueURI in interface ModelValueFactorynewRandomUniqueURI in class AbstractModelpublic Model open()
AbstractModelopen in interface Modelopen in class AbstractModelpublic ClosableIterable<Statement> queryConstruct(String query, String querylanguage) throws QueryLanguageNotSupportedException, ModelRuntimeException
AbstractModelqueryConstruct in interface SparqlablequeryConstruct in class AbstractModelQueryLanguageNotSupportedException - if the adapter can't
understand the given query languageModelRuntimeException - if the execution throws an exceptionMalformedQueryException - if the query is not a valid construct
query in the given query languagepublic QueryResultTable querySelect(String query, String querylanguage) throws QueryLanguageNotSupportedException, ModelRuntimeException
AbstractModelquerySelect in interface SparqlablequerySelect in class AbstractModelQueryLanguageNotSupportedException - if the given query langauge is
not supportedModelRuntimeException - if the execution throws an exceptionMalformedQueryException - if the query is not a valid query in the
given query languagepublic void readFrom(InputStream in) throws IOException, ModelRuntimeException
ModelIOreadFrom in interface ModelIOin - the input to readIOException - on IOErrorsModelRuntimeException - on RDF serialization errors or model errorspublic void readFrom(InputStream reader, Syntax syntax) throws IOException, ModelRuntimeException
AbstractModelreadFrom in interface ModelIOreadFrom in class AbstractModelsyntax - syntax to useIOException - on IOErrorsModelRuntimeException - on RDF serialization errors or model errorspublic void readFrom(Reader r) throws IOException, ModelRuntimeException
ModelIOreadFrom in interface ModelIOr - the input to readIOException - on IOErrorsModelRuntimeException - on RDF serialization errors or model errorspublic void readFrom(Reader reader, Syntax syntax) throws ModelRuntimeException, IOException
ModelIOreadFrom in interface ModelIOreader - the input to readsyntax - syntax to useModelRuntimeException - on RDF serialization errors or model errorsIOException - on IOErrorspublic void removeAll()
throws ModelRuntimeException
ModelAddRemoveremoveAll in interface ModelAddRemoveremoveAll in class AbstractModelModelRuntimeExceptionpublic void removeAll(Iterator<? extends Statement> other) throws ModelRuntimeException
ModelAddRemoveremoveAll in interface ModelAddRemoveremoveAll in class AbstractModelModelRuntimeExceptionpublic void removeStatement(Resource subject, URI predicate, Node object) throws ModelRuntimeException
ModelAddRemoveremoveStatement in interface ModelAddRemoveremoveStatement in class AbstractModelAddRemovesubject - URI or Object (= blankNode)object - URI or String (=plainLiteral) or BlankNode (=blankNode) or
TypedLiteral or LanguageTagLiteralModelRuntimeExceptionpublic void removeStatement(Resource subject, URI predicate, String literal) throws ModelRuntimeException
removeStatement in interface ModelAddRemoveremoveStatement in class AbstractModelModelRuntimeExceptionpublic void removeStatement(Resource subject, URI predicate, String literal, String languageTag) throws ModelRuntimeException
ModelAddRemoveremoveStatement in interface ModelAddRemoveremoveStatement in class AbstractModelModelRuntimeExceptionpublic void removeStatement(Resource subject, URI predicate, String literal, URI datatypeURI) throws ModelRuntimeException
ModelAddRemoveremoveStatement in interface ModelAddRemoveremoveStatement in class AbstractModelModelRuntimeExceptionpublic void removeStatement(Statement statement) throws ModelRuntimeException
ModelAddRemoveremoveStatement in interface ModelAddRemoveremoveStatement in class AbstractModelModelRuntimeExceptionpublic void removeStatement(String subjectURIString, URI predicate, String literal) throws ModelRuntimeException
removeStatement in interface ModelAddRemoveremoveStatement in class AbstractModelModelRuntimeExceptionpublic void removeStatement(String subjectURIString, URI predicate, String literal, String languageTag) throws ModelRuntimeException
ModelAddRemoveremoveStatement in interface ModelAddRemoveremoveStatement in class AbstractModelModelRuntimeExceptionpublic void removeStatement(String subjectURIString, URI predicate, String literal, URI datatypeURI) throws ModelRuntimeException
ModelAddRemoveremoveStatement in interface ModelAddRemoveremoveStatement in class AbstractModelModelRuntimeExceptionpublic void removeStatements(ResourceOrVariable subject, UriOrVariable predicate, NodeOrVariable object) throws ModelRuntimeException
ModelRemovePatternsremoveStatements in interface ModelRemovePatternsremoveStatements in class AbstractModelsubject - URI or Object (= blankNode)object - URI or String (=plainLiteral) or BlankNode (=blankNode) or
TypedLiteral or LanguageTagLiteralModelRuntimeException@Deprecated public void setAutocommit(boolean autocommit)
AbstractModelsetAutocommit in interface CommitablesetAutocommit in class AbstractModelautocommit - If true, all changes are immediately written to the
underlying persistence layer, if any is used.protected void setDelegatedModel(Model model)
public void setProperty(URI propertyURI, Object value)
AbstractModelsetProperty in interface ModelsetProperty in class AbstractModelpropertyURI - used as a parameter name for storing a model propertyvalue - any java object. Only stored in memory, not in RDF.public long size()
throws ModelRuntimeException
AbstractModelsize in interface Modelsize in class AbstractModelModelRuntimeExceptionpublic boolean sparqlAsk(String query) throws ModelRuntimeException
SparqlablesparqlAsk in interface SparqlablesparqlAsk in class AbstractModelquery - a SPARQL AKS queryModelRuntimeException - if the execution throws an exceptionMalformedQueryException - if the query is not a valid SPARQL ASK
querypublic ClosableIterable<Statement> sparqlConstruct(String query) throws ModelRuntimeException
sparqlConstruct in interface SparqlableModelRuntimeException - if the execution throws an exceptionMalformedQueryException - if the query is not a valid SPARQL
CONSTRUCT querypublic ClosableIterable<Statement> sparqlDescribe(String query) throws ModelRuntimeException
SparqlablesparqlDescribe in interface SparqlableModelRuntimeException - if the execution throws an exceptionMalformedQueryException - if the query is not a valid SPARQL
DESCRIBE querypublic QueryResultTable sparqlSelect(String queryString) throws ModelRuntimeException
SparqlablesparqlSelect in interface SparqlablequeryString - The SPARQL select query stringModelRuntimeException - if an error happens when executing the
queryMalformedQueryException - if the query is not a valid SPARQL SELECT
querypublic void unlock()
Lockablepublic void update(DiffReader diff) throws ModelRuntimeException
AbstractModelupdate in interface ModelAddRemoveupdate in class AbstractModelModelRuntimeExceptionpublic void writeTo(OutputStream out) throws IOException, ModelRuntimeException
ModelIOwriteTo in interface ModelIOout - the output to write toIOException - on IOErrorsModelRuntimeException - on RDF serialization errors or model errorspublic void writeTo(OutputStream out, Syntax syntax) throws IOException, ModelRuntimeException
AbstractModelwriteTo in interface ModelIOwriteTo in class AbstractModelout - the output to write tosyntax - syntax to useIOException - on IOErrorsModelRuntimeException - on RDF serialization errors or model errorspublic void writeTo(Writer w) throws IOException, ModelRuntimeException
ModelIOwriteTo in interface ModelIOw - the output to write toIOException - on IOErrorsModelRuntimeException - on RDF serialization errors or model errorspublic void writeTo(Writer writer, Syntax syntax) throws ModelRuntimeException, IOException
ModelIOwriteTo in interface ModelIOwriter - the output to write tosyntax - syntax to useModelRuntimeException - on RDF serialization errors or model errorsIOException - on IOErrorspublic void readFrom(Reader in, Syntax syntax, String baseURI) throws IOException, ModelRuntimeException
AbstractModelreadFrom in interface ModelIOreadFrom in class AbstractModelIOException - from readerModelRuntimeException - from modelpublic void readFrom(InputStream reader, Syntax syntax, String baseURI) throws IOException, ModelRuntimeException
AbstractModelreadFrom in interface ModelIOreadFrom in class AbstractModelIOExceptionModelRuntimeExceptionpublic String getNamespace(String prefix)
getNamespace in interface NamespaceSupportpublic Map<String,String> getNamespaces()
NamespaceSupportgetNamespaces in interface NamespaceSupportpublic void removeNamespace(String prefix)
NamespaceSupportremoveNamespace in interface NamespaceSupportpublic void setNamespace(String prefix, String namespaceURI) throws IllegalArgumentException
setNamespace in interface NamespaceSupportIllegalArgumentException - if the given namespaceURI is not a valid URI in this
environment.public void addModel(Model model) throws ModelRuntimeException
AbstractModeladdModel in interface ModeladdModel in class AbstractModelModelRuntimeException - if any internal (I/O related) exception
occursCopyright © 2005–2016 IT-Consulting Dr. Max V?lkel | Project started at FZI Forschungszentrum Informatik, www.fzi.de. All rights reserved.