(*
 $Id$
 ISO TC184/SC4/WG3 N1304 - ISO/TS 10303-1351 Catalog data information - EXPRESS MIM
*)

SCHEMA Catalog_data_information_mim;


USE FROM Alias_identification_mim;

USE FROM Alternative_solution_mim;

USE FROM Approval_mim;

USE FROM Assembly_structure_mim;

USE FROM Certification_mim;

USE FROM Classification_assignment_mim;

USE FROM Classification_with_attributes_mim;

USE FROM Configuration_effectivity_mim;

USE FROM Contextual_shape_positioning_mim;

USE FROM Contract_mim;

USE FROM Date_time_mim;

USE FROM Date_time_assignment_mim;

USE FROM Dimension_tolerance_mim;

USE FROM Document_and_version_identification_mim;

USE FROM Document_assignment_mim;

USE FROM Document_definition_mim;

USE FROM Document_properties_mim;

USE FROM Document_structure_mim;

USE FROM Effectivity_application_mim;

USE FROM Effectivity_mim;

USE FROM Elemental_geometric_shape_mim;

USE FROM Event_mim;

USE FROM Event_assignment_mim;

USE FROM Extended_measure_representation_mim;

USE FROM External_class_mim;

USE FROM External_model_mim;

USE FROM External_properties_mim;

USE FROM File_identification_mim;

USE FROM Foundation_representation_mim;

USE FROM Functional_breakdown_mim;

USE FROM Generic_material_aspects_mim;

USE FROM Group_mim;

USE FROM Incomplete_data_reference_mechanism_mim;

USE FROM Independent_property_mim;

USE FROM Inertia_characteristics_mim;

USE FROM Item_definition_structure_mim;

USE FROM Management_resource_information_mim;

USE FROM Manufacturing_configuration_effectivity_mim;

USE FROM Pdm_material_aspects_mim;

USE FROM Product_data_management_mim;

USE FROM Multi_linguism_mim;

USE FROM Part_and_version_identification_mim;

USE FROM Part_collection_mim;

USE FROM Part_definition_relationship_mim;

USE FROM Part_occurrence_mim;

USE FROM Part_view_definition_mim;

USE FROM Pdm_Material_aspects_mim;

USE FROM Person_organization_mim;

USE FROM Person_organization_assignment_mim;

USE FROM Plib_class_reference_mim;

USE FROM Product_breakdown_mim;

USE FROM Product_categorization_mim;

USE FROM Product_class_mim;

USE FROM Product_occurrence_mim;

USE FROM Product_replacement_mim;

USE FROM Product_view_definition_mim;

USE FROM Product_view_definition_properties_mim;


USE FROM Product_view_definition_relationship_mim;

USE FROM Property_assignment_mim;

USE FROM Shape_property_assignment_mim;

USE FROM Specification_based_configuration_mim;

USE FROM Specification_control_mim;

USE FROM Specified_product_mim;

USE FROM Time_interval_mim;

USE FROM Value_with_unit_mim;

USE FROM action_schema
  (executed_action); 
USE FROM application_context_schema
  (application_context); 
USE FROM approval_schema
  (approval,
   approval_person_organization,
   approval_relationship,
   approval_status); 
USE FROM certification_schema
  (certification); 
USE FROM classification_schema
  (class); 
USE FROM configuration_management_schema
  (configuration_design,
   configuration_effectivity,
   configuration_item); 
USE FROM contract_schema
  (contract); 
USE FROM date_time_schema
  (date_role,
   date_time_role,
   event_occurrence,
   time_interval_role); 
USE FROM document_schema
  (document_relationship,
   document_type); 
USE FROM effectivity_schema
  (effectivity,
   effectivity_relationship); 
USE FROM external_reference_schema
  (external_source); 
USE FROM geometry_schema
  (geometric_representation_item); 
USE FROM group_schema
  (group,
   group_relationship); 
USE FROM management_resources_schema
  (attribute_value_assignment,
   document_usage_role,
   identification_role); 
USE FROM material_property_definition_schema
  (property_definition_relationship,
   material_designation); 
USE FROM person_organization_schema
  (organization,
   organization_relationship,
   organization_role,
   organizational_project,
   organizational_project_relationship,
   person,
   person_and_organization,
   person_and_organization_role); 
USE FROM presentation_resource_schema
  (planar_extent); 
USE FROM product_concept_schema
  (product_concept,
   product_concept_feature,
   product_concept_feature_association,
   product_concept_relationship); 
USE FROM product_definition_schema
  (product,
   product_definition,
   product_definition_context_role,
   product_definition_formation,
   product_definition_formation_relationship,
   product_definition_substitute,
   product_related_product_category); 
USE FROM product_property_definition_schema
  (general_property,
   general_property_relationship,
   property_definition,
   shape_aspect,
   shape_aspect_relationship
   ); 
USE FROM product_property_representation_schema
  (shape_representation); 
USE FROM product_structure_schema
  (alternate_product_relationship,
   assembly_component_usage_substitute); 
USE FROM qualified_measure_schema
  (descriptive_representation_item,
   measure_representation_item,
   uncertainty_qualifier); 
USE FROM representation_schema
  (mapped_item,
   representation,
   representation_relationship,
   uncertainty_measure_with_unit); 

REFERENCE FROM support_resource_schema   -- ISO 10303-41
  (type_check_function); 

TYPE approval_item_236cc1 = EXTENSIBLE SELECT BASED_ON approval_item WITH
  (alternate_product_relationship,
   applied_classification_assignment,
   assembly_component_usage_substitute,
   certification,
   class,
   class_system,
   configuration_design,
   configuration_effectivity,
   configured_effectivity_assignment,
   contract,
   document_file,
   general_property,
   material_designation,
   organizational_project,
   product,
   product_concept,
   product_concept_feature,
   product_concept_feature_association,
   product_concept_feature_category,
   product_concept_feature_category_usage,
   product_definition,
   product_definition_formation,
   product_definition_relationship,
   product_definition_substitute,
   property_definition,
   shape_representation);
END_TYPE;

TYPE attribute_language_item_236cc1 = EXTENSIBLE SELECT BASED_ON attribute_language_item WITH
  (alternate_product_relationship,
   application_context,
   approval_relationship,
   assembly_component_usage_substitute,
   attribute_value_assignment,
   certification,
   configuration_design,
   configuration_item,
   contract,
   date_role,
   date_time_role,
   descriptive_representation_item,
   document_relationship,
   effectivity,
   effectivity_relationship,
   event_occurrence,
   external_source,
   general_property,
   general_property_relationship,
   geometric_representation_item,
   group,
   group_relationship,
   identification_role,
   mapped_item,
   organization_relationship,
   organization_role,
   organizational_project,
   organizational_project_relationship,
   person_and_organization_role,
   product,
   product_concept,
   product_concept_feature,
   product_concept_feature_association,
   product_concept_relationship,
   product_definition,
   product_definition_formation,
   product_definition_formation_relationship,
   product_definition_relationship,
   product_definition_substitute,
   product_related_product_category,
   property_definition,
   representation,
   representation_relationship,
   shape_aspect,
   shape_aspect_relationship,
   time_interval_role,
   uncertainty_measure_with_unit,
   uncertainty_qualifier);
END_TYPE;

TYPE certification_item_236cc1  = EXTENSIBLE SELECT BASED_ON certification_item WITH
  (product_definition,
   product_definition_formation,
   product_definition_formation_relationship,
   product_definition_relationship);
END_TYPE;

TYPE classification_item_236cc1  = EXTENSIBLE SELECT BASED_ON classification_item WITH
  (approval_status,
   class,
   configuration_item,
   contract,
   document_file,
   document_type,
   general_property,
   material_designation,
   organizational_project,
   planar_extent,
   product,
   product_concept,
   product_concept_feature_category,
   product_definition,
   product_definition_formation,
   product_definition_relationship,
   property_definition,
   shape_aspect);
END_TYPE;

TYPE contract_item_236cc1  = EXTENSIBLE SELECT BASED_ON contract_item WITH
  (product_definition_formation);
END_TYPE;

TYPE date_and_time_item_236cc1   = EXTENSIBLE SELECT BASED_ON date_and_time_item WITH
  (alternate_product_relationship,
   applied_classification_assignment,
   applied_organization_assignment,
   applied_person_and_organization_assignment,
   approval_person_organization,
   approval_status,
   assembly_component_usage_substitute,
   certification,
   class,
   class_system,
   configuration_design,
   configuration_item,
   configured_effectivity_assignment,
   contract,
   document_file,
   effectivity,
   event_occurrence,
   general_property,
   material_designation,
   organization_relationship,
   organizational_project,
   person_and_organization,
   product,
   product_concept,
   product_concept_feature,
   product_concept_feature_association,
   product_concept_feature_category,
   product_concept_feature_category_usage,
   product_definition,
   product_definition_formation,
   product_definition_formation_relationship,
   product_definition_relationship,
   product_definition_substitute,
   property_definition,
   shape_representation);
END_TYPE;

TYPE date_item_236cc1  = EXTENSIBLE SELECT BASED_ON date_item WITH
  (alternate_product_relationship,
   applied_classification_assignment,
   applied_organization_assignment,
   applied_person_and_organization_assignment,
   approval_person_organization,
   approval_status,
   assembly_component_usage_substitute,
   certification,
   class,
   class_system,
   configuration_design,
   configuration_item,
   configured_effectivity_assignment,
   contract,
   document_file,
   effectivity,
   event_occurrence,
   general_property,
   material_designation,
   organization_relationship,
   organizational_project,
   person_and_organization,
   product,
   product_concept,
   product_concept_feature,
   product_concept_feature_association,
   product_concept_feature_category,
   product_concept_feature_category_usage,
   product_definition,
   product_definition_formation,
   product_definition_formation_relationship,
   product_definition_relationship,
   product_definition_substitute,
   property_definition,
   shape_representation);
END_TYPE;

TYPE document_reference_item_236cc1  = EXTENSIBLE SELECT BASED_ON document_reference_item WITH
  (approval,
   certification,
   class,
   class_system,
   configuration_design,
   configuration_item,
   contract,
   descriptive_representation_item,
   general_property,
   material_designation,
   organization,
   organizational_project,
   person,
   product,
   product_concept,
   product_concept_feature,
   product_concept_feature_category,
   product_definition,
   product_definition_formation,
   product_definition_formation_relationship,
   product_definition_relationship,
   product_definition_substitute,
   product_related_product_category,
   property_definition,
   representation,
   shape_aspect,
   shape_aspect_relationship);
END_TYPE;

