EXPRESS Language Syntax

All EXPRESS reserved words are case insensitive. However, for emphasis they are presented in upper case throughout this section.

Keywords

The following is a list of the EXPRESS language keywords.

Abstract

AGGREGATE

ALIAS

ARRAY

AS

BAG

BEGIN

BINARY

BOOLEAN

BY

CASE

CONSTANT

CONTEXT

DERIVE

ELSE

END

END_ALIAS

END_CASE

END_CONSTANT

END_CONTEXT

END_ENTITY

END_FUNCTION

END_IF

END_LOCAL

END_MODEL

END_PROCEDURE

END_REPEAT

END_RULE

END_SCHEMA

END_TYPE

ENTITY

ENUMERATION

ESCAPE

FIXED

FOR

FROM

FUNCTION

GENERIC

IF

INTEGER

INVERSE

LIST

LOCAL

LOGICAL

MODEL

NUMBER

OF

ONEOF

OPTIONAL

OTHERWISE

PROCEDURE

QUERY

REAL

REFERENCE

REPEAT

RETURN

RULE

SCHEMA

SELECT

SET

SKIP

STRING

SUBTYPE

SUPERTYPE

THEN

TO

TYPE

UNIQUE

UNTIL

USE

VAR

WHERE

WHILE

 

 

 

Operators

AND

ANDOR

DIV

IN

LIKE

MOD

NOT

OR

XOR

 

 

 

Built-in constants

?

SELF

CONST_E

PI

FALSE

TRUE

UNKNOWN

 

Built-in functions

ABS

ACOS

ASIN

ATAN

BLENGTH

COS

EXISTS

EXP

FORMAT

HIBOUND

HIINDEX

LENGTH

LOBOUND

LOG

LOG2

LOG10

LOINDEX

NVL

ODD

ROLESOF

SIN

SIZEOF

SQRT

TAN

TYPEOF

USEDIN

VALUE

VALUE_IN

VALUE_UNIQUE

 

 

 

Built-in procedures

INSERT

REMOVE

 

 

Data Types

EXPRESS data types are classified under the following classes:

  • Simple data types.

  • Aggregate data types.

  • Named data types.

  • Constructed data types.

  • Generalized data types.

EXPRESS supports the following simple data types:

NUMBER

Its domain includes all numeric values in the EXPRESS language.

REAL

Its domain includes all rational, irrational and scientific real numbers.

INTEGER

Its domain includes all rational numbers.

LOGICAL

Its domain includes three literals TRUE, FALSE and UNKNOWN.

BOOLEAN

Its domain includes two literals TRUE and FALSE.

STRING

Its domain includes sequences of characters. The characters that are permitted to form part of a string value are defined in ISO 10646.

BINARY

Its domain includes sequences of bits, which are represented by the characters 0 or 1.


Jotnes Express compiler accepts some additional data type when the EDM_EXPRESS_EXTENSION option is switched on.

_FILE

A file that is imported from the file system and stored as database file

_BLOB

A binary large object stored within data space of an databased instance

_SEQUENCENUMBER

A sequence number within an entity extent (assigned automatically)

_INDEX

An index within an entity extent (assigned automatically)

_NAME

A string that obeys the conventions of a simple id

_TIMESTAMP

Automatically assigned timestamp

_DATETIME

Manullay assigned data and time


EXPRESS supports the following aggregate data types:

ARRAY

It has as its domain indexed, fixed-size collection of like elements.

LIST

Its domain includes sequences of like elements.

BAG

Its domain includes unordered collections of like elements.

SET

Its domain includes unordered


collections of like elements. It is a specialization of the BAG data type but the collection shall not contain two or more instance equals.

EXPRESS supports two classes of named data types:

ENTITY

An entity data type is established by ENTITY declarations. An entity data type is assigned an identifier that can be referenced by a defined data type or an attribute of another entity data type.

TYPE

