Class CustomGraphQueryInferencer

All Implemented Interfaces:
FederatedServiceResolverClient, NotifyingSail, Sail, StackableSail

public class CustomGraphQueryInferencer extends NotifyingSailWrapper
A forward-chaining inferencer that infers new statements using a SPARQL graph query.
Author:
Dale Visser
  • Constructor Details

  • Method Details

    • setFields

      public final void setFields(QueryLanguage language, String queryText, String matcherText) throws MalformedQueryException, SailException
      Called in order to set all the fields needed for the inferencer to function.
      Parameters:
      language - language that queryText and matcherText are expressed in
      queryText - a query that returns an RDF graph of inferred statements to be added to the underlying Sail
      matcherText - a query that returns an RDF graph of existing inferred statements already added previously
      Throws:
      MalformedQueryException - if there is a problem parsing either of the given queries
      SailException - if a problem occurs interpreting the rule pattern
    • getConnection

      public InferencerConnection getConnection() throws SailException
      Description copied from interface: Sail
      Opens a connection on the Sail which can be used to query and update data. Depending on how the implementation handles concurrent access, a call to this method might block when there is another open connection on this Sail.
      Specified by:
      getConnection in interface NotifyingSail
      Specified by:
      getConnection in interface Sail
      Overrides:
      getConnection in class NotifyingSailWrapper
      Throws:
      SailException - If no transaction could be started, for example because the Sail is not writable.
    • init

      public void init() throws SailException
      Description copied from interface: Sail
      Initializes the Sail. Care should be taken that required initialization parameters have been set before this method is called. Please consult the specific Sail implementation for information about the relevant parameters.
      Specified by:
      init in interface Sail
      Overrides:
      init in class SailWrapper
      Throws:
      SailException - If the Sail could not be initialized.
    • getWatchSubjects

      public Collection<Value> getWatchSubjects()
      Exposed for test purposes.
      Returns:
      a computed collection of the statement subjects that, when added or removed, trigger an update of inferred statements
    • getWatchPredicates

      public Collection<Value> getWatchPredicates()
      Exposed for test purposes.
      Returns:
      a computed collection of the statement predicates that, when added or removed, trigger an update of inferred statements
    • getWatchObjects

      public Collection<Value> getWatchObjects()
      Exposed for test purposes.
      Returns:
      a computed collection of the statement objects that, when added or removed, trigger an update of inferred statements