

3.1 Concepts and Domains 3.2 The Use of Domain Definitions 3.3 Sorts of Domains 3.3.1 Composite Domains 3.3.2 Selection Domains 3.3.3 Enumeration Domains 3.3.4 Optional Domains 3.3.5 Repetitive Domains 3.3.6 Subdomains 3.3.7 Equivalent Domains 3.3.8 Predefined Domains 3.4 Definitions of Domains 3.5 Manipulations of Domain Definitions 3.5.1 Substitution of Domain Definitions 3.5.2 Introduction of New Domain Definitions 3.6 Domain Expressions 3.6.1 Adding Operations 3.6.2 Selection Operations 3.6.3 Optional Operations 3.6.4 Repetitive Operations 3.6.5 Overview of important domain equations 3.7 Basic Domain Definitions 3.8 Guidelines 3.9 Summary The second step of the conceptual modeling process is to translate the key concepts of step 1 into domain definitions. The resulting domain definitions are used in following steps of the conceptual modeling process. In this chapter we will discuss what domains definitions are, how concepts can be expressed by domain definitions, and how domain definitions can be adapted to different needs.
Concepts are abstract notions of things in the real world or in the problem space. Because we want to model concepts in such a way that they can be understood by a computer, we need a method to represent those concepts in a program. For that purpose we will use domains and domain definitions. A domain is the representation of a concept in the computer. Concepts in the problem space are represented by corresponding domain definitions and domain operations. Domains are the computer counterparts of concepts in the problem space. In the preceding chapter we saw that the definition of a concept is based on other concepts. The same applies to the definition of domains. A domain definition defines how a domain is based upon other domains. Dependencies between concepts of the problem space are represented by dependencies between domain definitions. Often, a direct translation of a concept description into a corresponding domain definition is not feasible. Mainly, because a concept has many characteristics which are difficult to express in a domain definition. Many characteristics are also not relevant for the problem to be solved. Take for example, the concept of a person; not all aspects of persons can be recorded in a computer, because there are too many. But also, in a computer program we are only interested in a limited number of aspects of a person. For example, often we only have the need to identify a person, while we are not interested in his or her hair color, or size, or weight, or emotions. Translation of concepts into domains means a reduction of information. As a consequence, only a limited subset of all the characteristics of a concept will be represented by the corresponding domain.
3.2 The Use of Domain Definitions After the decision has been made what aspects of a concept should be described by a corresponding domain, a domain definition can be written. For example, we may want to describe the concept of a person. Let us assume that there is only a need to identify a person, and that three aspects of a person are sufficient for identification: name, address, and birth date. This can be expressed by the following domain definition:
Domain definitions are used to define new domains in terms of other domains. In this example, person is a new domain based on the name, address, and birthdate domains. So, we may read the definition as: the person domain consists of the name domain and the address domain and the birthdate domain. A domain represents a set of all possible elements. Thus, the name domain represents the set of all possible names, the address domain represents the set of all possible addresses, and the birthdate domain represents the set of all possible birthdates. Consequently, the person domain represents the set of all possible persons who can be characterized by the name domain, the address domain, and the birthdate domain. Our definition of person is based on three other domains which should also be defined. For an initial domain model the following domain definitions may suffice:
In this example, all three domains will be represented by text domains. Further refinement is not required. The text domain is an example of a predefined domain which will be discussed later on. Although in an initial domain model the name, address, and birthdate may be represented by text values, in real applications, this is often not sufficient. In that case, further refinements are necessary, such as:
These definitions state that the name domain is based on two other domains, the address is based on three domains, and the birthdate domain is based on a single domain. These domains should also be defined:
The only remaining composite domain is the date domain, which we will further define as: year = integer << range 1900 .. 2100 >>month = integer << range 1 .. 12 >>day = integer << range 1 .. 31 >> The integer domain is another example of a predefined domain. Note that we are using beside the definitions, comments, to specify additional information. This is the end of the exercise to define the domain of a person. The complete set of domain definitions is shown in Figure 31. In this example, we have not only defined domains for the concept of person, but also for other concepts as name, address, and date. person = name + address + birthdatename = firstname + familyname firstname = text familyname = textaddress = street + city + state street = text city = text state = textbirthdate = date date = year + month + day year = integer << range 1900 .. 3000 >> month = integer << range 1 .. 12 >> day = integer << range 1 .. 31 >> Figure 31: Example of a set of related domain definitions Remember that these domain definitions are the results of a topdown approach: start with a domain definition for a key concept in the problem space and define successively all the referred domains until all domains have been expressed in other domains or in predefined domains. Exercises:
There are different sorts of domains, depending on the way they are defined. For our modeling purposes we will distinguish the following sorts of domains:
These 8 sorts of domains will be described in the following sections.
A composite domain is composed of other domains. These other domains are called the elements of the composite domain. The elements are separated by the '+' character, which is a binary operator. It is pronounced as and . In Figure 31, the domains of person, name, address, and date are composite domains, as will be clear from their definitions: person = name + address + birthdate name = firstname + familynameaddress = street + city + statedate = year + month + day Elements of a composite domain may also be composite domains. For example, the elements of the composite domain person, being name, address, and birthdate, are also composite domains.
A selection domain consists of a number of alternative domains. Alternative domains are separated by the vertical bar '' character, which is a binary operator. It is pronounced as or . As an example, let us use the concept of customer defined in the previous chapter. A customer has been defined as being a person or an organization. We may express that in the following way:
In this example, customer is a selection domain. This definition may be read as: A customer is a person or an organization. It may also be read as a domain definition: the customer domain consists of the person domain or the organization domain. If we assume that the domain of a person is already defined (see Figure 31), then only the domain of organization need to be defined. This may be any sort of domain. For example, organization can also be defined as a selection domain:
Exercises:
An enumeration domain represents a distinct number of elements. Those elements are enumerated by the domain definition. Domain elements are enclosed by single quotes and separated by the vertical bar ''. As an example, let us assume that a person as specified in Figure 31 is also characterized by its sex:
The sex domain can be defined as an enumeration domain with only two elements:
Another example of an enumeration domain is the main wind directions:
Note, that 'North', 'East', 'South', and 'West' are names of elements of the direction domain, they are not names of other domains. Exercise:
An optional domain is a domain which may or may not be present. Square brackets are used to denote an optional domain. As an example, let us assume that the name of a person may or may not include a middle name. This can be specified in the following way:
In this example, [middlename] is an optional domain.
A repetitive domain consists of the repeated occurrence of a domain. Curly braces are used to denote a repetitive domain. As an example, let us assume that a family consists of a father, a mother and a number of children. This can be defined as follows: Family = Father + Mother + ChildrenFather = personMother = personChildren = { person } The last line defines the domain of Children as a repetitive domain. The curly braces may be read as "zero or more", or as "some number of". So, children is defined as zero or more persons, or as some number of persons. A domain may be based on several repetitive domains. Take, for example, the definition of a set of domains for playing chess: chess = white_pieces + black_pieceswhite_pieces = { piece }black_pieces = { piece }piece = kind + positionkind = 'king'  'queen'  'castle'  'knight'  'bishop'  'pawn'position = column + rowcolumn = 'a'  'b'  'c'  'd'  'e'  'f'  'g'  'h'row = integer << range 1 .. 8 >> Domains may also be recursively defined. For example, a machine consists of a number of parts; the parts themselves may consists of other parts, and so on, as defined by: machine = machine_name + {part}part = part_name + sub_partssub_parts = {part} Parts are recursively defined via subparts. The recursion stops as soon as a part has a part_name but no subparts. Exercises:
A subdomain is a domain which represents a subset of all possible elements of a given domain. For example, the set of male persons is a subset of the set of persons. The same applies to female persons. This may be represented by the following domain definitions: maleperson = subdomain(person) << sex of person is 'Male' >>femaleperson = subdomain(person) << sex of person is 'Female' >> A male person is a subdomain of person, a female person is another subdomain of person. Based on subdomains, other subdomains may be defined, such as woman and girl: woman = subdomain(femaleperson) << age of femaleperson > 18 >>girl = subdomain(femaleperson) << age of femaleperson <= 18 >> Exercise:
A domain can be defined to be equivalent to another domain. For example, client may be another name for customer. This may be expressed as:
In this example, the client domain is equivalent to the customer domain. Caution: If clients are special customers then the domain of client is a subdomain of customer and should be defined accordingly.
Predefined domains are domains which can directly be represented in Elisa. Therefore they need no further definitions. The predefined domains are:
A definition of a domain is introduced with the symbol =; in this context , the = symbol is read as "is defined as", or "consists of", or "based on". Thus, the notation:
could be read in any of the following ways:
Note, that domain definitions are not Elisa definitions! Domain definitions are metalinguistic tools used for modeling of problem space concepts. However, where applicable, we will use for domain definitions the same notational conventions as used for the lexical elements of Elisa. A domain definition has the following format:
A domain name is a simple name which may be defined only once. Consequently, two definitions of the same domain, as in
is not allowed, because A is defined twice. The domain expression may consist of several operations and operands as will be discussed later on. A domain definition may optionally be followed by comment. For comment we will use the same conventions as used in Elisa. For example, we may write:
Note that we have described the relevant units and the relevant range as comment. In addition to the units and the range, you may also need to specify the accuracy or precision of the domain. For a domain like price, for example, it may be important to indicate whether the values will be expressed in whole dollars, to the nearest penny, and so on. And in many engineering and scientific applications, it is important to indicate the number of significant digits in the domain values.
3.5 Manipulations of Domain Definitions The translation of concepts into domain definitions is not always a straight forward process. In practical situations, domain definitions are rearranged, or redefined, before a satisfactory set of domain definitions is obtained. After the key concepts of the concepts list have been translated into corresponding domain definitions, it is quite likely that you want to revise the set of domain definitions, either by changing the original definitions or by manipulating the domain definitions. In this section we will examine two techniques for formal manipulation of domain definitions. In the following section we will evaluate rules for algebraic manipulations of domain expressions.
3.5.1 Substitution of Domain Definitions The name of a domain in the right hand part of a definition may be substituted by its definition. So, in the domain definition for person of Figure 31, we may substitute the definitions for name, address, and birthdate:
We use parentheses to group domains together; they do not effect the result. The definition is equivalent to:
By means of this substitution we created a composite person domain with 6 elements. However, we have lost by this substitution the concepts of name, address and birthdate. Sometimes, this is what we want, because fewer concepts may help to simplify the model. But, sometimes substitution does not help to simplify the model; on the contrary, the loss of a domain name also means losing its semantic meaning. In our example, date may be interpreted in many different ways, such as birth date, the date when moved to the current address, the date of marriage, and so on. Because birthdate has a clear meaning, it should not have been substituted. That substitution can be pushed too far will be even more clear if we continue our substitution process until all domain references have been replaced by their definitions. The result is:
In this definition all semantic information has disappeared. It is a domain definition without any meaning. Exercises:
3.5.2 Introduction of New Domain Definitions It is also possible to do the inverse of substitution: define new domains and use these new domain names to simplify existing domain definitions. Suppose we have the following domain definitions:
These two domains have a number of common domains. We can introduce an additional domain representing the common domains and rewrite the other domains as follows:
In general, introducing a new domain can be useful if the new domain represents a concept which makes sense in the problem domain. Particularly, if the new domain represents a concept belonging to a concepts hierarchy, as in our example. On the other hand, the introduction of new domains which do not represent concepts in the problem domain may cause problems in following modeling steps.
A domain expression may consist of several operations and operands. For example, we may write in a domain definition:
or:
There are only a limited number of rules for building domain expressions. Here they are:
The last rule says that parentheses may be used in domain expressions to specify the order of domain operations. By applying these rules repeatedly, it is possible to build more and more complex domain expressions. We will discuss in more detail the following operations in domain expressions:
Note, that optional brackets and repetitive braces are considered to be operations in domain expressions.
Adding operations are used to specify the composition of domains. The operands of an adding operation are separated by the adding operator which is represented by the '+' character. The adding operator is a binary operator. The addition of two domains will result in a new domain. Thus the domain expression: a + b means that the two domains a and b are added together to form a new, composite domain. As in conventional algebra, the result of an adding operation is independent of the order in which the operands are taken. In other words: addition is commutative, as expressed by the equation: (1) a + b = b + a commutativity Because the order of operands is not important, it means, for instance, that the following domain definitions are all equivalent:
Parentheses may be used to group domains together without effect on the result. Consequently, the following expressions are all equivalent:
This second property is expressed by saying that addition is associative, as formulated by: (2) a + b + c = (a + b) + c = a + (b + c) associativity If three domains are being added, parentheses can be placed around either the first two or the last two, while the domains in parentheses are added first, and their result is added to the remaining term. The two results are, however, always equal and may be expressed as a + b + c. Just as we have number zero in normal algebra, we have a null domain. A null domain is a domain without any element. The following equation holds for the addition of null domains: (3) a + null = a In words, adding a null domain to another domain has no effect.
Selection operations are used to specify the selection of domains. The operands of a selection operation are separated by the selection operator which is represented by the '' character. The selection operator is a binary operator. The domain expression: a  b states that the resulting domain is either a or b. The result of a selection operation is independent of the order in which the operands are taken. In other words: selection is, just as the adding operation, commutative, as expressed by the equation: (4) a  b = b  a commutativity Because the order of operands is not important, it means, for instance, that the following domain definitions are all equivalent:
If a and b are the same domains then no selection is needed. Thus: (5) a  a = a Thus:
can be reduced to:
Parentheses may be used to group domains together without effecting the result. That means, for instance, that the following expressions are all equivalent:
This property is expressed by saying that the selection operation is associative, as formulated by: (6) a  b  c = (a  b)  c = a  (b  c) associativity If three domains are being selected, parentheses can be placed around either the first two or the last two, while the domains in parentheses are selected first, and their result is used to select the remaining term. The two results are, however, always equal and may be expressed as a  b  c. The  operator has a lower precedence level than the addition operator. This means, for example, that:
and
The following equation holds for the distribution of addition over selection: (7) a + (b  c) = a + b  a + c distributivity It says that if a domain is added to a selection domain then that domain may be added to the elements of the selection domain. As an example, let us assume that we want to add to a customer, which is either a person or an organization, a billing address, then the following equation holds: customer + billing_address =( person  organization ) + billing_address =billing_address + ( person  organization ) = by (1)billing_address + person  billing_address + organization by (7)
Optional operations are used to specify optional domains. The operand of an optional operation is enclosed by square brackets. The domain expression: [a] states that the resulting domain is either a or null. In general, the following equation holds for domains between brackets: (8) [a] = a  null As a consequence, the following equation holds for optional domains: (9) a + [b] = a + b  a Proof: a + [b] = a + (b  null) by (8)= a + b  a + null by (7)= a + b  a by (3) As an example, let us assume that the name of a person may or may not include a middle name. This can be specified in the following way:
Based on given equations we can now derive: name = firstname + [middlename] + familyname= (firstname + [middlename]) + familyname by (2)= (firstname + middlename  firstname) + familyname by (9)= firstname + middlename + familyname  firstname + familyname by (1) and (7) So, the name domain is equivalent to:
which is what we expected. Exercises:
Repetitive operations are used to specify repetitive domains. The operand of a repetitive operation is enclosed by curly braces. The domain expression: {a} states that the resulting domain is a repetition of a domains. In general, a repetitive domain means: (10) {a} = null  a  a + a  a + a + a  ... The number of a's in a repetitive domain is indefinite. If the number is zero, the repetitive domain is empty. For example, we specified that the domain of children in a family is a repetition of the domain of persons:
which is the same as:
Exercises:
3.6.5 Overview of important domain equations The equations of the most important domain operations are given in the following overview (see Figure 32). (1) a + b = b + a commutativity (2) a + b + c = (a + b) + c = a + (b + c) associativity (3) a + null = a (4) a  b = b  a commutativity (5) a  a = a (6) a  b  c = (a  b)  c = a  (b  c) associativity (7) a + (b  c) = a + b  a + c distributivity (8) [a] = a  null (9) a + [b] = a + b  a (10) {a} = null  a  a + a  a + a + a  ... Figure 32: Overview of Domain Equations
The translation of concepts into domain definitions and the manipulation of those definitions may result in a set of domain definitions which may reflect the intentions of the analyst but which may not be suitable for further processing. The reason is that following steps of the modeling process will require specific forms of domain definitions in order to be able to define domain operations and to use Elisa language elements for implementation of the domain specifications. Hence, domain definitions must be transformed into basic domain definitions in order to be prepared for the following steps of the domain modeling process. The rules for simplification are discussed in this section. To simplify domain definitions, the rules for manipulating domain definitions and domain expressions can be used. To arrive at basic domain definitions, there are a few rules to follow:
In many cases a domain definition can be simplified by the introduction of a new domain definition. For example, if a repetitive domain is specified as {a + b}, then this expression can be simplified by introducing a new domain: c = a + b and the repetitive domain becomes: { c } as required by rule 2.
The second step of domain modeling is to translate the key concepts of step 1 into domain definitions. The resulting domain definitions are used in following steps of the domain modeling process. Often the best way to start is to determine for the key concepts of the problem space those characteristics which should be recorded in the computer. Based on this the corresponding domain definitions can be defined. Then all the domain elements of these domain definitions should be defined. After an initial set of related domain definitions has been obtained, this set should be reviewed if it reflects the concepts of the problem space. Use the lists of key concepts and candidate concepts obtained in step 1, as check lists and revise them accordingly. In many cases, the translation of concepts into domain definitions is not a straight forward process. Often, domain definitions should be redefined, or rearranged, before a satisfactory set of domain definitions is obtained. After the set of domain definitions has been tuned to reflect the concepts of the problem space, further transformation may be necessary to arrive at a set of basic domain definitions which can be used by the following modeling steps. Also here formal manipulation of domain definitions may be necessary. The resulting set of basic domain definitions are representing an information model of the system.
