Package org.eclipse.rdf4j.sail.inferencer.fc

## Class AbstractForwardChainingInferencerConnection

- java.lang.Object
- - org.eclipse.rdf4j.sail.helpers.SailConnectionWrapper
  - - org.eclipse.rdf4j.sail.helpers.NotifyingSailConnectionWrapper
    - - org.eclipse.rdf4j.sail.inferencer.InferencerConnectionWrapper
      - - org.eclipse.rdf4j.sail.inferencer.fc.AbstractForwardChainingInferencerConnection

- All Implemented Interfaces:
    `AutoCloseable`, `FederatedServiceResolverClient`, `ThreadSafetyAware`, `InferencerConnection`, `NotifyingSailConnection`, `SailConnection`, `SailConnectionListener`

      public abstract class AbstractForwardChainingInferencerConnection
      extends InferencerConnectionWrapper
      implements SailConnectionListener

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected int` | `totalInferred` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `AbstractForwardChainingInferencerConnection​(Sail sail, InferencerConnection con)` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected abstract void` | `addAxiomStatements()` | Adds all basic set of axiom statements from which the complete set can be inferred to the underlying Sail.
    `protected abstract int` | `applyRules​(Model iteration)` | Returns the number of newly inferred statements.
    `void` | `begin()` | Begins a transaction requiring `SailConnection.commit()` or `SailConnection.rollback()` to be called to close the transaction.
    `void` | `begin​(IsolationLevel level)` | Begins a transaction with the specified `IsolationLevel` level, requiring `SailConnection.commit()` or `SailConnection.rollback()` to be called to close the transaction.
    `protected abstract Model` | `createModel()` |
    `protected void` | `doInferencing()` |
    `void` | `flushUpdates()` | Flushes any pending updates to be processed and the resulting changes to be reported to registered `SailConnectionListener`s.
    `protected boolean` | `hasNewStatements()` |
    `protected boolean` | `needsFullRecomputation()` | Indicates if a full recomputation of the deductive closure is needed.
    `protected Model` | `prepareIteration()` |
    `void` | `rollback()` | Rolls back the transaction, discarding any uncommitted changes that have been made in this SailConnection.
    `void` | `statementAdded​(Statement st)` | Notifies the listener that a statement has been added in a transaction that it has registered itself with.
    `void` | `statementRemoved​(Statement st)` | Notifies the listener that a statement has been removed in a transaction that it has registered itself with.

    - ### Methods inherited from class org.eclipse.rdf4j.sail.inferencer.InferencerConnectionWrapper

      `addInferredStatement, clearInferred, commit, evaluate, flush, getContextIDs, getStatements, getWrappedConnection, hasStatement, prepare, removeInferredStatement, size`

    - ### Methods inherited from class org.eclipse.rdf4j.sail.helpers.NotifyingSailConnectionWrapper

      `addConnectionListener, removeConnectionListener`

    - ### Methods inherited from class org.eclipse.rdf4j.sail.helpers.SailConnectionWrapper

      `addStatement, addStatement, clear, clearNamespaces, close, endUpdate, explain, getNamespace, getNamespaces, isActive, isOpen, pendingRemovals, prepareQuery, removeNamespace, removeStatement, removeStatements, setFederatedServiceResolver, setNamespace, setTransactionSettings, size, startUpdate, supportsConcurrentReads`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.rdf4j.sail.NotifyingSailConnection

      `addConnectionListener, removeConnectionListener`

    - ### Methods inherited from interface org.eclipse.rdf4j.sail.SailConnection

      `addStatement, addStatement, clear, clearNamespaces, close, endUpdate, explain, getNamespace, getNamespaces, isActive, isOpen, pendingRemovals, prepareQuery, removeNamespace, removeStatement, removeStatements, setNamespace, setTransactionSettings, startUpdate`