TYPE effectivity_item_236cc1  = EXTENSIBLE SELECT BASED_ON effectivity_item WITH
  (assembly_component_usage_substitute,
   class_system,
   configuration_design,
   configuration_item,
   configured_effectivity_assignment,
   document_file,
   general_property,
   material_designation,
   product,
   product_concept,
   product_concept_feature,
   product_concept_feature_association,
   product_concept_feature_category,
   product_concept_feature_category_usage,
   product_definition,
   product_definition_formation,
   product_definition_formation_relationship,
   product_definition_relationship,
   product_definition_substitute,
   property_definition,
   shape_aspect,
   shape_representation);
END_TYPE;

TYPE event_occurrence_item_236cc1  = EXTENSIBLE SELECT BASED_ON event_occurrence_item WITH
  (alternate_product_relationship,
   applied_classification_assignment,
   applied_person_and_organization_assignment,
   approval_status,
   assembly_component_usage_substitute,
   certification,
   class,
   class_system,
   configuration_design,
   configuration_effectivity,
   configuration_item,
   configured_effectivity_assignment,
   contract,
   document_file,
   general_property,
   material_designation,
   organization_relationship,
   organizational_project,
   person_and_organization,
   product,
   product_concept,
   product_concept_feature,
   product_concept_feature_association,
   product_concept_feature_category,
   product_concept_feature_category_usage,
   product_definition,
   product_definition_formation,
   product_definition_formation_relationship,
   product_definition_relationship,
   product_definition_substitute,
   property_definition,
   shape_representation);
END_TYPE;

TYPE external_identification_item_236cc1  = EXTENSIBLE SELECT BASED_ON external_identification_item WITH
  (document_file,
   externally_defined_class,
   externally_defined_general_property,
   product_definition);
END_TYPE;

TYPE identification_item_236cc1  = EXTENSIBLE SELECT BASED_ON identification_item WITH
  (applied_identification_assignment,
   approval_status,
   class,
   class_system,
   configuration_item,
   document_file,
   document_type,
   effectivity,
   general_property,
   measure_representation_item,
   organization,
   person_and_organization,
   product,
   product_concept,
   product_concept_feature,
   product_concept_feature_category,
   product_definition,
   product_definition_formation,
   product_definition_relationship,
   property_definition,
   shape_aspect_relationship,
   shape_representation);
END_TYPE;

TYPE multi_language_attribute_item_236cc1 = EXTENSIBLE SELECT BASED_ON multi_language_attribute_item WITH
  (alternate_product_relationship,
   application_context,
   approval_relationship,
   assembly_component_usage_substitute,
   certification,
   configuration_design,
   configuration_item,
   contract,
   date_role,
   date_time_role,
   descriptive_representation_item,
   document_relationship,
   effectivity,
   effectivity_relationship,
   event_occurrence,
   external_source,
   general_property,
   general_property_relationship,
   geometric_representation_item,
   group,
   group_relationship,
   identification_role,
   mapped_item,
   organization_relationship,
   organization_role,
   organizational_project,
   organizational_project_relationship,
   person_and_organization_role,
   product,
   product_concept,
   product_concept_feature,
   product_concept_feature_association,
   product_concept_relationship,
   product_definition,
   product_definition_formation,
   product_definition_formation_relationship,
   product_definition_relationship,
   product_definition_substitute,
   product_related_product_category,
   property_definition,
   representation,
   representation_relationship,
   shape_aspect,
   shape_aspect_relationship,
   time_interval_role,
   uncertainty_measure_with_unit,
   uncertainty_qualifier);
END_TYPE;

TYPE organization_item_236cc1  = EXTENSIBLE SELECT BASED_ON organization_item WITH
  (alternate_product_relationship,
   applied_classification_assignment,
   applied_identification_assignment,
   applied_organization_assignment,
   applied_person_and_organization_assignment,
   approval,
   approval_status,
   assembly_component_usage_substitute,
   certification,
   class,
   class_system,
   configuration_design,
   configuration_effectivity,
   configuration_item,
   configured_effectivity_assignment,
   contract,
   document_file,
   effectivity,
   event_occurrence,
   executed_action,
   general_property,
   material_designation,
   organization_relationship,
   organizational_project,
   person_and_organization,
   product,
   product_concept,
   product_concept_feature,
   product_concept_feature_association,
   product_concept_feature_category,
   product_concept_feature_category_usage,
   product_definition,
   product_definition_formation,
   product_definition_formation_relationship,
   product_definition_relationship,
   product_definition_substitute,
   property_definition,
   shape_representation);
END_TYPE;

TYPE person_and_organization_item_236cc1  = EXTENSIBLE SELECT BASED_ON person_and_organization_item WITH
  (alternate_product_relationship,
   applied_classification_assignment,
   applied_organization_assignment,
   applied_person_and_organization_assignment,
   approval_status,
   assembly_component_usage_substitute,
   certification,
   class,
   class_system,
   configuration_design,
   configuration_effectivity,
   configuration_item,
   configured_effectivity_assignment,
   contract,
   document_file,
   event_occurrence,
   executed_action,
   general_property,
   material_designation,
   organization_relationship,
   organizational_project,
   person_and_organization,
   product,
   product_concept,
   product_concept_feature,
   product_concept_feature_association,
   product_concept_feature_category,
   product_concept_feature_category_usage,
   product_definition,
   product_definition_formation,
   product_definition_formation_relationship,
   product_definition_relationship,
   product_definition_substitute,
   property_definition,
   shape_representation);
END_TYPE;


RULE approval_person_organization_requires_date_time 
    FOR (approval_person_organization);
WHERE
WR1: SIZEOF ( QUERY ( apo <* approval_person_organization | (
     SIZEOF ( QUERY ( u <* USEDIN ( apo , 'CATALOG_DATA_INFORMATION_MIM' + '.APPLIED_DATE_ASSIGNMENT.ITEMS' ) | 
	( u.role.name =  'sign off' ) ) ) + 
   SIZEOF ( QUERY ( u <* USEDIN ( apo , 'CATALOG_DATA_INFORMATION_MIM' + '.APPLIED_DATE_AND_TIME_ASSIGNMENT.ITEMS' ) | 
	( u.role.name =  'sign off' ) ) ) ) <>1 ) ) =  0;
END_RULE; 

RULE approval_requires_approval_assignment FOR (approval);
WHERE
WR1: SIZEOF ( QUERY ( a <* approval | 
	SIZEOF(USEDIN( a, 'CATALOG_DATA_INFORMATION_MIM' + '.APPROVAL_ASSIGNMENT.ASSIGNED_APPROVAL' )) =  0 )) =  0;
END_RULE;

RULE dependent_instantiable_derived_unit FOR
    (derived_unit);
WHERE
 WR1: SIZEOF ( QUERY ( d <* derived_unit | NOT ( SIZEOF ( USEDIN
     ( d , '' ) ) >0 ) ) ) =0;
END_RULE;

RULE dependent_instantiable_document_usage_role FOR
    (document_usage_role);
WHERE
 WR1: SIZEOF ( QUERY ( d <* document_usage_role | NOT ( SIZEOF (
     USEDIN ( d , '' ) ) >0 ) ) ) =0;
END_RULE;

RULE dependent_instantiable_measure_with_unit FOR
    (measure_with_unit);
WHERE
 WR1: SIZEOF ( QUERY ( m <* measure_with_unit | NOT ( SIZEOF (
     USEDIN ( m , '' ) ) >0 ) ) ) =0;
END_RULE;

RULE dependent_instantiable_named_unit FOR
    (named_unit);
WHERE
 WR1: SIZEOF ( QUERY ( n <* named_unit | NOT ( SIZEOF ( USEDIN (
     n , '' ) ) >0 ) ) ) =0;
END_RULE;

RULE dependent_instantiable_precision_qualifier FOR
    (precision_qualifier);
WHERE
 WR1: SIZEOF ( QUERY ( p <* precision_qualifier | NOT ( SIZEOF (
     USEDIN ( p , '' ) ) >0 ) ) ) =0;
END_RULE;

RULE dependent_instantiable_product_definition_context_role FOR
    (product_definition_context_role);
WHERE
 WR1: SIZEOF ( QUERY ( p <* product_definition_context_role |
     NOT ( SIZEOF ( USEDIN ( p , '' ) ) >0 ) ) ) =0;
END_RULE;

RULE dependent_instantiable_standard_uncertainty FOR
    (standard_uncertainty);
WHERE
 WR1: SIZEOF ( QUERY ( s <* standard_uncertainty | NOT ( SIZEOF
     ( USEDIN ( s , '' ) ) >0 ) ) ) =0;
END_RULE;

RULE dependent_instantiable_time_interval_role FOR (time_interval_role);
WHERE
WR1: SIZEOF ( QUERY ( t <* time_interval_role | NOT (
     SIZEOF ( USEDIN ( t , '' ) ) >0 ) ) ) =  0;
END_RULE;

RULE dependent_instantiable_type_qualifier FOR
    (type_qualifier);
WHERE
 WR1: SIZEOF ( QUERY ( t <* type_qualifier | NOT ( SIZEOF (
     USEDIN ( t , '' ) ) >0 ) ) ) =0;
END_RULE;

RULE dependent_instantiable_uncertainty_qualifier FOR
    (uncertainty_qualifier);
WHERE
 WR1: SIZEOF ( QUERY ( u <* uncertainty_qualifier | NOT ( SIZEOF
     ( USEDIN ( u , '' ) ) >0 ) ) ) =0;
END_RULE;

RULE dimensionality_is_two_or_three FOR
    (geometric_representation_context);
WHERE
 WR1: SIZEOF ( QUERY ( g <* geometric_representation_context |
     NOT ((g.coordinate_space_dimension =2 ) OR (g.coordinate_space_dimension =3 )))) =0;
END_RULE;

RULE event_occurrence_requires_event_occurrence_assignment FOR
    (event_occurrence);
WHERE
 WR1: SIZEOF ( QUERY ( eo <* event_occurrence | 
	( SIZEOF (USEDIN ( eo, 'CATALOG_DATA_INFORMATION_MIM' + '.RELATIVE_EVENT_OCCURRENCE.BASE_EVENT' ) ) =0 ) AND 
	( SIZEOF ( USEDIN ( eo ,
     'CATALOG_DATA_INFORMATION_MIM' + '.EVENT_OCCURRENCE_ASSIGNMENT.ASSIGNED_EVENT_OCCURRENCE' ) ) =0 )) ) =0;
END_RULE;

RULE global_length_and_angle_units_2d_or_3d FOR
    (global_unit_assigned_context);
WHERE
WR1: SIZEOF ( QUERY ( guac <* global_unit_assigned_context |
     SIZEOF ( guac. units ) <2 ) ) =0;
