Application module: Generic expression | ISO/TS 10303-1341:2014-02(E) © ISO |
This clause specifies the information requirements for the Generic expression application module. The information requirements are specified as the Application Reference Model (ARM) of this application module.
NOTE 1 A graphical representation of the information requirements is given in Annex C.
NOTE 2 The mapping specification is specified in 5.1. It shows how the information requirements are met by using common resources and constructs defined or imported in the MIM schema of this application module.
This clause defines the information requirements to which implementations shall conform using the EXPRESS language as defined in ISO 10303-11. The following begins the Generic expression schema.
The Generic_expression module represents all the possible expressions available. EXPRESS specification:
*)
SCHEMA Generic_expression_arm;
(*
This subclause specifies the ARM entities for this module. Each ARM application entity is an atomic element that embodies a unique application concept and contains attributes specifying the data elements of the entity. The ARM entities and definitions are specified below.
EXPRESS specification:
*)
ENTITY Binary_generic_expression
ABSTRACT SUPERTYPE
SUBTYPE OF (Generic_expression);
operands : LIST[2:2] OF Generic_expression;
END_ENTITY;
(*
Attribute definitions:
operands: a list of two generic expressions that represent the two operands of the binary operator.
NOTE In the context of this part of ISO 10303-1341, the Environment entity associates to a Generic_expression (syntax) its corresponding meaning (semantics) represented by the Variable_semantics entity.
EXPRESS specification:
*)
ENTITY Environment;
syntactic_representation : Generic_variable;
semantics : Variable_semantics;
END_ENTITY;
(*
Attribute definitions:
syntactic_representation: the Generic_variable that stands for the value of the variable.
semantics: the meaning of the variable that includes the mechanism to access its value.
EXPRESS specification:
*)
ENTITY Generic_expression
ABSTRACT SUPERTYPE
OF (ONEOF (Simple_generic_expression,
Unary_generic_expression,
Binary_generic_expression,
Multiple_arity_generic_expression));
WHERE
WR1: Is_Acyclic(SELF);
END_ENTITY;
(*
Formal propositions:
WR1: the graph associated with the described expression shall be acyclic.
EXPRESS specification:
*)
ENTITY Generic_literal
ABSTRACT SUPERTYPE
SUBTYPE OF (Simple_generic_expression);
END_ENTITY;
(*
NOTE The Real_numeric_variable, Numeric_variable, Boolean_variable and String_variable are examples of subtypes of Generic_variable.
EXPRESS specification:
*)
ENTITY Generic_variable
ABSTRACT SUPERTYPE
OF (Variable)
SUBTYPE OF (Simple_generic_expression);
INVERSE
interpretation : Environment FOR syntactic_representation;
END_ENTITY;
(*
Attribute definitions:
interpretation: the Environment that enables to associate a value with the variable.
EXPRESS specification:
*)
ENTITY Multiple_arity_generic_expression
ABSTRACT SUPERTYPE
SUBTYPE OF (Generic_expression);
operands : LIST[2:?] OF Generic_expression;
END_ENTITY;
(*
Attribute definitions:
operands: a list of generic expressions that represent the operands of the multiple-arity operator.
EXPRESS specification:
*)
ENTITY Simple_generic_expression
ABSTRACT SUPERTYPE
OF (ONEOF (Generic_literal,
Generic_variable))
SUBTYPE OF (Generic_expression);
END_ENTITY;
(*
EXPRESS specification:
*)
ENTITY Unary_generic_expression
ABSTRACT SUPERTYPE
SUBTYPE OF (Generic_expression);
operand : Generic_expression;
END_ENTITY;
(*
Attribute definitions:
operand: the operand is a generic expression that represents the operand of the unary operator.
EXPRESS specification:
*)
ENTITY Variable
ABSTRACT SUPERTYPE
SUBTYPE OF (Generic_variable);
END_ENTITY;
(*
A Variable_semantics is used to represent the meaning of a Generic_variable. It is an ABSTRACT SUPERTYPE that shall be subtyped wherever a Variable_semantics is used. A Variable_semantics shall specify the context within which the variable shall be used together with the interpretation function that associates a value with this variable.
EXAMPLE When modelling a class of components to which properties "a" and "b", with integer values apply. The constraint, stating that for every instance of this class, its value for "a" shall be greater than its value for "b", may be modelled through:
EXPRESS specification:
*)
ENTITY Variable_semantics
ABSTRACT SUPERTYPE
;
END_ENTITY;
(*
This subclause specifies the ARM functions for this module. The ARM functions and definitions are specified below.
EXPRESS specification:
*)
FUNCTION Acyclic (arg1 : Generic_expression; arg2 : SET[0:?] OF Generic_expression) : BOOLEAN;
LOCAL result: BOOLEAN; END_LOCAL; IF ('GENERIC_EXPRESSION_ARM.SIMPLE_GENERIC_EXPRESSION' IN TYPEOF (arg1)) THEN RETURN (TRUE); END_IF; IF arg1 IN arg2 THEN RETURN (FALSE); END_IF; IF 'GENERIC_EXPRESSION_ARM.UNARY_GENERIC_EXPRESSION' IN TYPEOF (arg1) THEN RETURN (Acyclic(arg1\Unary_generic_expression.operand,arg2+[arg1])); END_IF; IF 'GENERIC_EXPRESSION_ARM.BINARY_GENERIC_EXPRESSION' IN TYPEOF (arg1) THEN RETURN (Acyclic(arg1\Binary_generic_expression.operands[1],arg2+[arg1]) AND Acyclic(arg1\Binary_generic_expression.operands[2],arg2+[arg1])); END_IF; IF 'GENERIC_EXPRESSION_ARM.MULTIPLE_ARITY_GENERIC_EXPRESSION' IN TYPEOF (arg1) THEN result := TRUE; REPEAT i := 1 TO SIZEOF (arg1\Multiple_arity_generic_expression.operands); result := result AND Acyclic(arg1\Multiple_arity_generic_expression.operands[i], arg2+[arg1]); END_REPEAT; RETURN (result); END_IF;
END_FUNCTION;
(*
Argument definitions:
arg2: a set of Generic_expression.
NOTE The informative annex F discusses the role of such a structure for the static analysis (e.g. type control, variable collection and so on) and dynamic analysis (e.g. evaluation) of an expression.
EXPRESS specification:
*)
FUNCTION Is_Acyclic (arg : Generic_expression) : BOOLEAN;
RETURN (Acyclic (arg, []));
END_FUNCTION;
(*
Argument definitions:
EXPRESS specification:
*)
FUNCTION Used_variables (arg : Generic_expression) : SET[0:?] OF Generic_variable;
LOCAL result : SET OF Generic_variable := []; END_LOCAL; IF 'GENERIC_EXPRESSION_ARM.GENERIC_VARIABLE' IN TYPEOF (arg) THEN RETURN ([arg]); END_IF; IF 'GENERIC_EXPRESSION_ARM.UNARY_GENERIC_EXPRESSION' IN TYPEOF (arg) THEN RETURN (Used_variables (arg\Unary_generic_expression.operand)); END_IF; IF 'GENERIC_EXPRESSION_ARM.BINARY_GENERIC_EXPRESSION' IN TYPEOF (arg) THEN RETURN(Used_variables(arg\Binary_generic_expression.operands[1]) + Used_variables (arg\Binary_generic_expression.operands[2])); END_IF; IF 'GENERIC_EXPRESSION_ARM.MULTIPLE_ARITY_GENERIC_EXPRESSION' IN TYPEOF (arg) THEN REPEAT i := 1 TO SIZEOF(arg\Multiple_arity_generic_expression.operands); result := result + Used_variables( arg\Multiple_arity_generic_expression.operands[i]); END_REPEAT; RETURN (result); END_IF; RETURN ([ ]);
END_FUNCTION;
(*
Argument definitions:
*)
END_SCHEMA; -- Generic_expression_arm
(*
© ISO 2014 — All rights reserved