public class InferenceChangeLogReporter extends Object implements IChangeLog
IChangeLog
implementation reports inferences as RDF Statement
s. You install this change listener before writing on the sail connection.
After the commit, you use addedIterator()
(
removedIterator()
) to visit the inferences that were added to
(removed from) the KB by the transaction. If the transaction is aborted,
simply discard the InferenceChangeLogReporter
object. Always use a
new instance of this object for each transaction.
TODO The present implementation uses a LinkedHashMap to store the ISPOs for
the inferences. This should be scalable up to millions of inferences, and
maybe the low 10s of millions. If very large sets of inferences will be
drawn, then we could substitute an HTree
index for the
LinkedHashSet
. The existing NativeDistinctFilter
class
automatically converts from a JVM hash collection to an HTree
and and
could be used trivially as a replacement for the LinkedHashSet
in
this class. In this case, the native memory associated with the HTree needs
to be released, e.g., through an ICloseable
protocol on the change
listener.Constructor and Description |
---|
InferenceChangeLogReporter(AbstractTripleStore kb) |
Modifier and Type | Method and Description |
---|---|
BigdataStatementIterator |
addedIterator()
Return iterator visiting the inferences that were added to the KB.
|
void |
changeEvent(IChangeRecord record)
Occurs when a statement add or remove is flushed to the indices (but
not yet committed).
|
void |
clear()
Clear the internal state.
|
void |
close()
Close any open resources.
|
BigdataStatementIterator |
removedIterator()
Return iterator visiting the inferences that were removed from the KB.
|
void |
transactionAborted()
Occurs if the current SAIL transaction is aborted.
|
void |
transactionBegin()
Message issued when a new transaction will begin.
|
void |
transactionCommited(long commitTime)
Occurs when the current SAIL transaction is committed.
|
void |
transactionPrepare()
Message issued when preparing for a commit.
|
public InferenceChangeLogReporter(AbstractTripleStore kb)
kb
- The KB (used to resolve IV
s to Value
s).public void clear()
Note: It is faster to get a new InferenceChangeLogReporter
than
to clear the internal maps, but you can not replace an IChangeLog
listener once established on a connection.
public void changeEvent(IChangeRecord record)
IChangeLog
changeEvent
in interface IChangeLog
record
- the IChangeRecord
public void transactionBegin()
IChangeLog
transactionBegin
in interface IChangeLog
public void transactionPrepare()
IChangeLog
IChangeLog.transactionCommited(long)
or
IChangeLog.transactionAborted()
.
Note: The listener will have observed all updates by the time this message is generated. Thus, this message can be used to validate post-conditions for the transaction.
transactionPrepare
in interface IChangeLog
public void transactionCommited(long commitTime)
IChangeLog
transactionCommited
in interface IChangeLog
commitTime
- The timestamp associated with the commit point.public void transactionAborted()
IChangeLog
transactionAborted
in interface IChangeLog
public void close()
IChangeLog
close
in interface IChangeLog
public BigdataStatementIterator addedIterator()
public BigdataStatementIterator removedIterator()
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.