1

I am having an issue understanding RETE algorithm Beta node JoinNode and notNode?

enter image description here

Documentation says :

There are two two-input nodes, JoinNode and NotNode, and both are types of BetaNodes. BetaNodes are used to compare 2 objects, and their fields, to each other. The objects may be the same or different types. By convention, we refer to the two inputs as left and right. The left input for a BetaNode is generally a list of objects; in Drools this is a Tuple. The right input is a single object. Two Nodes can be used to implement 'exists' checks. BetaNodes also have memory. The left input is called the Beta Memory and remembers all incoming tuples. The right input is called the Alpha Memory and remembers all incoming objects.

I understood, Alpha Node: Various literal conditions for drl rules but above documentation for BetaNodes is confusing me a bit.

say below is drl condition for above diagram:

$person : Person( favouriteCheese == $cheddar )

Query: 1) what are these left and right inputs to two-input Beta Nodes exactly as explained in above documentation? I believe it's referring to facts and rules where I believe tuples would be facts?

2) notNode would be basically drl condition matching literal condition with not?

Updated question on 6Sep17:

3) I believe above diagram represent joinNode, how would notNode be represented , if above workflow is altered to suit notNode?

Kimchy
  • 501
  • 8
  • 24

1 Answers1

0

The condition corresponding to the diagram would be

Cheese( $name: name == "Cheddar" )
Person( favouriteCheese == $name )

Once there is a match, a new tuple consisting of the matching Cheese and Person is composed and can act as a new tuple for further matches if there is a third pattern in the condition.

A not-node would be one that asserts the non-existence of some fact. It would fire only once.

You might find a much better description of "rete" on the web.

laune
  • 31,114
  • 3
  • 29
  • 42
  • So, only validated Pojo instances which match are only referred as tuples and not other unmatched facts (Person Cheese pojo instances)? – Kimchy Sep 05 '17 at 18:26
  • In the above program,arenot Cheese and Person objects acting as input. I mean in above diagram as per documentation what is lhs and rhs input when documentation say " The left input for a BetaNode is generally a list of objects; in Drools this is a Tuple. The right input is a single object." – Kimchy Sep 05 '17 at 20:02
  • Laune, you been great help to people and i hope you wont mind clarifying my basic conceptual issues :) I believe above diagram represent joinNode, how would notNode be represented , if above workflow is altered to suit notNode? – Kimchy Sep 06 '17 at 04:23
  • Please understand that Rete is a complex topic. You can use it without needing to understand technical details of the linkage of the network's nodes. It should be sufficient to know that the network represents all (complete and ull) matches of facts to LHS patterns and conditions. – laune Sep 06 '17 at 12:44
  • Yes, i know it can be drools library can be implemented without getting into algorithm complexity but i am keen to learn more on algorithm being used at the backend and trying to gain clarity through official docs. – Kimchy Sep 06 '17 at 18:28