Package org.eclipse.rdf4j.sail.base
Class UnionSailSource
- java.lang.Object
-
- org.eclipse.rdf4j.sail.base.UnionSailSource
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,SailClosable
,SailSource
class UnionSailSource extends java.lang.Object implements SailSource
Combines two sources to act as a singleSailSource
. This is useful to provide a combined view of both explicit and inferred statements.
-
-
Field Summary
Fields Modifier and Type Field Description private SailSource
additional
Additional statements that should be included inSailDataset
s.private SailSource
primary
The branch that will be used in calls tosink(IsolationLevel)
.
-
Constructor Summary
Constructors Constructor Description UnionSailSource(SailSource primary, SailSource additional)
AnSailSource
that combines two otherSailSource
es.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes this resource, relinquishing any underlying resources.SailDataset
dataset(IsolationLevel level)
Create an observableSailDataset
of the current state of thisSailSource
.void
flush()
Apply all the changes to this branch to the backingSailSource
, if applicable.SailSource
fork()
Creates a new branch of this source.void
prepare()
Check the consistency of this branch and throws aSailConflictException
ifSailSource.flush()
ing this branch would cause the backingSailSource
to be inconsistent, if applicable.SailSink
sink(IsolationLevel level)
Create aSailSink
that when when itsSailSource.flush()
is called, the changes are applied to this source.java.lang.String
toString()
-
-
-
Field Detail
-
primary
private final SailSource primary
The branch that will be used in calls tosink(IsolationLevel)
.
-
additional
private final SailSource additional
Additional statements that should be included inSailDataset
s.
-
-
Constructor Detail
-
UnionSailSource
public UnionSailSource(SailSource primary, SailSource additional)
AnSailSource
that combines two otherSailSource
es.- Parameters:
primary
- delegates all calls to the givenSailSource
.additional
- delegate all call exceptsink(IsolationLevel)
.
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
close
public void close() throws SailException
Description copied from interface:SailClosable
Closes this resource, relinquishing any underlying resources.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceSailClosable
- Throws:
SailException
- if this resource cannot be closed
-
fork
public SailSource fork()
Description copied from interface:SailSource
Creates a new branch of this source. When it'sSailSource.flush()
is called the changes are applied to this backing source.- Specified by:
fork
in interfaceSailSource
- Returns:
- a branched
SailSource
.
-
prepare
public void prepare() throws SailException
Description copied from interface:SailSource
Check the consistency of this branch and throws aSailConflictException
ifSailSource.flush()
ing this branch would cause the backingSailSource
to be inconsistent, if applicable. If this is the final backingSailSource
calling this method has no effect.- Specified by:
prepare
in interfaceSailSource
- Throws:
SailException
-
flush
public void flush() throws SailException
Description copied from interface:SailSource
Apply all the changes to this branch to the backingSailSource
, if applicable. If this is the final backingSailSource
calling this method has no effect.- Specified by:
flush
in interfaceSailSource
- Throws:
SailException
-
sink
public SailSink sink(IsolationLevel level) throws SailException
Description copied from interface:SailSource
Create aSailSink
that when when itsSailSource.flush()
is called, the changes are applied to this source.- Specified by:
sink
in interfaceSailSource
- Parameters:
level
- If this level is compatible withIsolationLevels.SERIALIZABLE
then aSailSink.prepare()
can throw aSailConflictException
.- Returns:
- Newly created
SailSink
- Throws:
SailException
-
dataset
public SailDataset dataset(IsolationLevel level) throws SailException
Description copied from interface:SailSource
Create an observableSailDataset
of the current state of thisSailSource
. Repeatedly calling with methods withIsolationLevels.SNAPSHOT
(or higher) isolation levels will result inSailDataset
s that are all derived from the same state of the backingSailSource
(if applicable), that is the only difference between the states of theSailDataset
will be from changes using thisSailSource.sink(IsolationLevel)
.- Specified by:
dataset
in interfaceSailSource
- Parameters:
level
- If this is compatible withIsolationLevels.SNAPSHOT_READ
the resultingSailDataset
will observe a single state of thisSailSource
.- Returns:
- an
SailDataset
of the current state - Throws:
SailException
-
-