(*
ISO TC184/SC4/WG12 N4832 - ISO/CD 10303-101 Draughting - EXPRESS
*)

SCHEMA draughting_dimension_schema;

REFERENCE FROM draughting_element_schema
    (dimension_curve,
     leader_curve,
     projection_curve,
     draughting_callout,
     draughting_callout_relationship,
     dimension_curve_directed_callout,
     leader_directed_callout,
     projection_directed_callout,
     dimension_extent_usage);

ENTITY dimension_callout
  SUBTYPE OF (draughting_callout);
WHERE
  WR1: ('DRAUGHTING_ELEMENT_SCHEMA.LEADER_DIRECTED_CALLOUT'
        IN (TYPEOF (SELF))) XOR
       (SIZEOF (QUERY(dce_1 <* SELF\draughting_callout.contents |
       ('DRAUGHTING_ELEMENT_SCHEMA.LEADER_CURVE'
        IN (TYPEOF(dce_1))))) = 0);
  WR2: ('DRAUGHTING_ELEMENT_SCHEMA.PROJECTION_DIRECTED_CALLOUT'
        IN (TYPEOF (SELF))) XOR
       (SIZEOF (QUERY(dce_1 <* SELF\draughting_callout.contents |
       ('DRAUGHTING_ELEMENT_SCHEMA.PROJECTION_CURVE'
        IN (TYPEOF(dce_1))))) = 0);
  WR3:
('DRAUGHTING_ELEMENT_SCHEMA.DIMENSION_CURVE_DIRECTED_CALLOUT'
        IN (TYPEOF (SELF))) XOR
       (SIZEOF (QUERY(dce_1 <* SELF\draughting_callout.contents |
       ('DRAUGHTING_ELEMENT_SCHEMA.DIMENSION_CURVE'
        IN (TYPEOF(dce_1))))) = 0);
END_ENTITY;

ENTITY dimension_graph
  SUBTYPE OF (dimension_curve_directed_callout);
WHERE
  WR1: SIZEOF(USEDIN(SELF,'DRAUGHTING_DIMENSION_SCHEMA.'+
       'DIMENSION_GRAPH_PROJECTION_CURVE_USAGE.GRAPH')) <= 2;
  WR2: SIZEOF(QUERY(dce <* SELF\draughting_callout.contents |
       'DRAUGHTING_ELEMENT_SCHEMA.PROJECTION_CURVE'
       IN (TYPEOF(dce)))) = 0;
  WR3: 'DRAUGHTING_DIMENSION_SCHEMA.DIMENSION_CALLOUT' 
       IN (TYPEOF(SELF));
END_ENTITY;

ENTITY dimension_graph_projection_curve_usage;
  graph           : dimension_graph;
  projection_line : projection_curve;
  role            : dimension_extent_usage;
UNIQUE
  UR1: graph, projection_line;
  UR2: graph, role;
END_ENTITY;

ENTITY dimension_graph_sequence
  SUBTYPE OF (draughting_callout_relationship);
WHERE
  WR1: 'DRAUGHTING_DIMENSION_SCHEMA.DIMENSION_GRAPH' IN
       TYPEOF (SELF\draughting_callout_relationship.
                    relating_draughting_callout);
  WR2: 'DRAUGHTING_DIMENSION_SCHEMA.DIMENSION_GRAPH' IN
       TYPEOF (SELF\draughting_callout_relationship.
                    related_draughting_callout);
END_ENTITY;

END_SCHEMA; -- draughting_dimension_schema
