java.lang.Object
org.apache.jena.reasoner.rulesys.impl.RuleClauseCode
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.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final byte
Allocate a new environment framestatic final byte
call a built-in operation defined by a rule clause (clauseIndex(static final byte
call a predicate code object (predicateCodeList)static final byte
call a predicate code object with run time indexing (predicateCodeList)static final byte
call a table code object ()static final byte
call a pure triple match (predicate)static final byte
call a table code object from a wildcard ()static final byte
reset an argument to an unbound variable (Ai)static final byte
reset a temp variable to an unbound variable (Ti)static final byte
reset a permanent variable to an unbound variable (Yi)static final byte
fetch constant argument (const, Ai)static final byte
deconstruct a functor argument (functor)static final byte
fetch temporary variable argument (Ti, Ai)static final byte
fetch permanent variable argument, first occurance (Yi, Ai)static final byte
variant on CALL_PREDICATE using the last call optimization, only current used in chain rulesstatic final byte
create a functor object from a rule template (templateFunctor)static final int
The maximum number of argument variables allowed in a single goal Future refactorings will remove this restriction.static final int
The maximum number of permanent variables allowed in a single rule clause.static final int
The maximum number of temporary variables allowed in a single rule clause.static final byte
return from a call, proceeed along AND treestatic final byte
put constant value into call parameter (const, Ai)static final byte
put a dereferenced permanent variable into call parameter ready for BUILTIN call (Yi, Ai)static final byte
put permanaent variable into call parameter, first occurance (Yi, Ai)static final byte
put temp variable into call parameter (Ti, Ai)static final byte
put permanaent variable into call parameter (Yi, Ai)static RuleClauseCode
Dummy code block which just returnsstatic final byte
Test if an argument is bound (Ai)static final byte
Test if an argument is unbound (Ai)static final byte
fetch temporary variable argument, later occurance (Ti, Ai)static final byte
fetch permanent variable argument, later occurance (Yi, Ai) -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
compile
(LPRuleStore ruleStore) Compile the rule into byte code.Object[]
getArgs()
Return the argument vector associated with this clauses' byte codes.byte[]
getCode()
Return the byte code vector for this clause.getRule()
Return the rule from which this code block was compiled.static void
Debug support - not unit testing.void
print
(PrintStream out) Debug helper - list the code to a streamint
termIndex
(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).toString()
Print clause as rule for tracing.
-
Field Details
-
GET_CONSTANT
public static final byte GET_CONSTANTfetch constant argument (const, Ai)- See Also:
-
GET_VARIABLE
public static final byte GET_VARIABLEfetch permanent variable argument, first occurance (Yi, Ai)- See Also:
-
UNIFY_VARIABLE
public static final byte UNIFY_VARIABLEfetch permanent variable argument, later occurance (Yi, Ai)- See Also:
-
GET_TEMP
public static final byte GET_TEMPfetch temporary variable argument (Ti, Ai)- See Also:
-
UNIFY_TEMP
public static final byte UNIFY_TEMPfetch temporary variable argument, later occurance (Ti, Ai)- See Also:
-
PUT_CONSTANT
public static final byte PUT_CONSTANTput constant value into call parameter (const, Ai)- See Also:
-
PUT_NEW_VARIABLE
public static final byte PUT_NEW_VARIABLEput permanaent variable into call parameter, first occurance (Yi, Ai)- See Also:
-
PUT_VARIABLE
public static final byte PUT_VARIABLEput permanaent variable into call parameter (Yi, Ai)- See Also:
-
PUT_DEREF_VARIABLE
public static final byte PUT_DEREF_VARIABLEput a dereferenced permanent variable into call parameter ready for BUILTIN call (Yi, Ai)- See Also:
-
PUT_TEMP
public static final byte PUT_TEMPput temp variable into call parameter (Ti, Ai)- See Also:
-
CALL_PREDICATE
public static final byte CALL_PREDICATEcall a predicate code object (predicateCodeList)- See Also:
-
GET_FUNCTOR
public static final byte GET_FUNCTORdeconstruct a functor argument (functor)- See Also:
-
CALL_PREDICATE_INDEX
public static final byte CALL_PREDICATE_INDEXcall a predicate code object with run time indexing (predicateCodeList)- See Also:
-
CALL_TRIPLE_MATCH
public static final byte CALL_TRIPLE_MATCHcall a pure triple match (predicate)- See Also:
-
LAST_CALL_PREDICATE
public static final byte LAST_CALL_PREDICATEvariant on CALL_PREDICATE using the last call optimization, only current used in chain rules- See Also:
-
CALL_TABLED
public static final byte CALL_TABLEDcall a table code object ()- See Also:
-
CALL_WILD_TABLED
public static final byte CALL_WILD_TABLEDcall a table code object from a wildcard ()- See Also:
-
PROCEED
public static final byte PROCEEDreturn from a call, proceeed along AND tree- See Also:
-
MAKE_FUNCTOR
public static final byte MAKE_FUNCTORcreate a functor object from a rule template (templateFunctor)- See Also:
-
CALL_BUILTIN
public static final byte CALL_BUILTINcall a built-in operation defined by a rule clause (clauseIndex(- See Also:
-
CLEAR_VARIABLE
public static final byte CLEAR_VARIABLEreset a permanent variable to an unbound variable (Yi)- See Also:
-
CLEAR_TEMP
public static final byte CLEAR_TEMPreset a temp variable to an unbound variable (Ti)- See Also:
-
CLEAR_ARG
public static final byte CLEAR_ARGreset an argument to an unbound variable (Ai)- See Also:
-
ALLOCATE
public static final byte ALLOCATEAllocate a new environment frame- See Also:
-
TEST_BOUND
public static final byte TEST_BOUNDTest if an argument is bound (Ai)- See Also:
-
TEST_UNBOUND
public static final byte TEST_UNBOUNDTest if an argument is unbound (Ai)- See Also:
-
MAX_PERMANENT_VARS
public static final int MAX_PERMANENT_VARSThe maximum number of permanent variables allowed in a single rule clause. Now only relevent for initial holding clause.- See Also:
-
MAX_ARGUMENT_VARS
public static final int MAX_ARGUMENT_VARSThe maximum number of argument variables allowed in a single goal Future refactorings will remove this restriction.- See Also:
-
MAX_TEMPORARY_VARS
public static final int MAX_TEMPORARY_VARSThe maximum number of temporary variables allowed in a single rule clause.- See Also:
-
returnCodeBlock
Dummy code block which just returns
-
-
Constructor Details
-
RuleClauseCode
Constructor.- Parameters:
rule
- the rule to be compiled
-
-
Method Details
-
getCode
public byte[] getCode()Return the byte code vector for this clause. -
getArgs
Return the argument vector associated with this clauses' byte codes. -
getRule
Return the rule from which this code block was compiled. -
compile
Compile the rule into byte code.- Parameters:
ruleStore
- the store of LP rules through which calls to other predicates can be resolved.
-
termIndex
public int termIndex(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). -
print
Debug helper - list the code to a stream -
toString
Print clause as rule for tracing. -
main
Debug support - not unit testing.
-