(*
   $Id$
   ISO TC184/SC4/WG12 N5000 - ISO/CD-TS 10303-1760 Pre defined product data management specializations - EXPRESS ARM
   Supersedes ISO TC184/SC4/WG12 N4224
*)
SCHEMA Pre_defined_product_data_management_specializations_arm;

USE FROM Activity_arm; -- ISO/TS 10303-1047
USE FROM Approval_arm; -- ISO/TS 10303-1012
USE FROM External_item_identification_assignment_arm; -- ISO/TS 10303-1128
USE FROM Person_organization_assignment_arm; -- ISO/TS 10303-1013
USE FROM Security_classification_arm; -- ISO/TS 10303-1015
USE FROM Work_request_arm; -- ISO/TS 10303-1042

CONSTANT
  Pre_defined_activity_relationship_types : SET OF STRING := [
	'alternative',
	'decomposition',
	'derivation',
	'exclusiveness',
	'precedence',
	'sequence',
	'simultaneity'];

  Pre_defined_security_classification_types : SET OF STRING := [
	'unclassified',
	'classified',
	'proprietary',
	'confidential',
	'secret',
	'top secret'];
	
  Pre_defined_address_assignment_types : SET OF STRING := [
	'delivery address',
	'postal address',
	'visitor address'];
	
  Pre_defined_organization_or_person_in_organization_assignment_types : SET OF STRING := [
	'author',
	'classification officer',
	'creator',
	'custodian',
	'customer',
	'design supplier',
	'editor',
	'id owner',
	'location',
	'manufacturer',
	'owner',
	'read access',
	'supplier',
	'wholesaler',
	'write access',
	'organization in contract'];

  Pre_defined_approval_status_types : SET OF STRING := [
	'approved',
	'disapproved',
	'withdrawn',
	'not yet approved']	;

  Pre_defined_approval_types : SET OF STRING := [
	'disposition',
	'equipment order',
	'planning'];
	
  Pre_defined_date_or_date_time_assignment_types : SET OF STRING := [
	'creation',
	'installation',
	'production',
	'registration',
	'update',
	'planned',
	'actual',
	'start date',
	'end date',
	'release date',
	'request date'];
	
  Pre_defined_work_request_types : SET OF STRING := [
	'change of standard',
	'cost reduction',
	'customer rejection',
	'customer request',
	'durability improvement',
	'government regulation',
	'production alignment',
	'procurement alignment',
	'production relief',
	'production requirement',
	'quality improvement',
	'security reason',
	'standardization',
	'supplier request',
	'technical improvement',
	'tool improvement'];
	
  Pre_defined_work_request_status_types : SET OF STRING := [
	'in work',
	'issued',
	'proposed',
	'resolved'];