WR2: SIZEOF ( QUERY ( guac <* global_unit_assigned_context | (
     SIZEOF ( QUERY ( x <* guac. units | 
	'CATALOG_DATA_INFORMATION_MIM' + '.LENGTH_UNIT' IN TYPEOF ( x ) ) ) <>1 ) OR 
    ( SIZEOF(QUERY( x <* guac. units | 'CATALOG_DATA_INFORMATION_MIM' + '.PLANE_ANGLE_UNIT' IN TYPEOF(x))) <>1 ))) =0;
END_RULE;

RULE externally_defined_class_with_known_source_requirement FOR 
	(externally_defined_class);
LOCAL
   known_sourced_classes : SET OF externally_defined_class;
END_LOCAL;
  known_sourced_classes := QUERY( edc <* externally_defined_class | 
	'CATALOG_DATA_INFORMATION_MIM' + '.KNOWN_SOURCE' IN TYPEOF(edc.source) );
WHERE
WR1: SIZEOF ( QUERY ( edc <* known_sourced_classes | 
   (SIZEOF ( QUERY ( aoa <* USEDIN ( edc ,
     'CATALOG_DATA_INFORMATION_MIM' + '.APPLIED_ORGANIZATION_ASSIGNMENT.ITEMS' )
     | aoa.role.name =  'class supplier' )) =  0 ))) =  0;
END_RULE;

RULE restrict_name_for_known_source FOR (known_source); 
WHERE 
WR1: SIZEOF( QUERY( ks <* known_source | (ks.name <> 'ISO 13584 library') )) = 0; 
END_RULE; 

RULE plib_class_reference_requires_version FOR (externally_defined_class); 
LOCAL
   known_sourced_classes : SET OF externally_defined_class;
END_LOCAL;
  known_sourced_classes := QUERY( edc <* externally_defined_class | 
	'CATALOG_DATA_INFORMATION_MIM' + '.KNOWN_SOURCE' IN TYPEOF(edc.source) );
WHERE 
WR1: SIZEOF( QUERY( edc <* known_sourced_classes | 
  (SIZEOF( QUERY( aei <* USEDIN(edc,'CATALOG_DATA_INFORMATION_MIM' + '.APPLIED_EXTERNAL_IDENTIFICATION_ASSIGNMENT.ITEMS') | 
	aei.role.name = 'version' )) <> 1) )) = 0; 
WR2: SIZEOF( QUERY( edc <* known_sourced_classes | 
  (SIZEOF( QUERY( aei <* USEDIN(edc,'CATALOG_DATA_INFORMATION_MIM' + '.APPLIED_IDENTIFICATION_ASSIGNMENT.ITEMS') | 
	aei.role.name = 'version' )) > 0) )) = 0; 
END_RULE; 

RULE person_requires_person_and_organization FOR (person);
WHERE
WR1: SIZEOF ( QUERY ( p <* person | 
	SIZEOF ( USEDIN ( p ,'CATALOG_DATA_INFORMATION_MIM' + '.PERSON_AND_ORGANIZATION.THE_PERSON' )) =  0 )) =  0;
END_RULE; 

RULE restrict_applied_event_occurrence_assignment FOR
    (applied_event_occurrence_assignment);
WHERE
WR1: SIZEOF ( QUERY ( eo <* applied_event_occurrence_assignment| 
	( eo\event_occurrence_assignment.role.name ='event context' ) AND 
	( SIZEOF ( eo.items ) >1 ) ) ) =0;
END_RULE;

RULE restrict_applied_organizational_project_assignment FOR
    (applied_organizational_project_assignment);
WHERE
WR1: SIZEOF ( QUERY ( aopa <* applied_organizational_project_assignment | 
	( aopa.role.name = 'affecting project' ) AND 
	NOT item_correlation( aopa. items , 
	['PRODUCT_CONCEPT', 'PRODUCT', 'PRODUCT_DEFINITION', 'PRODUCT_DEFINITION_FORMATION'] ) ) ) =0;
WR2: SIZEOF ( QUERY ( aopa <* applied_organizational_project_assignment | 
	( aopa.role.name = 'work program' ) AND 
	NOT item_correlation (aopa.items , ['EXECUTED_ACTION'] ) ) ) =0;
END_RULE;

RULE restrict_approval FOR
    (approval,
     approval_date_time);
WHERE
 WR1: SIZEOF ( QUERY ( a <* approval | 
	SIZEOF ( USEDIN ( a , 'CATALOG_DATA_INFORMATION_MIM' + '.APPROVAL_DATE_TIME.DATED_APPROVAL' ) ) >2 ) ) =0;
 WR2: SIZEOF ( QUERY ( adt <* approval_date_time | 
	( NOT EXISTS( adt.role ) ) OR 
	( NOT ( adt.role.name IN ['actual' , 'planned'] ) ) ) ) =0;
 WR3: SIZEOF ( QUERY ( a <* approval | 
	SIZEOF ( QUERY ( adt <* USEDIN ( a , 'CATALOG_DATA_INFORMATION_MIM' + '.APPROVAL_DATE_TIME.DATED_APPROVAL' ) | 
	adt.role.name ='actual' ) ) >1 ) ) =0;
 WR4: SIZEOF ( QUERY ( a <* approval | 
	SIZEOF ( QUERY ( adt <* USEDIN ( a , 'CATALOG_DATA_INFORMATION_MIM' + '.APPROVAL_DATE_TIME.DATED_APPROVAL' ) | 
	adt.role.name ='planned' ) ) >1 ) ) =0;
END_RULE;

RULE restrict_class_system_assignment_for_approval_status FOR
    (approval_status);
WHERE
WR1: SIZEOF ( QUERY ( ent <* approval_status |
	NOT at_most_one_class_system(ent) ))=0; 
END_RULE;

RULE restrict_class_system_assignment_for_class FOR
    (class);
WHERE
WR1: SIZEOF ( QUERY ( c <* class | 
	SIZEOF ( QUERY ( aca <* USEDIN ( c , 'CATALOG_DATA_INFORMATION_MIM' + '.CLASSIFICATION_ASSIGNMENT.ASSIGNED_CLASS' ) | 
	( ( aca.role.name ='class system membership' ) AND 
	( 'CATALOG_DATA_INFORMATION_MIM' + '.APPLIED_CLASSIFICATION_ASSIGNMENT' IN TYPEOF ( aca ) ) ) ) ) >1 ) ) =0;
END_RULE;

RULE restrict_class_system_assignment_for_descriptive_representation_item FOR
    (descriptive_representation_item);
WHERE
WR1: SIZEOF ( QUERY ( ent <* descriptive_representation_item |
	NOT at_most_one_class_system(ent) ))=0; 
END_RULE;

RULE restrict_class_system_assignment_for_document_type FOR
    (document_type);
WHERE
WR1: SIZEOF ( QUERY ( ent <* document_type | 
	NOT at_most_one_class_system(ent) ))=0; 
END_RULE;

RULE restrict_class_system_assignment_for_planar_extent FOR
 (planar_extent);
WHERE
WR1: SIZEOF ( QUERY ( pe <* planar_extent | 
				( pe\representation_item.name = 'size format' ) AND 
				NOT at_most_one_class_system(pe) ))=0; 
END_RULE;

RULE restrict_class_system_assignment_for_security_classification_level FOR
    (security_classification_level);
WHERE
WR1: SIZEOF ( QUERY ( ent <* security_classification_level |
	NOT at_most_one_class_system(ent) ))=0; 
END_RULE;

RULE restrict_configuration_design_for_specified_individual FOR
    (configuration_design);
WHERE
WR1: SIZEOF ( QUERY ( cd <* configuration_design | 
	( cd. name ='physical instance basis' ) AND 
	( NOT ('CATALOG_DATA_INFORMATION_MIM' + '.PRODUCT_DEFINITION' IN TYPEOF ( cd.design ) ) OR 
	( cd. design\product_definition.frame_of_reference.name<> 'physical occurrence' ) ) ) ) =0;
WR2: SIZEOF ( QUERY ( cd <* configuration_design | 
	( cd. name ='physical instance basis' ) AND 
	( NOT ('CATALOG_DATA_INFORMATION_MIM' + '.PRODUCT_IDENTIFICATION' IN TYPEOF (cd.configuration ) ) ) ) ) =0;
END_RULE;

RULE restrict_date_assignment FOR 
	(applied_date_assignment);
WHERE
WR1: SIZEOF(QUERY(adr <* applied_date_assignment |
  (adr.role.name = 'actual end') AND
   (NOT  item_correlation (adr.items, ['ORGANIZATIONAL_PROJECT', 'EFFECTIVITY'])) 
	))=0; 
END_RULE;

RULE restrict_document_reference FOR 
	(applied_document_reference);
WHERE
WR1: SIZEOF(QUERY(adr <* applied_document_reference |
 (adr.role.name = 'general tolerance definition') AND 
 (NOT item_correlation (adr.items, ['REPRESENTATION']))
	))=0; 
WR2: SIZEOF(QUERY(adr <* applied_document_reference |
  NOT ((adr.role.name = 'general tolerance definition') OR 
   item_correlation (adr.items, 
	['APPROVAL','CERTIFICATION','CLASS',
	'CLASS_SYSTEM','CONFIGURATION_DESIGN', 
	'CONFIGURATION_ITEM','CONTRACT',
	'GENERAL_PROPERTY','MATERIAL_DESIGNATION', 
	'ORGANIZATION','ORGANIZATIONAL_PROJECT',
	'PERSON','PRODUCT_CONCEPT',
	'PRODUCT_CONCEPT_FEATURE', 'PRODUCT_CONCEPT_FEATURE_CATEGORY',
	'PRODUCT_DEFINITION','PRODUCT_DEFINITION_FORMATION',
	'PRODUCT_DEFINITION_FORMATION_RELATIONSHIP','PRODUCT_DEFINITION_RELATIONSHIP', 
	'PRODUCT_DEFINITION_SUBSTITUTE','PRODUCT_RELATED_PRODUCT_CATEGORY',
	'PROPERTY_DEFINITION', 'REPRESENTATION',
	'SECURITY_CLASSIFICATION','SHAPE_ASPECT', 'SHAPE_ASPECT_RELATIONSHIP']))
	))=0;
END_RULE;

RULE restrict_effectivity_assignment_for_class_category_usage FOR 
	(applied_effectivity_assignment);
