(*
 * $Id$
 *
 * JSDAI(TM), a way to implement STEP, ISO 10303
 * Copyright (C) 1997-2008, LKSoftWare GmbH, Germany
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License
 * version 3 as published by the Free Software Foundation (AGPL v3).
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * JSDAI is a registered trademark of LKSoftWare GmbH, Germany
 * This software is also available under commercial licenses.
 * See also http://www.jsdai.net/
 *)

(*
   Derived from ISO TC184/SC4/WG12 N2915 - ISO/TS 10303-1021 Identification assignment - EXPRESS MIM
   by LKSoftWare GmbH for implementation purpose within IDA-STEP(TM)
*)

(* ARM and AIM entities are 1:1, except roles - so use AIM *)

SCHEMA Identification_assignment_xim;

USE FROM management_resources_schema   -- ISO 10303-41
  (identification_assignment,
   identification_role); 

USE FROM Identification_assignment_mim;

(** GL - moved from pre_design_product_...specializations *)
USE FROM External_item_identification_assignment_xim; -- needed by the inverse at Externally_defined_identification_assignment

CONSTANT
Pre_defined_identification_assignment_types : SET OF STRING := [
	'alias'];
END_CONSTANT;

TYPE ia_external_identification_item_armx = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON external_identification_item WITH (
	  Externally_defined_identification_assignment);
END_TYPE;

ENTITY Pre_defined_identification_assignment
	ABSTRACT SUPERTYPE OF (Applied_identification_assignment__alias)
  SUBTYPE OF (applied_identification_assignment);
  WHERE
    WR1: SELF\identification_assignment.role.name IN Pre_defined_identification_assignment_types;
END_ENTITY;

ENTITY Externally_defined_identification_assignment
  SUBTYPE OF (applied_identification_assignment);
INVERSE
  source : External_source_identification FOR item;
WHERE
  WR1: NOT (SELF\identification_assignment.role.name IN Pre_defined_identification_assignment_types);
END_ENTITY;

ENTITY Applied_identification_assignment__alias
  SUBTYPE OF (Pre_defined_identification_assignment);
DERIVE
   SELF\identification_assignment.role : identification_role := identification_role('alias', ?);
END_ENTITY;

SUBTYPE_CONSTRAINT ia_applied_identification_assignment_subtypes FOR applied_identification_assignment;
	ABSTRACT SUPERTYPE;
    ONEOF (Pre_defined_identification_assignment,
           Externally_defined_identification_assignment);
END_SUBTYPE_CONSTRAINT;

END_SCHEMA;  -- Identification_assignment_xim

