Relationships

You can model relationships between objects. The type of construct that you use determines the type of relationship. You can also define simple and multiple relationships.

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

Use the is related to keyword to create a relationship to an instance of an entity type. Do not use is related to to create a relationship to an instance of an event type or a simple concept. Use the has construct to create an attribute instead.

The is related to keyword creates relationships where both objects can exist independently of the relationship.

The following examples show simple relationships to instances of entity types.

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

The following example shows a multiple relationship to instances of an entity type.

a flight is related to some crew members.

The following example shows a multiple relationship to an entity type where each instance has a unique identifier.

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 attribute is then inferred from the defined term.

In the following example, the statement is interpreted in a context where airport is already defined. The departure airport is inferred from 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 departure airport is an airport.

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

This inference mechanism also applies to multiple 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 and that are keywords.

  • Parentheses:

    In a multiple 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 this construction only on unary relationships.