FUNCTION valid_selected_instance_representation
(pd : product_definition_or_assembly_relationship) : LOGICAL;
LOCAL properties: SET OF property_definition := bag_to_set(QUERY( prd<* USEDIN ( pd ,'PART_OCCURRENCE_MIM.PROPERTY_DEFINITION.DEFINITION' ) | (prd.name = 'occurrence selection' ))); property_definition_representations: SET OF property_definition_representation := bag_to_set(QUERY ( pdr <* USEDIN ( properties[1] , 'PART_OCCURRENCE_MIM.PROPERTY_DEFINITION_REPRESENTATION.DEFINITION') | ( pdr.used_representation.name = 'selection criteria' ))); selected_representation: representation; END_LOCAL; IF (SIZEOF( properties)<>1) THEN RETURN(FALSE); END_IF; IF (SIZEOF(property_definition_representations)<>1) THEN RETURN(FALSE); END_IF; selected_representation := property_definition_representations[1]\property_definition_representation.used_representation; IF (SIZEOF(selected_representation\representation.items) <1) OR (SIZEOF(selected_representation\representation.items) >2) THEN RETURN(FALSE); END_IF; IF (SIZEOF ( QUERY ( i <* selected_representation\representation.items | ( SIZEOF (['PART_OCCURRENCE_MIM.MEASURE_REPRESENTATION_ITEM' , 'PART_OCCURRENCE_MIM.VALUE_RANGE']* TYPEOF ( i ) ) = 1) AND ( i.name = 'selection quantity' ))) <> 1 ) THEN RETURN(FALSE); END_IF; IF (SIZEOF ( QUERY ( i <* selected_representation\representation.items | ( 'PART_OCCURRENCE_MIM.DESCRIPTIVE_REPRESENTATION_ITEM' IN TYPEOF ( i ) ) AND ( i.name = 'selection control' )))> 1) THEN RETURN(FALSE); END_IF; --the selection control is NOT specified THEN the quantity shall be a qualified_representation_item OR a value_range IF (SIZEOF ( QUERY ( i <* selected_representation\representation.items | ( 'PART_OCCURRENCE_MIM.DESCRIPTIVE_REPRESENTATION_ITEM' IN TYPEOF( i ) ) AND ( i.name = 'selection control' ) ))= 0) AND (SIZEOF ( QUERY ( i <* selected_representation\representation.items | ( i.name = 'selection quantity' ) AND ( SIZEOF(['PART_OCCURRENCE_MIM.QUALIFIED_REPRESENTATION_ITEM' , 'PART_OCCURRENCE_MIM.VALUE_RANGE']* TYPEOF ( i ) ) =0 ))) > 0 ) THEN RETURN(FALSE); END_IF; RETURN(TRUE); END_FUNCTION; -- valid_selected_instance_representation
|