Dynamic View Services > Defining Runtime Access to the Server Model > Declaring Runtime Relations > Basic Macros
 
Basic Macros
To declare a runtime relation, choose the appropriate basic macros depending on the kind of relation (ownership, use, or inverse relation) and arity (unary or n-ary relation). Each of these macros is used with the following arguments:
*The type of the relation holder, which must be a runtime type.
*The type of the relation target(s), which must also be a runtime type.
*The relation name.
*In the case of an inverted relation, the name of the direct relation that is inverted, as the fourth argument.
The code sample from the Company example below illustrates the use of these macros (the macros for other members are omitted):
ILS_ENTITY_BEGIN(Company)
ILS_OWNS_N(Company,Department,departments)
ILS_USES_N(Company,Project,projects)
...
ILS_ENTITY_END(Company)
 
ILS_OBJECT_WITH_ID_BEGIN(Project,identifier)
ILS_OWNS_N(Project,Contribution,contributions)
ILS_USES_1(Project,Manager,manager)
ILS_INVERTED_N(Project,Company,companies,projects)
...
ILS_OBJECT_END(Project)
 
ILS_OBJECT_BEGIN(Department)
ILS_OWNS_N(Department,Employee,employees)
ILS_USES_1(Department,Manager,manager)
ILS_INVERTED_1(Department,Company,company,departments)
...
ILS_OBJECT_END(Department)
 
ILS_OBJECT_BEGIN(Employee)
ILS_INVERTED_1(Employee,Department,department,employees)
ILS_INVERTED_N(Employee,Contribution,contributions,employee)
...
ILS_OBJECT_END(Employee)
 
ILS_OBJECT_BEGIN(Contribution)
ILS_USES_1(Contribution,Employee,employee)
...
ILS_OBJECT_END(Contribution)
The runtime relations associated with the ownership and use relations declare their modifiers to the server model interpreter. Those associated to inverted relations have no associated modifier since an inverted relation should never be edited directly.
If a new target object is inserted into the relation, the default modifier of a runtime ownership relation automatically performs a cut of the ownership relation on this object before it is inserted.

Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.