WHERE
WR1: SIZEOF( QUERY( aea <* applied_effectivity_assignment |
      ((SIZEOF( QUERY( i <* aea.items |
      ('CATALOG_DATA_INFORMATION_MIM' + '.PRODUCT_CONCEPT_FEATURE_CATEGORY_USAGE' IN TYPEOF(i)) )) > 0) AND 
	((SIZEOF( QUERY( i <* aea.items |
      ('CATALOG_DATA_INFORMATION_MIM' + '.PRODUCT_CONCEPT_FEATURE_CATEGORY_USAGE' IN TYPEOF(i)) )) <> SIZEOF(aea.items)) OR
      (SIZEOF(TYPEOF(aea.assigned_effectivity) * 
      ['CATALOG_DATA_INFORMATION_MIM' + '.TIME_INTERVAL_BASED_EFFECTIVITY',
       'CATALOG_DATA_INFORMATION_MIM' + '.DATED_EFFECTIVITY',
       'CATALOG_DATA_INFORMATION_MIM' + '.SERIAL_NUMBERED_EFFECTIVITY',
       'CATALOG_DATA_INFORMATION_MIM' + '.LOT_EFFECTIVITY',
       'CATALOG_DATA_INFORMATION_MIM' + '.PRODUCT_DEFINITION_EFFECTIVITY']) > 0) OR
      (aea.assigned_effectivity.id <> 'class usage') OR
      (SIZEOF( QUERY ( cueca <* USEDIN(aea,'CATALOG_DATA_INFORMATION_MIM' + '.EFFECTIVITY_CONTEXT_ASSIGNMENT.ASSIGNED_EFFECTIVITY_ASSIGNMENT') |
      'CATALOG_DATA_INFORMATION_MIM' + '.CLASS_USAGE_EFFECTIVITY_CONTEXT_ASSIGNMENT' IN TYPEOF (cueca ) )) = 0)) ))) = 0;
END_RULE;

RULE restrict_effectivity_for_effectivity_relationship FOR
    (effectivity_relationship);
WHERE
 WR1: SIZEOF ( QUERY ( er <* effectivity_relationship | 
	( SIZEOF
     ( ['CATALOG_DATA_INFORMATION_MIM' + '.LOT_EFFECTIVITY' ,
     'CATALOG_DATA_INFORMATION_MIM' + '.SERIAL_NUMBERED_EFFECTIVITY' ,
     'CATALOG_DATA_INFORMATION_MIM' + '.PRODUCT_DEFINITION_EFFECTIVITY']*TYPEOF( er.relating_effectivity ) ) >0 ) OR 
	( SIZEOF (
     ['CATALOG_DATA_INFORMATION_MIM' + '.LOT_EFFECTIVITY' ,
     'CATALOG_DATA_INFORMATION_MIM' + '.SERIAL_NUMBERED_EFFECTIVITY' ,
     'CATALOG_DATA_INFORMATION_MIM' + '.PRODUCT_DEFINITION_EFFECTIVITY']*TYPEOF( er.related_effectivity ) ) >0 ) ) ) =0;
END_RULE;

RULE restrict_effectivity_usage FOR (effectivity); 
LOCAL
  other_effectivities : SET OF effectivity ;
END_LOCAL;
  other_effectivities := QUERY( e <* effectivity | 
	(SIZEOF(['CATALOG_DATA_INFORMATION_MIM' + '.DATED_EFFECTIVITY', 'CATALOG_DATA_INFORMATION_MIM' + '.TIME_INTERVAL_BASED_EFFECTIVITY'] * TYPEOF(e)) =  0));
WHERE 
WR1: SIZEOF( QUERY( e <* other_effectivities | 
	( (SIZEOF( QUERY( er <* USEDIN(e,'CATALOG_DATA_INFORMATION_MIM' + '.EFFECTIVITY_RELATIONSHIP.' + 'RELATED_EFFECTIVITY') | 
		er.name = 'inheritance' )) = 0) 
       OR
	  ((e.id = 'configuration validity') AND 
	  (SIZEOF( QUERY ( cea <* USEDIN(e,'CATALOG_DATA_INFORMATION_MIM' + '.EFFECTIVITY_ASSIGNMENT.ASSIGNED_EFFECTIVITY') | 
		'CATALOG_DATA_INFORMATION_MIM' + '.CONFIGURED_EFFECTIVITY_ASSIGNMENT' IN TYPEOF ( cea) ) ) = 0)) 
       OR
	  ((e.id = 'class usage') AND 
	  (SIZEOF( QUERY( aea <* USEDIN(e,'CATALOG_DATA_INFORMATION_MIM' + '.EFFECTIVITY_ASSIGNMENT.ASSIGNED_EFFECTIVITY') | 
		('CATALOG_DATA_INFORMATION_MIM' + '.APPLIED_EFFECTIVITY_ASSIGNMENT' IN TYPEOF ( aea ) ) AND 
		(SIZEOF( QUERY( i <* aea.items | 'CATALOG_DATA_INFORMATION_MIM' + '.PRODUCT_CONCEPT_FEATURE_CATEGORY_USAGE' IN TYPEOF(i) )) > 0) )) = 0))) 
	)) = 0; 
END_RULE; 

RULE restrict_externally_defined_item_relationship FOR
    (externally_defined_item_relationship);
WHERE
 WR1: SIZEOF ( QUERY ( edir <* externally_defined_item_relationship | 
	( edir. name = 'name scope' ) AND 
	( NOT ( 'CATALOG_DATA_INFORMATION_MIM' + '.EXTERNALLY_DEFINED_GENERAL_PROPERTY' IN TYPEOF ( edir.relating_item ) ) OR 
	NOT ( 'CATALOG_DATA_INFORMATION_MIM' + '.KNOWN_SOURCE' IN TYPEOF ( edir. relating_item.source ) )
     OR 
	NOT ( 'CATALOG_DATA_INFORMATION_MIM' + '.EXTERNALLY_DEFINED_CLASS' IN TYPEOF ( edir. related_item ) ) OR 
	NOT ('CATALOG_DATA_INFORMATION_MIM' + '.KNOWN_SOURCE' IN TYPEOF ( edir.related_item.source ) ) ) ) ) =0;
END_RULE;

RULE restrict_external_identification_assignment FOR 
	(applied_external_identification_assignment);
WHERE
WR1: SIZEOF(QUERY(aeia <* applied_external_identification_assignment |
   (aeia.role.name = 'alternative document id and location') AND 
   (NOT item_correlation (aeia.items, ['DOCUMENT_FILE']))))=0; 
WR2: SIZEOF(QUERY(aeia <* applied_external_identification_assignment |
   (aeia.role.name = 'version') AND 
   (NOT item_correlation (aeia.items, ['EXTERNALLY_DEFINED_CLASS', 'EXTERNALLY_DEFINED_GENERAL_PROPERTY']))
	))=0; 
END_RULE;

RULE restrict_group_assignment FOR 
	(applied_group_assignment);
WHERE
WR2: SIZEOF(QUERY(aeia <* applied_group_assignment |
 (aeia.role.name = 'group membership') AND
  (NOT item_correlation (aeia.items, ['GEOMETRIC_REPRESENTATION_ITEM', 'SHAPE_ASPECT'])) 
	))=0; 
WR3: SIZEOF(QUERY(aeia <* applied_group_assignment |
 (aeia.role.name = 'group membership') AND
 (NOT  ((SIZEOF(aeia.items) = SIZEOF( QUERY( i <* aeia.items | 'CATALOG_DATA_INFORMATION_MIM' + '.GEOMETRIC_REPRESENTATION_ITEM' IN TYPEOF(i)))) OR 
  (SIZEOF(aeia.items) = SIZEOF( QUERY( i <* aeia.items | 'CATALOG_DATA_INFORMATION_MIM' + '.SHAPE_ASPECT' IN TYPEOF(i)))))) 
	))=0; 
END_RULE;

RULE restrict_multi_language_for_alternate_product_relationship FOR
    (alternate_product_relationship);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* alternate_product_relationship |
	NOT allowed_translations (ent, ['basis']) ))=0;
END_RULE;

RULE restrict_multi_language_for_application_context FOR
    (application_context);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* application_context | 
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_approval_relationship FOR
    (approval_relationship);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* approval_relationship | 
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_assembly_component_usage_substitute FOR
    (assembly_component_usage_substitute);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* assembly_component_usage_substitute | 
	NOT allowed_translations (ent, ['definition']) ))=0;
END_RULE;

RULE restrict_multi_language_for_certification FOR
    (certification);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* certification | 
	NOT allowed_translations (ent, ['purpose', 'name']) ))=0;
END_RULE;

RULE restrict_multi_language_for_configuration_design FOR
    (configuration_design);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* configuration_design | 
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_configuration_item FOR
    (configuration_item);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* configuration_item | 
	NOT allowed_translations (ent, ['name']) ))=0;
END_RULE;

RULE restrict_multi_language_for_contract FOR
    (contract);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* contract | 
	NOT allowed_translations (ent, ['purpose']) ))=0;
END_RULE;

RULE restrict_multi_language_for_data_environment FOR
    (data_environment);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* data_environment | 
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_date_role FOR
    (date_role);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* date_role | 
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_date_time_role FOR
    (date_time_role);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* date_time_role | 
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_descriptive_representation_item FOR
    (descriptive_representation_item);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* descriptive_representation_item |
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_document_relationship FOR
    (document_relationship);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* document_relationship | 
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_effectivity FOR
    (effectivity);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* effectivity | 
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_effectivity_relationship FOR
    (effectivity_relationship);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* effectivity_relationship | 
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_event_occurrence FOR
    (event_occurrence);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* event_occurrence | 
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_external_source FOR
    (external_source);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* external_source | 
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_general_property FOR
    (general_property);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* general_property | 
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_general_property_relationship FOR
    (general_property_relationship);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* general_property_relationship |
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_geometric_representation_item FOR
    (geometric_representation_item);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* geometric_representation_item |
	NOT allowed_translations (ent, ['name']) ))=0;
END_RULE;

RULE restrict_multi_language_for_group FOR
    (group);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* group | 
	NOT allowed_translations (ent, ['description', 'name']) ))=0;
END_RULE;

RULE restrict_multi_language_for_group_relationship FOR
    (group_relationship);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* group_relationship | 
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_identification_role FOR
    (identification_role);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* identification_role | 
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_mapped_item FOR
    (mapped_item);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* mapped_item | 
	NOT allowed_translations (ent, ['name']) ))=0;
END_RULE;

RULE restrict_multi_language_for_organization_relationship FOR
    (organization_relationship);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* organization_relationship | 
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_organization_role FOR
    (organization_role);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* organization_role | 
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_organizational_project FOR
    (organizational_project);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* organizational_project | 
	NOT allowed_translations (ent, ['description', 'name']) ))=0;
END_RULE;

RULE restrict_multi_language_for_organizational_project_relationship FOR
    (organizational_project_relationship);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* organizational_project_relationship | 
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_person_and_organization_role FOR
    (person_and_organization_role);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* person_and_organization_role |
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_product FOR
    (product);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* product | 
	NOT allowed_translations (ent, ['description', 'name']) ))=0;
