# Presentation: 625247

## EXPRESS v2 Metamodel

*Ed Barkmeyer, NIST*
- Draft 16 February 2006

## MEXICO Project Status

- Current Metamodel draft
- 060301 = complete,
- 060301a = MOF 1.4 compatible
- Implementations
- Eurostep EXPRESS version and tools
- ATHENA MOF implementation
- NIST Parser and MOF implementation

## Participants

**Notes:**
We still need the Logos for the plain text participants.

## Changes in Metamodel v060216

- Repackaging: Core
- Instance models: Built-in types, constants
- Reworked Aggregation types and values
- Reworked relationships and redeclarations
- TypeName and RoleName values
- MOF compatibilities
- Enumeration types and values
- <<implicit>> for refined/abstract associations
- <<structure>> for complex data types

## Packages

## Slide 6

## Meta-types for the EXPRESS Language

**Notes:**
These are the primitive data types that appear in the model.  The top three are native EMOF types.

## Basic Elements

**Notes:**
Basic elements are principal concepts that are used in various other packages.
Schemas define Data Types and describe Populations.
Populations consist of Instances of DataTypes.
Expressions describe some data type elements.  They have DataTypes and evaluate to Instances.
TextExpressions are what processors do with Expressions if they don’t really parse them.

## Scopes and Identifiers

**Notes:**
Continuation.  This slide is about subtyping Identifier by its scope of visibility.

## Overview of Scopes and Named Elements

## Schemas

**Notes:**
First real EXPRESS concepts.  This is about Schemas and Interfacing (Clause 11). CommonScope and CommonElement are artifacts of the namespace concerns.

## Remarks

**Notes:**
Represents the EXPRESS in-schema documentation elements.  isTagged and isTail are lexical information for reconstruction only.

## EXPRESS Types

***DataType***

***InstantiableType***

***GeneralizedType***

***ParameterType***

**PartialEntityType**

***AnonymousType***

**EntityType**

- +

- isAbstract

- :

- Boolean

***NamedType***

- +

- id

- :

*ScopedId*

- (disjoint, total)

- (disjoint, total)

- (disjoint, total)

- (disjoint, total)

**Notes:**
This is an overview of the EXPRESS Types model.  All the components appear later as well.
Note that the EXPRESS declaration for InstantiableType would read:
ENTITY InstantiableType
  SUBTYPE OF (DataType, ParameterType)
  SUPERTYPE OF (ONE OF(EntityType, ConcreteType) AND ONE OF(NamedType,AnonymousType));
