Class RETEClauseFilter

java.lang.Object
org.apache.jena.reasoner.rulesys.impl.RETEClauseFilter
All Implemented Interfaces:
RETENode, RETESourceNode

public class RETEClauseFilter extends Object implements RETESourceNode
Checks a triple against the grounded matches and intra-triple matches for a single rule clause. If the match passes it creates a binding environment token and passes it on the RETE network itself. The checks and bindings are implemented using a simple byte-coded interpreter.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final byte
    Argument addressing code: triple object functor node, offset in low nibble, only usable after a successful TestFunctorName.
    static final byte
    Argument addressing code: triple object as a whole
    static final byte
    Argument addressing code: triple predicate
    static final byte
    Argument addressing code: triple subject
    static final byte
    Instruction code: Bind a node (arg1) to a place in the rules token (arg2).
    static final byte
    Instruction code: Create a result environment of length arg1.
    static final byte
    Instruction code: Final entry - dispatch to the network.
    static final byte
    Instruction code: Check literal value is a functor of name arg1
    static final byte
    Instruction code: Cross match two triple entries (arg1, arg2)
    static final byte
    Instruction code: Check triple entry (arg1) against literal value (arg2).
  • Constructor Summary

    Constructors
    Constructor
    Description
    RETEClauseFilter(byte[] instructions, Object[] args)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    Clone this node in the network.
    compile(TriplePattern clause, int envLength, List<Node> varList)
    Create a filter node from a rule clause.
    void
    fire(Triple triple, boolean isAdd)
    Insert or remove a triple into the network.
    void
    Set the continuation node for this node.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • TESTValue

      public static final byte TESTValue
      Instruction code: Check triple entry (arg1) against literal value (arg2).
      See Also:
    • TESTFunctorName

      public static final byte TESTFunctorName
      Instruction code: Check literal value is a functor of name arg1
      See Also:
    • TESTIntraMatch

      public static final byte TESTIntraMatch
      Instruction code: Cross match two triple entries (arg1, arg2)
      See Also:
    • CREATEToken

      public static final byte CREATEToken
      Instruction code: Create a result environment of length arg1.
      See Also:
    • BIND

      public static final byte BIND
      Instruction code: Bind a node (arg1) to a place in the rules token (arg2).
      See Also:
    • END

      public static final byte END
      Instruction code: Final entry - dispatch to the network.
      See Also:
    • ADDRSubject

      public static final byte ADDRSubject
      Argument addressing code: triple subject
      See Also:
    • ADDRPredicate

      public static final byte ADDRPredicate
      Argument addressing code: triple predicate
      See Also:
    • ADDRObject

      public static final byte ADDRObject
      Argument addressing code: triple object as a whole
      See Also:
    • ADDRFunctorNode

      public static final byte ADDRFunctorNode
      Argument addressing code: triple object functor node, offset in low nibble, only usable after a successful TestFunctorName.
      See Also:
  • Constructor Details

    • RETEClauseFilter

      public RETEClauseFilter(byte[] instructions, Object[] args)
      Constructor.
      Parameters:
      instructions - the set of byte-coded instructions and argument pointers.
      args - the object arguments referenced from the instructions array.
  • Method Details

    • compile

      public static RETEClauseFilter compile(TriplePattern clause, int envLength, List<Node> varList)
      Create a filter node from a rule clause. Clause complexity is limited to less than 50 args in a Functor.
      Parameters:
      clause - the rule clause
      envLength - the size of binding environment that should be created on successful matches
      varList - a list to which all clause variables will be appended
    • setContinuation

      public void setContinuation(RETESinkNode continuation)
      Set the continuation node for this node.
      Specified by:
      setContinuation in interface RETESourceNode
    • fire

      public void fire(Triple triple, boolean isAdd)
      Insert or remove a triple into the network.
      Parameters:
      triple - the triple to process.
      isAdd - true if the triple is being added to the working set.
    • clone

      public RETENode clone(Map<RETENode,RETENode> netCopy, RETERuleContext context)
      Clone this node in the network.
      Specified by:
      clone in interface RETENode
      Parameters:
      netCopy - a map from RETENode to cloned instance
      context - the new context to which the network is being ported