Class Node_RuleVariable

All Implemented Interfaces:

public class Node_RuleVariable extends Node_Variable
A variation on the normal Node_Variable which support for value bindings. Currently the forward rule system stores the values externally but requires variables to have an offset index in the rule environment vector. The variables can also support prolog-like reference chains and trails but these are not yet used.

Note that this should not be used in a real Triple, in particular it should not end up in a Graph. It is only needed for the rule systems.

See Also:
  • Field Details

    • WILD

      public static final Node_RuleVariable WILD
      A static wildcard - like Node.ANY but tests equal to other Node_RuleVariables
  • Constructor Details

    • Node_RuleVariable

      public Node_RuleVariable(String label, int index)
      label - the text label for the variable
      index - the calculated index of this variable in the rule
  • Method Details

    • getIndex

      public int getIndex()
      Returns the variable's index in a binding vector.
    • setIndex

      public void setIndex(int index)
      Changes the variable's index. This is used in LP rules which classify the variables into different sequences.
    • simpleBind

      public void simpleBind(Node node)
      Binds a value to the brule version of the variable. Does not follow any reference trail, assues we have already been derefenced.
      node - a concrete Node value or another Node_RuleVariable to alias to
    • deref

      public Node deref()
      Dereference a variable by following the reference chain.
      either a concrete node value or the last variable in the reference chain.
    • getRawBoundValue

      public Node getRawBoundValue()
      Return the raw value to which this variable is bound (via LP binding) with no dereferencing.
    • unbind

      public void unbind()
      Set the variable to be unbound (in the brule sense)
    • isUnbound

      public boolean isUnbound()
      Test if the variable is unbound (in the brule sense).
    • cloneNode

      public Node_RuleVariable cloneNode()
      Clone the rule variable to allow multiple rule instaces to be active at the same time.
    • toString

      public String toString()
      printable form
      toString in class Node_Variable
    • equals

      public boolean equals(Object o)
      Description copied from class: Node
      Java rules for equals. See also {#sameTermAs} and {#sameValueAs} Nodes only equal other Nodes that have equal labels.
      equals in class Node_Variable
    • hashCode

      public int hashCode()
      hashCode in class Node_Variable
    • sameValueAs

      public boolean sameValueAs(Object o)
      Test that two nodes are semantically equivalent.
      sameValueAs in class Node
    • sameNodeAs

      public static boolean sameNodeAs(Node n, Node m)
      Compare two nodes, taking into account variable indices.