Package org.eclipse.rdf4j.sail.base
Class SailDatasetImpl
- java.lang.Object
-
- org.eclipse.rdf4j.sail.base.SailDatasetImpl
-
- All Implemented Interfaces:
java.lang.AutoCloseable,SailClosable,SailDataset
class SailDatasetImpl extends java.lang.Object implements SailDataset
A view of anSailSourcethat is derived from a backingSailDataset.
-
-
Field Summary
Fields Modifier and Type Field Description private ChangesetchangesChanges that have not yet beenSailSource.flush()ed to the backingSailDataset.private SailDatasetderivedFromSailDatasetof the backingSailSource.private static EmptyIteration<Namespace,SailException>NAMESPACES_EMPTY_ITERATIONprivate static EmptyIteration<Statement,SailException>STATEMENT_EMPTY_ITERATIONprivate static EmptyIteration<Triple,SailException>TRIPLE_EMPTY_ITERATION
-
Constructor Summary
Constructors Constructor Description SailDatasetImpl(SailDataset derivedFrom, Changeset changes)Create a derivative dataset that applies the given changeset.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Called when thisSailDatasetis no longer is used, such as when a read operation is complete.private CloseableIteration<? extends Statement,SailException>difference(CloseableIteration<? extends Statement,SailException> result, java.util.function.Function<Statement,java.lang.Boolean> excluded)CloseableIteration<? extends Resource,SailException>getContextIDs()Returns the set of all unique context identifiers that are used to store statements.java.lang.StringgetNamespace(java.lang.String prefix)Gets the namespace that is associated with the specified prefix, if any.CloseableIteration<? extends Namespace,SailException>getNamespaces()Gets the namespaces relevant to the data contained in this object.CloseableIteration<? extends Statement,SailException>getStatements(Resource subj, IRI pred, Value obj, Resource... contexts)Gets all statements that have a specific subject, predicate and/or object.CloseableIteration<? extends Triple,SailException>getTriples(Resource subj, IRI pred, Value obj)Gets all RDF-star triples that have a specific subject, predicate and/or object.private booleanisDeprecated(Triple triple, java.util.List<Statement> deprecatedStatements)java.lang.StringtoString()private CloseableIteration<? extends Triple,SailException>triplesDifference(CloseableIteration<? extends Triple,SailException> result, java.util.function.Function<Triple,java.lang.Boolean> excluded)
-
-
-
Field Detail
-
TRIPLE_EMPTY_ITERATION
private static final EmptyIteration<Triple,SailException> TRIPLE_EMPTY_ITERATION
-
NAMESPACES_EMPTY_ITERATION
private static final EmptyIteration<Namespace,SailException> NAMESPACES_EMPTY_ITERATION
-
STATEMENT_EMPTY_ITERATION
private static final EmptyIteration<Statement,SailException> STATEMENT_EMPTY_ITERATION
-
derivedFrom
private final SailDataset derivedFrom
SailDatasetof the backingSailSource.
-
changes
private final Changeset changes
Changes that have not yet beenSailSource.flush()ed to the backingSailDataset.
-
-
Constructor Detail
-
SailDatasetImpl
public SailDatasetImpl(SailDataset derivedFrom, Changeset changes)
Create a derivative dataset that applies the given changeset. The life cycle of this and the givenSailDatasetare bound.- Parameters:
derivedFrom- will be released when this object is releasedchanges- changeset to be observed with the given dataset
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
close
public void close() throws SailExceptionDescription copied from interface:SailDatasetCalled when thisSailDatasetis no longer is used, such as when a read operation is complete. An isolation level compatible withIsolationLevels.SNAPSHOTwill ensure the state of thisSailDatasetdose not change between the first call to this object untilSailClosable#release()is called.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceSailClosable- Specified by:
closein interfaceSailDataset- Throws:
SailException- if this resource cannot be closed
-
getNamespace
public java.lang.String getNamespace(java.lang.String prefix) throws SailExceptionDescription copied from interface:SailDatasetGets the namespace that is associated with the specified prefix, if any.- Specified by:
getNamespacein interfaceSailDataset- Parameters:
prefix- A namespace prefix, or an empty string in case of the default namespace.- Returns:
- The namespace name that is associated with the specified prefix, or null if there is no such namespace.
- Throws:
SailException- If this object encountered an error or unexpected situation internally.
-
getNamespaces
public CloseableIteration<? extends Namespace,SailException> getNamespaces() throws SailException
Description copied from interface:SailDatasetGets the namespaces relevant to the data contained in this object.- Specified by:
getNamespacesin interfaceSailDataset- Returns:
- An iterator over the relevant namespaces, should not contain any duplicates.
- Throws:
SailException- If this object encountered an error or unexpected situation internally.
-
getContextIDs
public CloseableIteration<? extends Resource,SailException> getContextIDs() throws SailException
Description copied from interface:SailDatasetReturns the set of all unique context identifiers that are used to store statements.- Specified by:
getContextIDsin interfaceSailDataset- Returns:
- An iterator over the context identifiers, should not contain any duplicates.
- Throws:
SailException
-
getStatements
public CloseableIteration<? extends Statement,SailException> getStatements(Resource subj, IRI pred, Value obj, Resource... contexts) throws SailException
Description copied from interface:SailDatasetGets all statements that have a specific subject, predicate and/or object. All three parameters may be null to indicate wildcards. Optionally a (set of) context(s) may be specified in which case the result will be restricted to statements matching one or more of the specified contexts.- Specified by:
getStatementsin interfaceSailDataset- Parameters:
subj- A Resource specifying the subject, or null for a wildcard.pred- A IRI specifying the predicate, or null for a wildcard.obj- A Value specifying the object, or null for a wildcard.contexts- The context(s) to get the statements from. Note that this parameter is a vararg and as such is optional. If no contexts are supplied the method operates on all contexts.- Returns:
- An iterator over the relevant statements.
- Throws:
SailException- If the triple source failed to get the statements.
-
getTriples
public CloseableIteration<? extends Triple,SailException> getTriples(Resource subj, IRI pred, Value obj) throws SailException
Description copied from interface:SailDatasetGets all RDF-star triples that have a specific subject, predicate and/or object. All three parameters may be null to indicate wildcards.- Specified by:
getTriplesin interfaceSailDataset- Parameters:
subj- A Resource specifying the subject, or null for a wildcard.pred- A IRI specifying the predicate, or null for a wildcard.obj- A Value specifying the object, or null for a wildcard.- Returns:
- An iterator over the relevant triples.
- Throws:
SailException- If the triple source failed to get the RDF-star triples.
-
difference
private CloseableIteration<? extends Statement,SailException> difference(CloseableIteration<? extends Statement,SailException> result, java.util.function.Function<Statement,java.lang.Boolean> excluded)
-
triplesDifference
private CloseableIteration<? extends Triple,SailException> triplesDifference(CloseableIteration<? extends Triple,SailException> result, java.util.function.Function<Triple,java.lang.Boolean> excluded)
-
-