Package org.eclipse.rdf4j.sail.base
Class UnionSailDataset
- java.lang.Object
-
- org.eclipse.rdf4j.sail.base.UnionSailDataset
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,SailClosable
,SailDataset
class UnionSailDataset extends java.lang.Object implements SailDataset
Combines twoSailDataset
into a single view.
-
-
Field Summary
Fields Modifier and Type Field Description private SailDataset
dataset1
private SailDataset
dataset2
-
Constructor Summary
Constructors Modifier Constructor Description private
UnionSailDataset(SailDataset dataset1, SailDataset dataset2)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Called when thisSailDataset
is no longer is used, such as when a read operation is complete.CloseableIteration<? extends Resource,SailException>
getContextIDs()
Returns the set of all unique context identifiers that are used to store statements.static SailDataset
getInstance(SailDataset dataset1, SailDataset dataset2)
Creates a newSailDataset
that includes both the providedSailDataset
s.java.lang.String
getNamespace(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.java.lang.String
toString()
private <T> CloseableIteration<? extends T,SailException>
union(CloseableIteration<? extends T,SailException> iteration1, CloseableIteration<? extends T,SailException> iteration2)
-
-
-
Field Detail
-
dataset1
private final SailDataset dataset1
-
dataset2
private final SailDataset dataset2
-
-
Constructor Detail
-
UnionSailDataset
private UnionSailDataset(SailDataset dataset1, SailDataset dataset2)
-
-
Method Detail
-
getInstance
public static SailDataset getInstance(SailDataset dataset1, SailDataset dataset2)
Creates a newSailDataset
that includes both the providedSailDataset
s.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
close
public void close() throws SailException
Description copied from interface:SailDataset
Called when thisSailDataset
is no longer is used, such as when a read operation is complete. An isolation level compatible withIsolationLevels.SNAPSHOT
will ensure the state of thisSailDataset
dose not change between the first call to this object untilSailClosable#release()
is called.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceSailClosable
- Specified by:
close
in interfaceSailDataset
- Throws:
SailException
- if this resource cannot be closed
-
getNamespaces
public CloseableIteration<? extends Namespace,SailException> getNamespaces() throws SailException
Description copied from interface:SailDataset
Gets the namespaces relevant to the data contained in this object.- Specified by:
getNamespaces
in 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.
-
getNamespace
public java.lang.String getNamespace(java.lang.String prefix) throws SailException
Description copied from interface:SailDataset
Gets the namespace that is associated with the specified prefix, if any.- Specified by:
getNamespace
in 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.
-
getContextIDs
public CloseableIteration<? extends Resource,SailException> getContextIDs() throws SailException
Description copied from interface:SailDataset
Returns the set of all unique context identifiers that are used to store statements.- Specified by:
getContextIDs
in 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:SailDataset
Gets 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:
getStatements
in 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:SailDataset
Gets all RDF-star triples that have a specific subject, predicate and/or object. All three parameters may be null to indicate wildcards.- Specified by:
getTriples
in 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.
-
union
private <T> CloseableIteration<? extends T,SailException> union(CloseableIteration<? extends T,SailException> iteration1, CloseableIteration<? extends T,SailException> iteration2)
-
-