next up previous contents
Next: Derived Classes Up: Derived Attributes Previous: Attribute Composition Derivation

User Specified Derivation

A user specified derived attribute can be associated with one or more retrieval methods defining how the attribute values are computed. Retrieval methods are specified as attribute properties, and each retrieval method is defined for an individual platform. Currently only one platform is provided: OPM_SQL.

For example, the derived attribute length of class ENTRY can be defined as a user specified attribute as well:

OBJECT CLASS ENTRY
   DESCRIPTION: "an entry is part of a sequence from begin_pos to end_pos"
   ID: entry_id
   ATTRIBUTE entry_id: [1,1] INTEGER
   ATTRIBUTE from_sequence: [0,1] SEQUENCE
   ATTRIBUTE (begin_pos, end_pos): [0,1] (INTEGER, INTEGER)
   ATTRIBUTE length
                   DERIVATION: userspecified
                   DESCRIPTION: "length from beginning position to end position"
                   PROPERTIES: "OPM_SQL"
                               "select _oid = _oid,
                                length = (end_pos - begin_pos + 1)
                                from ENTRY where _oid = @oid;"

Note that the object identity and the derived attribute must be selected in the SQL query in the property. For a derived tuple attribute, all the component attributes must be selected in the SQL query in the property.