END_RULE;

RULE restrict_multi_language_for_product_concept FOR
    (product_concept);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* product_concept | 
	NOT allowed_translations (ent, ['description', 'name']) ))=0;
END_RULE;

RULE restrict_multi_language_for_product_concept_feature FOR
    (product_concept_feature);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* product_concept_feature | 
	NOT allowed_translations (ent, ['description', 'name']) ))=0;
END_RULE;

RULE restrict_multi_language_for_product_concept_feature_association FOR
    (product_concept_feature_association);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* product_concept_feature_association | 
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_product_concept_relationship FOR
    (product_concept_relationship);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* product_concept_relationship |
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_product_definition FOR
    (product_definition);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* product_definition | 
	NOT allowed_translations (ent, ['description', 'name']) ))=0;
END_RULE;

RULE restrict_multi_language_for_product_definition_formation FOR
    (product_definition_formation);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* product_definition_formation |
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_product_definition_formation_relationship FOR
    (product_definition_formation_relationship);
WHERE
 WR1: SIZEOF ( QUERY ( ent <*
     product_definition_formation_relationship | 
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_product_definition_relationship FOR
    (product_definition_relationship);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* product_definition_relationship |
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_product_definition_substitute FOR
    (product_definition_substitute);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* product_definition_substitute |
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_product_related_product_category FOR
    (product_related_product_category);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* product_related_product_category |
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_property_definition FOR
    (property_definition);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* property_definition | 
	NOT allowed_translations (ent, ['description', 'name']) ))=0;
END_RULE;

RULE restrict_multi_language_for_representation FOR
    (representation);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* representation | 
	NOT allowed_translations (ent, ['description', 'name']) ))=0;
END_RULE;

RULE restrict_multi_language_for_representation_relationship FOR
    (representation_relationship);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* representation_relationship |
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_security_classification FOR
    (security_classification);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* security_classification | 
	NOT allowed_translations (ent, ['purpose', 'name']) ))=0;
END_RULE;

RULE restrict_multi_language_for_shape_aspect FOR
    (shape_aspect);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* shape_aspect | 
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_shape_aspect_relationship FOR
    (shape_aspect_relationship);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* shape_aspect_relationship | 
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_time_interval_role FOR
    (time_interval_role);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* time_interval_role | 
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_uncertainty_measure_with_unit FOR
    (uncertainty_measure_with_unit);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* uncertainty_measure_with_unit |
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_multi_language_for_uncertainty_qualifier FOR
    (uncertainty_qualifier);
WHERE
 WR1: SIZEOF ( QUERY ( ent <* uncertainty_qualifier | 
	NOT allowed_translations (ent, ['description']) ))=0;
END_RULE;

RULE restrict_organization_assignment FOR
	(applied_organization_assignment);
WHERE
WR1: SIZEOF(QUERY(aoa <* applied_organization_assignment |
  (aoa.role.name = 'organization in contract') AND 
  (NOT item_correlation (aoa.items, ['CONTRACT'])) 
	))= 0;
WR2: SIZEOF(QUERY(aoa <* applied_organization_assignment |
  (aoa.role.name = 'signing for contract') AND 
  (NOT item_correlation (aoa.items, ['APPLIED_ORGANIZATION_ASSIGNMENT'])) 
	))= 0;
WR3: SIZEOF(QUERY(aoa <* applied_organization_assignment |
  (aoa.role.name = 'validity context') AND
  (NOT item_correlation (aoa.items, ['PROPERTY_DEFINITION'])) 
	))= 0;
WR4: SIZEOF(QUERY(aoa <* applied_organization_assignment |
 (aoa.role.name = 'alias scope') AND 
  (NOT  item_correlation (aoa.items, ['APPLIED_IDENTIFICATION_ASSIGNMENT']))
	))= 0;
END_RULE;

RULE restrict_person_and_organization_assignment FOR
	(applied_person_and_organization_assignment);
WHERE
WR1: SIZEOF(QUERY(aoa <* applied_person_and_organization_assignment |
 (aoa.role.name = 'signing for contract') AND
    (NOT item_correlation (aoa.items, ['APPLIED_ORGANIZATION_ASSIGNMENT']))
	))= 0;
END_RULE;

RULE restrict_product_categories_for_tool_part_relationship FOR
    (product_definition_relationship);
WHERE
 WR1: SIZEOF ( QUERY ( pdr <* product_definition_relationship |
     ( pdr.name = 'tool part relationship' ) AND 
	( ( SIZEOF (QUERY ( prpc <* USEDIN ( pdr.relating_product_definition.formation.of_product ,
     'CATALOG_DATA_INFORMATION_MIM' + '.PRODUCT_RELATED_PRODUCT_CATEGORY.PRODUCTS' ) | 
	prpc.name ='tool') ) <1 ) OR 
	( SIZEOF ( QUERY (prpc <* USEDIN ( pdr. related_product_definition.formation.of_product ,
     'CATALOG_DATA_INFORMATION_MIM' + '.PRODUCT_RELATED_PRODUCT_CATEGORY.PRODUCTS') | 
	prpc.name ='part') ) <1 ) ) ) ) =0;
END_RULE;

RULE restrict_product_category_for_product FOR (product); 
WHERE 
WR1: SIZEOF(QUERY(p <* product | 
  SIZEOF(QUERY(prpc <* USEDIN(p, 'CATALOG_DATA_INFORMATION_MIM' + '.PRODUCT_RELATED_PRODUCT_CATEGORY.PRODUCTS') | 
   prpc.name IN ['part','document','functionality', 'conceptual product','alternative solution','requirement', 'physically realized product','tool','raw material'] ) ) 
	<> 1 )) = 0; 
END_RULE; 

RULE restrict_product_definition_context_for_external_properties FOR
    (product_definition);
WHERE
WR1: SIZEOF ( QUERY (pd <* product_definition | 
	(SIZEOF (QUERY ( propd <* USEDIN ( pd, 'CATALOG_DATA_INFORMATION_MIM' + '.PROPERTY_DEFINITION.DEFINITION' ) | 
	  SIZEOF ( QUERY (gpa <* USEDIN ( propd , 'CATALOG_DATA_INFORMATION_MIM' + '.GENERAL_PROPERTY_ASSOCIATION.DERIVED_DEFINITION' )| 
	  'CATALOG_DATA_INFORMATION_MIM' + '.EXTERNALLY_DEFINED_GENERAL_PROPERTY' IN TYPEOF (gpa.base_definition ) ) ) > 0 ) ) > 0 ) AND 
	  ( SIZEOF (QUERY ( pdca <* USEDIN ( pd, 'CATALOG_DATA_INFORMATION_MIM' + '.PRODUCT_DEFINITION_CONTEXT_ASSOCIATION.DEFINITION' )| 
		(pdca.frame_of_reference.name = 'external') AND
      	(pdca.role.name = 'external') ) ) = 0 ) ) ) = 0;
END_RULE;

RULE restrict_product_definition_context_for_product FOR
    (product_definition);
WHERE
WR2: SIZEOF ( QUERY ( pd <* product_definition | 
	( pd.frame_of_reference.name = 'functional definition' ) AND 
	(SIZEOF ( QUERY ( prpc <* USEDIN ( pd. formation.of_product,
     'CATALOG_DATA_INFORMATION_MIM' + '.PRODUCT_RELATED_PRODUCT_CATEGORY.PRODUCTS' ) | 
	prpc.name ='functionality' ) ) =0 ) ) ) =0;
WR3: SIZEOF ( QUERY ( pd <* product_definition | 
	( pd.frame_of_reference.name = 'conceptual definition' ) AND 
	(SIZEOF ( QUERY ( prpc <* USEDIN ( pd. formation.of_product,
     'CATALOG_DATA_INFORMATION_MIM' + '.PRODUCT_RELATED_PRODUCT_CATEGORY.PRODUCTS') |
 	prpc.name = 'conceptual product' ) ) =0 ) ) ) =0;
WR7: SIZEOF ( QUERY ( pd <* product_definition | 
	( pd.frame_of_reference.name IN ['physical document definition',
	'digital document definition',
	'physical model_occurrence'] ) AND 
	( SIZEOF ( QUERY ( prpc <* USEDIN ( pd.formation.of_product ,
     'CATALOG_DATA_INFORMATION_MIM' + '.PRODUCT_RELATED_PRODUCT_CATEGORY.PRODUCTS' ) | 
	prpc.name ='document' ) ) =0 ) ) ) =0;
END_RULE;

RULE restrict_product_definition_substitute FOR
    (product_definition_substitute);
WHERE
WR1: SIZEOF ( QUERY ( pds <* product_definition_substitute | 
	(SIZEOF ( USEDIN ( pds ,
     'CATALOG_DATA_INFORMATION_MIM' + '.APPLIED_EFFECTIVITY_ASSIGNMENT.ITEMS' ) ) =0 ) ) ) =0;
WR2: SIZEOF ( QUERY ( pds <* product_definition_substitute |
     pds.substitute_definition.frame_of_reference.name <> 'part occurrence' ) ) =0;
WR3: SIZEOF ( QUERY ( pds <* product_definition_substitute | (
     ( 'CATALOG_DATA_INFORMATION_MIM' + '.ASSEMBLY_COMPONENT_USAGE' IN TYPEOF ( pds.context_relationship ) ) AND 
     ( SIZEOF (USEDIN ( pds.context_relationship , 'CATALOG_DATA_INFORMATION_MIM' + '.PRODUCT_DEFINITION_OCCURRENCE_RELATIONSHIP.OCCURRENCE_USAGE' ) ) =0 ) ) AND 
	(( 'CATALOG_DATA_INFORMATION_MIM' + '.PRODUCT_DEFINITION_RELATIONSHIP' IN TYPEOF ( pds.context_relationship ) ) AND 
	( pds.context_relationship.related_product_definition.frame_of_reference.name <> 'part occurrence' ) ) ) ) =0;
END_RULE;

RULE restrict_product_definitions_for_product_definition_relationship FOR
    (product_definition_relationship);
WHERE
WR3: SIZEOF ( QUERY ( pdr <* product_definition_relationship |
     ( 'CATALOG_DATA_INFORMATION_MIM' + '.ASSEMBLY_COMPONENT_USAGE' IN TYPEOF ( pdr ) ) AND 
	( ( pdr.relating_product_definition.frame_of_reference.name <> 'part definition' ) OR 
	( pdr.related_product_definition.frame_of_reference.name <> 'part definition' ) ) AND 
	( ( pdr.relating_product_definition.frame_of_reference.name <>'physical occurrence' ) OR 
	( pdr.related_product_definition.frame_of_reference.name <>'physical occurrence' ) ) ) ) =0;
