(*
   $Id$
   ISO TC184/SC4/WG12 N4801 - ISO/CD-TS 10303-1782 Qualified measure - EXPRESS ARM
*)

SCHEMA Qualified_measure_arm;

USE FROM Measure_representation_arm; -- ISO/TS 10303-1118

  CONSTANT
    pre_defined_type_qualifiers : SET OF STRING := ['minimum', 'maximum',
    'nominal', 'specified', 'typical', 'calculated', 'designed', 'estimated',
    'measured', 'required', 'set point',
    'basic', 'lower deviation', 'upper deviation'];
  END_CONSTANT;

  TYPE value_qualifier = SELECT
    (Precision_qualifier,
     Type_qualifier,
     Uncertainty_qualifier);
  END_TYPE;

  ENTITY Expanded_uncertainty
    SUBTYPE OF (Standard_uncertainty);
      coverage_factor : REAL;
  END_ENTITY;

  ENTITY Measure_qualification;
      name              : STRING; 
      description       : STRING; 
      qualified_measure : Value_with_unit;
      qualifiers        : SET[1:?] OF value_qualifier;
    WHERE
      WR1 : NOT('MEASURE_REPRESENTATION_ARM.'+'NUMERICAL_ITEM_WITH_UNIT' IN TYPEOF(qualified_measure));
      WR2 : SIZEOF(QUERY(temp <* qualifiers | 
        'QUALIFIED_MEASURE_ARM.PRECISION_QUALIFIER' IN TYPEOF(temp))) < 2;      
  END_ENTITY;

  ENTITY Precision_qualifier;
    precision_value : INTEGER;
  END_ENTITY;

  ENTITY Pre_defined_type_qualifier
    SUBTYPE OF (Type_qualifier);
    WHERE
      WR1: SELF\Type_qualifier.name IN pre_defined_type_qualifiers;
  END_ENTITY;

  ENTITY Qualified_numerical_item_with_unit 
    SUBTYPE OF (Numerical_item_with_unit, Qualified_representation_item); 
  END_ENTITY; 

  ENTITY Qualified_representation_item 
    ABSTRACT SUPERTYPE
    SUBTYPE OF (Representation_item); 
       qualifiers : SET [1:?] OF value_qualifier; 
    WHERE 
      WR1: SIZEOF(QUERY(temp <* qualifiers | 
        'QUALIFIED_MEASURE_ARM.PRECISION_QUALIFIER' 
        IN TYPEOF(temp))) < 2; 
  END_ENTITY; 

  ENTITY Qualitative_uncertainty
    SUBTYPE OF (Uncertainty_qualifier);
      uncertainty_value : STRING; 
  END_ENTITY;

  ENTITY Standard_uncertainty
    SUPERTYPE OF (Expanded_uncertainty)
    SUBTYPE OF (Uncertainty_qualifier);
      uncertainty_value : REAL;
  END_ENTITY;

  ENTITY Type_qualifier
    ABSTRACT SUPERTYPE OF(Pre_defined_type_qualifier);
    name : STRING;
  END_ENTITY;

  ENTITY Uncertainty_qualifier
    SUPERTYPE OF (ONEOF (Standard_uncertainty,
      Qualitative_uncertainty));
      measure_name : STRING; 
      description  : STRING; 
  END_ENTITY;

END_SCHEMA;
