(*
   $Id$
   ISO TC184/SC4/WG12 N4589 - ISO/CD-TS 10303-1472 General model parameter - EXPRESS ARM
*)

SCHEMA General_model_parameter_arm;

USE FROM Class_arm;

USE FROM Classification_assignment_arm;

USE FROM External_class_arm;

USE FROM Foundation_representation_arm;

USE FROM Independent_property_arm;

USE FROM Independent_property_representation_arm;

USE FROM Parameter_value_specification_arm;

USE FROM Property_assignment_arm;

TYPE gmp_classification_item = SELECT BASED_ON classification_item WITH
  (Constrained_general_parameter_relationship,
   General_model_parameter,
   Parameter_value_representation_item);
END_TYPE;

ENTITY Constrained_general_parameter_relationship
SUBTYPE OF (Independent_property_relationship);
  SELF\Independent_property_relationship.relating : General_model_parameter;
  SELF\Independent_property_relationship.related : General_model_parameter;
  required_class : Class;
WHERE
    WR1: (required_class.id IN CLASSOF(related)) AND (required_class.id IN CLASSOF(relating));
END_ENTITY;

ENTITY General_model_parameter
SUBTYPE OF (Independent_property);
END_ENTITY;

ENTITY Parameter_value_representation_item
SUBTYPE OF (Representation_item);
  parameter_value : parameter_value_select;
END_ENTITY;

FUNCTION CLASSOF(the_instance : GENERIC_ENTITY:ininst) : SET OF STRING;

  LOCAL
    result : SET OF STRING;
    classifications : BAG OF Classification_assignment;
  END_LOCAL;

  result := TYPEOF(the_instance);
  classifications := USEDIN(the_instance,'GENERAL_MODEL_PARAMETER_ARM.CLASSIFICATION_ASSIGNMENT.ITEMS');

  REPEAT i := LOINDEX(classifications) TO HIINDEX(classifications);
    result := result + classifications[i].ASSIGNED_CLASS.ID;
  END_REPEAT;

  RETURN (result);

END_FUNCTION;

END_SCHEMA;