next up previous contents
Next: Derived Attributes and Up: Object Classes Previous: Independent and Dependent

Foreign Object Classes

Foreign object classes are used for modeling data in foreign databases. A foreign class definition is similar to the definition of a base object class, and contains in addition information on the name of the native foreign database and the name (foreign alias) of the corresponding class or relation in the foreign database.

<foreign class> ::= FOREIGN <base object class> <foreign info> 
                  ;
<foreign info> ::= <foreign db name or null> <foreign class name>
                 ;
<foreign db name or null> ::= DATABASE: <foreign database name>
                            | <null>
                            ;
<foreign class name> ::= ALIAS: <text>
                       | <null>
                       ;

For example, suppose that data on maps and people is included in two different databases. In the first database (specified in OPM), class MAP has attribute attribute Owner whose value class consists of PERSON which is specified in a (foreign) database called people_DB.

1

FOREIGN_DATABASES: { ("people_DB", "foreign database people") }

OBJECT CLASS MAP 
   ID: MapNr
   ATTRIBUTE MapNr: [1,1] CHAR(10)
   ATTRIBUTE Name: [1,1] VARCHAR(80)
                            DESCRIPTION: "map name"
   ATTRIBUTE Owner: [0,1] PERSON
                            DESCRIPTION: "owners in people database"
FOREIGN OBJECT CLASS PERSON 
   DATABASE: "people_DB"
   ALIAS: "PERSONS"
   ATTRIBUTE SSN: [1,1] CHAR(9)
   ATTRIBUTE Name: [1,1] VARCHAR(80)
   ATTRIBUTE OtherName: [0,1] VARCHAR(100)

1

Note that a foreign class definition can have attributes that do not necessarily appear in the foreign database. For example, attribute OtherName of class PERSON can represent local aliases for persons.