WR5: SIZEOF( QUERY( pdr <* product_definition_relationship | 
	(pdr.name = 'physical realization') AND 
	((pdr.relating_product_definition.frame_of_reference.name <> 'part definition') OR 
	(pdr.related_product_definition.frame_of_reference.name <> 'physical occurrence')) )) = 0; 
WR6: SIZEOF( QUERY( pdr <* product_definition_relationship | 
	(pdr.name = 'physical occurrence usage') AND 
	(NOT('CATALOG_DATA_INFORMATION_MIM' + '.ASSEMBLY_COMPONENT_USAGE' IN TYPEOF(pdr)) OR 
	(pdr.relating_product_definition.frame_of_reference.name <> 'physical occurrence') OR 
	(pdr.related_product_definition.frame_of_reference.name <> 'physical occurrence')) )) = 0; 
END_RULE;

RULE restrict_properties_of_document_file FOR
    (document_file);
WHERE
WR1: SIZEOF ( QUERY ( df <* document_file | 
	SIZEOF ( QUERY ( pd <* USEDIN ( df ,'CATALOG_DATA_INFORMATION_MIM' + '.PROPERTY_DEFINITION.DEFINITION' )| 
	pd.name = 'document property' ) ) >1 ) ) =0;
WR2: SIZEOF ( QUERY ( df <* document_file | 
	SIZEOF ( QUERY ( rt<* df.representation_types | 
	( 'CATALOG_DATA_INFORMATION_MIM' + '.DOCUMENT_REPRESENTATION_TYPE' IN TYPEOF ( rt ) ) AND 
	( rt.name IN ['digital' , 'physical'] ) ) ) =0 ) ) =0;
END_RULE;

RULE restrict_properties_of_document_representation FOR
    (product_definition);
WHERE
 WR1: SIZEOF ( QUERY ( pd <* product_definition | 
	(pd.frame_of_reference.name IN 
	  ['physical document definition', 'digital document definition' ,'physical model occurrence' ] ) AND 
	( SIZEOF ( QUERY ( pd1 <* USEDIN ( pd , 'CATALOG_DATA_INFORMATION_MIM' + '.PROPERTY_DEFINITION.DEFINITION' )| 
	pd1.name = 'document property' ) ) >1 ) ) ) =0;
END_RULE;

RULE restrict_representation_for_document_content_property FOR
    (representation,
     representation_item);
LOCAL
  document_content_representations: SET OF representation := [];
END_LOCAL;
  document_content_representations :=  QUERY( r <* representation |
	(r.name ='document content' ));
WHERE
WR1: SIZEOF ( QUERY ( r <* document_content_representations | 
	( ( SIZEOF ( r.items ) <1 ) OR ( SIZEOF ( r.items ) >3 ) ) ) ) =0;
WR2: SIZEOF ( QUERY ( ri <* representation_item | 
	( SIZEOF (QUERY ( r <* USEDIN ( ri , 'CATALOG_DATA_INFORMATION_MIM' + '.REPRESENTATION.ITEMS' ) | 
	r.name ='document content' ) ) >0 ) AND 
	NOT ( ri. name IN ['detail level' , 'geometry type' , 'real world scale' ] ) )) =0;
WR3: SIZEOF ( QUERY ( r <* document_content_representations | 
	( SIZEOF ( QUERY ( it <* r.items |( it.name = 'detail level' ) AND 
	( 'CATALOG_DATA_INFORMATION_MIM' + '.DESCRIPTIVE_REPRESENTATION_ITEM' IN TYPEOF ( it ) ) ) ) >1) ) ) =0;
WR4: SIZEOF ( QUERY ( r <* document_content_representations | 
	( SIZEOF ( QUERY ( it <* r.items |
     ( it.name = 'geometry type' ) AND 
	( 'CATALOG_DATA_INFORMATION_MIM' + '.DESCRIPTIVE_REPRESENTATION_ITEM' IN TYPEOF ( it ) ) ) ) >1 ) ) ) =0;
WR5: SIZEOF ( QUERY ( r <* document_content_representations | 
	( SIZEOF ( QUERY ( it <* r.items |( it.name = 'real world scale' ) AND 
	( SIZEOF (
     ['CATALOG_DATA_INFORMATION_MIM' + '.MEASURE_REPRESENTATION_ITEM' ,
     'CATALOG_DATA_INFORMATION_MIM' + '.VALUE_REPRESENTATION_ITEM']* TYPEOF( it ) ) =1 ) ) ) >1 ) ) ) =0;
END_RULE;

RULE restrict_representation_for_document_creation_property FOR
    (representation,
     representation_item);
LOCAL
  document_creation_representations: SET OF representation := [];
END_LOCAL;
  document_creation_representations :=  QUERY( r <* representation |
	(r.name ='document creation' ));
WHERE
WR1: SIZEOF ( QUERY ( r <* document_creation_representations | 
	( ( SIZEOF ( r.items ) <1 ) OR (SIZEOF ( r.items ) >3 ) ) ) ) =0;
WR2: SIZEOF ( QUERY ( ri <* representation_item | 
	( SIZEOF (QUERY ( r <* USEDIN ( ri ,'CATALOG_DATA_INFORMATION_MIM' + '.REPRESENTATION.ITEMS' ) | 
	r.name ='document creation' ) ) >0 ) AND 
	NOT ( ri. name IN [ 'creating interface' , 'creating system' ,'operating system' ] ) ) ) =0;
WR3: SIZEOF ( QUERY ( r <* document_creation_representations | 
	( SIZEOF ( QUERY ( i <* r.items |
     ( i.name = 'creating interface' ) AND (
     'CATALOG_DATA_INFORMATION_MIM' + '.DESCRIPTIVE_REPRESENTATION_ITEM' IN TYPEOF ( i )))) >1 ) ) ) =0;
WR4: SIZEOF ( QUERY ( r <* document_creation_representations | 
	( SIZEOF ( QUERY ( i <* r.items |
     ( i.name = 'creating system' ) AND 
	( 'CATALOG_DATA_INFORMATION_MIM' + '.DESCRIPTIVE_REPRESENTATION_ITEM' IN TYPEOF ( i )))) <>1 ) ) ) =0;
WR5: SIZEOF ( QUERY ( r <* document_creation_representations | 
	( SIZEOF ( QUERY ( i <* r.items |
     ( i.name = 'operating system' ) AND 
	( 'CATALOG_DATA_INFORMATION_MIM' + '.DESCRIPTIVE_REPRESENTATION_ITEM' IN TYPEOF ( i )))) >1) ) ) =0;
END_RULE;

RULE restrict_representation_for_document_format_property FOR
    (representation,
     representation_item);
LOCAL
  document_format_representations: SET OF representation := [];
END_LOCAL;
  document_format_representations :=  QUERY( r <* representation |
	(r.name ='document format' ));
WHERE
WR1: SIZEOF ( QUERY ( r <* document_format_representations | 
	( ( SIZEOF ( r.items ) <1 ) OR (SIZEOF ( r.items ) >3 ) ) ) ) =0;
WR2: SIZEOF ( QUERY ( ri <* representation_item | 
	( SIZEOF (QUERY ( r <* USEDIN ( ri ,'CATALOG_DATA_INFORMATION_MIM' + '.REPRESENTATION.ITEMS' ) | 
	r.name ='document format' ) ) >0 ) AND 
	NOT ( ri. name IN ['character code' , 'data format' ] ) ) ) =0;
WR3: SIZEOF ( QUERY ( r <* document_format_representations | 
	( SIZEOF ( QUERY ( i <* r.items | (i.name = 'character code' ) AND 
	( 'CATALOG_DATA_INFORMATION_MIM' + '.DESCRIPTIVE_REPRESENTATION_ITEM' IN TYPEOF ( i ) ) ) ) >1) ) ) =0;
WR4: SIZEOF ( QUERY ( r <* document_format_representations | 
	( SIZEOF ( QUERY ( i <* r.items | (i.name = 'data format' ) AND 
	( 'CATALOG_DATA_INFORMATION_MIM' + '.DESCRIPTIVE_REPRESENTATION_ITEM' IN TYPEOF ( i ) ) ) ) >1) ) ) =0;
WR5: SIZEOF ( QUERY ( r <* document_format_representations | 
	( SIZEOF ( QUERY ( i <* r.items| ( i.name =  'size format' ) AND 
	( 'CATALOG_DATA_INFORMATION_MIM' + '.PLANAR_EXTENT' IN TYPEOF ( i ) ) ) ) >1 ) ) ) =  0;
END_RULE;

RULE restrict_representation_for_document_properties FOR
    (property_definition,
     representation,
     representation_context);
WHERE
WR1: SIZEOF ( QUERY ( pd <* property_definition | 
	( pd. name ='document property' ) AND 
	( SIZEOF ( QUERY ( pdr <* USEDIN( pd ,
     'CATALOG_DATA_INFORMATION_MIM' + '.PROPERTY_DEFINITION_REPRESENTATION.DEFINITION') | 
	NOT ( pdr.used_representation.name IN ['document content' , 'document creation' ,
     'document format' , 'document size' ] ) ) ) >0 ) ) ) =0;
WR2: SIZEOF ( QUERY ( r <* representation | 
	( r.name IN [ 'document content' , 'document creation' , 'document format' , 'document size' ] ) AND 
	( SIZEOF (QUERY ( pdr <* USEDIN ( r ,
     'CATALOG_DATA_INFORMATION_MIM' + '.PROPERTY_DEFINITION_REPRESENTATION.USED_REPRESENTATION') | 
	( 'CATALOG_DATA_INFORMATION_MIM' + '.PROPERTY_DEFINITION' IN TYPEOF( pdr. definition ) ) AND 
	( pdr. definition.name = 'document property' ) ) ) =0 ) ) ) =0;
WR3: SIZEOF ( QUERY ( r <* representation | 
	( r.name IN ['document content' , 'document creation' , 'document format' , 'document size' ] ) AND 
	(r.context_of_items.context_type<> 'document parameters' )) ) =0;
WR4: SIZEOF ( QUERY ( rc <* representation_context | 
	( rc.context_type = 'document parameters' ) AND 
	( SIZEOF ( QUERY( r <* USEDIN ( rc ,'CATALOG_DATA_INFORMATION_MIM' + '.REPRESENTATION.CONTEXT_OF_ITEMS' ) | 
	NOT( r.name IN [ 'document content' , 'document creation' ,
     'document format' , 'document size' ] ) ) ) >0 ) ) ) =0;
END_RULE;

RULE restrict_representation_for_document_size_property FOR
    (representation,
     representation_item);
LOCAL
  document_size_representations: SET OF representation := [];
