public abstract class AbstractModelSetImpl extends Object implements ModelSet
| Constructor and Description |
|---|
AbstractModelSetImpl() |
| 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)
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(URI context,
Resource subject,
URI predicate,
Node object)
This method creates a Model named 'contextURI' if needed.
|
boolean |
contains(Statement s) |
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
|
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)
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)
Search across all existing models
|
Collection<Resource> |
getAllReificationsOf(Statement statement) |
boolean |
hasReifications(Statement statement) |
boolean |
isEmpty()
sublcasses should override this method for performance
|
boolean |
isLocked() |
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
|
void |
readFrom(InputStream in,
Syntax syntax)
Reads assuming the given syntax.
|
void |
readFrom(Reader in,
Syntax syntax)
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.
|
void |
removeStatement(URI context,
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.
|
boolean |
sparqlAsk(String query)
SPARQL ask queries
|
void |
unlock()
Removes a lock.
|
void |
update(DiffReader diff)
Apply the changes given by this diff
|
void |
writeTo(OutputStream out,
Syntax syntax)
Write the model to the passed writer, using the passed syntax.
|
void |
writeTo(Writer writer,
Syntax syntax)
Write the model to the passed writer, using the passed syntax.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, containsModel, getDefaultModel, getModel, getModels, getModelURIs, getUnderlyingModelSetImplementation, isOpen, open, removeModel, sizequeryConstruct, querySelect, sparqlConstruct, sparqlDescribe, sparqlSelectreadFrom, readFrom, readFrom, readFrom, writeTo, writeTocreateQuadPatternaddStatement, removeStatementforEach, spliteratorcommit, setAutocommitgetNamespace, getNamespaces, removeNamespace, setNamespacepublic void dump()
ModelSetpublic void removeAll()
throws ModelRuntimeException
ModelSetremoveAll in interface ModelSetModelRuntimeExceptionpublic Statement createStatement(URI context, Resource subject, URI predicate, Node object)
ModelSetcreateStatement in interface ModelSetpublic 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(InputStream in, 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 writeTo(Writer writer, Syntax syntax) throws IOException, ModelRuntimeException, SyntaxNotSupportedException
ModelSetIOwriteTo in interface ModelSetIOwriter - 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, 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 String serialize(Syntax syntax) throws SyntaxNotSupportedException
ModelSetIOserialize in interface ModelSetIOSyntaxNotSupportedException - if the syntax is not supportedpublic boolean containsStatements(UriOrVariable contextURI, ResourceOrVariable subject, UriOrVariable predicate, NodeOrVariable object) throws ModelRuntimeException
containsStatements in interface FindableModelSetModelRuntimeExceptionpublic void addStatement(URI context, Resource subject, URI predicate, Node object) throws ModelRuntimeException
ModelSetAddRemoveaddStatement in interface ModelSetAddRemovecontext - a URI or nullsubject - a Resource (URI or BlankNode)object - a NodeModelRuntimeException - if any internal (I/O related) exception occurspublic void addAll(Iterator<? extends Statement> statement) throws ModelRuntimeException
ModelSetAddRemoveaddAll in interface ModelSetAddRemoveModelRuntimeException - if any internal (I/O related) exception occurspublic void removeStatement(URI context, 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 removeAll(Iterator<? extends Statement> statement) throws ModelRuntimeException
ModelSetAddRemoveremoveAll in interface ModelSetAddRemoveModelRuntimeException - 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 BlankNode createBlankNode()
ModelValueFactorycreateBlankNode in interface ModelValueFactorypublic BlankNode createBlankNode(String internalID)
ModelValueFactorycreateBlankNode in interface ModelValueFactorypublic 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 boolean isValidURI(String uriString)
ModelValueFactoryisValidURI in interface ModelValueFactorypublic PlainLiteral createPlainLiteral(String literal)
ModelValueFactorycreatePlainLiteral in interface ModelValueFactorypublic LanguageTagLiteral createLanguageTagLiteral(String literal, String langugeTag) throws ModelRuntimeException
createLanguageTagLiteral in interface ModelValueFactoryModelRuntimeException - e.g. if the language tag is malformedpublic DatatypeLiteral createDatatypeLiteral(String literal, URI datatypeURI) throws ModelRuntimeException
createDatatypeLiteral in interface ModelValueFactoryModelRuntimeException - e.g. if the datatype URI causes problemspublic Statement createStatement(Resource subject, URI predicate, Node object)
ModelValueFactorycreateStatement in interface ModelValueFactorypublic URI newRandomUniqueURI()
ModelValueFactorynewRandomUniqueURI in interface ModelValueFactorypublic boolean isLocked()
public void lock()
throws LockException
Lockablelock in interface LockableLockException - if already lockedpublic void unlock()
Lockablepublic boolean contains(Statement s) throws ModelRuntimeException
contains in interface FindableModelSets - a StatementModelRuntimeExceptionpublic long countStatements(QuadPattern pattern) throws ModelRuntimeException
countStatements in interface FindableModelSetModelRuntimeExceptionpublic ClosableIterator<Statement> findStatements(QuadPattern pattern) throws ModelRuntimeException
findStatements in interface FindableModelSetModelRuntimeExceptionpublic ClosableIterator<Statement> findStatements(UriOrVariable contextURI, ResourceOrVariable subject, UriOrVariable predicate, NodeOrVariable object) throws ModelRuntimeException
FindableModelSetfindStatements in interface FindableModelSetModelRuntimeExceptionpublic ClosableIterator<Statement> iterator()
ClosableIterablepublic boolean addModel(Model model)
ModelSetpublic void addModelSet(ModelSet modelSet)
ModelSetModelSet to this ModelSet. Context URIs in the
Statements of the modelSet are respected.addModelSet in interface ModelSetpublic void update(DiffReader diff) throws ModelRuntimeException
ModelSetAddRemoveupdate in interface ModelSetAddRemoveModelRuntimeException - if the ModelSet is lockedpublic boolean isEmpty()
public 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 BlankNode addReificationOf(Statement statement)
ReificationSupportaddReificationOf in interface ReificationSupportpublic 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 boolean hasReifications(Statement statement)
hasReifications in interface ReificationSupport
?reificationResource rdf:type rdf:Statement .
?reificationResource rdf:subject ?s .
?reificationResource rdf:predicate ?p .
?reificationResource rdf:object ?o .
public Collection<Resource> getAllReificationsOf(Statement statement)
getAllReificationsOf in interface ReificationSupportpublic 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 ReificationSupportCopyright © 2005–2016 IT-Consulting Dr. Max V?lkel | Project started at FZI Forschungszentrum Informatik, www.fzi.de. All rights reserved.