Class CustomGraphQueryInferencer

  • All Implemented Interfaces:
    FederatedServiceResolverClient, NotifyingSail, Sail, StackableSail

    public class CustomGraphQueryInferencer
    extends org.eclipse.rdf4j.sail.helpers.NotifyingSailWrapper
    A forward-chaining inferencer that infers new statements using a SPARQL graph query.
    Author:
    Dale Visser
    • Method Detail

      • 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
      • init

        public void init()
                  throws SailException
        Specified by:
        init in interface Sail
        Overrides:
        init in class org.eclipse.rdf4j.sail.helpers.SailWrapper
        Throws:
        SailException
      • getWatchSubjects

        public Collection<org.eclipse.rdf4j.model.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<org.eclipse.rdf4j.model.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<org.eclipse.rdf4j.model.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