- - ### Field Detail

    - #### totalInferred

          protected int totalInferred

  - ### Constructor Detail

    - #### AbstractForwardChainingInferencerConnection

          public AbstractForwardChainingInferencerConnection​(Sail sail,
                                                             InferencerConnection con)

  - ### Method Detail

    - #### statementAdded

          public void statementAdded​(Statement st)

      Description copied from interface: `SailConnectionListener`
      Notifies the listener that a statement has been added in a transaction that it has registered itself with.
      Specified by:
        `statementAdded` in interface `SailConnectionListener`
      Parameters:
        `st` - The statement that was added.

    - #### createModel

          protected abstract Model createModel()

    - #### statementRemoved

          public void statementRemoved​(Statement st)

      Description copied from interface: `SailConnectionListener`
      Notifies the listener that a statement has been removed in a transaction that it has registered itself with.
      Specified by:
        `statementRemoved` in interface `SailConnectionListener`
      Parameters:
        `st` - The statement that was removed.

    - #### flushUpdates

          public void flushUpdates()
                            throws SailException

      Description copied from interface: `InferencerConnection`
      Flushes any pending updates to be processed and the resulting changes to be reported to registered `SailConnectionListener`s.
      Specified by:
        `flushUpdates` in interface `InferencerConnection`
      Overrides:
        `flushUpdates` in class `InferencerConnectionWrapper`
      Throws:
        `SailException` - If the updates could not be processed.

    - #### begin

          public void begin()
                     throws SailException

      Description copied from interface: `SailConnection`
      Begins a transaction requiring `SailConnection.commit()` or `SailConnection.rollback()` to be called to close the transaction. The transaction will use the default `IsolationLevel` level for the SAIL, as returned by `Sail.getDefaultIsolationLevel()`.
      Specified by:
        `begin` in interface `SailConnection`
      Overrides:
        `begin` in class `SailConnectionWrapper`
      Throws:
        `SailException` - If the connection could not start a transaction or if a transaction is already active on this connection.

    - #### begin

          public void begin​(IsolationLevel level)
                     throws SailException

      Description copied from interface: `SailConnection`
      Begins a transaction with the specified `IsolationLevel` level, requiring `SailConnection.commit()` or `SailConnection.rollback()` to be called to close the transaction.
      Specified by:
        `begin` in interface `SailConnection`
      Overrides:
        `begin` in class `SailConnectionWrapper`
      Parameters:
        `level` - the transaction isolation level on which this transaction operates.
      Throws:
        `UnknownSailTransactionStateException` - If the IsolationLevel is not supported by this implementation
        `SailException` - If the connection could not start a transaction, if the supplied transaction isolation level is not supported, or if a transaction is already active on this connection.

    - #### rollback

          public void rollback()
                        throws SailException

      Description copied from interface: `SailConnection`
      Rolls back the transaction, discarding any uncommitted changes that have been made in this SailConnection.
      Specified by:
        `rollback` in interface `SailConnection`
      Overrides:
        `rollback` in class `SailConnectionWrapper`
      Throws:
        `UnknownSailTransactionStateException` - If the transaction state can not be determined (this can happen for instance when communication between client and server fails or times-out). It does not indicate a problem with the integrity of the store.
        `SailException` - If the SailConnection could not be rolled back.

    - #### addAxiomStatements

          protected abstract void addAxiomStatements()
                                              throws SailException

      Adds all basic set of axiom statements from which the complete set can be inferred to the underlying Sail.
      Throws:
        `SailException`

    - #### doInferencing

          protected void doInferencing()
                                throws SailException

      Throws:
        `SailException`

    - #### applyRules

          protected abstract int applyRules​(Model iteration)
                                     throws SailException

      Returns the number of newly inferred statements.
      Throws:
        `SailException`

    - #### prepareIteration

          protected Model prepareIteration()

    - #### hasNewStatements

          protected boolean hasNewStatements()

    - #### needsFullRecomputation

          protected boolean needsFullRecomputation()

      Indicates if a full recomputation of the deductive closure is needed.