Schema: experience_schema

Source : ISO 10303-41



SCHEMA experience_schema;

REFERENCE FROM support_resource_schema   -- ISO 10303-41
  (identifier,
   label,
   text,
   bag_to_set);


ENTITY experience;
  id : identifier;
  name : label;
  description : OPTIONAL text;
END_ENTITY;

ENTITY experience_relationship;
  id : identifier;
  name : label;
  description : OPTIONAL text;
  relating_experience : experience;
  related_experience : experience;
END_ENTITY;

ENTITY experience_type;
  id : identifier;
  name : label;
  description : OPTIONAL text;
END_ENTITY;

ENTITY experience_type_relationship;
  id : identifier;
  name : label;
  description : OPTIONAL text;
  relating_experience_type : experience_type;
  related_experience_type : experience_type;
END_ENTITY;

FUNCTION acyclic_experience_relationship
 (relation : experience_relationship; relatives : SET[0:?] OF experience; specific_relation : STRING) : BOOLEAN;
LOCAL
      x : SET OF experience_relationship;
    END_LOCAL;

    IF relation.relating_experience IN relatives THEN
      RETURN (FALSE);
    END_IF;
    x := QUERY(expr <* bag_to_set(USEDIN(relation.relating_experience, 'EXPERIENCE_SCHEMA.' + 'EXPERIENCE_RELATIONSHIP.' + 'RELATED_EXPERIENCE')) | specific_relation IN TYPEOF(expr));
    REPEAT i := 1 TO HIINDEX(x);
      IF NOT acyclic_experience_relationship(x[i], relatives + relation.relating_experience, specific_relation) THEN
        RETURN (FALSE);
      END_IF;
    END_REPEAT;
    RETURN (TRUE);
END_FUNCTION;

FUNCTION acyclic_experience_type_relationship
 (relation : experience_type_relationship; relatives : SET[0:?] OF experience_type; specific_relation : STRING) : BOOLEAN;
LOCAL
      x : SET OF experience_type_relationship;
    END_LOCAL;

    IF relation.relating_experience_type IN relatives THEN
      RETURN (FALSE);
    END_IF;
    x := QUERY(exptyp <* bag_to_set(USEDIN(relation.relating_experience_type, 'EXPERIENCE_SCHEMA.' + 'EXPERIENCE_TYPE_RELATIONSHIP.' + 'RELATED_EXPERIENCE_TYPE')) | specific_relation IN TYPEOF(exptyp));
    REPEAT i := 1 TO HIINDEX(x);
      IF NOT acyclic_experience_type_relationship(x[i], relatives + relation.relating_experience_type, specific_relation) THEN
        RETURN (FALSE);
      END_IF;
    END_REPEAT;
    RETURN (TRUE);
END_FUNCTION;

END_SCHEMA;  -- experience_schema