java.lang .Object com.hp.hpl.jena.reasoner.rulesys.impl .RuleClauseCode RuleClauseCode public class RuleClauseCode (Code) Object used to hold the compiled bytecode stream for a single rule clause.
This uses a slightly WAM-like code stream but gluing of the clauses together
into disjunctions is done in the interpreter loop so a complete predicate is
represented as a list of RuleClauseCode objects.
author: Dave Reynolds version: $Revision: 1.12 $ on $Date: 2008/01/02 12:06:16 $
Inner Class :static class CompileState
Inner Class :static class TermIndex
Method Summary public voidcompile (LPRuleStore ruleStore) Compile the rule into byte code.public Object []getArgs () Return the argument vector associated with this clauses' byte codes.public byte[]getCode () Return the byte code vector for this clause.public Rule getRule () Return the rule from which this code block was compiled.public static voidmain (String [] args) Debug support - not unit testing.public voidprint (PrintStream out) public inttermIndex (int pc) Translate a program counter offset to the index of the corresponding
body term (or -1 if a head term or a dummy rule).public String toString () Print clause as rule for tracing.
ALLOCATE final public static byte ALLOCATE (Code) Allocate a new environment frame
CALL_BUILTIN final public static byte CALL_BUILTIN (Code) call a built-in operation defined by a rule clause (clauseIndex(
CALL_PREDICATE final public static byte CALL_PREDICATE (Code) call a predicate code object (predicateCodeList)
CALL_PREDICATE_INDEX final public static byte CALL_PREDICATE_INDEX (Code) call a predicate code object with run time indexing (predicateCodeList)
CALL_TABLED final public static byte CALL_TABLED (Code) call a table code object ()
CALL_TRIPLE_MATCH final public static byte CALL_TRIPLE_MATCH (Code) call a pure triple match (predicate)
CALL_WILD_TABLED final public static byte CALL_WILD_TABLED (Code) call a table code object from a wildcard ()
CLEAR_ARG final public static byte CLEAR_ARG (Code) reset an argument to an unbound variable (Ai)
CLEAR_TEMP final public static byte CLEAR_TEMP (Code) reset a temp variable to an unbound variable (Ti)
CLEAR_VARIABLE final public static byte CLEAR_VARIABLE (Code) reset a permanent variable to an unbound variable (Yi)
GET_CONSTANT final public static byte GET_CONSTANT (Code) fetch constant argument (const, Ai)
GET_FUNCTOR final public static byte GET_FUNCTOR (Code) deconstruct a functor argument (functor)
GET_TEMP final public static byte GET_TEMP (Code) fetch temporary variable argument (Ti, Ai)
GET_VARIABLE final public static byte GET_VARIABLE (Code) fetch permanent variable argument, first occurance (Yi, Ai)
LAST_CALL_PREDICATE final public static byte LAST_CALL_PREDICATE (Code) variant on CALL_PREDICATE using the last call optimization, only current used in chain rules
MAKE_FUNCTOR final public static byte MAKE_FUNCTOR (Code) create a functor object from a rule template (templateFunctor)
MAX_ARGUMENT_VARS final public static int MAX_ARGUMENT_VARS (Code) The maximum number of argument variables allowed in a single goal
Future refactorings will remove this restriction.
MAX_PERMANENT_VARS final public static int MAX_PERMANENT_VARS (Code) The maximum number of permanent variables allowed in a single rule clause.
Now only relevent for initial holding clause.
MAX_TEMPORARY_VARS final public static int MAX_TEMPORARY_VARS (Code) The maximum number of temporary variables allowed in a single rule clause.
PROCEED final public static byte PROCEED (Code) return from a call, proceeed along AND tree
PUT_CONSTANT final public static byte PUT_CONSTANT (Code) put constant value into call parameter (const, Ai)
PUT_DEREF_VARIABLE final public static byte PUT_DEREF_VARIABLE (Code) put a dereferenced permanent variable into call parameter ready for BUILTIN call (Yi, Ai)
PUT_NEW_VARIABLE final public static byte PUT_NEW_VARIABLE (Code) put permanaent variable into call parameter, first occurance (Yi, Ai)
PUT_TEMP final public static byte PUT_TEMP (Code) put temp variable into call parameter (Ti, Ai)
PUT_VARIABLE final public static byte PUT_VARIABLE (Code) put permanaent variable into call parameter (Yi, Ai)
TEST_BOUND final public static byte TEST_BOUND (Code) Test if an argument is bound (Ai)
TEST_UNBOUND final public static byte TEST_UNBOUND (Code) Test if an argument is unbound (Ai)
UNIFY_TEMP final public static byte UNIFY_TEMP (Code) fetch temporary variable argument, later occurance (Ti, Ai)
UNIFY_VARIABLE final public static byte UNIFY_VARIABLE (Code) fetch permanent variable argument, later occurance (Yi, Ai)
args protected Object [] args(Code) Any Object argements needed by the byte codes
code protected byte[] code(Code) The byte code sequence
returnCodeBlock public static RuleClauseCode returnCodeBlock(Code) Dummy code block which just returns
rule protected Rule rule(Code) The rule from which is code was derived
termStart protected int[] termStart(Code) starting byte code offset for body terms
RuleClauseCode public RuleClauseCode(Rule rule)(Code) Constructor.
Parameters: rule - the rule to be compiled
compile public void compile(LPRuleStore ruleStore)(Code) Compile the rule into byte code.
Parameters: ruleStore - the store of LP rules through which calls to other predicatescan be resolved.
getArgs public Object [] getArgs()(Code) Return the argument vector associated with this clauses' byte codes.
getCode public byte[] getCode()(Code) Return the byte code vector for this clause.
getRule public Rule getRule()(Code) Return the rule from which this code block was compiled.
main public static void main(String [] args)(Code) Debug support - not unit testing.
print public void print(PrintStream out)(Code) Debug helper - list the code to a stream
termIndex public int termIndex(int pc)(Code) Translate a program counter offset to the index of the corresponding
body term (or -1 if a head term or a dummy rule).
toString public String toString()(Code) Print clause as rule for tracing.