Data Structures   3.  Sorts of Domain Definitions 4.  Manipulations of Domain Definitions 5.  Translating Domain Definitions 6.  Dialogue Sessions 7.  Example of Concentric Circles 8.  Example of Domain Substitution applied to Concentric Circles 9.  Example of an Order Processing Application 10.Example of an Airport Information System 11.Example of a Rental Boat Business 12.Benefits of Domain Definitions

3.  Sorts of Domain Definitions

There are different sorts of domain definitions. The following sorts are distinguished:

1.        Compound domain definitions

2.        Alternative domain definitions

3.        Collection domain definitions

4.        Enumeration domain definitions

5.        Sub-domain definitions

6.        Equivalent domain definitions

7.        Predefined domain definitions

Each definition consists of a name followed by a ‘=’ character, followed by the remaining part of the definition. The remaining part determines the sort of the domain definition and is closed by a semicolon. The order of domain definitions is not important. Text between << and >> is comment.

In the following sections the different sorts of domain definitions will be described.

3.1 Compound Domain definitions ;

A compound domain definition is composed of references to other domain definitions. These references are names of other domain definitions and are called the elements of the compound domain. The elements are separated by the ‘+’ character. For example, the following domain definitions of Person, Name, Address, and Date are compound domain definitions:

Person   = Name + Address + Birthdate;

Name     = Firstname + Familyname;

Address = Street + City + State;

Date       = Year + Month + Day;

3.2 Alternative Domain definitions

An alternative domain definition consists of a number of references to other domain definitions. The references are separated by the ‘|’ (or) character. For example, we take the concept of a customer. A customer of a company may be a person or an organization. This can be expressed in the following way:

Customer = Person | Organization;

In this example, Customer is an alternative domain. This definition may be read as: A customer is a person or an organization. If we assume that the domain of a Person is already defined, then only the domain of Organization need to be defined. This must be the name of another compound domain. For example, Organization can be defined as:

Organization = Name + Address;

3.3 Collection Domain definitions

A collection domain definition specifies a collection of domains. In an earlier example we introduced Children as a collection of Persons:

Children = collection (Person) ;

The collection phrase may be read as “zero or more”, or as “some number of” Persons.

Let us use another example. We assume that a company consists of a number of divisions and that each division consists of a number of departments and that each department has a number of employees.

Company       = collection (Division);

Division          = collection (Department);

Department   = collection (Employee);

Employee       = Person;

Domain definitions 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 = machinename + collection (part);

part = partname + subparts;

subparts = collection (part);

Parts are recursively defined via subparts. The recursion stops as soon as a part has a partname but no subparts.

3.4 Enumeration Domain definitions

An enumeration domain represents a distinct number of elements. Those elements are enumerated by the domain definition. As an example of an enumeration domain we specify the main wind directions:

Direction = enum (North,  East, South, West);

Note, that North, East, South, and West are names of elements of the Direction domain; they are not names of other domain definitions. As another example, let us assume that a person is also characterized by its Gender:

Person = Name + Birthdate + Gender;

The gender domain can be defined as an enumeration domain with only two elements:

Gender = enum (Male, Female);

3.5 Sub-domain definitions

A sub-domain is a domain that represents a subset of all possible elements of a given domain. For example, money can be defined as a sub-domain of real numbers.

Money = subdomain (real);

real      = predefined;

Based on these domain definitions we may define the dollar and the euro:

Dollar = subdomain (Money);

Euro   =  subdomain (Money);

3.6 Equivalent Domain definitions

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:

Client = Customer;

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 sub-domain of customer and should be defined accordingly.

3.7 Predefined Domain definitions

Predefined domain definitions are domain definitions that can directly be represented in Elisa[14]. Therefore they need no further definitions. The predefined domain definitions in our current implementation are:

boolean

character

integer

real

text

term

symbol

 Part 6: Metaprogramming Sorts of Domain Definitions

 Introduction: Home | Highlights of Elisa | Integrating Different Paradigms | Getting Started with Elisa | Demo's  | What is Domain Orientation | Bibliography | Copyright | News | Contact Language Description: Lexical Elements | Basic Data Types and Expressions | Definitions | Streams | Backtracking | Statements and Special Expressions | Arrays | Lists | Descriptors | Components | Collections | Generic Components | Terms | Categories | Types | Built-in Definitions | Higher-order Definitions | External Interfaces | Index Data Structures: Sequences | Examples involving Lists | Trees | Graphs | Searching State Spaces | Language Processing | Knowledge Representations Domain Modeling: Design Patterns: Introduction | Abstract Factory | Builder | Factory Method | Prototype | Singleton | Adapter | Bridge | Composite | Decorator | Facade | Flyweight | Proxy | Chain of Responsibility | Command | Interpreter | Iterator | Mediator | Memento | Observer | State | Strategy | Template Method | Visitor