Getting Started with Elisa

Using EDS




Language Description

1. Lexical Elements
2. Basic Data Types and Expressions
3. Definitions
4. Streams
5. Backtracking
6. Statements and Special Expressions
7. Arrays
8. Lists
9. Descriptors
10. Components
11. Collections
12. Generic Components
13. Terms
14. Categories
15. Types 

16. Built-in Definitions
17. Higher-order Definitions

18. External Interfaces


Data Structures

1. Sequences
2. Examples involving Lists
3. Trees
4. Graphs
5. Searching State Spaces
6. Language Processing
7. Knowledge Representations          



1. Introduction
2. What are Domain Definitions?

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


Back Home Up Next


9.1 Descriptor Types
9.2 Descriptor Layout
9.3 Descriptor Creation
9.4 Selecting Descriptor Elements
9.5 Summary

Descriptors are used to describe concrete or abstract real world entities such as persons, cars, insurance policies, weather conditions, and so on. These kinds of entities are often described in terms of attributes or properties, like size, age, or color. Therefore a descriptor is a composite data structure with named elements that are used to characterize the attributes and properties of an entity. This chapter explains the concepts of descriptors and how to use them.


9.1 Descriptor Types

Each descriptor is of a user-defined type. Descriptors of the same type have the same structure. User-defined types are simply introduced by so-called descriptor-type-specifications. For example, the user may introduce the concept of an employee by specifying:

type Employee;

From now on, Employee is known as the name of a new descriptor-type.


9.2 Descriptor Layout

A descriptor is a data structure consisting of a fixed number of elements. Each element has a name, a type and a single value. The name of an element should be unique within the descriptor. The types of the elements in a descriptor may be different. The descriptor type is associated with the descriptor. The layout of the descriptor is described by a so-called descriptor constructor. For example, the descriptor constructor for an Employee may be:

Employee:[ Name= PersonsName; Hiredate= Date; Salary= Amount ]

A descriptor constructor starts with the name of the descriptor type, followed by a colon, followed by a list of elements within square brackets and separated by semicolons. In our example, an Employee-descriptor has three elements: Name, Hiredate, and Salary.


9.3 Descriptor Creation

A new descriptor is created by the evaluation of the descriptor-constructor. A descriptor-constructor is a special kind of expression. Its evaluation results in the creation of a corresponding descriptor and in the assignment of the specified values to its elements.

This means that in our example, after the creation of the Employee-descriptor, the PersonsName will be assigned to the Name element, that Date will be assigned to the Hiredate and that Amount will be assigned to the Salary element. Furthermore, Name will get the type of PersonsName, Hiredate will get the type of Date, and Salary will get the type of Amount.

Often, a descriptor-constructor is embedded in a function-definition. Such a function is called a constructor function, as in:

NewEmployee (Name= text, Date= text, Salary= integer) -> Employee;
NewEmployee (PersonsName, Date, Amount) =
	  Employee:[ Name=PersonsName; Hiredate=Date; Salary=Amount ];

Each call of NewEmployee will now result in the creation of a new Employee-descriptor, as will be shown in the following dialogue:

John = NewEmployee ( "John Smith", "3-7-90", 10000);
Employee:[ Name = "John Smith";
           Hiredate = "3-7-90"; 
           Salary = 10000];

In this dialogue, the user first introduces a new employee, John Smith, by calling the NewEmployee constructor function. The name John is assigned to the resulting descriptor.

The following step from the user is to ask for John. The system returns a textual representation of the Employee descriptor associated with John.

The dialogue session may be continued in the following way:

Mary = NewEmployee ( "Mary Ford", "9-4-91", 15000);
Employee:[ Name = "Mary Ford";
           Hiredate = "9-4-91"; 
           Salary = 15000];

In our example we used in the descriptor-constructor element definitions such as Name = PersonsName. In many cases, however, it is more convenient to use a single name as a short-hand notation for an element. Such a single name must refer to an existing name. If such a name is used then the element's name, type and value are copied from the referred name. So, our example can be rewritten, without any change in functionality, as:

NewEmployee (Name= text, Date= text, Salary= integer) -> Employee;
NewEmployee (Name, Hiredate, Salary) = Employee:[ Name; Hiredate; Salary ]; 

The elements Name, Hiredate and Salary are receiving their names, types and values from the corresponding parameters.

In practical applications, both the Name and the Hiredate are itself again descriptors, representing composite data structures. For example, Name may be composed of First Name, Middle Name, and Last Name. We will show later on, how descriptors of a given type can be used as elements of other descriptors. Also arrays and lists may be used as elements of descriptors. On the other hand, descriptors may also be used as elements of arrays and lists.


  • 9.1 Make a constructor function for Name which is composed of First Name, Middle Name, and Last Name.


9.4 Selecting Descriptor Elements

An element of a descriptor is selected by placing a period between the name of the descriptor and the name of the element. For example, to select the Salary of John, we may write:


Instead of John, we may also write an expression which represents John, or in a more general case, an expression which represents an Employee. We say that the element name is qualified by the descriptor expression. Suppose we want to ask for the Salary of any Employee, by means of a function:

ShowSalary (Employee) -> integer;
ShowSalary (Empl) = Empl.Salary;

We can now ask for the salaries of John and Mary:

ShowSalary (John)?
ShowSalary (Mary)?

If we want to change the salary of an Employee we define:

UpdateSalary (Employee, Increase = integer) -> nothing;
UpdateSalary (Empl, Inc) = [Empl.Salary:= Empl.Salary + Inc];

In the following dialogue the given definitions are used:

UpdateSalary (Mary, 2000);
ShowSalary (Mary)?
UpdateSalary (John, -1000);
ShowSalary (John)?

May be you have noticed that in this chapter three types of definitions were shown:

  • constructors, such as NewEmployee, which are creating new descriptors.
  • accessors, such as ShowSalary, which are retrieving data from descriptor-elements without changing them.
  • mutators, such as UpdateSalary, which are changing values of descriptor-elements.

Later on, we will see more applications of these different kinds of definitions.


  • 9.2 Define an accessor function for Name of Exercise 9.1 to retrieve the Last Name.
  • 9.3 Define a mutator function for changing the First Name of Exercise 9.1.


9.5 Summary

  • Descriptors may be used to describe real world entities. The elements of a descriptor are used to describe attributes or properties. Each element has a name, a type and a single value. The name of an element should be unique within the descriptor. The types of the elements in a descriptor may be different.
  • Constructor definitions are creating new descriptors.
  • Accessor definitions are retrieving data from descriptor-elements without changing them.
  • Mutator definitions are changing values of descriptor-elements.


Top of Page   Part 1: Language Description   Chapter 9: Descriptors


Home | Highlights of Elisa | Integrating Different Paradigms | Getting Started with Elisa | Demo's  | What is Domain Orientation | Bibliography | Copyright | News | Contact | Contents

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:

Domain Modeling | Concepts | Domain Definitions | Domain Operations | Domain Implementations | Systems | Case study: an Order processing system | Case study: an Airport Support system | Domain Orientation versus Object Orientation

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 


click tracking

This page was last modified on 27-05-2015 14:34:26   

free hit counter