|
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 ; 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 |
|
public class FValid_selected_instance_representation public static Value run(SdaiContext _context, Value pd) |