A defined data type is established by TYPE declarations. A defined data type is assigned an identifier that can be referenced by a defined data type or an attribute of an entity data type.

There are two classes of constructed data types: ENUMERATION data type and SELECT data type.

ENUMERATION

An ENUMERATION data type has as its domain an ordered set of names. The names represent the values of the enumeration data type.

SELECT

The SELECT data type has as its domain a list of identifier of named data types. A SELECT data type is a limited form of generalization of each of the named data types in its list. Members of a SELECT list do not have to have common attributes.

There are two main classes of generalized data types: AGGREGATE data type and GENERIC data type.

AGGREGATE

An AGGREGATE data type is a generalization of all aggregate data types (ARRAY, LIST, BAG and SET). This data type is used only to represent generalized functional and procedural parameters.

GENERIC

A GENERIC data type is a generalization of all data types. This data type is used to represent generalized functional and procedural parameters, and/or generalized types of elements in an aggregate data type.

 

Entities

EXPRESS is used to define entities. Within the entity definition, all the attributes and behaviors which characterize it are declared. An entity is declared by the keyword ENTITY and terminated by the keyword END_ENTITY.

 ENTITY OwnerID;
Â…Â…
 END_ENTITY;

 

Attributes are the characteristics (data or behavior) which are required to support use and understanding of the entity. Attributes may be represented by simple data types (such as real, string, integer), or by other entities. Each attribute has a relationship with the entity. An attribute represented by a simple data type can be shown in EXPRESS by its data type.

ENTITY OwnerID;
	Identifier : String;
	OwningApp : String;
	OwningUser : Actor;
END_ENTITY;

 

Attributes

An attribute represented by a relationship to another entity is shown by the name of the relationship and the name of the entity with which the relationship exists (in the direction of the relationship). Thus for an LayeredElement with a MtrlLayerSet which is declared as an entity in its own right, EXPRESS takes the form:

ENTITY LayeredElement;
Â…	MtrlLayerSet : MaterialLayerSet;
Â…END_ENTITY;

 

Cardinality

EXPRESS allows numerical relations to be mandatory or optional. A mandatory attribute which must be asserted is expressed by there being no prefix term before the attribute name as in the example above. An optional attribute that may be asserted is expressed by the word OPTIONAL appearing as a prefix term before the attribute name

ENTITY LayeredElement;
Â…	TotalAreaPerSide : OPTIONAL AreaMeasure;
	TotalVolume : OPTIONAL VolumeMeasure;
	TotalLength : OPTIONAL LengthMeasure;
Â…END_ENTITY;

 

 

Inverse Rule

Attributes explicitly capture a relation between entities and attributes Inverse relations can also be captured between an entity and a named attribute of another entity or between two entities.

ENTITY ProjectObject
Â…	ResultOf : SET [0:?] OF ProcessObject;
Â…	UNIQUE
		UR1: OwnerID;
END_ENTITY;


ENTITY ProcessObject;
Â…	INVERSE
		ResultsIn : SET[0:?] OF ProjectObject FOR ResultOf;
END_ENTITY;

 

 

Note the use of the INVERSE keyword to define the inverse relation

 

Unique Rule

EXPRESS allows for the uniqueness of attributes to be defined by a 'unique rule'. This specifies that the value of an attribute which is declared to be UNIQUE is associated with only one instance of that entity (object). Where more than one attribute is described as unique, each must be included in the UNIQUE declaration.

ENTITY ProjectObject
Â… UNIQUE
  UR1: OwnerID;
END_ENTITY;

 

 

Derive Rule

In some cases, it is appropriate to include an attribute, which can be computed directly from other attributes. This can be achieved through use of derived attributes which are declared following the DERIVE keyword. The following example also introduces the use of function TotalWidth to calculate the derived value:

ENTITY LayeredElement
Â… DERIVE
   ImplGeoTotalWidth : LengthMeasure := TotalWidth
   (SELF.MaterialLayerSet);
END_ENTITY;


 

Where Rule

