I've got my ObjectTypeNodes, my AlphaNodes, my BetaNodes, my AlphaMemories, my BetaMemories and my ProductionNodes. Everything is set, I'm all ready to start constructing the Rete Network.
Most of my test-rules provide little or no problem at all. I hook up a chain of AlphaNodes after an ObjectTypeNode and end it all with an AlphaMemory. If it's the "first" AlphaMemory for this Rule I also make a LeftInputAdapterNode. Then I hook up the "first" BetaNode's leftInput to the LeftInputAdapter and the rightInput to the AlphaMemory that holds the second variable's type and so on and so on until there's no more BetaNodes left and I add on the ProductionNode.
In cases like that there's no problem. This is also the "classic" portrait of what a Rete Network looks like. Almost every example I've seen has had this "look", but what if there's no condition in the rule that requires joining? Say that we'd write a rule like this:
>>> import pyRetesure, it's stupid. But never mind that.
... def foo(a = Type1, b = Type2):
... if a.n == 1 and b.n == 2:
... print "Score!"
At the moment, pyRete makes two ObjectTypeNodes, two AlphaNodes and a ProductionNode. But there's no way to trigger the Action because the Rete Network "stops" at the AlphaMemories. So now I have to decide, do I perform a dummy join in the ProductionNode or do I set up a dummy BetaNode that feeds the ProductionNode? Also, are there more situations like this? Looks like I'm spending this week going through some source code to check out how Drools and Sumatra handles this situation.
BTW. Charles Young updated Wikipedia this week with more details on the Rete Algorithm. I likes.