EXPRESS X Language Syntax
EDMexpressX is the mapping language implemented in the EXPRESS Data Manager for defining the mapping (conversion) of a data set from one structure to another. Both structures are defined in the ISO 10303 EXPRESS language. EDMexpressX is a superset of EXPRESS, which means that the capabilities of EDMexpressX envelop the capabilities of EXPRESS and more.
The specification of EDMexpressX is based on the following:
ISO 10303-11: The EXPRESS Language Reference Manual.
ISO TC184/SC4/WG11/N002: The EXPRESS-X Reference Manual of August 21, 1996.
Experiences from using the previous versions of an EXPRESS-X mapping language in commercial implementations since begin of 1997.
Requirements to a mapping language within the EXPRESS and STEP communities.
EDMexpressXÂ has the following main functionalities:
Definition of the mapping of a given data set from one structure to another.
Definition of the conversion of a data set from one EXPRESS schema version to another version of the same EXPRESS schema.
Programming language constructs for manipulating data in the EXPRESS Data Manager.
Work is going on within STEP to define a version of the mapping language EXPRESS-X that shall be an ISO standard. The current proposal (August 2004) differs much from the specification dated August 1996. It is the intention to incorporate the ISO EXPRESS-X in EDMexpressX as soon as a stable version of ISO EXPRESS-X is available. EDMexpressX defines the mapping (conversion) of a data set from one structure to another. Both structures are defined in the ISO 10303 EXPRESS language. The EXPRESS schema defining the original structure is called the Source Schema and the EXPRESS schema describing the resulting structure after the conversion is called the Target Schema. Both the original data set and the resulting data set are (SDAI) models in the EXPRESS Data Manager. The original data set is called the Source Model and the resulting data set is called the Target Model. For more detailed information about EDMexpressX than presented here, consult EDMassist Volume VI: EDMexpressX – Language Reference.
EDMexpressXÂ mapping schema
An EDMexpressX specification consists of one mapping schema defined in the EDMexpressX language. This mapping schema defines how the source data set should be converted to the specified target data set. These data sets are called the Source Model and the Target Model respectively. The structures of the Source Model and the Target Model are defined in the EXPRESS language in the Source Schema and in the Target Schema respectively. Normally the Source Schema and the Target Schema are different schemata. A legal special case is when the source and target schemas are the same.
Basic language elements
This clause specifies the basic elements from which an EDMexpressX mapping specification is composed: the character set, remarks, literals, reserved words, identifiers, and symbols. The basic language elements of EDMexpressX are those of the EXPRESS language defined in Clause 7 of ISO10303-11, with the exceptions noted below.
- The EDMexpressXÂ is a case insensitive language in the same way as the EXPRESS language.
- The EDMexpressX uses exactly the same character set as the EXPRESS language.
- The EDMexpressX language has exactly the same definition of remarks as in the EXPRESS language.
- The EDMexpressX defines literals exactly as the EXPRESS language.
Â
Reserved words
The reserved words of EDMexpressX are the keywords, and the names of built-in constants, functions, and procedures. All reserved words in the EXPRESS language are also reserved words in the EDMexpressX language. It is illegal to use a reserved word as an identifier in an EDMexpressX schema. The EDMexpressX language has a set of built-in functions and constants whose names are not reserved words. These names can be used within an EDMexpressX mapping schema as user defined identifiers, i.e., these names can be redefined.
Â
Keywords
The following is a list of keywords in EDMexpressX that are not keywords in the EXPRESS language.
ASC | BEGIN_COMPOSE | BEGIN_MAP |
COMPOSE | COPY_MODEL | DECLARE |
DELETE | DESC | END_COMPOSE |
END_COPY_MODEL | END_GLOBAL | END_MAP |
END_RENAME_ENTITY | END_SCHEMA_MAP | END_STATEMENTS |
END_RENAME_ENUMERATION | EXCLUDE | GLOBAL |
INCLUDE | INSTANCE | IS |
NEW | NO_INHERITANCE | ON_CALL_ONLY |
PERSISTENT | RENAME_ENTITY | RENAME_ENUMERATION |
SCHEMA_MAP | SOURCE_SCHEMA | STATEMENTS |
TARGET_SCHEMA | WHEN | Â |
Â
Built-in constants
The following is a list of EDMexpressX built-in constants that are not built-in constants in the EXPRESS language.
XPXAGGREGATE | XPXARRAY | XPXBAG |
XPXBINARY | XPXBOOLEAN | XPXCURRENTLINE |
XPXENUMERATION | XPXEOF | XPXEOS |
XPXESCAPEREASON | XPXINDETERMINATE | XPXINSTANCE |
XPXINTEGER | XPXLIST | XPXLOGICAL |
XPXNOACCESS | XPXNULL | XPXUNSET |
XPXREAL | XPXRO | XPXRW |
XPXSELECT | XPXSET | XPXSOURCEMODELID |
XPXSTRING | XPXTARGETMODELID | XPXUNTYPED |
Â
Symbols
The EDMexpressX language defines the following additional symbols, which are not defined in the EXPRESS language
:: ++ += -= &
Â
Identifiers
EDMexpressX defines identifiers used in GLOBAL and LOCAL declarations exactly like the definition of identifiers in the EXPRESS language. The entity_id is extended so that a complex instance type can be specified. A complex instance type is specified as an alphabetical ordered list of all constituents of the complex type with the character ‘&’ between each of the constituents.
SYNTAX:
entity_id = simple_id { '&' simple_id } .
EXAMPLE:
cartesian_point
person
adult&hockey_player&student -- complex entity type
Â
Within an EDMexpressX mapping schema a population of the Source Schema is called a Schema Instance. A population of the Target Schema is called a Schema Instance as well. The schema instances are given names and these names are referenced within the EDMexpressX constructs to distinguish between the Source Schema and the Target Schema, and to distinguish between the population of the Source Schema and the population of the Target Schema.
SYNTAX:
schema_instance_id = simple_id .
EXAMPLE:
GLOBAL DECLARE src INSTANCE OF SOURCE_SCHEMA source_geometry; DECLARE tar INSTANCE OF TARGET_SCHEMA target_geometry; END_GLOBAL; Data structures consisting of one or more related entity instances can be specified in an EDMexpressX mapping schema. All these instances must be defined by an ENTITY definition in the Target Schema. Each of these instances is given a unique name so that they can be referenced from other constructs in the mapping schema. The name associated with an entity instance is an identifier of type instance_id. An instance_id must begin with the character '#' followed by a simple_id. SYNTAX:
instance_id = '#' simple_id .
EXAMPLE:
#startPoint = tar::POINT(0.0,0.0); #endPoint = tar::POINT(100.0,0.0); #myLine = tar::LINE(#startPoint,#endPoint );
Â
Extended References are introduced, to be able to uniquely reference identifiers in the global scope of the mapping schema. The global scope of the Source Schema, plus the global scope of the Target Schema, plus the outer scope of the mapping schema, constitutes the global scope of an EDMexpressX mapping schema. Constants, entities, defined types, and enumeration elements are the identifier types in the source and target schemata that can be directly referenced from a mapping schema. A notation is required to uniquely reference these identifier types within an EDMexpressX construct, in case the same name is used for more than one identifier in the mapping schema global scope. This notation is called an Extended Reference. An Extended Reference consists of an optional schema instance identifier followed by a double colon, followed by the identifier name.
SYNTAX:
constant_ref = [schema_instance_id ‘::Â’] constant_id . entity_ref = [schema_instance_id ‘::Â’] entity_id . enumeration_ref = [schema_instance_id ‘::Â’] enumeration_id . type_ref = [schema_instance_id ‘::Â’] type_id . Â
EXAMPLE:
cartesian_point source::person ap214::address
Â
Â
The extended entity reference is used in MAP declarations, COMPOSE declarations, FROM clauses, and FROM statements, to uniquely identify an entity instance type within the global scope of the mapping schema, i.e. instance types defined in the Source Schema or in the Target Schema. The extended_entity_ref_id part of an extended entity reference is used within a MAP or COMPOSE declaration, and within a FROM statement to reference the current instance, i.e. as a placeholder for an instance currently being mapped, composed or referred to. An extended entity reference can specify a complex instance type by listing all constituents of the complex type in alphabetical order with the character ‘&’ between each of the constituents.
SYNTAX:
extended_entity_ref = extended_entity_ref_id ‘:’ entity_ref . extended_entity_ref_id = simple_id .
EXAMPLE:
t_e:target_model::aTargetEntity pers:source::person m_s:target::male&student -- complex instance
Â
The extended references can be used in all expressions in EDMexpressX, where the EXPRESS language permits reference to identifiers of type constant, entity, enumeration element, and defined type.
Â
Data types
The EDMexpressX defines exactly the same data types as the EXPRESS language. No new data types can be defined in EDMexpressX. All data types defined in Source and Target schemas can be used/referenced from the EDMexpressX schema. As the same data type/identifier may be defined in more than one schema, data types must be qualified (scoped). Scoping is defined by prefixing the actual identifier with the schema instance name followed by double colon.
EXAMPLE:
GLOBAL DECLARE src INSTANCE OF SOURCE_SCHEMA s; DECLARE trg INSTANCE OF TARGET_SCHEMA t; aPerson:src::person; -- instance of type person defined -- in source schema aMan:trg::man; -- instance of type man defined -- in target schema END_GLOBAL;
Â
Where src is the source schema instance, s is the source schema, trg is the target schema instance and t is the target schema.
Â
Declarations
An EDMexpressX declaration defines a new EDMexpressX item and may optionally associate an identifier with it. If the EDMexpressX item should be referenced elsewhere in the mapping schema, an identifier must be associated with it because the EDMexpressX item can only be referenced by its name, e.g., the identifier associated by the EDMexpressX item. The ENTITY, RULE, and TYPE declarations in the EXPRESS language are not supported in EDMexpressX.
The EDMexpressX language defines the following declarations:
- Schema Map
- Global
- Constant
- Map
- Compose
- Statements
- Copy Model
- Function
- Procedure
The Global declaration is mandatory and must be the very first declaration after the Schema Map declaration. The order of the Map, Compose, and Statements declarations are significant for the execution of the mapping specification, i.e., the order of execution is the same as the order of the declarations in the mapping schema. The order of the Constant, Function, and Procedure declarations is not significant, i.e., it has no influence on the result of the mapping.
Â
Executable Statements
SYNTAX:
stmt = alias_stmt | assignment_stmt | case_stmt | compound_stmt| delete_stmt | escape_stmt | from_stmt | if_stmt | map_call_stmt | new_stmt | null_stmt | procdedure_call_stmt | repeat_stmt | return_stmt | skip_stmt | when_stmt .
Â
A sequence of one or more executable statements defines the actions of maps, composes, statements, functions, and procedures declarations in an EDMexpressX mapping schema. These statements act on global variables, local variables or persistent instances in the source and target model.
EDMexpressXÂ defines the DELETE, FROM, MAP_CALL, NEW, and WHEN statements in addition to the executable statements defined in the EXPRESS language: (null, alias, assignment, case, compound, escape, if, procedure, call, repeat, return and skip). A sequence of statements may require constants, global variables and local variables to be able to perform its intended operations. Constants are declared within constant declarations. Global variables can be defined in the global declaration. Local variables can be defined within the map body, compose body, statements clause, function, and procedure declarations.
EXAMPLE:
SCHEMA example2; GLOBAL DECLARE source INSTANCE OF SOURCE_SCHEMA ARM; DECLARE target INSTANCE OF TARGET_SCHEMA AIM; (* Global variables *) MapStatus : INTEGER; fileId : GENERIC; END_GLOBAL; CONSTANT Language : STRING := ‘NORWEGIAN’; END_CONSTANT; COPY_MODEL . . . END_COPY_MODEL; STATEMENTS; LOCAL i, j, k, l : INTEGER; aPerson : target::person; END_LOCAL; . . . (* Sequence of executable statements *) . . . END_STATEMENTS; MAP t:target::targetEntity; FROM (s:source::sourceEntity)WHEN (TRUE); BEGIN_MAP LOCAL i, l, n : INTEGER; anInst : GENERIC; END_LOCAL; . . . (* Sequence of executable statements *) . . . END_MAP; COMPOSE t:target::entityA; WHEN (TRUE); BEGIN_COMPOSE LOCAL i, amount : INTEGER; stat : BOOLEAN; END_LOCAL; . . . (* Sequence of executable statements *) . . . END_COMPOSE; FUCNTION aFunction(val : INTEGER) : REAL; LOCAL i, n : INTEGER; str : STRING; END_LOCAL; . . . (* Sequence of executable statements *) . . . END_FUNCTION; PROCEDURE aProcedure(rArg : REAL, VAR stat : LOGICAL); LOCAL i, n : INTEGER; str : STRING; END_LOCAL; . . . (* Sequence of executable statements *) . . . END_PROCEDURE; END_SCHEMA_MAP;
Â
Â
Execution of an EDMexpressX Mapping Schema.
When the EDMmodelConverter process an EDMexpressX mapping schema the sequence of execution will be as follows:
All global identifiers will be initialized. This includes the creation of persistent instances in the target model when the GLOBAL declaration contains identifier of an instance type that is initialized by an entity constructor. All MAP, COMPOSE and STATEMENTS declarations will be executed in exactly the same order as they occur in the mapping schema.