public class DelegatingModelSet extends AbstractModelSetImpl implements ModelSet
| Modifier and Type | Field and Description |
|---|---|
protected ModelSet |
baseModelSet |
| Constructor and Description |
|---|
DelegatingModelSet(ModelSet baseModelSet) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addModel(Model model)
Adds a model to this ModelSet.
|
void |
addModel(Model model,
URI contextURI)
subclasses should overwrite this for performance reasons
|
void |
addModelSet(ModelSet modelSet)
Adds a complete
ModelSet to this ModelSet. |
BlankNode |
addReificationOf(Statement statement)
A convenience function for addReficationOf( createBlankNode(), statement
);
|
Resource |
addReificationOf(Statement statement,
Resource resource)
Reifies the statement, whether the statement was present in the model or
not.
|
void |
addStatement(Statement statement)
This method creates a Model named statement.getContextURI if needed.
|
void |
close()
Close connection of the underlying implementation
|
void |
commit()
Deprecated.
|
boolean |
containsModel(URI contextURI) |
boolean |
containsStatements(UriOrVariable contextURI,
ResourceOrVariable subject,
UriOrVariable predicate,
NodeOrVariable object) |
BlankNode |
createBlankNode(String internalID)
Create a new blank node with the given internal ID.
|
QuadPattern |
createQuadPattern(UriOrVariable context,
ResourceOrVariable subject,
UriOrVariable predicate,
NodeOrVariable object) |
URI |
createURI(String uriString)
Creates an RDF2Go URI.
|
void |
deleteReification(Resource reificationResource)
Delete reifications made by this resource.
|
ClosableIterator<Statement> |
findStatements(UriOrVariable contextURI,
ResourceOrVariable subject,
UriOrVariable predicate,
NodeOrVariable object)
Search across all existing models
|
Collection<Resource> |
getAllReificationsOf(Statement statement) |
Model |
getDefaultModel()
The default model is used when the ModelSet is loaded from a
serialisation that has no context.
|
ModelSet |
getDelegatedModelSet() |
Model |
getModel(URI contextURI)
Get the Model with the passed URI.
|
ClosableIterator<Model> |
getModels() |
ClosableIterator<URI> |
getModelURIs() |
String |
getNamespace(String prefix) |
Map<String,String> |
getNamespaces()
Get all namespaces as a map of prefix to namespace.
|
Object |
getUnderlyingModelImplementation()
Deprecated.
|
Object |
getUnderlyingModelSetImplementation() |
boolean |
hasReifications(Statement stmt) |
boolean |
isEmpty()
sublcasses should override this method for performance
|
boolean |
isOpen() |
ModelSet |
open()
Open connection to the underlying implementation
|
ClosableIterable<Statement> |
queryConstruct(String query,
String querylanguage) |
QueryResultTable |
querySelect(String query,
String querylanguage)
returns results for queries in other query languages as a
QueryResultTable as supported by underlying implementation.
|
void |
readFrom(InputStream in)
Read from InputStream assuming to read an TRiX stream.
|
void |
readFrom(InputStream in,
Syntax syntax)
Reads assuming the given syntax.
|
void |
readFrom(InputStream reader,
Syntax syntax,
String baseURI)
Reads assuming the given syntax.
|
void |
readFrom(Reader in)
Read from Reader assuming to read a TRiX stream in UTF8 encoding.
|
void |
readFrom(Reader in,
Syntax syntax)
Reads assuming the given syntax.
|
void |
readFrom(Reader in,
Syntax syntax,
String baseURI)
Reads assuming the given syntax.
|
boolean |
removeModel(URI contextURI)
Removes the Model (NamedGraph) denoted by contextURI from this modelset.
|
void |
removeNamespace(String prefix)
Throws no exception if the prefix was not present.
|
void |
removeStatement(Statement statement)
Removes the statement (s,p,o) from a model named statement.getContext().
|
void |
setAutocommit(boolean autocommit)
Deprecated.
|
void |
setNamespace(String prefix,
String namespaceURI) |
long |
size()
The number of explicit statements.
|
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 |
update(DiffReader diff)
Apply the changes given by this diff
|
void |
writeTo(OutputStream out)
Writing a TRiX stream in UTF8 encoding For more info on TRiX read:
http://www.hpl.hp.com/techreports/2003/HPL-2003-268.html
|
void |
writeTo(OutputStream out,
Syntax syntax)
Write the model to the passed writer, using the passed syntax.
|
void |
writeTo(Writer out)
Write to writer in UTF8 and TRiX.
|
void |
writeTo(Writer out,
Syntax syntax)
Write the model to the passed writer, using the passed syntax.
|
addAll, addStatement, contains, countStatements, createBlankNode, createDatatypeLiteral, createLanguageTagLiteral, createPlainLiteral, createStatement, createStatement, dump, findStatements, isLocked, isValidURI, iterator, lock, newRandomUniqueURI, removeAll, removeAll, removeStatement, removeStatements, removeStatements, serialize, unlockclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateStatement, dump, removeAllserializecontains, countStatements, findStatementsaddAll, addStatement, removeAll, removeStatement, removeStatements, removeStatementsiteratorforEach, spliteratorcreateBlankNode, createDatatypeLiteral, createLanguageTagLiteral, createPlainLiteral, createStatement, isValidURI, newRandomUniqueURIprotected ModelSet baseModelSet
public DelegatingModelSet(ModelSet baseModelSet)
public boolean addModel(Model model)
ModelSetaddModel in interface ModelSetaddModel in class AbstractModelSetImplpublic void addStatement(Statement statement) throws ModelRuntimeException
ModelSetAddRemoveaddStatement in interface ModelSetAddRemoveModelRuntimeException - if any internal (I/O related) exception occurspublic void close()
ModelSetpublic boolean containsStatements(UriOrVariable contextURI, ResourceOrVariable subject, UriOrVariable predicate, NodeOrVariable object) throws ModelRuntimeException
containsStatements in interface FindableModelSetcontainsStatements in class AbstractModelSetImplModelRuntimeExceptionpublic QuadPattern createQuadPattern(UriOrVariable context, ResourceOrVariable subject, UriOrVariable predicate, NodeOrVariable object)
createQuadPattern in interface FindableModelSetpublic URI createURI(String uriString) throws ModelRuntimeException
ModelSetcreateURI in interface ModelSetcreateURI in interface ModelValueFactorycreateURI in class AbstractModelSetImplModelRuntimeException - if URI has not a valid URI format -
according to the adapterpublic ClosableIterator<Statement> findStatements(UriOrVariable contextURI, ResourceOrVariable subject, UriOrVariable predicate, NodeOrVariable object) throws ModelRuntimeException
FindableModelSetfindStatements in interface FindableModelSetfindStatements in class AbstractModelSetImplModelRuntimeExceptionpublic Model getDefaultModel()
ModelSetgetDefaultModel in interface ModelSetpublic ModelSet getDelegatedModelSet()
public Model getModel(URI contextURI)
ModelSetModelSet.isOpen() is false.
Note that the returned model is tied to this ModelSet. Any
changes in the model will be reflected here, closing this ModelSet will
close the returned Model. To avoid side-effects, closing the returned
Model will NOT close this ModelSet. Closing the returned model will not
affect objects returned by previous calls to this method, hence this
method should always return a new copy of the Model object to allow
callers to close() a returned model.getModel in interface ModelSetcontextURI - the URI of the context. This is the same as the name of
the named graph.public ClosableIterator<Model> getModels()
public ClosableIterator<URI> getModelURIs()
getModelURIs in interface ModelSet@Deprecated public Object getUnderlyingModelImplementation()
public Object getUnderlyingModelSetImplementation()
getUnderlyingModelSetImplementation in interface ModelSetpublic boolean isOpen()
public ModelSet open()
ModelSetpublic ClosableIterable<Statement> queryConstruct(String query, String querylanguage) throws QueryLanguageNotSupportedException, MalformedQueryException, ModelRuntimeException
queryConstruct in interface SparqlableQueryLanguageNotSupportedException - if the adapter can't
understand the given query languageMalformedQueryException - if the query is not a valid construct
query in the given query languageModelRuntimeException - if the execution throws an exceptionpublic QueryResultTable querySelect(String query, String querylanguage) throws QueryLanguageNotSupportedException, MalformedQueryException, ModelRuntimeException
SparqlablequerySelect in interface SparqlableQueryLanguageNotSupportedException - if the given query langauge is
not supportedMalformedQueryException - if the query is not a valid query in the
given query languageModelRuntimeException - if the execution throws an exceptionpublic void readFrom(InputStream in) throws IOException, ModelRuntimeException
ModelSetIOreadFrom in interface ModelSetIOin - the input to readIOException - on IOErrorsModelRuntimeException - on RDF serialisation errors or model errorspublic void readFrom(InputStream in, Syntax syntax) throws IOException, ModelRuntimeException, SyntaxNotSupportedException
ModelSetIOreadFrom in interface ModelSetIOreadFrom in class AbstractModelSetImplsyntax - syntax to useIOException - on IOErrorsModelRuntimeException - on RDF serialisation errors or model errorsSyntaxNotSupportedException - if adapter can't handle the given syntaxpublic void readFrom(Reader in) throws IOException, ModelRuntimeException
ModelSetIOreadFrom in interface ModelSetIOin - the input to readIOException - on IOErrorsModelRuntimeException - on RDF serialization errors or model errorspublic void readFrom(Reader in, Syntax syntax) throws IOException, ModelRuntimeException, SyntaxNotSupportedException
ModelSetIOreadFrom in interface ModelSetIOreadFrom in class AbstractModelSetImplin - the input to readsyntax - syntax to useIOException - on IOErrorsModelRuntimeException - on RDF serialisation errors or model errorsSyntaxNotSupportedException - if adapter can't handle the given syntaxpublic void removeStatement(Statement statement) throws ModelRuntimeException
ModelSetAddRemoveremoveStatement in interface ModelSetAddRemovestatement - a StatementModelRuntimeException - if any internal (I/O related) exception occurspublic long size()
throws ModelRuntimeException
ModelSetsize in interface ModelSetModelSet.ModelRuntimeExceptionpublic boolean sparqlAsk(String query) throws ModelRuntimeException, MalformedQueryException
SparqlablesparqlAsk in interface SparqlablesparqlAsk in class AbstractModelSetImplquery - 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, MalformedQueryException
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 MalformedQueryException, ModelRuntimeException
SparqlablesparqlSelect in interface SparqlablequeryString - The SPARQL select query stringMalformedQueryException - if the query is not a valid SPARQL SELECT
queryModelRuntimeException - if an error happens when executing the
querypublic void update(DiffReader diff) throws ModelRuntimeException
ModelSetAddRemoveupdate in interface ModelSetAddRemoveupdate in class AbstractModelSetImplModelRuntimeException - if the ModelSet is lockedpublic void writeTo(OutputStream out) throws IOException, ModelRuntimeException
ModelSetIOwriteTo in interface ModelSetIOout - the output to write toIOException - on IOErrorsModelRuntimeException - on RDF serialization errors or model errorspublic void writeTo(OutputStream out, Syntax syntax) throws IOException, ModelRuntimeException, SyntaxNotSupportedException
ModelSetIOwriteTo in interface ModelSetIOwriteTo in class AbstractModelSetImplout - the output to write tosyntax - syntax to useIOException - on IOErrorsModelRuntimeException - on RDF serialization errors or model errorsSyntaxNotSupportedException - if adapter can't handle the given syntaxpublic void writeTo(Writer out) throws IOException, ModelRuntimeException
ModelSetIOwriteTo in interface ModelSetIOout - the output to write toIOException - on IOErrorsModelRuntimeException - on RDF serialization errors or model errorspublic void writeTo(Writer out, Syntax syntax) throws IOException, ModelRuntimeException, SyntaxNotSupportedException
ModelSetIOwriteTo in interface ModelSetIOwriteTo in class AbstractModelSetImplout - the output to write tosyntax - syntax to useIOException - on IOErrorsModelRuntimeException - on RDF serialization errors or model errorsSyntaxNotSupportedException - if adapter can't handle the given syntaxpublic boolean isEmpty()
AbstractModelSetImplisEmpty in interface ModelSetisEmpty in class AbstractModelSetImplpublic boolean containsModel(URI contextURI)
containsModel in interface ModelSetpublic boolean removeModel(URI contextURI)
ModelSetremoveModel in interface ModelSetpublic BlankNode createBlankNode(String internalID)
ModelValueFactorycreateBlankNode in interface ModelValueFactorycreateBlankNode in class AbstractModelSetImpl@Deprecated public void commit()
Commitablecommit in interface Commitable@Deprecated public void setAutocommit(boolean autocommit)
CommitablesetAutocommit in interface Commitableautocommit - If true, all changes are immediately written to the
underlying persistence layer, if any is used.public Resource addReificationOf(Statement statement, Resource resource)
ReificationSupport
(resource) rdf:type rdf:Statement .
(resource) rdf:subject (statement.getSubject()) .
(resource) rdf:predicate (statement.getPredicate()) .
(resource) rdf:object (statement.getObject()) .
addReificationOf in interface ReificationSupportaddReificationOf in class AbstractModelSetImplstatement - which will be reifiedresource - used to represent the reified statementpublic BlankNode addReificationOf(Statement statement)
ReificationSupportaddReificationOf in interface ReificationSupportaddReificationOf in class AbstractModelSetImplpublic void deleteReification(Resource reificationResource)
ReificationSupport
(reificationResource) rdf:type rdf:Statement .
(reificationResource) rdf:subject * .
(reificationResource) rdf:predicate * .
(reificationResource) rdf:object * .
Note that one resource might have been used in several
reifications. Although semantic nonsense, this can happen. This method
cleans up also these cases.
Note that this method deletes the reification from all contexts.deleteReification in interface ReificationSupportdeleteReification in class AbstractModelSetImplpublic Collection<Resource> getAllReificationsOf(Statement statement)
getAllReificationsOf in interface ReificationSupportgetAllReificationsOf in class AbstractModelSetImplpublic boolean hasReifications(Statement stmt)
hasReifications in interface ReificationSupporthasReifications in class AbstractModelSetImpl
?reificationResource rdf:type rdf:Statement .
?reificationResource rdf:subject ?s .
?reificationResource rdf:predicate ?p .
?reificationResource rdf:object ?o .
public void readFrom(InputStream reader, Syntax syntax, String baseURI) throws IOException, ModelRuntimeException, SyntaxNotSupportedException
ModelSetIOreadFrom in interface ModelSetIOsyntax - syntax to usebaseURI - base URI to useIOException - on IOErrorsModelRuntimeException - on RDF serialisation errors or model errorsSyntaxNotSupportedException - if adapter can't handle the given syntaxpublic void readFrom(Reader in, Syntax syntax, String baseURI) throws IOException, ModelRuntimeException, SyntaxNotSupportedException
ModelSetIOreadFrom in interface ModelSetIOin - the input to readsyntax - syntax to usebaseURI - baseURI to useIOException - on IOErrorsModelRuntimeException - on RDF serialisation errors or model errorsSyntaxNotSupportedException - if adapter can't handle the given syntaxpublic 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, URI contextURI) throws ModelRuntimeException
AbstractModelSetImpladdModel in interface ModelSetaddModel in class AbstractModelSetImplModelRuntimeException - if any internal (I/O related) exception
occurspublic void addModelSet(ModelSet modelSet) throws ModelRuntimeException
ModelSetModelSet to this ModelSet. Context URIs in the
Statements of the modelSet are respected.addModelSet in interface ModelSetaddModelSet in class AbstractModelSetImplModelRuntimeException - 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.