Schema: Extended_basic_geometry_mim



SCHEMA Extended_basic_geometry_mim;

USE FROM Basic_geometry_mim;    -- ISO/TS 10303-1652

USE FROM Shape_property_assignment_mim;    -- ISO/TS 10303-1032

USE FROM representation_schema   -- ISO 10303-43
  (mapped_item,
   representation_item_relationship,
   representation_map,
   representation_relationship_with_transformation,
   transformation);

USE FROM geometry_schema   -- ISO 10303-42
  (vector);

REFERENCE FROM support_resource_schema   -- ISO 10303-41
  (bag_to_set);


ENTITY definitional_representation_relationship
  SUBTYPE OF (representation_relationship);
WHERE
  WR1: acyclic_representation_relationship(SELF, [SELF\representation_relationship.rep_2], 'REPRESENTATION_SCHEMA.'+ 'REPRESENTATION');
END_ENTITY;

ENTITY geometric_model_element_relationship
  SUBTYPE OF (geometric_representation_item, representation_item_relationship);
UNIQUE
  UR1: SELF\representation_item_relationship.relating_representation_item, SELF\representation_item_relationship.related_representation_item;
WHERE
  WR1: SELF\representation_item_relationship.relating_representation_item :<>: SELF\representation_item_relationship.related_representation_item;
END_ENTITY;

FUNCTION acyclic_representation_relationship
 (relation : representation_relationship; relatives : SET[1:?] OF representation; specific_relation : STRING) : BOOLEAN;
LOCAL
      x : SET OF representation_relationship;
    END_LOCAL;

    IF relation.rep_1 IN relatives THEN
      RETURN (FALSE);
    END_IF;
    x := QUERY(r <* bag_to_set(USEDIN(relation.rep_1, 'REPRESENTATION_SCHEMA.' + 'REPRESENTATION_RELATIONSHIP.' + 'REP_2')) | specific_relation IN TYPEOF(r));
    REPEAT i := 1 TO HIINDEX(x);
      IF NOT acyclic_representation_relationship(x[i], relatives + relation.rep_1, specific_relation) THEN
        RETURN (FALSE);
      END_IF;
    END_REPEAT;
    RETURN (TRUE);
END_FUNCTION;

END_SCHEMA;  -- Extended_basic_geometry_mim