Relationships

You can model relationships between objects. The type of construct that you use determines the type of relationship. You can define single-valued and multi-valued relationships.

Use the is a keyword to make one object type acquire the attributes of another object type; this object type has the type of that object type.

Use the is related to keyword to create a relationship between an object type and an entity type. Do not use is related to to create a relationship between an object type and an event type or a concept. Use the has construct to create an attribute instead.

The following examples show single-valued relationships to entity types.

a flight is related to an aircraft.
a flight event is related to a flight.

The following example shows a multi-valued relationship to entity types.

a flight is related to some crew members.

The following example shows a multi-valued relationship to an entity type, where a flight entity can be related to several crew member, but it can be related to the same crew member only once.

a flight is related to several different crew members.
The following example shows several relationships in the same is related to statement.
a customer is related to a store, named the preferred store and a friend (a customer).

Relationship inferred from the context

To create a relationship, you can use a term that you already defined. The type of the relationship is then inferred from the defined term.

In the following example, the statement is interpreted in a context where airport is already defined. The type of the relationship departure airport is inferred from its name and corresponds to the already defined airport. The existing term must be the last term in the expression. For example, in the expression departure airport, airport is the last term.

a flight is related to a departure airport.

The type cannot be inferred from predefined types. For example, the expression purchase date is not interpreted as a date but as a string.

This inference mechanism also applies to multi-valued relationships.

In the following example, boarded customers is inferred from an existing customer entity type.

a flight is related to some boarded customers.

If stated explicitly, this statement is equivalent to the following statement:

a flight is related to some boarded customers (customers).

Relationship specified by a type

You can specify the type between parentheses, or by using the that is, that are, and named the keywords.

  • Parentheses:

    In a multi-valued relationship, the type that is specified must be in plural:

    a car is related to some drivers (persons).
  • that is and that are keywords:
    a car is related to some drivers that are persons.
  • named the keyword:
    a car is related to a person, named the driver.

    You can use the named the keyword only on single-valued relationships.