« Back to CIDOC-CRM Project

Follow Up "Multiple Inheritance": Relation definition according to type

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Follow Up "Multiple Inheritance": Relation definition according to type
community class relation documentation
Answer
27/03/14 11:16
This question was raised after analysing the FAQ entry Multiple Inheritance and proceeding with solution 2.

How to describe the relation between two objects according the relation type?

RE: Relation definition according to type
Answer
26/07/13 10:42 as a reply to Anonymous.
Basically you can place any text or attribute value in form of a description in the graphical representation (GRAPHREP) of a relation. For more information see the corresponding section in the latest “Method Engineering” tutorial slides in the section of graphical representation.

For simplicity reasons, we use the STRING attribute “Name” in the relation “any2any”, but you can use any self-defined STRING attribute. You have to ensure that the GRAPHREP of the relation “any2any” displays the value of the attribute “NAME” with the keyword “ATTR”. To have the name placed in the centre of the relation, we use the keyword “MIDDLE”.

1
2GRAPHREP
3….
4MIDDLE
5ATTR "Name" w:c
6….



After having defined the STRING attribute, we need to extend the event handler for "CreateRelationInstance" in order to automatically change the name of the connector after the user has chosen the desired type.

This is done by adding the following statement after the command call that create the interref ( CC "Core" ADD_INTERREF ...) :
1
2#set the name of the connector
3CC "Core" SET_ATTR_VAL objid: (id_relationinstanceid) attrname: ("Name") val: (str_attrName)
4#--> RESULT ecode: intValue .


Now the STRING attribute “Name” has been set to the name of the INTERREF attribute, which is our relation type (e.g. ePy). In order to avoid manual overwriting of this attribute, ensure that it is either hidden – so it is not included in the ATTREP, or if included in the ATTREP and hence visible in the notebook, that it is read-only using the keyword “write-protected”.


A sample implementation can be downloaded in Solution Sample 2b V2: DOWNLOAD