Where rules (domain rules) is used to provide constraints on the values which attributes may have and is defined following the WHERE keyword. In the example below, the entity can only exist if all three lists have the same number of members. This is used to ensure that those lists actually correspond, i.e. that for each thickness also an offset and a material are given.

 

ENTITY MaterialLayerSet;
	SetName : OPTIONAL String;
	Offsets : LIST [1:?] OF LengthMeasure;
	Thicknesses : LIST [1:?] OF LengthMeasure;
	Materials : LIST [1:?] OF Material;
	WHERE
		WR1 : (HIINDEX(SELF.Offsets) = HIINDEX(SELF.Thicknesses)) AND (HIINDEX(SELF.Thicknesses) = HIINDEX(SELF.Materials));
END_ENTITY;

 

Arithmetical statements that are available within EXPRESS may be used in conjunction with the domain rule to provide constraints on attribute values. For instance, if the perimeter length of a window were constrained to be less than or equal to 4 meters, the rule would take the form:

ENTITY Window;
	WINDOW_LENGTH : REAL;
	WINDOW_HEIGHT : REAL;
	WHERE
		perimeter : (WINDOW_LENGTH * 2 + WINDOW_HEIGHT * 2) <= 4.0;
END_ENTITY;

 

 

Subtypes

EXPRESS allows for the classification of an entity into subtypes. This defines a parent – child relation in which each subclass (referred to as subtype) contains more specific detail than its parent superclass (referred to as supertype).

ENTITY LayeredElement ABSTRACT SUPERTYPE OF (ONEOF(Floor, RoofSlab, Wall));
Â…
END_ENTITY;


ENTITY Wall SUBTYPE OF (LayeredElement);
Â…
END_ENTITY;

 

Note that the supertype declares the Wall as being 'ONEOF'. This indicates that the layered element is exclusively either a Wall or a Floor or a RoofSlab; it cannot be two or more at the same time. Alternative constraints on subtypes exist, most notably the ANDOR constraint that would allow the layered element to be either a Wall or a Floor or a RoofSlab or any combination of the three subtypes at the same time.. EXPRESS supports both, single inheritance and multiple inheritance. Having more than one entity within the SUBTYPE clause specifies multiple inheritance. A supertype may be included for the purposes of classification only, such situations occurring where it may be appropriate to include a supertype within the EXPRESS model for clarity. A supertype included for this purpose is never instanced; only its subtypes are used. In this case, it is known as an abstract supertype. The LayeredElement is an example of an abstract supertype.

 

Declared Data Types

The type of a data item being used may be declared using a TYPE clause. For certain types of data item, this is necessary whilst for simple data types, it is optional. For instance, consider a space type that may be selected from an enumerated list of occupied, technical or circulation. The enumeration is declared as a data type as below:

TYPE SpaceTypeEnum = ENUMERATION OF (Occupied, Technical, Circulation);
END_TYPE;

 

 

Note that the use of the TYPE clause causes the declaration of the attribute within the entity to be written in the same manner as if the relationship was with another entity.

A SELECT data type defines a named collection of other data types. These may be other entities, a list of string values, a list of real values etc. As with enumerationÂ’s, only one item from a SELECT list is used by an instance of the entity, which uses the TYPE.

TYPE BuildingSelect = SELECT (Building, BuildingStorey);
END_TYPE;

Access to Other Schema

Entities that are defined in schema other than that which is current may be accessed using an EXPRESS interface. This allows schema to be partitioned into manageable parts and enables reuse of schema, which may have been previously defined or defined elsewhere. There are two interface possibilities.

The REFERENCE specification allows declarations made in other schema (usually entities) to be referenced but does not make them part of the current schema i.e. the declarations remain remote. The following indicates the referencing of entities defined in a geometry schema.

 REFERENCE FROM GeometryResource (CartesianPoint, Bounded_curve, Polyline, Trimmed_curve, CompositeCurve, Placement, Line, Conic,Circle, Ellipse));