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 SailSourceadditionalAdditional statements that should be included inSailDatasets.private SailSourceprimaryThe branch that will be used in calls tosink(IsolationLevel).
-
Constructor Summary
Constructors Constructor Description UnionSailSource(SailSource primary, SailSource additional)AnSailSourcethat combines two otherSailSourcees.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this resource, relinquishing any underlying resources.SailDatasetdataset(IsolationLevel level)Create an observableSailDatasetof the current state of thisSailSource.voidflush()Apply all the changes to this branch to the backingSailSource, if applicable.SailSourcefork()Creates a new branch of this source.voidprepare()Check the consistency of this branch and throws aSailConflictExceptionifSailSource.flush()ing this branch would cause the backingSailSourceto be inconsistent, if applicable.SailSinksink(IsolationLevel level)Create aSailSinkthat when when itsSailSource.flush()is called, the changes are applied to this source.java.lang.StringtoString()
-
-
-
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 inSailDatasets.
-
-
Constructor Detail
-
UnionSailSource
public UnionSailSource(SailSource primary, SailSource additional)
AnSailSourcethat combines two otherSailSourcees.- Parameters:
primary- delegates all calls to the givenSailSource.additional- delegate all call exceptsink(IsolationLevel).
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
close
public void close() throws SailExceptionDescription copied from interface:SailClosableCloses this resource, relinquishing any underlying resources.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceSailClosable- Throws:
SailException- if this resource cannot be closed
-
fork
public SailSource fork()
Description copied from interface:SailSourceCreates a new branch of this source. When it'sSailSource.flush()is called the changes are applied to this backing source.- Specified by:
forkin interfaceSailSource- Returns:
- a branched
SailSource.
-
prepare
public void prepare() throws SailExceptionDescription copied from interface:SailSourceCheck the consistency of this branch and throws aSailConflictExceptionifSailSource.flush()ing this branch would cause the backingSailSourceto be inconsistent, if applicable. If this is the final backingSailSourcecalling this method has no effect.- Specified by:
preparein interfaceSailSource- Throws:
SailException
-
flush
public void flush() throws SailExceptionDescription copied from interface:SailSourceApply all the changes to this branch to the backingSailSource, if applicable. If this is the final backingSailSourcecalling this method has no effect.- Specified by:
flushin interfaceSailSource- Throws:
SailException
-
sink
public SailSink sink(IsolationLevel level) throws SailException
Description copied from interface:SailSourceCreate aSailSinkthat when when itsSailSource.flush()is called, the changes are applied to this source.- Specified by:
sinkin interfaceSailSource- Parameters:
level- If this level is compatible withIsolationLevels.SERIALIZABLEthen aSailSink.prepare()can throw aSailConflictException.- Returns:
- Newly created
SailSink - Throws:
SailException
-
dataset
public SailDataset dataset(IsolationLevel level) throws SailException
Description copied from interface:SailSourceCreate an observableSailDatasetof the current state of thisSailSource. Repeatedly calling with methods withIsolationLevels.SNAPSHOT(or higher) isolation levels will result inSailDatasets that are all derived from the same state of the backingSailSource(if applicable), that is the only difference between the states of theSailDatasetwill be from changes using thisSailSource.sink(IsolationLevel).- Specified by:
datasetin interfaceSailSource- Parameters:
level- If this is compatible withIsolationLevels.SNAPSHOT_READthe resultingSailDatasetwill observe a single state of thisSailSource.- Returns:
- an
SailDatasetof the current state - Throws:
SailException
-
-