FUNCTION item_in_context
(item : representation_item, cntxt : representation_context) : BOOLEAN;
LOCAL y : BAG OF representation_item; END_LOCAL; -- IF there is one OR more representation using both the item -- AND cntxt RETURN true. IF SIZEOF(USEDIN(item,'REPRESENTATION_SCHEMA.REPRESENTATION.ITEMS') * cntxt.representations_in_context) > 0 THEN RETURN (TRUE); -- Determine the BAG OF representation_items that reference -- item ELSE y := QUERY(z <* USEDIN (item , '') | 'REPRESENTATION_SCHEMA.REPRESENTATION_ITEM' IN TYPEOF(z)); -- Ensure that the BAG is NOT empty IF SIZEOF(y) > 0 THEN -- FOR each element IN the bag REPEAT i := 1 TO HIINDEX(y); -- Check TO see it is an item IN the input cntxt. IF item_in_context(y[i], cntxt) THEN RETURN (TRUE); END_IF; END_REPEAT; END_IF; END_IF; -- RETURN FALSE when all possible branches have been checked -- WITH no success. RETURN (FALSE); END_FUNCTION; -- item_in_context
|