In this series of posts we are going back to some basics (we have some more back to basic post series that you might be interested in) that even today are causing issues for new starters or infrequent users of Intelligent Advisor / Oracle Policy Modeling. It’s about relationships (reference relationships and containment relationships) and how they work / affect our Projects.
When we talk about relationships in Intelligent Advisor, we can basically think of them as being of two distinct types:
- Containment Relationships
- Everything else
Before we start talking about the details of relationships, let’s just get those two things above sorted out. If I create an entity called the family member and it is attached to Global, we say it is contained by global. It’s like one of those Venn diagrams from school.
The default position is that you can have N (0 to many) family members in your Global. You are able to change that to one (by clicking the many link) but let’s assume that you want to stick with that.
This is a Containment Relationship. You cannot remove it, unless you remove the Entity (in which case it will be removed for you). The entity cannot exist in our hierarchical world without a relationship defining where it exists in the hierarchy. Take the second example. I create another entity the pet, which has the family member as the parent. In this case, the Containment Relationship looks like this:
So in this case,the Containment is between the family member and the pet(s). We use these containment relationships whenever we want to create new instances of family members or pets. They show up in the New Input Dialog as little entity icons with red lines :
We can also use them to display existing entity instances, if we need to do that, using the New Control > Entity Container option. Essentially that is the job of Containment Relationships : help us define the set of pets, or the set of family members, and display them appropriately. The user adds pets or family members (on you write rules to infer their existence) and the containment relationship just fills up with pets or family members. That’s it. There is more to the concept of Containment, but this is a good start.
All of the example seen so far have been Containment relationships. So what are Reference Relationships? Well, the short answer is everything else. Any relationship that is not a Containment is a Reference relationship. But what does that mean?
Simple : if your relationship is something that a user has to select (for example, you want the user to show which pet belongs to which family member) or if the relationship is defined using logic, then it’s a reference relationship. Again, this is a simplification but it is a good start. So let’s look at a few examples:
In the above screen capture you can see we have added another entity, the shopping list item. Therefore, just like last time, there is a Containment Relationship between the family member and the shopping list item. In this case we have set it to be one to one. Each family member has a single shopping list item at a maximum.
But what about the relationship between the pet and the shopping list item. Is there one? If the answer is yes, then we need to create one. There is no hierarchical structure here – we need to explain the nature of the relationship. Let’s imagine we decide that it is also one to one – one pet, one shopping list item.
And if we want to be able to capture this information in our interview, we need to ensure that the reference relationship is available to the end user. So you need to ensure that you add it to your Screen. Note in the screenshot below the different icon. Depending on the cardinality (1-1, 1-N, N-N) you will have different display options. For our 1-1, a radio button is a good choice.
This Screen is likely to need a bit of work, because otherwise it might be too generic and rather hard to understand. Here is a quick example to illustrate what I mean
In the above screen capture, notice the following things:
- The Screen Title mentions %pet% which is a substitution so the Pet name will show in the Title
- The shopping list item, the family member and the shopping list item price are all used in the relationship control
- I used a radio button, since there is only one item per pet.
- Since in my Project there is no need to actually go through this from a logical point of view (Intelligent Advisor has not been informed in any way of the importance or relevance of what I’m doing so I have to set the Screen to show Always or it never shows 🙂
The result is shown above, with the shopping list item, price and family member name etc. shown in the Screen and Control.
From the point of view of Data your Debugger looks like this, once you have completed the whole thing and got to the last Screen.
The relationship is shown as a sort of multi-colored brick stack, and you can see the data (and modify it, based on whatever cardinality you defined). So it is a fully functional, manually accessible relationship.
In the next part of this series, we will continue our work and build on this with some other relationship features and functionality. You can also read about in the online help. The next part of this series, if you want to continue reading, is here…
Update : the Zip can be found here in the Shop, for free.