Specifying Entity Sets and Entity Instances

Specify Entity Sets and Entity Instances

A rulebase data model may also include a number of entities which have attributes attached to them. There are a number of rules that need to be observed when setting data for an entity:

 

Example:

If we had a rulebase with the following entity model:

 

 

In this case there are two types of entities (apart from the ever-present global entity) the person entity and the animal entity. Any person can have two relationships (in this example both relationships are "to-many":

 

1   <list-entity entity="person">
2     <entity label="Bob Smith">
3       <attribute id="name">
4         <text-val>Bob Smith</text-val>
5       </attribute>
6       <relationships>
7         <relationship name="pets">
8           <target ref="snoopy" />
9         </relationship>
10        <relationship name="children">
11          <target ref="Bob Jr" />
12        </relationship>
13      </relationships>
14    </entity>
15
16    <entity label="Bob Jr">
17      <attribute id="name">
18        <text-val>Bob Jr</text-val>
19      </attribute>
20      <relationships>

21        <relationship name="pets">
22          <target ref="snoopy" />
23        </relationship>
24      </relationships>
25    </entity>
26  </list-entity>
27
28  <list-entity entity="pet">
29    <entity label="snoopy">
30      <attribute id="name">
31        <text-val>Snoopy</text-val>
32      </attribute>
33      <attribute id="has_fleas">
34        <text-val>false</text-val>
35      </attribute>
36    </entity
37  </list-entity>

 

In the above example:

 

See also: