The Entity-Relationship Model [ HP System Dictionary XL Gen. Ref. Vol. 1 ] MPE/iX 5.0 Documentation
HP System Dictionary XL Gen. Ref. Vol. 1
The Entity-Relationship Model
System Dictionary is based on a structure called an Entity-Relationship
model. The theoretical model is composed of entities, that represent
pieces of real-world data in an information network, and relationships
between entities. This model is general enough that it can describe
most, if not all, of the information processing done on a computer
network.
A simple example of the E-R model might represent a data base called
COMPANY, which contains a file called PERSONNEL. In this example, the
entities are COMPANY and PERSONNEL, and the relationship between the two
is contains. A standard illustration for this example is shown in Figure
3-1 below.
Figure 3-1. E-R Model
Within System Dictionary, the E-R model has been enhanced and also
includes entity types, relationship types, relationship classes, and
attributes. These are definitions within the structure of System
Dictionary, and they support the creation, maintenance, and retrieval of
the entities and relationships, which comprise the bulk of the
definitions within the dictionary. The components of the E-R model are
described on the following pages. The E-R structure is illustrated in
Figure 3-2.
Figure 3-2. System Dictionary E-R Structure
Entities
Entities are dictionary definitions that refer to tangible objects in an
information network. In System Dictionary, an entity definition has
three parts:
* An entity name--usually the name of a real object.
* The entity type, a dictionary category to which the entity belongs.
* Attribute values that further define and characterize the entity.
An entity is therefore a unique pairing of an entity name with an entity
type. For example, to create a dictionary definition of an IMAGE data
base named ORDERS, you would need to create an entity named ORDERS of
entity type IMAGE-DATABASE. To define a VPLUS form named CUSTOMERS, you
would need to create an entity named CUSTOMERS of type FORM. If there is
also an IMAGE data set named CUSTOMERS, you would need to define an
entity named CUSTOMERS of type IMAGE-DATASET. The dictionary would then
contain two CUSTOMERS entities, but they would be unique when qualified
by entity type FORM or IMAGE-DATASET.
Special Entity Naming
Entity names have the same restrictions as discussed in Chapter 2 under
the Syntax discussion. Along with those restrictions there are two
reserved entity names.
The two reserved entity names in System Dictionary are the slash (/) and
the question mark (?). These entity names have a special meaning in
creating or accessing relationships. You can use the slash name in a
relationship to indicate a null entity. You can use the question mark
name in relationship retrieval to indicate that any entity name is
acceptable in a given position. Entity names may include slashes and
question marks. The restriction is that you cannot use them as entity
names except in the relationship contexts just described. For example,
you cannot create an entity named ?, but you can create entities named
ORDER?NUMBER or A/B.
Specifying Entity Types
Entity types are dictionary categories that you must specify when you
create, delete, modify, or retrieve an entity. When you create or access
an entity, you must specify an entity type that already exists in the
dictionary. If the entity type you specify does not exist, the access
fails. System Dictionary has a built in set of entity types, called core
set entity types. You can also add your own extended set of entity
types. Any entity type in the core set or extended set is available to
all users of the dictionary. The core set and extended set are discussed
in Chapter 6 of this manual.
An example of entities and entity types is illustrated in Figure 3-3.
The top half of the figure shows the entity types (as ellipses) and the
attributes of those entity types (as boxes). The lower half shows
specific entity occurrences (CORP and R&D) of the respective entity
types, and the attribute values of the attributes associated with them.
Figure 3-3. Entity Types vs. Entities
Entity Attribute Values
Entities have attribute values that define and characterize the entity
definition itself (when it was created in the dictionary, the owner,
etc.) or that describe the entity's tangible object. Table 3-1 shows
some sample entities of the entity type IMAGE-DATASET. Each entity in the
table refers to a data set in an IMAGE data base. In the first column of
the table are the entity names. The other columns contain values for the
attributes SCOPE-OWNER, DATE-CREATED, and IMAGE-DATASET-TYPE. The
SCOPE-OWNER and DATE-CREATED attributes describe the entity definitions
themselves--who owns them and when they were created in the dictionary.
The IMAGE-DATASET-TYPE attribute describes each entity's real-world
object, a particular IMAGE data set. In the CUSTOMERS entity, for
example, the IMAGE-DATASET-TYPE attribute indicates that the CUSTOMERS
data set is a manual master.
Table 3-1. Entities of type IMAGE-DATASET
-------------------------------------------------------------------------------------------------
| | | | |
| IMAGE-DATASET | SCOPE-OWNER | DATE-CREATED | IMAGE-DATASET-TYPE |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| CUSTOMERS | DA | 5/20/86 | MANUAL |
| SALES | RON | 4/18/86 | RELATION |
| BURGERS | KELLY | 4/25/86 | DETAIL |
| CHEESE-CODES | SAM | 7/21/86 | AUTOMATIC |
| | | | |
-------------------------------------------------------------------------------------------------
Every entity of type IMAGE-DATASET must have a value for each of these
attributes (plus other attributes not shown in the abbreviated table).
You can think of an entity type as defining an imaginary "table" of
entity information. Each "row" in the table corresponds to an entity,
including its name and attribute values. The entity type has a list of
associated attributes, and each attribute has a "column" in the table.
When you create an entity, a row is added to the table, and you must
specify a value in each attribute "column" (or allow the attribute value
to be defaulted).
When you retrieve an entity, you can request all or part of the
conceptual "table" by specifying a complete or partial attribute list.
Only the values corresponding to the attributes you specify are returned.
The complete attribute list of the IMAGE-DATASET entity type is shown in
Table 3-2. When you retrieve an entity of type IMAGE-DATASET, you can
request a value for any of these attributes.
System Dictionary supports attributes of type alias and variable-length
(described later in this chapter). These attributes are "free-floating"
in that they are never associated with an entity type, but you can assign
values for these attributes to any entity. Not every entity needs alias
or variable-length attributes, so the as-needed method of attribute
assignment helps conserve space in the dictionary.
Table 3-2. Core-Set Attribute List Examples
------------------------------------------------------------------------------------------
| |
| Entity Type Core-Set Attribute List |
| |
------------------------------------------------------------------------------------------
| |
| ELEMENT DATE-CREATED COUNT |
| |
| DATE-CHANGED DECIMAL |
| |
| SCOPE-OWNER DISPLAY-LENGTH |
| |
| SCOPE-CHANGED ELEMENT-TYPE |
| |
| SENSITIVITY JUSTIFY |
| |
| ID-NUMBER SIGN |
| |
| BLANK SYNCHRONIZE |
| |
| BYTE-LENGTH UNITS |
| |
| IMAGE-DATASET SCOPE-OWNER SENSITIVITY |
| |
| SCOPE-CHANGED ID-NUMBER |
| |
| DATE-CREATED IMAGE-DATASET-TYPE |
| |
| DATE-CHANGED |
| |
------------------------------------------------------------------------------------------
Creating and Accessing Entities
In System Dictionary, you can create, delete, modify, and retrieve
entities.
To create an entity, the dictionary must be open in shared or exclusive
update mode. When you create an entity, you must specify its external
name, its entity type, an attribute list, and values for each attribute
in the list. The attribute list may contain any attribute associated
with the entity type, plus any alias attribute. Variable-length
attribute values are assigned later, after you create the entity. When
you create an entity, you can specify an internal name. If you do not
specify an internal name, it will default to the external name.
Modifying an entity means changing the entity's external name or
assigning new attribute values. To modify an entity, the dictionary must
be open in shared or exclusive update mode.
To delete an entity, the dictionary must be open in shared or exclusive
update mode. When you delete an entity, relationships, variable-length
attribute values, aliases, and other information are also deleted.
To retrieve an entity, the dictionary must be open in read, read only,
shared update, or exclusive update mode. One reason to retrieve an
entity is to determine whether it exists. Another reason is to retrieve
one or more of the entity's attribute values. You retrieve the attribute
values by specifying the list of attributes for which values are to be
returned.
When the dictionary is open in read, read only, shared update, or
exclusive update mode, you can retrieve information about dictionary
structure that is needed to create, modify, delete, or retrieve entities.
When you create or access an entity, you must specify the entity type.
System Dictionary allows you to retrieve the list of entity types
available in the dictionary. You can also retrieve information about the
attributes associated with an entity type so that you can assign values
to the appropriate attributes. Since you can assign any alias or
variable-length attribute to any entity, System Dictionary also allows
you to retrieve information about these attributes.
Detailed instructions for creating, deleting, modifying and retrieving
entities 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