In the above graph model, we have a tree, this is what our decisions are going to fit into, and we have the first rule. The first rule asks: Are you age 21 or older? If the answer is true, then you go down to the yes node. From the IS_TRUE relationship, you are allowed to get into the club.
If the answer is false, and you are not age 21 or older, then we check something else. We then ask: Are you 18 or older?
Then the gender equals some gender, and we don’t know what that is just yet. And if that’s true, then that is great. That means that you are allowed to get in as well. However, if it’s false, out you go. You are not allowed in.
How can I apply these kind of rules on new triplets that will come inside the graph (node-relation-node)?
I think so what you are trying to understand here is how can this model be dynamic, i.e. with every addition of a new rule in the form of triplets can be included into the existing model without breaking the existing model.
One suggestion here could be to use triplets for each rule separately. So like there can be triplet with main node having the rule(if age >= 21) and two result nodes based on outcome(true/false). Another separate triplet for another rule(if age>=18) and similarly its possible outputs. And another third one for the third rule(for gender).
Then have these groups/triplets connected to each other through some kind of Relationship maybe something like a relationship [:NEXT_RULE] and separate nodes for each eventual outcome (like one node for "allowed in club" and another for "cannot enter club").
So this would look something like, We first hit the first rule, see if age is greater than 21, if yes we go follow the [:TRUE] relationship and go to the left node of that triplet, then that left node goes by a relationship to the outcome node that says "allowed in club".
If in the initial rule we flow through [:FALSE] then we got to the other node of the triplet which would again flow to another rule(whether greater than 18yrs) through a relationship [:NEXT_RULE]. Then further the process will flow similarly through the next rule.
The Advantages this gives is-
We can always have new rules incoming that can easily be added to the existing model by just connecting them to existing rule's outcome.
We could have common rules that can be used throughout different combination and be used multiple times in different decision tress without the need to create them again in the model.
We could also add in rules that might have more than 2 possible outcomes and won't affect the existing model as there is enough flexibility in this approach.