Specifying the Cardinality of Relations
An important property of a relation is its cardinality, which specifies how many instances of the relation's first class can be related to how many instances of the relation's second class.
You specify the cardinality of a relation in the Type-of-relation attribute, which can be one of the values listed in the following table.
Type-of-relation attribute value
|
Description
|
|---|
One-to-one
|
An instance of the relation's first class can be related to at most one instance of the relation's second class, and an instance of the second class can be related to at most one instance of the first class.
For example, each server on a network can have only one backup server, and each backup server can support only one server.
|
One-to-many
|
An instance of the relation's first class can be related to one or more instances of the relation's second class, and an instance of the second class can be related to at most one instance of the first class.
For example, one local-area network supports connections to one or more computer nodes, and each computer node can be connected to only one local-area network.
|
Many-to-one
|
One or more instances of the relation's first class can be related to at most one instance of the relation's second class, and an instance of the second class can be related to one or more instance of the second class.
For example, each of many computer nodes can be connected to one local-area network, and the local-area network supports connections to more than one computer node.
|
Many-to-many
|
An instance of either of the relation's classes can be related to one or more instances of the other class. This is the default cardinality.
For example, each printer in a local-area network can be the print server for more than one computer node, and each computer node on the network can be served by one or more printers.
|
As soon as you enter the relation name, the first class, and the second class in the relation's table, G2 displays a description of the possible relations based on the type of relation. If you change the type of relation, G2 updates this description.
For example, the following description shows how two computers are related based on a many-to-many relation named in-communication-with.
Copyright © 1997 Gensym Corporation, Inc.