Infer Membership of a Relationship
You can infer that existing entity instances are members of a relationship using an inferred relationship rule. The syntax for inferred relationship rules is:
- <target entity> is a member of <relationship text> if, or
- IsMemberOf(<target entity>, <relationship text>) if
Note that membership rules must be written in the positive form. That is, it is not possible to infer that an entity is not a member of a relationship. Relationship membership can then be used as a condition (called a membership statement) in another rule, in the positive or negative form.
A relationship conclusion can only ever be the top line of a rule. (If the syntax is used anywhere else in a rule, then it will be treated as a membership statement.)
All subsequent rule levels for this conclusion must have the source entity and the target entity in its reasoning scope. The relationship used must be defined as either a many-to-many relationship, or a one-to-many relationship from the global entity. (For more information on relationship types, see Types of Relationship.) A relationship must only be inferred in its primary direction.
For example, the Is Member Of function could be used to conclude membership of the inferred relationship 'the person's household' as shown below.
| Example rule | Inputs | Output | |||
|---|---|---|---|---|---|
| the child | the child's address | the person | the person's address | the child is a member of the person's household | |
|
the child is a member of the person's household if the child's address = the person's address |
Sam | 15 Melbourne Avenue Canberra | James | 21 Sydney Avenue Canberra | false |
| Mark | 60 Northbourne Avenue Canberra | Sarah | 60 Northbourne Avenue Canberra | true | |
For this rule to validate the following entities and relationship must be defined in the project: a source entity 'the person' , a target entity 'the child' and a many-to-many relationship 'the person's household'.
Note that an inferred relationship will be partially known if its target entity is not complete. For more information on entity completion, see Ensure a Decision Can Be Made.
An inferred relationship will also be partially known if the rule used to infer it returns unknown for some, but not all, of the potential target entity instances. Take the example rule below where "the customer" entity has a many-to-many relationship ("the customer's triple A products") to "the product" entity.
the product is a member of the customer's triple A products if
the rating of the product = "AAA"
If we have the following entity instances:
- Customer "customer0"
- Product "product0" with rating "AAA"
- Product "product1" with rating "BBB"
- Product "product2" with unknown rating
then when the above rule is evaluated to infer customer0's "the customer's triple A products" relationship, the rule will return true for product0, false for product1, and unknown for product2. Hence product0 is a target of the relationship, and product1 is not a target of the relationship. product2 on the other hand may or may not be part of the relationship - this cannot be determined until its rating is provided.
Therefore customer0's "the customer's triple A products" relationship is partially known, with one known target (product0), and one known "not target" (product1). product2 may or may not be a target of the relationship - this cannot be determined until more information is provided. Known and partially known targets are shown in the Debugger on the Data tab like this:
Combining inferred relationships with manually created relationships or with temporal values is not allowed.
Tip: To see rules that infer membership of a relationship, open the Worked Example 1 project in Oracle Policy Modeling.