END_LOCAL;
  document_size_representations :=  QUERY( r <* representation |
	(r.name ='document size'));
WHERE
WR1: SIZEOF ( QUERY ( r <* document_size_representations | 
	( ( SIZEOF ( r.items ) <1 ) OR (SIZEOF ( r.items ) >2 ) ) ) ) =0;
WR2: SIZEOF ( QUERY ( ri <* representation_item | ( SIZEOF (
     QUERY ( r <* USEDIN ( ri ,'CATALOG_DATA_INFORMATION_MIM' + '.REPRESENTATION.ITEMS' ) | 
	r.name ='document size' ) ) >0 ) AND 
	NOT ( ri. name IN ['file size' , 'page count' ] ) ) ) =0;
WR3: SIZEOF ( QUERY ( r <* document_size_representations| 
	( SIZEOF ( QUERY ( i <* r.items | (i.name = 'file size' ) AND 
	( SIZEOF (
	['CATALOG_DATA_INFORMATION_MIM' + '.MEASURE_REPRESENTATION_ITEM' ,
	'CATALOG_DATA_INFORMATION_MIM' + '.VALUE_RANGE' , 
	'CATALOG_DATA_INFORMATION_MIM' + '.VALUE_REPRESENTATION_ITEM']* TYPEOF ( i ) ) =1 ) ) ) >1 ) ) ) =0;
WR4: SIZEOF ( QUERY ( r <* document_size_representations | 
	( SIZEOF ( QUERY ( i <* r.items | ( i.name = 'page count' ) AND 
	( SIZEOF ( 
	['CATALOG_DATA_INFORMATION_MIM' + '.MEASURE_REPRESENTATION_ITEM' ,
	'CATALOG_DATA_INFORMATION_MIM' + '.VALUE_RANGE' , 
	'CATALOG_DATA_INFORMATION_MIM' + '.VALUE_REPRESENTATION_ITEM']* TYPEOF ( i ) ) =1 ) ) ) >1 )) ) =0;
END_RULE;

RULE restrict_version_assignment_for_applied_identification_assignment FOR
    (applied_identification_assignment);
WHERE
WR1: SIZEOF ( QUERY ( ent <* applied_identification_assignment| 
	NOT at_most_one_version_id (ent) ))=0;
END_RULE;

RULE restrict_version_assignment_for_class FOR
    (class);
WHERE
WR1: SIZEOF ( QUERY ( ent <* class | 
	NOT at_most_one_version_id (ent) ))=0;
END_RULE;

RULE restrict_version_assignment_for_configuration_item FOR
    (configuration_item);
WHERE
WR1: SIZEOF ( QUERY ( ent <* configuration_item | 
	NOT at_most_one_version_id (ent) ))=0;
END_RULE;

RULE restrict_version_assignment_for_document_file FOR
    (document_file);
WHERE
WR1: SIZEOF ( QUERY ( ent <* document_file | 
	NOT at_most_one_version_id (ent) ))=0;
END_RULE;

RULE restrict_version_assignment_for_effectivity FOR
    (effectivity);
WHERE
WR1: SIZEOF ( QUERY ( ent <* effectivity | 
	NOT at_most_one_version_id (ent) ))=0;
END_RULE;

RULE restrict_version_assignment_for_general_property FOR
    (general_property);
WHERE
WR1: SIZEOF ( QUERY ( ent <* general_property | 
	NOT at_most_one_version_id (ent) ))=0;
END_RULE;

RULE restrict_version_assignment_for_product_concept FOR
    (product_concept);
WHERE
WR1: SIZEOF ( QUERY ( ent <* product_concept | 
	NOT at_most_one_version_id (ent) ))=0;
END_RULE;

RULE restrict_version_assignment_for_product_concept_feature FOR
    (product_concept_feature);
WHERE
WR1: SIZEOF ( QUERY ( ent <* product_concept_feature | 
	NOT at_most_one_version_id (ent) ))=0;
END_RULE;

RULE restrict_version_assignment_for_shape_representation FOR
    (shape_representation);
WHERE
WR1: SIZEOF ( QUERY ( ent <* shape_representation | 
	NOT at_most_one_version_id (ent) ))=0;
END_RULE;

RULE security_classification_requires_security_classification_assignment FOR
    (security_classification);
WHERE
 WR1: SIZEOF ( QUERY ( sc <* security_classification | 
	SIZEOF (USEDIN ( sc ,
     'CATALOG_DATA_INFORMATION_MIM' + '.SECURITY_CLASSIFICATION_ASSIGNMENT.ASSIGNED_SECURITY_CLASSIFICATION' ) ) =0 ) ) =0;
END_RULE;

RULE subtype_exclusiveness_characterized_object FOR
    (characterized_object);
WHERE
WR1: SIZEOF ( QUERY ( co <* characterized_object | NOT (
     type_check_function ( co , 
	['CATALOG_DATA_INFORMATION_MIM' + '.CHARACTERIZED_CLASS' , 
	'CATALOG_DATA_INFORMATION_MIM' + '.DOCUMENT_FILE' , 
	'CATALOG_DATA_INFORMATION_MIM' + '.FEATURE_COMPONENT_DEFINITION' , 
	'CATALOG_DATA_INFORMATION_MIM' + '.FEATURE_DEFINITION' , 
	'CATALOG_DATA_INFORMATION_MIM' + '.PRODUCT_CLASS' , 
	'CATALOG_DATA_INFORMATION_MIM' + '.PRODUCT_IDENTIFICATION'] , 3 ) ) ) ) =0;
END_RULE;

RULE subtype_exclusiveness_classification_assignment FOR
    (classification_assignment);
WHERE
WR1: SIZEOF ( QUERY ( ca <* classification_assignment | NOT (
     type_check_function ( ca , 
	['CATALOG_DATA_INFORMATION_MIM' + '.APPLIED_CLASSIFICATION_ASSIGNMENT' , 
	'CATALOG_DATA_INFORMATION_MIM' + '.LANGUAGE_ASSIGNMENT'] , 3 ) ) ) ) =0;
END_RULE;

RULE subtype_exclusiveness_compound_representation_item FOR
    (compound_representation_item);
WHERE
WR1: SIZEOF ( QUERY ( cri <* compound_representation_item | NOT
     ( type_check_function ( cri , 
	['CATALOG_DATA_INFORMATION_MIM' + '.DEFAULT_TOLERANCE_TABLE_CELL' , 
	'CATALOG_DATA_INFORMATION_MIM' + '.VALUE_RANGE'] , 3 ) ) ) ) =0;
END_RULE;

RULE subtype_exclusiveness_document_reference FOR
    (document_reference);
WHERE
 WR1: SIZEOF ( QUERY ( dr <* document_reference | NOT (
     type_check_function ( dr , 
	['CATALOG_DATA_INFORMATION_MIM' + '.APPLIED_DOCUMENT_REFERENCE' , 
	'CATALOG_DATA_INFORMATION_MIM' + '.DRAUGHTING_SPECIFICATION_REFERENCE'] , 3 ) ) ) ) =0;
END_RULE;

RULE subtype_exclusiveness_effectivity FOR
    (effectivity);
WHERE
 WR1: SIZEOF ( QUERY ( e <* effectivity | NOT (
     type_check_function ( e , 
	['CATALOG_DATA_INFORMATION_MIM' + '.PRODUCT_DEFINITION_EFFECTIVITY' , 
	'CATALOG_DATA_INFORMATION_MIM' + '.TIME_INTERVAL_BASED_EFFECTIVITY'] , 3 ) ) ) ) =0;
END_RULE;

RULE subtype_exclusiveness_effectivity_assignment FOR
    (effectivity_assignment);
WHERE
 WR1: SIZEOF ( QUERY ( ea <* effectivity_assignment | NOT (
     type_check_function ( ea , 
	['CATALOG_DATA_INFORMATION_MIM' + '.APPLIED_EFFECTIVITY_ASSIGNMENT' , 
	'CATALOG_DATA_INFORMATION_MIM' + '.APPLIED_INEFFECTIVITY_ASSIGNMENT' , 
	'CATALOG_DATA_INFORMATION_MIM' + '.CONFIGURED_EFFECTIVITY_ASSIGNMENT'] , 3 ) ) ) ) =0;
END_RULE;

RULE subtype_exclusiveness_effectivity_context_assignment FOR
    (effectivity_context_assignment);
WHERE
 WR1: SIZEOF ( QUERY ( eca <* effectivity_context_assignment |
     NOT ( type_check_function ( eca , 
	['CATALOG_DATA_INFORMATION_MIM' + '.CLASS_USAGE_EFFECTIVITY_CONTEXT_ASSIGNMENT' ,
     'CATALOG_DATA_INFORMATION_MIM' + '.CONFIGURED_EFFECTIVITY_CONTEXT_ASSIGNMENT'] , 3 ) ) ) ) =0;
END_RULE;

RULE subtype_exclusiveness_externally_defined_item FOR
    (externally_defined_item);
WHERE
 WR1: SIZEOF ( QUERY ( edi <* externally_defined_item | NOT (
     type_check_function ( edi , 
	['CATALOG_DATA_INFORMATION_MIM' + '.EXTERNALLY_DEFINED_CHARACTER_GLYPH' ,
     'CATALOG_DATA_INFORMATION_MIM' + '.EXTERNALLY_DEFINED_CLASS' ,
     'CATALOG_DATA_INFORMATION_MIM' + '.EXTERNALLY_DEFINED_CURVE_FONT' ,
     'CATALOG_DATA_INFORMATION_MIM' + '.EXTERNALLY_DEFINED_FEATURE_DEFINITION' ,
     'CATALOG_DATA_INFORMATION_MIM' + '.EXTERNALLY_DEFINED_GENERAL_PROPERTY',
     'CATALOG_DATA_INFORMATION_MIM' + '.EXTERNALLY_DEFINED_HATCH_STYLE' ,
     'CATALOG_DATA_INFORMATION_MIM' + '.EXTERNALLY_DEFINED_STYLE' ,
     'CATALOG_DATA_INFORMATION_MIM' + '.EXTERNALLY_DEFINED_SYMBOL' ,
     'CATALOG_DATA_INFORMATION_MIM' + '.EXTERNALLY_DEFINED_TEXT_FONT' ,
     'CATALOG_DATA_INFORMATION_MIM' + '.EXTERNALLY_DEFINED_TILE_STYLE'] , 3
     ) ) ) ) =0;
END_RULE;

RULE subtype_exclusiveness_group FOR
    (group);
