Define an entity

An entity is a grouping of things with rules or data in common. An entity often represents a group of people (eg children, applicants, stakeholders) but it can also represent a group of objects (eg textbooks), activities (eg assignments) or concepts (eg school terms).

By defining entities, the same set of rules can be used for multiple instances of the same type, and rules can be written which relate to all of those instances.

A member of the entity group is called an entity instance. For example, if a family had 2 children, Sarah and Peter, Sarah would be one instance of "the child" entity and Peter would be another instance of "the child" entity. By creating an entity to represent "the child", information such as the child's age can be collected for each child.

We can also infer attributes from this data just as we can in a normal rule. Therefore, the attribute "the child is a young child" can hold a different value for each child, depending on the child's age. For instance, if we had a rule:

the child is a young child if the child's age < 8

we could infer the following:

Child Instance 1 (Sarah) Child Instance 2 (Peter)
the child's age = 6 the child's age = 12
the child is a young child = true the child is a young child = false

What do you want to do?

Understand the different types of entities

Create an entity in a properties file

Define the identifying attribute for an entity

Understand the different types of entities

There are two types of entities: regular entities and the global entity.

Entities

An entity can have zero or more entity instances. For example, children in a family, applicants on an application form, taxable events in a tax period. Using entities you can apply the same rules, or collect the same data, for multiple instances of an entity.

An attribute of an entity may hold one value at a time during an investigation for each instance of the entity. That attribute may have as many values as there are instances of the entity, and will only operate within the context of that entity instance.

Global Entities

Not all information relevant to your rules may belong to a particular entity. As such, Oracle Policy Modeling has a global entity which acts as a catch-all for information that does not belong to any other entity. For example "the sun is shining" is a global attribute that does not belong to the entity "the family, "the child" and so forth.

An attribute of a global entity may only hold one value at a time during an investigation, and that value persists across the entire rulebase, common to all entities and instances of entities.

The global entity is the default location of attributes. If you do not create entities in your rulebase, or if you create an attribute which does not belong to another entity, the attribute will be stored in the global entity.

The following diagram shows how instances of a child in a family situation have entity attributes:

 

 

In the diagram, both children are in the same family and are going to the same holiday destination, but each has their own distinct properties (entity attributes), such as name, age and favorite animal.

Create an entity in a properties file

Entities are declared in a properties file for the project, rather than in individual Word and Excel documents. This eliminates the need to re-declare the same entities in each rule file.

When an entity is created, a containment relationship is also specified for the new entity, to ensure that the containment structure in the rulebase data model is well-defined.

To add an entity to a properties file:

  1. In Oracle Policy Modeling, double-click the properties file in the Project Explorer. The file will open in the right hand pane.
  2. Right-click on the Global entity in the Entities tab and select New Entity... The Create New Entity dialog box will open.



  3. In the Create New Entity dialog box, enter the textual form of the entity name in Entity text field. TIP: Entities should be named using the definite article 'the', eg 'the family', 'the child', 'the friend', 'the school' etc.
  4. Optionally, enter a Public name for the entity. This is a user-defined name that overrides the entity text. You should define a public name for an entity when the entity name in the data model differs from the entity name in the source material.
  5. Optionally, enter an Identifying attribute for the entity. See Define the identifying attribute for an entity below.
  6. Select the Containing entity if necessary.
  7. Change the Relationship type if necessary.
  8. Enter the Forward Relationship Text for the containment relationship. The containment relationship for an entity will always be a "to-one" relationship to the containing (parent) entity, ie either many-to-one or one-to-one. Note that the Containment area in the Create New Entity dialog box shows the relationship in the direction from the containing (parent) entity to the child entity. (The automatically-created public name for the forward relationship will be shown as the forward relationship text is added.)
  9. Enter Reverse Relationship Text for the containment relationship if appropriate. (The automatically-created public name for the reverse relationship will be shown as the reverse relationship text is added.)
  10. Click OK.

 

The entities that you have added will now be displayed on the Entities tab in the properties file, in the structure specified by the containment relationships:

 

After you have defined an entity in this way, every attribute which uses the exact entity text (eg 'the child') becomes an entity-level attribute belonging to that entity.

Define the identifying attribute for an entity

The identifying attribute for an entity is the text attribute whose value is used for labelling instances of the entity in decision reports, Web Determinations and the debugger. So for instance, in the Data view in the debugger, instead of the entity instances being labeled 'entity1', 'entity2', 'entity3' etc, they will be labeled according to the value of the chosen identity attribute. For instance, if you chose 'the child's name' as the identity attribute for the entity 'the child', then after you have set values for 'the child's name', the child entity instances would be labeled in the debugger accordingly, eg, 'Reid', 'Cohen' and 'Emery'.)

 

 

To define an identifying attribute for an entity, do the following:

  1. In Oracle Policy Modeling, double-click the properties file in the Project Explorer. The file will open in the right hand pane.
  2. In the Entities tab, right-click the entity and select Edit Entity...
  3. In the Edit Entity dialog box, click the browse button next to the Identifying attribute field.
  4. In the Attribute Selector dialog box, search for the attribute by text or ID.
  5. Once found, select the attribute and click OK, then click OK in the Edit Entity dialog box.

 

See also: