FUNCTION assembly_shape_is_defined
(assy : next_assembly_usage_occurrence) : BOOLEAN;
LOCAL sdr_set : SET OF shape_definition_representation := []; srr_set : SET OF shape_representation_relationship := []; sdr1_set : SET OF shape_definition_representation := []; pd_set : SET OF property_definition := []; pdr_set : SET OF product_definition_relationship := []; pds_set : SET OF product_definition_shape := []; prop_set : SET OF property_definition := []; END_LOCAL;
-- Gather all instances OF shape_definition_representation WHERE the -- component part has a representation defined FOR it.
pd_set := bag_to_set( USEDIN(assy.related_product_definition, 'AUTOMOTIVE_DESIGN.PROPERTY_DEFINITION.DEFINITION')); pdr_set := QUERY( pdr <* bag_to_set(USEDIN (assy.related_product_definition, 'AUTOMOTIVE_DESIGN.PRODUCT_DEFINITION_RELATIONSHIP.' + 'RELATED_PRODUCT_DEFINITION')) | SIZEOF( USEDIN( pdr, 'AUTOMOTIVE_DESIGN.PROPERTY_DEFINITION.DEFINITION')) > 0); IF SIZEOF(pd_set) > 0 THEN REPEAT i:=1 TO HIINDEX(pd_set); sdr_set := sdr_set + QUERY( pdr <* USEDIN(pd_set[i], 'AUTOMOTIVE_DESIGN.PROPERTY_DEFINITION_REPRESENTATION.'+ 'DEFINITION') | 'AUTOMOTIVE_DESIGN.SHAPE_DEFINITION_REPRESENTATION' IN TYPEOF(pdr)); END_REPEAT; END_IF; IF SIZEOF(pdr_set) > 0 THEN --mp: first, get all the property_definitions --that REFERENCE the elements OF pdr_set REPEAT i:=1 TO HIINDEX(pdr_set); prop_set := prop_set + bag_to_set(USEDIN(pdr_set[i], 'AUTOMOTIVE_DESIGN.PROPERTY_DEFINITION.DEFINITION')); END_REPEAT; --mp: now, get all the shape_definition_representations -- that are reps OF the properties found IF SIZEOF (prop_set) > 0 THEN REPEAT i:=1 TO HIINDEX(prop_set); sdr_set := sdr_set + QUERY( pdr <* USEDIN(prop_set[i], 'AUTOMOTIVE_DESIGN.' + 'PROPERTY_DEFINITION_REPRESENTATION.DEFINITION') | 'AUTOMOTIVE_DESIGN.SHAPE_DEFINITION_REPRESENTATION' IN TYPEOF(pdr)); END_REPEAT; END_IF; END_IF;
-- IF there is a representation defined FOR the component part
IF SIZEOF (sdr_set) > 0 THEN
-- FOR each representation OF the shape OF the component part gather -- all instances OF shape_representation_relationship WHERE the -- representation OF component part is related TO another -- representation.
REPEAT i := 1 TO HIINDEX (sdr_set); srr_set := QUERY (rr <* bag_to_set ( USEDIN (sdr_set[i]\ property_definition_representation.used_representation, 'AUTOMOTIVE_DESIGN.REPRESENTATION_RELATIONSHIP.REP_2')) | 'AUTOMOTIVE_DESIGN.SHAPE_REPRESENTATION_RELATIONSHIP' IN TYPEOF (rr));
-- IF there is a shape_representation_relationship WHERE the component -- component part's shape_representation is related to another shape_- -- representation.
pd_set := bag_to_set(USEDIN(assy.relating_product_definition, 'AUTOMOTIVE_DESIGN.PROPERTY_DEFINITION.DEFINITION'));
IF SIZEOF(pd_set) > 0 THEN REPEAT i:=1 TO HIINDEX(pd_set); sdr1_set := sdr1_set + QUERY( pdr <* USEDIN(pd_set[i], 'AUTOMOTIVE_DESIGN.PROPERTY_DEFINITION_REPRESENTATION.'+ 'DEFINITION') | 'AUTOMOTIVE_DESIGN.SHAPE_DEFINITION_REPRESENTATION' IN TYPEOF(pdr)); END_REPEAT; END_IF;
IF ( (SIZEOF(sdr_set) > 0) AND (SIZEOF(sdr1_set) > 0) ) THEN
IF SIZEOF (srr_set) > 0 THEN
-- For each shape_representation_relationship in that set
REPEAT j := 1 TO HIINDEX (srr_set);
-- If the other shape_representation in the shape_representa- -- tion_relationship is the shape_representation of the assembly -- product_definition in at least one instance.
IF SIZEOF (QUERY (pdr <* bag_to_set (USEDIN (srr_set[j]\representation_relationship.rep_1, 'AUTOMOTIVE_DESIGN.PROPERTY_DEFINITION_REPRESENTATION.' + 'USED_REPRESENTATION')) | 'AUTOMOTIVE_DESIGN.SHAPE_DEFINITION_REPRESENTATION' IN TYPEOF (pdr)) * sdr1_set) >= 1 THEN
-- If the shape_representation_relationship and the -- product_definition_relationship of each occurrence -- of the component -- and assembly relationship is not given via the -- context_dependent_shape_representation then return FALSE
pds_set := QUERY(x <* bag_to_set( USEDIN(assy, 'AUTOMOTIVE_DESIGN.PROPERTY_DEFINITION.DEFINITION')) | 'AUTOMOTIVE_DESIGN.PRODUCT_DEFINITION_SHAPE' IN TYPEOF(x));
IF SIZEOF(pds_set) = 0 THEN RETURN (FALSE); END_IF;
REPEAT k:=1 TO HIINDEX(pds_set); IF SIZEOF (QUERY (cdsr <* USEDIN (pds_set[k], 'AUTOMOTIVE_DESIGN.' + 'CONTEXT_DEPENDENT_SHAPE_REPRESENTATION.' + 'REPRESENTED_PRODUCT_RELATION') | (cdsr.representation_relation :=: srr_set[j]) )) > 0 THEN RETURN (FALSE); END_IF; END_REPEAT; END_IF; END_REPEAT; END_IF; END_IF; END_REPEAT; END_IF;
-- If the shape of the component is not specified or there are no -- violations then return TRUE
RETURN (TRUE); END_FUNCTION; -- assembly_shape_is_defined
|