[wg11] sub-supertype constraints on USED entities

Lothar Klein lothar.klein at lksoft.com
Tue Oct 26 14:07:04 EDT 2004


Hi,

In the modules I found a situation which is wrong in my opinion.
Please have a look to the simplified Express below.
Two schemas using each other crosswise. I have doubts that the
ABSTRACT SUPERTYPE constraint of "Variable" is valid since it calls
out entities which are USED FROM. As a minimum I would consider this
as a bad modelling style.


SCHEMA Expression_arm;

 USE FROM Generic_expression_arm;

 ENTITY String_variable
   SUBTYPE OF (Variable);
 END_ENTITY;

 ENTITY Numeric_variable
   SUBTYPE OF (Variable);
 END_ENTITY;

END_SCHEMA;


SCHEMA Generic_expression_arm;

 USE FROM Expression_arm;

 ENTITY Variable
   ABSTRACT SUPERTYPE OF (ONEOF (Numeric_variable,
                                 String_variable))
 END_ENTITY;

END_SCHEMA;

------------------------

A much better and correct modelling style would be to use
SUBTYPE_CONSTRAINT; something like this:

SCHEMA Expression_arm;

 USE FROM Generic_expression_arm;

 ENTITY String_variable
   SUBTYPE OF (Variable);
 END_ENTITY;

 ENTITY Numeric_variable
   SUBTYPE OF (Variable);
 END_ENTITY;

 SUBTYPE_CONSTRAINT separate_variables FOR Variable;
   ONEOF(Numeric_variable, String_variable)));
 END_SUBTYPE_CONSTRAINT;
 
END_SCHEMA;


SCHEMA Generic_expression_arm;

 ENTITY Variable
 END_ENTITY;

END_SCHEMA;

Here schemas are no longer referencing each other crosswise.
Expression_arm is clearly build on top of Generic_expression_arm.

--------

What are others thinking about this?
Is there a place in part 11 which clarifies the situation?

Lothar



-- 
// Lothar Klein, LKSoftWare GmbH
// Steinweg 1, 36093 Kuenzell, Germany
// +49 661 933933-0, Fax: -2
// url: http://www.lksoft.com



More information about the wg11 mailing list