HP 3000 Manuals

Relationships [ HP System Dictionary XL Gen. Ref. Vol. 1 ] MPE/iX 5.0 Documentation


HP System Dictionary XL Gen. Ref. Vol. 1

Relationships 

Relationships are dictionary definitions that express a logical
connection between the real-world objects of an information network.
Most relationships involve two entities and are called binary 
relationships.  System Dictionary supports binary relationships, as well
as N-ary relationships that involve from three to six entities.  A
relationship serves two main purposes:

 *  Relationships express a connection between entities.  The fact can be
    expressed that a VPLUS form named WINERY contains a field named
    VINTAGE by creating the relationship WINERY contains VINTAGE using
    the relationship type FORM contains ELEMENT. This dictionary
    definition documents the true connection between the form and the
    field.

 *  Relationships describe a context in which an entity is used.  As
    already mentioned, an entity has attribute values that provide a
    general description of an object.  Relationships also have attribute
    values.  They document the entity in a specific context or usage.

A relationship definition has three parts:

 *  An ordered list of the entities involved in the relationship.

 *  A relationship type, a dictionary category to which the relationship
    belongs.  A relationship type is an ordered list of entity types
    paired with a connecting name called a relationship class.

 *  Attribute values that further define and characterize the
    relationship (or, in some cases, one of the entities in the
    relationship).

These relationship components are discussed next.

Specifying Entity Lists 

A relationship does not have a name.  It has a list of names representing
the entities involved in the relationship.  Before you can create a
relationship, all the entities in the entity list must already exist.
Also, if you delete one of the entities involved in a relationship,
System Dictionary automatically deletes the relationship.  The order of
the entity list is significant.  The relationship CUSTOMER-ADDRESS
contains LAST-NAME, for example, is not the same as LAST-NAME contains
CUSTOMER-ADDRESS.

Specifying Relationship Types 

Relationships belong to categories called relationship types.  A
relationship type has two parts:  an ordered list of entity types that
serves as a template for defining the entity list, and a relationship
class that expresses the action or connection of the relationship.  When
you create or access a relationship, you must specify the relationship
type.

For example, RECORD contains ELEMENT is a relationship type in the System
Dictionary core set.  This relationship type requires that all
relationships of this type must involve two entities.  The first entity
must be of type RECORD, and the second must be of type ELEMENT. The
relationship class (contains) expresses the fact that the record contains
the element.

When you create or access a relationship, you must use a relationship
type that already exists in the dictionary or System Dictionary issues an
error.  System Dictionary comes with a built-in set of relationship types
called core set relationship types.  You can also add an extended set of
relationship types.  You can create relationships using any relationship
type in the core set or extended set.  Figure 3-4 illustrates an example
of a relationship type and a relationship occurrence of that relationship
type.  In the example, IMAGE-DATABASE and IMAGE-DATASET are the entity
types of the relationship type, CONTAINS is the relationship class, and
SCOPE-OWNER, IMAGE-DATABASE-TYPE, and IMAGE-DATASET-TYPE are attributes
of the entity types.  SCOPE-OWNER and CAPACITY are attributes of the
relationship type.

In the RELATIONSHIP shown, ENGINEERING, TURBO, and MANUAL are the
attribute values of the entities CORP and R&D, while ENGINEERING and 117
are the attribute values of the relationship.

