FUNCTION using_representation_with_mapping
(item : representation_item) : SET [0:?] OF representation;
LOCAL results: SET OF representation := []; local_results : SET OF representation := []; local_representation_map : SET OF representation_map := []; intermediate_items : SET OF representation_item := []; i : INTEGER; j : INTEGER; END_LOCAL; -- find the representations IN which the item is used -- AND which is referenced FROM the representation_map local_results := QUERY (z <* using_representations (item)| SIZEOF (USEDIN (z, 'REPRESENTATION_SCHEMA.REPRESENTATION_MAP.' + 'MAPPED_REPRESENTATION')) > 0 ); IF (SIZEOF (local_results) = 0) THEN RETURN ([]); ELSE -- find the SET OF representation_map IN which the local_results are used REPEAT i := 1 TO HIINDEX(local_results); local_representation_map := local_representation_map + bag_to_set (USEDIN (local_results[i], 'REPRESENTATION_SCHEMA.REPRESENTATION_MAP.MAPPED_REPRESENTATION')); END_REPEAT; -- find the SET OF mapped_item REPEAT i := 1 TO HIINDEX(local_representation_map); intermediate_items := intermediate_items + bag_to_set (USEDIN (local_representation_map[i], 'REPRESENTATION_SCHEMA.MAPPED_ITEM.MAPPING_SOURCE')); END_REPEAT; -- REPEAT same manner REPEAT j := 1 TO HIINDEX(intermediate_items); results := results + bag_to_set (using_representation_with_mapping (intermediate_items[j])); END_REPEAT; END_IF; RETURN (results); END_FUNCTION; -- using_representation_with_mapping
|