(*
   $Id$
   ISO TC184/SC4/WG12 N4876 - ISO/CD-TS 10303-1262 Task specification - EXPRESS ARM
   Supersedes ISO TC184/SC4/WG12 N3181
*) 

SCHEMA Task_specification_arm;

USE FROM State_observed_arm;

USE FROM Task_element_arm;

TYPE constraint_context = EXTENSIBLE GENERIC_ENTITY SELECT 
  (Task_element,
   Task_method_version);
END_TYPE;

TYPE method_or_method_version = SELECT 
  (Task_method,
   Task_method_version);
END_TYPE;

TYPE state_or_state_definition_select = SELECT 
  (Applied_state_assignment,
   Applied_state_definition_assignment,
   State,
   State_definition);
END_TYPE;

TYPE task_classification_item = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON classification_item WITH
  (Activity_method,
   Activity_method_relationship,
   Applied_activity_method_assignment,
   Task_element_state_relationship,
   Task_method,
   Task_method_state_relationship,
   Task_objective,
   Task_objective_state_relationship);
END_TYPE;

ENTITY Element_constraint
SUBTYPE OF (Task_element_relationship);
  applies_in : OPTIONAL constraint_context;
END_ENTITY;

ENTITY Simultaneous_elements
SUBTYPE OF (Concurrent_elements);
END_ENTITY;

ENTITY Task_element_levels
SUBTYPE OF (Task_element);
  alternatives : SET [2 : ?] OF Task_element;
END_ENTITY;

ENTITY Task_element_state_relationship;
  state : state_or_state_definition_select;
  task_element : Task_element;
END_ENTITY;

ENTITY Task_invocation
SUBTYPE OF (Task_element);
  task_method : method_or_method_version;
END_ENTITY;

ENTITY Task_method
SUBTYPE OF (Activity_method);
  objective : SET [0 : ?] OF Task_objective;
END_ENTITY;

ENTITY Task_method_assignment
SUBTYPE OF (Applied_activity_method_assignment);
  SELF\Applied_activity_method_assignment.assigned_activity_method : Task_method;
  SELF\Applied_activity_method_assignment.items : SET [1 : ?] OF task_item;
END_ENTITY;

ENTITY Task_method_relationship
SUBTYPE OF (Activity_method_relationship);
  SELF\Activity_method_relationship.relating_method : Task_method;
  SELF\Activity_method_relationship.related_method : Task_method;
END_ENTITY;

ENTITY Task_method_state_relationship;
  state : state_or_state_definition_select;
  task_method : Task_method_version;
END_ENTITY;

ENTITY Task_method_version
SUBTYPE OF (Activity_method);
  content : OPTIONAL Task_element;
  of_task_method : Task_method;
END_ENTITY;

ENTITY Task_method_version_assignment
SUBTYPE OF (Applied_activity_method_assignment);
  SELF\Applied_activity_method_assignment.assigned_activity_method RENAMED assigned_task_method : Task_method_version;
  SELF\Applied_activity_method_assignment.items : SET [1 : ?] OF task_item;
END_ENTITY;

ENTITY Task_method_version_relationship
SUBTYPE OF (Activity_method_relationship);
  SELF\Activity_method_relationship.relating_method RENAMED relating_task_method : Task_method_version;
  SELF\Activity_method_relationship.related_method RENAMED related_task_method : Task_method_version;
END_ENTITY;

ENTITY Task_objective;
  name : STRING;
  description : STRING;
END_ENTITY;

ENTITY Task_objective_state_relationship;
  state : state_or_state_definition_select;
  task_objective : Task_objective;
END_ENTITY;

SUBTYPE_CONSTRAINT restrict_activity_method_relationship FOR Activity_method_relationship;
  ONEOF(Task_element_relationship, Task_method_relationship, Task_method_version_relationship);
END_SUBTYPE_CONSTRAINT;

SUBTYPE_CONSTRAINT restrict_activity_method_subtypes FOR Activity_method;
  ONEOF(Task_element, Task_method, Task_method_version);
END_SUBTYPE_CONSTRAINT;

SUBTYPE_CONSTRAINT restrict_task_element_subtypes FOR Task_element;
  ONEOF(End_task, Exit_loop, Structured_task_element, Task_element_levels, Task_invocation, Task_step);
END_SUBTYPE_CONSTRAINT;

END_SCHEMA;

