(*
 * $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 N2925 - ISO/TS 10303-1017 Product identification - EXPRESS ARM
   by LKSoftWare GmbH for implementation purpose within IDA-STEP(TM)
*)

SCHEMA Product_identification_xim; 

USE FROM Product_categorization_xim;    -- ISO/TS 10303-1016

USE FROM application_context_schema
  (product_context);

USE FROM product_definition_schema   -- ISO 10303-41
  (product,
   product_related_product_category); 

	SUBTYPE_CONSTRAINT product_related_product_category_constraint FOR product_related_product_category;
		ABSTRACT SUPERTYPE;
	END_SUBTYPE_CONSTRAINT;  

ENTITY Product_armx
	(* CONNOTATIONAL *) SUBTYPE OF (Product);
  DERIVE
    SELF\product.frame_of_reference : SET [1:?] OF product_context := ?;
END_ENTITY;

FUNCTION types_of_product
 (obj : Product) : SET OF STRING; 
 LOCAL
 	category_assignments: BAG OF product_related_product_category;
 	categories: SET OF STRING:=[];
 	i: INTEGER;
 END_LOCAL;
 
 category_assignments := USEDIN(obj,'PRODUCT_DEFINITION_SCHEMA.' + 'PRODUCT_RELATED_PRODUCT_CATEGORY.PRODUCTS');
    
 REPEAT i := LOINDEX(category_assignments) TO HIINDEX(category_assignments) BY 1;
       categories := categories + category_assignments[i].name;
 END_REPEAT;
 
 RETURN(categories);
       END_FUNCTION; 

(** We decided that product_related_product_category is not allowed to be created in XIM level *)

END_SCHEMA;  -- Product_identification_xim





