(*
 * $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 N - ISO/CD-TS 10303-xxxx Component feature - EXPRESS ARM
   by LKSoftWare GmbH for implementation purpose within IDA-STEP(TM)
*)

SCHEMA Component_feature_xim;

	USE FROM Physical_unit_design_view_xim;
	
USE FROM Component_feature_mim;

	TYPE feature_select = EXTENSIBLE GENERIC_ENTITY SELECT
		(Part_feature);
	END_TYPE;

  ENTITY Component_feature_armx
    ABSTRACT SUPERTYPE
    (* CONNOTATIONAL *) SUBTYPE OF (Shape_element, component_feature);
      definition           : OPTIONAL feature_select;
      SELF\Shape_element.containing_shape RENAMED associated_component : Assembly_component_armx;
    UNIQUE
      UR1 : definition, associated_component;
      UR2 : SELF\Shape_element.element_name, associated_component;
  END_ENTITY;

  ENTITY Component_feature_joint_armx
     ABSTRACT SUPERTYPE
  SUBTYPE OF (Component_feature_relationship_armx, Shape_element);
    SELF\Shape_element_relationship.relating RENAMED feature_1 : Component_feature_armx;
    SELF\Shape_element_relationship.related RENAMED feature_2 : Component_feature_armx;
    SELF\Shape_element.containing_shape RENAMED associated_definition : Item_shape;
    WHERE
      WR1 : feature_1 <> feature_2;
      WR2 : 'PRODUCT_VIEW_DEFINITION_XIM.PRODUCT_VIEW_DEFINITION' in TYPEOF(associated_definition);
      WR3 : SELF\Shape_element.containing_shape\Item_shape.described_element = feature_1\Shape_element.containing_shape\Item_shape.described_element;      
  END_ENTITY;

	-- Possible problem - supertype is of component_feature_relationship type, but Component_feature_make_from_relationship is only make_from_feature_relationship.
  ENTITY Component_feature_make_from_relationship
		(* CONNOTATIONAL *) SUBTYPE OF (Component_feature_relationship_armx, make_from_feature_relationship);
      SELF\Shape_element_relationship.relating RENAMED reusable_feature	: Component_feature_armx;
      SELF\Shape_element_relationship.related RENAMED resultant_feature	: Component_feature_armx;
  END_ENTITY;

	-- SEDS
  ENTITY Component_feature_relationship_armx
    SUPERTYPE OF (ONEOF(Component_feature_joint_armx,
      Component_feature_make_from_relationship))
  	(* CONNOTATIONAL *) SUBTYPE OF (Shape_element_relationship, component_feature_relationship);
      SELF\Shape_element_relationship.relating : Component_feature_armx;  	
      SELF\Shape_element_relationship.related  : Component_feature_armx;
  END_ENTITY;

  ENTITY Component_feature_to_physical_usage_view_assignment
  	(* CONNOTATIONAL *) SUBTYPE OF (shape_aspect_relationship);
      SELF\shape_aspect_relationship.relating_shape_aspect RENAMED defined_part_feature		: Part_feature;
      SELF\shape_aspect_relationship.related_shape_aspect RENAMED assigned_design_object : Component_feature_armx;
    DERIVE
      SELF\shape_aspect_relationship.name : label := ?;
    UNIQUE 
    	UR1 : assigned_design_object;
    	UR2 : defined_part_feature;
  END_ENTITY;

	(* This is needed in order to resolve conflicts with non matching ARM and AIM structures *)
  ENTITY Component_terminal_abstract
    (* CONNOTATIONAL *) ABSTRACT SUBTYPE OF (Component_feature_armx);
      local_swappable  : OPTIONAL BOOLEAN;
      global_swappable : OPTIONAL BOOLEAN;
      swap_code        : OPTIONAL STRING;
  END_ENTITY;

  ENTITY Component_terminal_armx
    (* CONNOTATIONAL *) SUBTYPE OF (Component_terminal_abstract, component_terminal);
  END_ENTITY;

END_SCHEMA;

