public class LoggingModelSet extends Object implements ModelSet
| Constructor and Description |
|---|
LoggingModelSet(ModelSet modelset) |
| Modifier and Type | Method and Description |
|---|---|
void |
addAll(Iterator<? extends Statement> statement)
For each statement in the iterator, this method creates a Model named
statement.getContextURI if needed.
|
boolean |
addModel(Model model)
Adds a model to this ModelSet.
|
void |
addModel(Model model,
URI contextURI)
Adds a complete
Model to the given contextURI. |
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 |
addStatement(URI contextURI,
Resource subject,
URI predicate,
Node object)
This method creates a Model named 'contextURI' if needed.
|
void |
close()
Close connection of the underlying implementation
|
void |
commit()
Deprecated.
|
boolean |
contains(Statement s) |
boolean |
containsModel(URI contextURI) |
boolean |
containsStatements(UriOrVariable contextURI,
ResourceOrVariable subject,
UriOrVariable predicate,
NodeOrVariable object) |
long |
countStatements(QuadPattern pattern) |
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.
|
DatatypeLiteral |
createDatatypeLiteral(String literal,
URI datatypeURI) |
LanguageTagLiteral |
createLanguageTagLiteral(String literal,
String langugeTag) |
PlainLiteral |
createPlainLiteral(String literal)
Create a new plain literal
|
QuadPattern |
createQuadPattern(UriOrVariable context,
ResourceOrVariable subject,
UriOrVariable predicate,
NodeOrVariable object) |
Statement |
createStatement(Resource subject,
URI predicate,
Node object)
Create a new statement - but DOES NOT add it to the model
|
Statement |
createStatement(URI context,
Resource subject,
URI predicate,
Node object)
Creates a statement with a context URI.
|
URI |
createURI(String uriString)
Creates an RDF2Go URI.
|
void |
deleteReification(Resource reificationResource)
Delete reifications made by this resource.
|
void |
dump()
Print the whole content of this ModelSet to System.out.
|
ClosableIterator<Statement> |
findStatements(QuadPattern pattern)
Search across all existing models
|
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.
|
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 |
getUnderlyingModelSetImplementation() |
boolean |
hasReifications(Statement stmt) |
boolean |
isEmpty() |
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
|
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 reader,
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.
|
void |
removeAll()
Removes all models, which is not the same as removing all
statements from all models in this ModelSet.
|
void |
removeAll(Iterator<? extends Statement> statement)
For each statement in the iterator, the statement is removed form the
model named statement.getContext(); If the model named
statement.getContext() becomes empty, it remains in the ModelSet.
|
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 |
removeStatement(URI contextURI,
Resource subject,
URI predicate,
Node object)
Removes the statement (s,p,o) from a model named contextURI.
|
void |
removeStatements(QuadPattern quadPattern)
Find all models matching the context of the pattern and remove all
matching triple patterms from them
|
void |
removeStatements(UriOrVariable context,
ResourceOrVariable subject,
UriOrVariable predicate,
NodeOrVariable object)
Find all models matching the context, and remove all (subject, property
,object)-statements from these model
|
String |
serialize(Syntax syntax)
Convenience method to export a ModelSet to a String in a given syntax.
|
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 |
unlock()
Removes a lock.
|
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic LoggingModelSet(ModelSet modelset)
public void addAll(Iterator<? extends Statement> statement) throws ModelRuntimeException
ModelSetAddRemoveaddAll in interface ModelSetAddRemoveModelRuntimeException - if any internal (I/O related) exception occurspublic void addModel(Model model, URI contextURI) throws ModelRuntimeException
ModelSetModel to the given contextURI. The context URI of
the model is ignored.addModel in interface ModelSetModelRuntimeException - if any internal (I/O related) exception
occurspublic boolean addModel(Model model)
ModelSetpublic void addModelSet(ModelSet modelSet) throws ModelRuntimeException
ModelSetModelSet to this ModelSet. Context URIs in the
Statements of the modelSet are respected.addModelSet in interface ModelSetModelRuntimeException - if any internal (I/O related) exception
occurspublic 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 ReificationSupportstatement - which will be reifiedresource - used to represent the reified statementpublic BlankNode addReificationOf(Statement statement)
ReificationSupportaddReificationOf in interface ReificationSupportpublic void addStatement(Statement statement) throws ModelRuntimeException
ModelSetAddRemoveaddStatement in interface ModelSetAddRemoveModelRuntimeException - if any internal (I/O related) exception occurspublic void addStatement(URI contextURI, Resource subject, URI predicate, Node object) throws ModelRuntimeException
ModelSetAddRemoveaddStatement in interface ModelSetAddRemovecontextURI - a URI or nullsubject - a Resource (URI or BlankNode)object - a NodeModelRuntimeException - if any internal (I/O related) exception occurspublic void close()
ModelSet@Deprecated public void commit() throws ModelRuntimeException
Commitablecommit in interface CommitableModelRuntimeException - if the commit could not be executedpublic boolean contains(Statement s) throws ModelRuntimeException
contains in interface FindableModelSets - a StatementModelRuntimeExceptionpublic boolean containsModel(URI contextURI)
containsModel in interface ModelSetpublic boolean containsStatements(UriOrVariable contextURI, ResourceOrVariable subject, UriOrVariable predicate, NodeOrVariable object) throws ModelRuntimeException
containsStatements in interface FindableModelSetModelRuntimeExceptionpublic long countStatements(QuadPattern pattern) throws ModelRuntimeException
countStatements in interface FindableModelSetModelRuntimeExceptionpublic BlankNode createBlankNode()
ModelValueFactorycreateBlankNode in interface ModelValueFactorypublic BlankNode createBlankNode(String internalID)
ModelValueFactorycreateBlankNode in interface ModelValueFactorypublic DatatypeLiteral createDatatypeLiteral(String literal, URI datatypeURI) throws ModelRuntimeException
createDatatypeLiteral in interface ModelValueFactoryModelRuntimeException - e.g. if the datatype URI causes problemspublic LanguageTagLiteral createLanguageTagLiteral(String literal, String langugeTag) throws ModelRuntimeException
createLanguageTagLiteral in interface ModelValueFactoryModelRuntimeException - e.g. if the language tag is malformedpublic PlainLiteral createPlainLiteral(String literal)
ModelValueFactorycreatePlainLiteral in interface ModelValueFactorypublic QuadPattern createQuadPattern(UriOrVariable context, ResourceOrVariable subject, UriOrVariable predicate, NodeOrVariable object)
createQuadPattern in interface FindableModelSetpublic Statement createStatement(Resource subject, URI predicate, Node object)
ModelValueFactorycreateStatement in interface ModelValueFactorypublic Statement createStatement(URI context, Resource subject, URI predicate, Node object)
ModelSetcreateStatement in interface ModelSetpublic URI createURI(String uriString) throws ModelRuntimeException
ModelSetcreateURI in interface ModelSetcreateURI in interface ModelValueFactoryModelRuntimeException - if URI has not a valid URI format -
according to the adapterpublic 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 ReificationSupportpublic void dump()
ModelSetpublic ClosableIterator<Statement> findStatements(QuadPattern pattern) throws ModelRuntimeException
FindableModelSetfindStatements in interface FindableModelSetModelRuntimeExceptionpublic ClosableIterator<Statement> findStatements(UriOrVariable contextURI, ResourceOrVariable subject, UriOrVariable predicate, NodeOrVariable object) throws ModelRuntimeException
FindableModelSetfindStatements in interface FindableModelSetModelRuntimeExceptionpublic Collection<Resource> getAllReificationsOf(Statement statement)
getAllReificationsOf in interface ReificationSupportpublic Model getDefaultModel()
ModelSetgetDefaultModel in interface ModelSetpublic 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 ModelSetpublic String getNamespace(String prefix)
getNamespace in interface NamespaceSupportpublic Map<String,String> getNamespaces()
NamespaceSupportgetNamespaces in interface NamespaceSupportpublic Object getUnderlyingModelSetImplementation()
getUnderlyingModelSetImplementation in interface ModelSetpublic boolean hasReifications(Statement stmt)
hasReifications in interface ReificationSupport
?reificationResource rdf:type rdf:Statement .
?reificationResource rdf:subject ?s .
?reificationResource rdf:predicate ?p .
?reificationResource rdf:object ?o .
public boolean isEmpty()
public boolean isLocked()
public boolean isOpen()
public 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 ModelValueFactorypublic 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 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(InputStream reader, Syntax syntax) throws IOException, ModelRuntimeException, SyntaxNotSupportedException
ModelSetIOreadFrom in interface ModelSetIOsyntax - syntax to useIOException - on IOErrorsModelRuntimeException - on RDF serialisation errors or model errorsSyntaxNotSupportedException - if adapter can't handle the given syntaxpublic 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(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 void readFrom(Reader in, Syntax syntax) throws IOException, ModelRuntimeException, SyntaxNotSupportedException
ModelSetIOreadFrom in interface ModelSetIOin - 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 readFrom(Reader in) throws IOException, ModelRuntimeException
ModelSetIOreadFrom in interface ModelSetIOin - the input to readIOException - on IOErrorsModelRuntimeException - on RDF serialization errors or model errorspublic void removeAll()
throws ModelRuntimeException
ModelSetremoveAll in interface ModelSetModelRuntimeExceptionpublic void removeAll(Iterator<? extends Statement> statement) throws ModelRuntimeException
ModelSetAddRemoveremoveAll in interface ModelSetAddRemoveModelRuntimeException - if any internal (I/O related) exception occurspublic boolean removeModel(URI contextURI)
ModelSetremoveModel in interface ModelSetpublic void removeNamespace(String prefix)
NamespaceSupportremoveNamespace in interface NamespaceSupportpublic void removeStatement(Statement statement) throws ModelRuntimeException
ModelSetAddRemoveremoveStatement in interface ModelSetAddRemovestatement - a StatementModelRuntimeException - if any internal (I/O related) exception occurspublic void removeStatement(URI contextURI, Resource subject, URI predicate, Node object) throws ModelRuntimeException
ModelSetAddRemoveremoveStatement in interface ModelSetAddRemovesubject - a Resource (URI or BlankNode)object - a NodeModelRuntimeException - if any internal (I/O related) exception occurspublic void removeStatements(QuadPattern quadPattern) throws ModelRuntimeException
ModelSetAddRemoveremoveStatements in interface ModelSetAddRemoveModelRuntimeExceptionpublic void removeStatements(UriOrVariable context, ResourceOrVariable subject, UriOrVariable predicate, NodeOrVariable object) throws ModelRuntimeException
ModelSetAddRemoveremoveStatements in interface ModelSetAddRemoveModelRuntimeExceptionpublic String serialize(Syntax syntax) throws SyntaxNotSupportedException
ModelSetIOserialize in interface ModelSetIOSyntaxNotSupportedException - if the syntax is not supported@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 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 long size()
throws ModelRuntimeException
ModelSetsize in interface ModelSetModelSet.ModelRuntimeExceptionpublic boolean sparqlAsk(String query) throws ModelRuntimeException, MalformedQueryException
SparqlablesparqlAsk in interface Sparqlablequery - 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 unlock()
Lockablepublic void update(DiffReader diff) throws ModelRuntimeException
ModelSetAddRemoveupdate in interface ModelSetAddRemoveModelRuntimeException - if a model or statement in a model to be removed does not
exist.public void writeTo(OutputStream out, Syntax syntax) throws IOException, ModelRuntimeException, SyntaxNotSupportedException
ModelSetIOwriteTo in interface ModelSetIOout - 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(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(Writer out, Syntax syntax) throws IOException, ModelRuntimeException, SyntaxNotSupportedException
ModelSetIOwriteTo in interface ModelSetIOout - 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 errorsCopyright © 2005–2016 IT-Consulting Dr. Max V?lkel | Project started at FZI Forschungszentrum Informatik, www.fzi.de. All rights reserved.