END_ENTITY;
(a wonderful example of EXPRESS complex entity type declaration, but in fact invalid EXPRESS: EntityType and AnonymousType are not immediate subtypes of InstantiableType; EntityType is a subtype of NamedType and AnonymousType is a subtype of ConcreteType, and they inherit their InstantiableType ancestry.  This is the intended model, but it cannot be easily written in EXPRESS, and to do it in UML, the author added two “derived” inheritances from InstantiableType.

## Type Scopes and Naming

**Notes:**
Yet another Namespace slide.

## Instantiable Types

**Instantiable Types**

## Simple Types

**Notes:**
Note: NUMBERType is a metaclass.  NUMBER, INTEGER and all REAL types are individuals in it.  Similarly, BOOLEAN and LOGICAL are individuals in metaclass LOGICALType.  (Compare with the Simple Instances diagram)

## Built-In Types

- BuiltInTypes

## Aggregation Types

## Generalized Types

**Notes:**
GeneralizedTypes are abstract DataTypes.  They specify allowable values that belong to different EXPRESS data types.
A GeneralAggregationType is distinguished from an AggregationType by the fact that its member-type is a GeneralizedType.  (It takes some effort to sort this out from the EXPRESS grammar.)
GENERIC and GENERIC_ENTITY are individuals in the GenericType metaclass.

## Generic Types

- GenericTypes

- specializes

## Entity Types

**Notes:**
SingleEntityType represents the set of attributes declared in a given entity_declaration.  As a consequence there is a 1-to-1 correspondence between EntityType and SingleEntityType.  But entity-has-attributes includes all the inherited attributes as well, whereas SingleEntityType includes only the attributes locally declared.  The SingleEntityType and PartialEntityType concepts are needed for Expressions.  (Note: SingleEntityType is not said to be a DataType, because it has no Instances per se.  All of its would-be Instances are instances of a (degenerate) PartialEntityType.)

## Attributes

**Notes:**
Redeclared Attributes are not a kind of Attribute.  Redeclaration is a separate concept that relates to Attributes.

## Relationships

**Notes:**
Tentative addition:  This proposal adds the concepts Relationship and Cardinality to the model.
Relationship = a relationship between Instances of an EntityType and Instances of some other InstantiableType (which may also be an EntityType).  In EXPRESS, a Relationship is modeled by 1 or more Attributes, each of which represents the view of the Relationship taken by the EntityType having that Attribute, and each of which has a Cardinality. 
Relationship.domain = the relationship between the Relationship and the EntityType that “owns” (is the “domain” of) the Relationship
Relationship.range = the relationship between the Relationship and the InstantiableType that is the range of the Relationship (and the data-type of the Explicit or Derived Attribute that represents the Relationship.
Relationship.view = the relationship between the Relationship and any of the Attributes that represents it.  The primary “view” is usually an ExplicitAttribute of the domain EntityType, but it may be a DerivedAttribute of that EntityType.  When the range InstantiableType is an EntityType, the inverse view – the view of the Relationship from the range EntityType can also be modeled, as an InverseAttribute.
Cardinality = a Constraint on the number of instances of the Relationship in which a given Instance of the EntityType can appear.  It is defined by a lower bound and an optional upper bound.  When the upper bound does not exist, the number of times the Instance can appear is unbounded.The Cardinality of the Attribute of the domain EntityType represents the number of times an Instance of the domain EntityType can appear as the domain instance in the Relationship.  The Cardinality of the (Inverse) Attribute of the range EntityType constrains the number of times an Instance of the range EntityType can appear as the range Instance in the Relationship.  When the range InstantiableType is not an EntityType, the Cardinality constraint must be expressed by a GlobalRule.
Every instantiable Attribute models a Relationship and has an explicit Cardinality.  When the data type of the Attribute is an InstantiableType that is not an AggregationType, the Cardinality is [1..1].  When the data type of the Attribute is an (anonymous) AggregationType, the Cardinality is the SizeConstraints on the AggregationType ([0..?] if not explicitly modeled).
A Cardinality Individual is treated as unique to the Attribute it constrains.
(Note: In general, the Expression equivalent to a Cardinality Bound is a NamedRule (not a DomainRule) – it involves Extents.)

## Redeclarations

**Redeclarations**

## Constants

## Algorithms

## Algorithms

**Notes:**
Function definition is needed for Expressions.
Note: the ActualTypeConstraint concept is not quite right.  It represents the constraints among formal parameters, internal variables, and result types that are derived from the syntactic use of “tags” on GeneralizedTypes.

## Actual Types and Constraints

- {OR}

- {OR}

**Notes:**
An ActualType represents a reference to the data type of an actual-parameter when the formal parameter has a GeneralizedType.
The ActualType is denoted by the type_label on the GeneralizedType.
Variables and results declared to be of GeneralizedType are actually of some ActualType.
An ActualTypeConstraint declares the data types of the actual parameters for two formal parameters to be type-compatible.

## Rules

## Global Rules

**Notes:**
Global Rules describe constraints on the Extents of EntityTypes within a given Population.
The form of a NamedRule is an Expression that involves EntityType identifiers as references to their Extents.

## Supertype Rules

**Notes:**
SupertypeRules represents SUPERTYPE clauses and SUBTYPE_CONSTRAINTs.
They constrain relationships between the Extents of subtypes of the “supertype”.
The equivalent boolean Expressions contain references to those Extents as SETValues, just as NamedRules do. 

## Expressions

## Expressions

**Notes:**
Note: This provides a “compliance point break”.  An implementation must handle Expression, but it need not handle FullExpression.  An implementation that does not support FullExpression supports OpaqueExpression and represents the Expression as a string of ExpressText.

## Full Expression

**Notes:**
Operation, IndexOperation, Referencer and Initializer are artifacts of the diagram.  
They have no properties – they serve only as collectors of other subclasses of FullExpression.

## Operations

**Notes:**
BinaryOperator is one of: Add, Subtract, Multiply, RealDivide, Exponent, DIV, MOD, AND, OR, XOR, Equal, Unequal, Greater, GreaterEqual, Less, LessEqual, BinaryEqual, BinaryUnequal, BinaryGreater, BinaryGreaterEqual, BinaryLess, BinaryLessEqual, LogicalEqual, LogicalUnequal, LogicalGreater, LogicalGreaterEqual, LogicalLess, LogicalLessEqual, StringEqual, StringUnequal, StringGreater, StringGreaterEqual, StringLess, StringLessEqual, EnumEqual, EnumUnequal, EnumGreater, EnumGreaterEqual, EnumLess, EnumLessEqual, ArrayEqual, ArrayUnequal, ArrayInstanceEqual, ArrayInstanceUnequal, ListEqual, ListUnequal, ListInstanceEqual, ListInstanceUnequal, BagEqual, BagUnequal, BagInstanceEqual, BagInstanceUnequal, EntityValueEqual, EntityValueUnequal, EntityInstanceEqual, EntityInstanceUnequal, IN, EntityValueIN, LIKE, Subset, EntityValueJoin, BinaryAppend, StringAppend, Intersection, BagUnion, SetUnion, ListAppend, SetAdd, BagAdd, ListAddFirst, ListAddLast,  BagDifference, BagRemove, Substitute (NVL). 
UnaryOperator is one of: NOT, Exists, ODD, VALUE_UNIQUE, SizeOf, BinaryLength, StringLength, HiBound, HiIndex, LoBound, LoIndex, VALUE, RolesOf, TypeOf, Identity, Negate, ABS, ACOS, ASIN, ATAN, COS, EXP, LOG, LOG2, LOG10, SIN, SQRT, TAN 
Coercion changes the type of the operand to the target-type, e.g. from length_measure to REAL.

## Operators

- <<

- enumeration

- >>

**BinaryOperator**

- +

- Add

- :

- int

- +

- Subtract

- :

- int

- +

- Multiply

- :

- int

- +

- Divide

- :

- int

- +

- DIV

- :

- int

- +

- MOD

- :

- int

- +

- AND

- :

- int

- +

- OR

- :

- int

- +

- XOR

- :

- int

- +

- Equal

- :

- int

- +

- NotEqual

- :

- int

- +

- Greater

- :

- int

- +

- NotGreater

- :

- int

- +

- Less

- :

- int

- +

- NotLess

- :

- int

- +

- InstanceEqual

- :

- int

- +

- InstanceNotEqual

- :

- int

- +

- EntityValueEqual

- :

- int

- +

- EntityValueNotEqual

- :

- int

- +

- IN

- :

- int

- +

- ValueIn

- :

- int

- +

- LIKE

- :

- int

- +

- Exponent

- :

- int

- +

- Subset

- :

- int

- +

- Intersection

- :

- int

- +

- SetUnion

- :

- int

- +

- BagUnion

- :

- int

- +

- BagDifference

- :

- int

- +

- ListAppend

- :

- int

- +

- ListAddFirst

- :

- int

- +

- ListAddLast

- :

- int

- +

- BagAdd

- :

- int

- +

- BagRemove

- :

- int

- +

- SetAdd

- :

- int

- +

- StringAppend

- :

- int

- +

- BinaryAppend

- :

- int

- +

- EntityConstructor

- :

- int

- +

- NVL

- :

- int

## Indexing

**Notes:**
AggregateIndex is the subscript operation for ARRAY, LIST, BAG and SET
StringIndex is the EXPRESS substring selector S[first-char:last-char], and BinaryIndex is the similar operation for bitstrings.

## Reference Expressions

**Reference Expressions**

**Notes:**
All of these are references to values that already exist in the Population or in the evaluation context.

## Built-In Constants

- BuiltInConstants

**Notes:**
Treated as literals

## Function calls

## Initializer Expressions

**Initializer Expressions**

**Notes:**
The EXPRESS ComplexEntityConstructor is not an Initializer per se.  It is a binary operation that creates more complex PartialEntityValues.

## Instances

## Instances

**Notes:**
This model parallels the InstantiableTypes model (of course).
TaggedInstance represents an Instance of a NamedType.  Only instances of NamedTypes can be used as values of a SelectType.  (Note also that TaggedInstance.of-type has multiplicity 0..*: A TaggedInstance could be an Instance of several SelectTypes or none.

## Simple Values

## Aggregate Values

**Notes:**
Note that the models of AggregateInstance do not have a common pattern.  The EXPRESS-defined use of an AggregateValue as a GenericAggregate is actually a conversion imposed on it.  (GenericAggregate appears to be LISTValue.)

## Entity Values

**Entity Values**

**Notes:**
This diagram distinguishes EntityInstance (the conceptual Individual) from EntityValue (the struct/record of its current state).
Part 11 defines a “subtype/supertype graph” that can be determined from the set of entity_declarations in a Schema: the nodes are the EntityTypes and the directed edges are SUBTYPE OF relationships between them.  An EntityInstance that corresponds to a “leaf node” in such a graph is a SingleLeafInstance – there is one modeled EntityType – the characterizing-type -- that has all the attributes that appear in a representation of its state.
But because the set of subtypes of an EntityType are not required to be mutually exclusive, it is possible that an EntityInstance is a valid instance of several EntityTypes, including more than one “leaf type”.  Such an Instance is a MultiLeafInstance; it has no characterizing-type (no modeled EntityType has all of its Attributes).

## Express2

**Notes:**
This package exists to collect all the others.  It has no new content.
We put the overview diagrams in this package, for lack of a better place.

## Named Elements

**Notes:**
This is a purely informative slide.  It is an attempt to capture the entire “namespace” behavior of the EXPRESS language.Note: Namespace concerns are mostly syntactic.  The presumption of the model is that the parser identifies the objects, using EXPRESS scoping rules, and populates the metamodel accordingly.  Names are used only to navigate the model database from “outside”.

## Scopes

**Notes:**
Continuation of previous.  This is derived from Clause 10 of ISO 10303-11:2004.

## Issues/Questions