[]
Figure 3-4. Relationship Types vs. Relationships Specifying Relationship Classes In System Dictionary, a relationship type and, consequently, all relationships belonging to the type are qualified by a relationship class that describes the connection or action of the relationship. The System Dictionary core set includes relationship types like contains, uses, redefines, and other commonly used connecting words. The relationship class is required when more than one relationship type in the dictionary involves the same ordered list of entity types. In the core set, for example, there are three relationship types involving element pairs: ELEMENT contains ELEMENT ELEMENT redefines ELEMENT ELEMENT references ELEMENT The first type describes a parent-child relationship. The second describes elements that share common storage space in a program. The third type documents an element that references another element, as in a Pascal type reference. When creating or retrieving relationships defined with non-unique entity type lists like these, you must specify the relationship class as a qualifier or System Dictionary issues an error. Remember that a relationship type is an entity-type list paired with a relationship class. Many of these pairs are built into the dictionary core set, and you can extend the dictionary structure by adding your own pairs. When you create a relationship, however, you cannot mix and match entity-type lists and relationship classes. You must use an existing pair, or System Dictionary issues an error stating that the relationship type does not exist. Relationship Attribute Values Relationships have attribute values that describe the relationship definition itself, such as when it was created, who "owns" it, and so on. You can also use the attribute values of a relationship to describe one of the entities involved in the relationship. Attribute values can provide a description of the entity in a particular context. Table 3-3 shows some sample relationships of the type FORM contains ELEMENT. Each "row" in the table represents a relationship involving two entities, shown in the first two columns. The other columns contain values for the attributes SCOPE-OWNER and FIELD-ENHANCEMENT. The SCOPE-OWNER attribute applies to the relationship definition itself (who owns it in the dictionary). The FIELD-ENHANCEMENT value refers to an object. Table 3-3. Relationships of type FORM contains ELEMENT -------------------------------------------------------------------------------------------------- | | | | | | FORM | ELEMENT | SCOPE-OWNER | FIELD-ENHANCEMENT | | | | | | -------------------------------------------------------------------------------------------------- | | | | | | CUSTOMERS | LAST_NAME | DA | N | | SALES | PURCHASE_PRICE | RON | HI | | BURGERS | PURCHASE_PRICE | KELLY | HU | | CHEESE_CODES | NAME | SAM | B | | | | | | -------------------------------------------------------------------------------------------------- N-Ary Relationships System Dictionary allows relationships that involve up to six entities. Relationships involving more than two entities are called N-ary relationships. An example of an N-ary relationship type is the core set type IMAGE-DATASET ELEMENT ELEMENT IMAGE-DATASET IMAGE-DATABASE chains. This relationship type defines an IMAGE data base chain by including the detail data set, search item, sort item, master set, and data base in a single relationship. An N-ary relationship allows you to define multiple relationships in a single definition. It also prevents part of the definition from being left out. You cannot create an N-ary relationship unless you specify all the entities. If it is necessary to omit one of the entities in an N-ary relationship, you may use a slash (/) to indicate a null entity. Creating and Accessing Relationships You can create, delete, modify, and retrieve relationships. To create, delete, or modify a relationship, the dictionary must be open in shared or exclusive update mode. To retrieve a relationship, the read and read only mode are sufficient. When you create a relationship, you must specify a list of already existing entities that will be involved in the relationship. You must specify the relationship type as an ordered list of entity types corresponding to the entity list. If the entity type list you specify is not unique in the dictionary (for example, ELEMENT ELEMENT), you must qualify the entity type list by relationship class (for example, contains). When you create a relationship, you can specify a list of attributes and their values. The list may contain any attribute associated with the entity type, plus any alias attribute. Variable-length attribute values are to be assigned later, after you create the relationship. To retrieve a relationship, the dictionary can be open in read, read only, shared update, or exclusive update mode. You retrieve a relationship to determine whether it exists, or to retrieve one or more of its attribute values. You can request a value for any attribute associated with the relationship type, or for any alias or variable-length attribute. When the dictionary is open in read, read only, shared update, or exclusive update mode, System Dictionary allows you to retrieve dictionary structure information that is needed to create, delete, modify, and retrieve relationships. You can retrieve a list of relationship types and relationship classes available in the dictionary. Also, you can retrieve the list of attributes associated with a relationship type, and a list of the alias and variable-length attributes since you can assign these to any relationship. Detailed instructions for creating, deleting, modifying, and retrieving relationships are located in other HP System Dictionary/XL manuals. Refer to the HP System Dictionary/XL SDMAIN Reference Manual (32256-90001) for instructions to do these operations with the System Dictionary user interface, or to the HP System Dictionary/XL Intrinsics Reference Manual (32256-90002), if using the System Dictionary intrinsics.


MPE/iX 5.0 Documentation