Class RETEClauseFilter
- java.lang.Object
-
- org.apache.jena.reasoner.rulesys.impl.RETEClauseFilter
-
- All Implemented Interfaces:
RETENode
,RETESourceNode
public class RETEClauseFilter extends java.lang.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 byte
ADDRFunctorNode
Argument addressing code: triple object functor node, offset in low nibble, only usable after a successful TestFunctorName.static byte
ADDRObject
Argument addressing code: triple object as a wholestatic byte
ADDRPredicate
Argument addressing code: triple predicatestatic byte
ADDRSubject
Argument addressing code: triple subjectstatic byte
BIND
Instruction code: Bind a node (arg1) to a place in the rules token (arg2).static byte
CREATEToken
Instruction code: Create a result environment of length arg1.static byte
END
Instruction code: Final entry - dispatch to the network.static byte
TESTFunctorName
Instruction code: Check literal value is a functor of name arg1static byte
TESTIntraMatch
Instruction code: Cross match two triple entries (arg1, arg2)static byte
TESTValue
Instruction code: Check triple entry (arg1) against literal value (arg2).
-
Constructor Summary
Constructors Constructor Description RETEClauseFilter(byte[] instructions, java.lang.Object[] args)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RETENode
clone(java.util.Map<RETENode,RETENode> netCopy, RETERuleContext context)
Clone this node in the network.static RETEClauseFilter
compile(TriplePattern clause, int envLength, java.util.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
setContinuation(RETESinkNode continuation)
Set the continuation node for this node.
-
-
-
Field Detail
-
TESTValue
public static final byte TESTValue
Instruction code: Check triple entry (arg1) against literal value (arg2).- See Also:
- Constant Field Values
-
TESTFunctorName
public static final byte TESTFunctorName
Instruction code: Check literal value is a functor of name arg1- See Also:
- Constant Field Values
-
TESTIntraMatch
public static final byte TESTIntraMatch
Instruction code: Cross match two triple entries (arg1, arg2)- See Also:
- Constant Field Values
-
CREATEToken
public static final byte CREATEToken
Instruction code: Create a result environment of length arg1.- See Also:
- Constant Field Values
-
BIND
public static final byte BIND
Instruction code: Bind a node (arg1) to a place in the rules token (arg2).- See Also:
- Constant Field Values
-
END
public static final byte END
Instruction code: Final entry - dispatch to the network.- See Also:
- Constant Field Values
-
ADDRSubject
public static final byte ADDRSubject
Argument addressing code: triple subject- See Also:
- Constant Field Values
-
ADDRPredicate
public static final byte ADDRPredicate
Argument addressing code: triple predicate- See Also:
- Constant Field Values
-
ADDRObject
public static final byte ADDRObject
Argument addressing code: triple object as a whole- See Also:
- Constant Field Values
-
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:
- Constant Field Values
-
-
Method Detail
-
compile
public static RETEClauseFilter compile(TriplePattern clause, int envLength, java.util.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 clauseenvLength
- the size of binding environment that should be created on successful matchesvarList
- 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 interfaceRETESourceNode
-
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.
-
-