acyclic_mapped_representation

EXPRESS specification:

FUNCTION acyclic_mapped_representation
(parent_set : SET OF representation; children_set : SET OF representation_item) : BOOLEAN; LOCAL x,y : SET OF representation_item; i : INTEGER; END_LOCAL; (* Determine the subset of children_set that are mapped_items. *) x := QUERY(z <* children_set | 'STRUCTURAL_FRAME_SCHEMA.MAPPED_ITEM' IN TYPEOF(z)); (* Determine that the subset has elements. *) IF SIZEOF(x) > 0 THEN (* Check each element of the set. *) REPEAT i := 1 TO HIINDEX(x); (* If the selected element maps a representation in the parent_set, then return false. *) IF x[i]\mapped_item.mapping_source.mapped_representation IN parent_set THEN RETURN (FALSE); END_IF; (* Recursive check of the items of mapped_rep. *) IF NOT acyclic_mapped_representation (parent_set + x[i]\mapped_item.mapping_source.mapped_representation, x[i]\mapped_item.mapping_source.mapped_representation.items) THEN RETURN (FALSE); END_IF; END_REPEAT; END_IF; (* Determine the subset of children_set that are not mapped_items. *) x := children_set - x; (* Determine that the subset has elements. *) IF SIZEOF(x) > 0 THEN (* For each element of the set: *) REPEAT i := 1 TO HIINDEX(x); (* Determine the set of representation_items referenced. *) y := QUERY(z <* bag_to_set( USEDIN(x[i], '')) | 'STRUCTURAL_FRAME_SCHEMA.REPRESENTATION_ITEM' IN TYPEOF(z)); (* Recursively check for an offending mapped_item. Return false for any errors encountered. *) IF NOT acyclic_mapped_representation(parent_set, y) THEN RETURN (FALSE); END_IF; END_REPEAT; END_IF; (* Return true when all elements are checked and no error conditions found. *) RETURN (TRUE);
END_FUNCTION;