WHERE
 WR1: SIZEOF ( QUERY ( g <* group | NOT ( type_check_function ( g , 
	['CATALOG_DATA_INFORMATION_MIM' + '.CLASS' , 
	'CATALOG_DATA_INFORMATION_MIM' + '.CLASS_SYSTEM' , 
	'CATALOG_DATA_INFORMATION_MIM' + '.LANGUAGE' ,
     'CATALOG_DATA_INFORMATION_MIM' + '.PRODUCT_CONCEPT_FEATURE_CATEGORY' ,
     'CATALOG_DATA_INFORMATION_MIM' + '.REP_ITEM_GROUP'] , 3 ) ) ) ) =0;
END_RULE;

RULE subtype_exclusiveness_group_assignment FOR
    (group_assignment);
WHERE
 WR1: SIZEOF ( QUERY ( ga <* group_assignment | NOT (
     type_check_function ( ga , 
	['CATALOG_DATA_INFORMATION_MIM' + '.APPLIED_GROUP_ASSIGNMENT' , 
	'CATALOG_DATA_INFORMATION_MIM' + '.PRODUCT_CONCEPT_FEATURE_CATEGORY_USAGE'] , 3 ) ) ) ) =0;
END_RULE;

RULE subtype_exclusiveness_identification_assignment FOR
    (identification_assignment);
WHERE
 WR1: SIZEOF ( QUERY ( ia <* identification_assignment | NOT (
     type_check_function ( ia , 
	['CATALOG_DATA_INFORMATION_MIM' + '.APPLIED_IDENTIFICATION_ASSIGNMENT' , 
	'CATALOG_DATA_INFORMATION_MIM' + '.EXTERNAL_IDENTIFICATION_ASSIGNMENT'] , 3 ) ) ) ) =0;
END_RULE;

RULE subtype_exclusiveness_property_definition FOR
    (property_definition);
WHERE
 WR1: SIZEOF ( QUERY ( pd <* property_definition | NOT (
     type_check_function ( pd , 
	['CATALOG_DATA_INFORMATION_MIM' + '.MATERIAL_PROPERTY' , 
	'CATALOG_DATA_INFORMATION_MIM' + '.PRODUCT_DEFINITION_SHAPE'] , 3 ) ) ) ) =0;
END_RULE;

RULE subtype_exclusiveness_property_definition_representation FOR
    (property_definition_representation);
WHERE
WR1: SIZEOF ( QUERY ( pdr <* property_definition_representation| 
	NOT ( type_check_function ( pdr , 
	['CATALOG_DATA_INFORMATION_MIM' + '.MATERIAL_PROPERTY_REPRESENTATION' ,
     'CATALOG_DATA_INFORMATION_MIM' + '.SHAPE_DEFINITION_REPRESENTATION'] ,3 ) ) ) ) =0;
END_RULE;

RULE subtype_exclusiveness_representation FOR (representation); 
WHERE 
WR1: SIZEOF(QUERY (r <* representation | 
NOT (type_check_function(r, 
['CATALOG_DATA_INFORMATION_MIM' + '.CONSTRUCTIVE_GEOMETRY_REPRESENTATION', 
'CATALOG_DATA_INFORMATION_MIM' + '.CONTACT_RATIO_REPRESENTATION', 
'CATALOG_DATA_INFORMATION_MIM' + '.DEFAULT_TOLERANCE_TABLE', 
'CATALOG_DATA_INFORMATION_MIM' + '.DEFINITIONAL_REPRESENTATION', 
'CATALOG_DATA_INFORMATION_MIM' + '.DIRECTION_SHAPE_REPRESENTATION', 
'CATALOG_DATA_INFORMATION_MIM' + '.HARDNESS_REPRESENTATION', 
'CATALOG_DATA_INFORMATION_MIM' + '.MOMENTS_OF_INERTIA_REPRESENTATION', 
'CATALOG_DATA_INFORMATION_MIM' + '.SHAPE_REPRESENTATION', 
'CATALOG_DATA_INFORMATION_MIM' + '.SURFACE_TEXTURE_REPRESENTATION', 
'CATALOG_DATA_INFORMATION_MIM' + '.TACTILE_APPEARANCE_REPRESENTATION', 
'CATALOG_DATA_INFORMATION_MIM' + '.TEXT_STRING_REPRESENTATION', 
'CATALOG_DATA_INFORMATION_MIM' + '.VISUAL_APPEARANCE_REPRESENTATION'] , 3 ) 
))) = 0; 
END_RULE; 

RULE subtype_exclusiveness_representation_item FOR
    (representation_item);
WHERE
WR1: SIZEOF ( QUERY ( ri <* representation_item | NOT (
     type_check_function ( ri , 
	['CATALOG_DATA_INFORMATION_MIM' + '.COMPOUND_REPRESENTATION_ITEM' , 
	'CATALOG_DATA_INFORMATION_MIM' + '.MEASURE_REPRESENTATION_ITEM' , 
	'CATALOG_DATA_INFORMATION_MIM' + '.REP_ITEM_GROUP' , 
	'CATALOG_DATA_INFORMATION_MIM' + '.VALUE_REPRESENTATION_ITEM'] , 3 ) ) ) ) =0;
END_RULE;

RULE subtype_mandatory_address FOR
    (address);
WHERE
WR1: SIZEOF ( QUERY ( a <* address | NOT ( type_check_function( a , 
	['CATALOG_DATA_INFORMATION_MIM' + '.ORGANIZATIONAL_ADDRESS' ,
     'CATALOG_DATA_INFORMATION_MIM' + '.PERSONAL_ADDRESS'] , 0 ) ) ) ) =0;
END_RULE;

RULE subtype_mandatory_configurable_item FOR
    (configurable_item);
WHERE
 WR1: SIZEOF ( QUERY ( ci <* configurable_item | NOT (
     type_check_function ( ci , 
	['CATALOG_DATA_INFORMATION_MIM' + '.PRODUCT_SPECIFICATION'] , 0 ) ) ) ) =0;
END_RULE;

RULE subtype_mandatory_document_product_association FOR
    (document_product_association);
WHERE
 WR1: SIZEOF ( QUERY ( dpa <* document_product_association | NOT
     ( type_check_function ( dpa , 
	['CATALOG_DATA_INFORMATION_MIM' + '.DOCUMENT_PRODUCT_EQUIVALENCE'] , 0 ) ) ) ) =0;
END_RULE;

RULE subtype_mandatory_externally_defined_item FOR
    (externally_defined_item);
WHERE
 WR1: SIZEOF ( QUERY ( edi <* externally_defined_item | NOT (
     type_check_function ( edi , 
	['CATALOG_DATA_INFORMATION_MIM' + '.EXTERNALLY_DEFINED_CHARACTER_GLYPH' ,
     'CATALOG_DATA_INFORMATION_MIM' + '.EXTERNALLY_DEFINED_CLASS' ,
     'CATALOG_DATA_INFORMATION_MIM' + '.EXTERNALLY_DEFINED_CURVE_FONT' ,
     'CATALOG_DATA_INFORMATION_MIM' + '.EXTERNALLY_DEFINED_FEATURE_DEFINITION' ,
     'CATALOG_DATA_INFORMATION_MIM' + '.EXTERNALLY_DEFINED_GENERAL_PROPERTY',
     'CATALOG_DATA_INFORMATION_MIM' + '.EXTERNALLY_DEFINED_HATCH_STYLE' ,
     'CATALOG_DATA_INFORMATION_MIM' + '.EXTERNALLY_DEFINED_STYLE' ,
     'CATALOG_DATA_INFORMATION_MIM' + '.EXTERNALLY_DEFINED_SYMBOL' ,
     'CATALOG_DATA_INFORMATION_MIM' + '.EXTERNALLY_DEFINED_TEXT_FONT' ,
     'CATALOG_DATA_INFORMATION_MIM' + '.EXTERNALLY_DEFINED_TILE_STYLE'] , 0 ) ) ) ) =0;
END_RULE;

FUNCTION at_most_one_class_system (ent: GENERIC_ENTITY): LOGICAL;
RETURN(
  SIZEOF ( QUERY (ia <* USEDIN ( ent , 'CATALOG_DATA_INFORMATION_MIM' + '.APPLIED_CLASSIFICATION_ASSIGNMENT.ITEMS' ) | 
	ia.role.name = 'class system membership' ) )<=1 );
END_FUNCTION;

FUNCTION at_most_one_version_id (ent: GENERIC_ENTITY): LOGICAL;
RETURN(
  SIZEOF ( QUERY ( ia <* USEDIN ( ent , 'CATALOG_DATA_INFORMATION_MIM' + '.APPLIED_IDENTIFICATION_ASSIGNMENT.ITEMS' ) | 
	ia.role.name ='version' ) ) <=1 );
END_FUNCTION;

FUNCTION item_correlation 
         (items : SET OF GENERIC_ENTITY; c_items: SET OF STRING): LOGICAL;
LOCAL
  c_types   : SET OF STRING := [];
  c_hit     : INTEGER := 0;
END_LOCAL;
 
REPEAT i:=1 TO HIINDEX(c_items);
  c_types := c_types + ['CATALOG_DATA_INFORMATION_MIM' + '.' + c_items[i]];
END_REPEAT;

REPEAT i:=1 TO HIINDEX(items);
  IF (SIZEOF(c_types * TYPEOF(items[i])) = 1) THEN
    c_hit := c_hit + 1;
  END_IF;
END_REPEAT;

RETURN (SIZEOF(items) = c_hit);
END_FUNCTION;

FUNCTION allowed_translations ( ent: GENERIC_ENTITY; translatable_attributes: SET OF STRING): LOGICAL;

	LOCAL
	  mlaa: BAG OF multi_language_attribute_assignment;
	  ala: BAG OF attribute_language_assignment;
	END_LOCAL;
			
	IF (SIZEOF(translatable_attributes)=0) THEN
	  RETURN(UNKNOWN);
	END_IF;
			
	mlaa:= USEDIN ( ent , 'CATALOG_DATA_INFORMATION_MIM' + '.MULTI_LANGUAGE_ATTRIBUTE_ASSIGNMENT.ITEMS' );
			
	REPEAT i:=1 TO HIINDEX(mlaa);
	  IF NOT (mlaa[i].attribute_name IN translatable_attributes) THEN
		RETURN(FALSE);
	  END_IF;
	END_REPEAT;
			
	ala:= USEDIN ( ent , 'CATALOG_DATA_INFORMATION_MIM' + '.ATTRIBUTE_LANGUAGE_ASSIGNMENT.ITEMS' );
			
	REPEAT i:=1 TO HIINDEX(ala);
	  IF NOT (ala[i].attribute_name IN translatable_attributes) THEN
		RETURN(FALSE);
	  END_IF;
	END_REPEAT;
			
	RETURN(TRUE);
END_FUNCTION;

END_SCHEMA;