(*
   $Id$
   ISO TC184/SC4/WG12 N4699 - ISO/CD-TS 10303-1628 Design product data management - EXPRESS ARM
   Supersedes ISO TC184/SC4/WG12 N3837
*)

SCHEMA Design_product_data_management_arm;

USE FROM Classification_with_attributes_arm;	-- ISO/TS 10303-1111
USE FROM Generic_material_aspects_arm;	-- ISO/TS 10303-1681
USE FROM Information_rights_arm;    -- ISO/TS 10303-1241
USE FROM Item_definition_structure_arm;	-- ISO/TS 10303-1345
USE FROM Pre_defined_product_data_management_specializations_arm; -- ISO/TS 10303-1760
USE FROM Product_data_management_arm;	-- ISO/TS 10303-1231
USE FROM Requirement_assignment_arm;	-- ISO/TS 10303-1233
USE FROM Requirement_view_definition_relationship_arm;	-- ISO/TS 10303-1142
USE FROM Specification_control_arm; -- ISO/CD-TS 10303-1112
USE FROM Test_select_product_arm;	-- ISO/TS 10303-1757
USE FROM Activity_method_assignment_arm;    -- ISO/TS 10303-1249
USE FROM Attribute_classification_arm; -- ISO/TS 10303-1246
	

  TYPE design_activity_method_item = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON activity_method_item WITH 
    (Document,
     Document_version);
  END_TYPE;

  TYPE design_approval_item = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON pdm_approval_item WITH 
    (Certification,
     Document_definition,
     Effectivity,
     Group,
     Group_relationship,
     Independent_property_relationship, 
     Product_configuration,
     Product_version,
     Product_view_definition,
     Requirement_assignment,
     Security_classification,
     Supplied_part_relationship,
     Work_order);
  END_TYPE;

  TYPE design_pdm_affected_item_select = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON pdm_affected_item_select WITH 
    (Work_request);
  END_TYPE; 

  TYPE design_pdm_assigned_name_select = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON assigned_name_select WITH 
    (Group,
     Group_relationship,
     Product,
     Product_view_definition);
  END_TYPE; 

  TYPE design_pdm_certification_item = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON pdm_certification_item WITH 
    (Alternate_product_relationship,
     Product_version);
  END_TYPE; 

  TYPE design_pdm_classification_item = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON classification_item WITH 
    (classified_element_select,
     Characterizable_object,
     Information_right, 
     Information_usage_right, 
     Information_usage_right_relationship);
  END_TYPE; 

  TYPE design_pdm_classified_attribute_select = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON classified_attribute_select WITH (
	Activity,
	Activity_method,
	Activity_method_assignment,
	Activity_property,
	Activity_property_representation,
	Activity_relationship,
	Address_assignment,
	Affected_items_assignment,
	Alternate_part_relationship,
	Applied_activity_assignment,
	Approval,
	Approval_assignment,
	Approval_relationship,
	Approval_status,
	Approving_person_organization,
	Assigned_property,
	Certification,
	Certification_assignment,
	Context_dependent_unit,
	Contract,
	Date_or_date_time_assignment,
	Descriptive_document_property,
	Digital_file,
	Document_assignment,
	Document_definition_relationship,
	Document_location_identification,
	Document_property_representation,
	Effectivity,
	Effectivity_assignment,
	Event_assignment,
	Event_relationship,
	External_item_identification,
	External_source_identification,
	File_location_identification,
	File_relationship,
    Group,
    Group_relationship,
	Hardcopy,
	Identification_assignment,
	Independent_property,
	Independent_property_relationship,
	Independent_property_representation,
    Information_right, 
    Information_usage_right, 
    Information_usage_right_relationship,
    Language,
	Market,
	Numerical_document_property,
	Organization_or_person_in_organization_assignment,
	Organization_relationship,
	Part_view_definition,
	Partial_document_assignment,
	Person_in_organization,
	Product,
	Product_category,
	Product_concept,
	Product_version,
	Product_version_relationship,
	Product_view_definition,
	Project_assignment,
	Project_relationship,
	Property_representation,
	Representation,
	Representation_context,
	Representation_item,
	Security_classification,
	Time_interval_relationship,
	Uncertainty_with_unit,
	Unit,
	Value_with_unit,
	View_definition_context,
	View_definition_relationship,
	Work_order,
	Work_request,
	Work_request_status);
  END_TYPE;

  TYPE design_pdm_contract_item = EXTENSIBLE SELECT BASED_ON contract_item WITH 
    (organization_or_person_in_organization_select,
     Product_version,
     Work_order);
  END_TYPE;

  TYPE design_pdm_date_or_date_time_item = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON pdm_date_or_date_time_item WITH 
    (Contract,
     Document_definition,
     Product_view_definition,
     Security_classification,
     Work_order);
  END_TYPE; 

  TYPE design_pdm_documented_element_select = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON pdm_documented_element_select WITH 
    (Class_with_attributes,
     External_item_identification,
     Information_right, 
     Information_usage_right, 
     Information_usage_right_relationship, 
     Group,
     Group_relationship,
     Material_identification,
     Product_category,
     Product_view_definition,
     Representation_item);
  END_TYPE; 

  TYPE design_pdm_groupable_item = SELECT BASED_ON groupable_item WITH 
    (Group_relationship);
  END_TYPE; 

  TYPE design_pdm_identification_item = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON pdm_identification_item WITH 
    (Group,
     Group_relationship,
     Information_right, 
     Information_usage_right, 
     Information_usage_right_relationship, 
     Material_identification,
     Organization,   
     Product,
     Product_category,
     Product_configuration,
     Product_concept,
     Product_version);
  END_TYPE; 

  TYPE design_pdm_information_usage_right_item = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON information_usage_right_item WITH 
    (design_pdm_identification_item, 
     design_pdm_requirement_assignment_item, 
     design_pdm_documented_element_select,  
     design_pdm_classification_item, 
     design_pdm_certification_item, 
     Characterizable_object,
     Organization, 
     Person_in_organization,
     Product_version,
     Work_order);
     WHERE
      WR1: SIZEOF(['INFORMATION_RIGHTS_ARM.INFORMATION_RIGHT',
               'INFORMATION_RIGHTS_ARM.INFORMATION_USAGE_RIGHT',
               'INFORMATION_RIGHTS_ARM.INFORMATION_USAGE_RIGHT_RELATIONSHIP'] * TYPEOF(SELF)) = 0;
  END_TYPE; 

  TYPE design_pdm_material_item_select = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON material_item_select WITH
    (Part_view_definition);
  END_TYPE;

  TYPE design_pdm_organization_or_person_in_organization_item = SELECT BASED_ON organization_or_person_in_organization_item WITH 
    (Alias_identification,
     Classification_assignment,
     Classification_association,
     Document_definition,
     Supplied_part_relationship,
     Work_order);
  END_TYPE; 

  TYPE design_pdm_requirement_assignment_item = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON requirement_assignment_item WITH 
    (Product_configuration,
     Product_class,
     Product_view_definition,
     Product_version,
     Product,
     View_definition_relationship);
  END_TYPE; 

  TYPE design_pdm_requirement_source_item = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON requirement_source_item WITH 
    (Group,
     Group_relationship,
     Product_view_definition,
     Product_version,
     Product,
     Shape_element,
     Characterizable_object,
     View_definition_relationship);
  END_TYPE; 

  TYPE design_pdm_security_classification_item = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON pdm_security_classification_item WITH 
    (Document_definition,
     Product_version,
     Product_view_definition,
     Promissory_usage);
  END_TYPE; 

  TYPE design_pdm_string_select = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON string_select WITH 
    (Information_right, 
     Information_usage_right,
     Information_usage_right_relationship);
  END_TYPE; 

  RULE unique_document_id FOR
      (Document);
    WHERE
      WR1:  SIZEOF(QUERY (p1 <* Document | SIZEOF(QUERY (p2 <* Document | 
              (NOT(p1 :=: p2) AND (p1.id = p2.id)))) > 0 )) = 0;
  END_RULE;

  RULE unique_part_id FOR
      (Part);
    WHERE
      WR1:  SIZEOF(QUERY (p1 <* Part | SIZEOF(QUERY (p2 <* Part | 
              (NOT(p1 :=: p2) AND (p1.id = p2.id)))) > 0 )) = 0;
  END_RULE;

  RULE unique_requirement_id FOR
      (Requirement);
    WHERE
      WR1:  SIZEOF(QUERY (p1 <* Requirement | SIZEOF(QUERY (p2 <* Requirement | 
              (NOT(p1 :=: p2) AND (p1.id = p2.id)))) > 0 )) = 0;
  END_RULE;

  RULE unique_product_version_id FOR
      (Product);
    WHERE
      WR1:  SIZEOF(QUERY (p <* Product | 
       (SIZEOF (QUERY (pv1 <*
       USEDIN(p,'PRODUCT_VIEW_DEFINITION_ARM.PRODUCT_VERSION.OF_PRODUCT') |  
       (SIZEOF (QUERY (pv2 <*
       USEDIN(p,'PRODUCT_VIEW_DEFINITION_ARM.PRODUCT_VERSION.OF_PRODUCT')
       |  pv1.id = pv2.id)) > 1)
       )) > 0)
       )) = 0;  
  END_RULE;

  RULE unique_product_view_definition_id FOR
      (Product_version);
    WHERE
      WR1:  SIZEOF(QUERY (pv <* Product_version | 
        (SIZEOF (QUERY (pvd1 <*
        USEDIN(pv,'PRODUCT_VIEW_DEFINITION_ARM.PRODUCT_VIEW_DEFINITION.DEFINED_VERSION') |  
        (SIZEOF (QUERY (pvd2 <*
        USEDIN(pv,'PRODUCT_VIEW_DEFINITION_ARM.PRODUCT_VIEW_DEFINITION.DEFINED_VERSION')
        |  pvd1.id = pvd2.id)) > 1)
        )) > 0)
        )) = 0;  
  END_RULE;

  RULE product_occurrence_usage FOR
      (Product_occurrence);
    WHERE
      WR1: SIZEOF(QUERY( po <* Product_occurrence |
      NOT (
      (SIZEOF(USEDIN(po,'ASSEMBLY_STRUCTURE_ARM.PRODUCT_OCCURRENCE_DEFINITION_RELATIONSHIP.RELATED_VIEW')) +
        SIZEOF(USEDIN(po,'PRODUCT_BREAKDOWN_ARM.PRODUCT_DEFINITION_ELEMENT_RELATIONSHIP.PRODUCT'))) > 0
        )
        )) = 0;
  END_RULE;

END_SCHEMA;