END_CONSTANT;

  TYPE pdpdms_external_identification_item = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON external_identification_item WITH (
    Externally_defined_activity_relationship,
    Externally_defined_security_classification,
    Externally_defined_address_assignment,
    Externally_defined_organization_or_person_in_organization_assignment,
    Externally_defined_approval_status,
    Externally_defined_approval,
    Externally_defined_date_or_date_time_assignment,
    Externally_defined_work_request,
    Externally_defined_work_request_status);
  END_TYPE;
  
  ENTITY Externally_defined_activity_relationship
    SUBTYPE OF (Activity_relationship);
    INVERSE
      source : External_source_identification FOR item;
    WHERE
      WR1: NOT (SELF\Activity_relationship.name IN Pre_defined_activity_relationship_types);
  END_ENTITY;

  ENTITY Externally_defined_security_classification
    SUBTYPE OF (Security_classification);
    INVERSE
      source : External_source_identification FOR item;
    WHERE
      WR1: NOT (SELF\Security_classification.classification_level IN Pre_defined_security_classification_types);
  END_ENTITY;

  ENTITY Externally_defined_address_assignment
    SUBTYPE OF (Address_assignment);
    INVERSE
      source : External_source_identification FOR item;
    WHERE
      WR1: (EXISTS(SELF\Address_assignment.address_type)) AND
        (NOT (SELF\Address_assignment.address_type IN Pre_defined_address_assignment_types));
  END_ENTITY;

  ENTITY Externally_defined_organization_or_person_in_organization_assignment
    SUBTYPE OF (Organization_or_person_in_organization_assignment);
    INVERSE
      source : External_source_identification FOR item;
    WHERE
      WR1: NOT (SELF\Organization_or_person_in_organization_assignment.role IN Pre_defined_organization_or_person_in_organization_assignment_types);
  END_ENTITY;

  ENTITY Externally_defined_approval_status
    SUBTYPE OF (Approval_status);
    INVERSE
      source : External_source_identification FOR item;
    WHERE
      WR1: NOT (SELF\Approval_status.status_name IN Pre_defined_approval_status_types);
  END_ENTITY;

  ENTITY Externally_defined_approval
    SUBTYPE OF (Approval);
    INVERSE
      source : External_source_identification FOR item;
    WHERE
      WR1: NOT (SELF\Approval.purpose IN Pre_defined_approval_types);
  END_ENTITY;

  ENTITY Externally_defined_date_or_date_time_assignment
    SUBTYPE OF (Date_or_date_time_assignment);
    INVERSE
      source : External_source_identification FOR item;
    WHERE
      WR1: NOT (SELF\Date_or_date_time_assignment.role IN Pre_defined_date_or_date_time_assignment_types);
  END_ENTITY;

  ENTITY Externally_defined_work_request
    SUBTYPE OF (Work_request);
    INVERSE
      source : External_source_identification FOR item;
    WHERE
      WR1: NOT (SELF\Work_request.purpose IN Pre_defined_work_request_types);
  END_ENTITY;

  ENTITY Externally_defined_work_request_status
    SUBTYPE OF (Work_request_status);
    INVERSE
      source : External_source_identification FOR item;
    WHERE
      WR1: NOT (SELF\Work_request_status.status IN Pre_defined_work_request_status_types);
  END_ENTITY;

  ENTITY Person_in_organization_relationship;
    description   : OPTIONAL STRING; 
    relating      : Person_in_organization;
    related       : Person_in_organization;
    relation_type : STRING;
  END_ENTITY;

  ENTITY Pre_defined_activity_relationship
    SUBTYPE OF (Activity_relationship);
    WHERE
      WR1: SELF\Activity_relationship.name IN Pre_defined_activity_relationship_types;
  END_ENTITY;

  ENTITY Pre_defined_security_classification
    SUBTYPE OF (Security_classification);
    WHERE
      WR1: SELF\Security_classification.classification_level IN Pre_defined_security_classification_types;
  END_ENTITY;

  ENTITY Pre_defined_address_assignment
    SUBTYPE OF (Address_assignment);
    WHERE
      WR1: SELF\Address_assignment.address_type IN Pre_defined_address_assignment_types;
  END_ENTITY;

  ENTITY Pre_defined_organization_or_person_in_organization_assignment
    SUBTYPE OF (Organization_or_person_in_organization_assignment);
    WHERE
      WR1: SELF\Organization_or_person_in_organization_assignment.role IN Pre_defined_organization_or_person_in_organization_assignment_types; 
  END_ENTITY;

  ENTITY Pre_defined_approval_status
    SUBTYPE OF (Approval_status);
    WHERE
      WR1: SELF\Approval_status.status_name IN Pre_defined_approval_status_types;
  END_ENTITY;

  ENTITY Pre_defined_approval
    SUBTYPE OF (Approval);
    WHERE
      WR1: SELF\Approval.purpose IN Pre_defined_approval_types;
  END_ENTITY;

  ENTITY Pre_defined_date_or_date_time_assignment
    SUBTYPE OF (Date_or_date_time_assignment);
    WHERE
      WR1: SELF\Date_or_date_time_assignment.role IN Pre_defined_date_or_date_time_assignment_types;
  END_ENTITY;

  ENTITY Pre_defined_work_request
    SUBTYPE OF (Work_request);
    WHERE
      WR1: SELF\Work_request.purpose IN Pre_defined_work_request_types;
  END_ENTITY;
  
  ENTITY Pre_defined_work_request_status
    SUBTYPE OF (Work_request_status);
    WHERE
      WR1: SELF\Work_request_status.status IN Pre_defined_work_request_status_types;
  END_ENTITY;
 
  SUBTYPE_CONSTRAINT pdpdms_activity_relationship_subtypes FOR Activity_relationship;
    ABSTRACT SUPERTYPE;
    ONEOF (Pre_defined_activity_relationship,
           Externally_defined_activity_relationship);
  END_SUBTYPE_CONSTRAINT;

  SUBTYPE_CONSTRAINT pdpdms_security_classification_subtypes FOR Security_classification;
    ABSTRACT SUPERTYPE;
    ONEOF (Pre_defined_security_classification,
           Externally_defined_security_classification);
  END_SUBTYPE_CONSTRAINT;

  SUBTYPE_CONSTRAINT pdpdms_address_assignment_subtypes FOR Address_assignment;
    ABSTRACT SUPERTYPE;
    ONEOF (Pre_defined_address_assignment,
           Externally_defined_address_assignment);
  END_SUBTYPE_CONSTRAINT;

  SUBTYPE_CONSTRAINT pdpdms_organization_or_person_in_organization_assignment_subtypes FOR Organization_or_person_in_organization_assignment;
    ABSTRACT SUPERTYPE;
    ONEOF (Pre_defined_organization_or_person_in_organization_assignment,
           Externally_defined_organization_or_person_in_organization_assignment);
  END_SUBTYPE_CONSTRAINT;

  SUBTYPE_CONSTRAINT pdpdms_approval_status_subtypes FOR Approval_status;
    ABSTRACT SUPERTYPE;
    ONEOF (Pre_defined_approval_status,
           Externally_defined_approval_status);
  END_SUBTYPE_CONSTRAINT;

  SUBTYPE_CONSTRAINT pdpdms_approval_subtypes FOR Approval;
    ABSTRACT SUPERTYPE;
    ONEOF (Pre_defined_approval,
           Externally_defined_approval);
  END_SUBTYPE_CONSTRAINT;

  SUBTYPE_CONSTRAINT pdpdms_date_or_date_time_assignment_subtypes FOR Date_or_date_time_assignment;
    ABSTRACT SUPERTYPE;
    ONEOF (Pre_defined_date_or_date_time_assignment,
           Externally_defined_date_or_date_time_assignment);
  END_SUBTYPE_CONSTRAINT;

  SUBTYPE_CONSTRAINT pdpdms_work_request_subtypes FOR Work_request;
    ABSTRACT SUPERTYPE;
    ONEOF (Pre_defined_work_request,
           Externally_defined_work_request);
  END_SUBTYPE_CONSTRAINT;

  SUBTYPE_CONSTRAINT pdpdms_work_request_status_subtypes FOR Work_request_status;
    ABSTRACT SUPERTYPE;
    ONEOF (Pre_defined_work_request_status,
           Externally_defined_work_request_status);
  END_SUBTYPE_CONSTRAINT;
  
END_SCHEMA;