(*
 * $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 N2917 - ISO/TS 10303-1022 Part and version identification - EXPRESS ARM
   by LKSoftWare GmbH for implementation purpose within IDA-STEP(TM)
*)

SCHEMA Part_and_version_identification_xim; 
 
USE FROM Product_identification_xim;    -- ISO/TS 10303-1017 
 
USE FROM product_version_xim;    -- ISO/TS 10303-1018 

USE FROM application_context_schema(product_context);

REFERENCE FROM product_identification_xim(          -- ISO/TS 10303-1017 
        types_of_product 
); 
 
ENTITY Part 
  SUPERTYPE OF (ONEOF (Tool, Raw_material))
  SUBTYPE OF (Product_armx);
  WHERE
    WR1: SIZEOF(['part', 'raw material', 'tool']*types_of_product(SELF))=1;
END_ENTITY; 
 
ENTITY Tool 
  SUBTYPE OF (Part); 
  WHERE
    WR1: 'tool' IN types_of_product(SELF);
END_ENTITY; 
 
ENTITY Raw_material 
  SUBTYPE OF (Part); 
  WHERE
    WR1: 'raw material' IN types_of_product(SELF);
END_ENTITY; 
 
ENTITY Part_version 
  SUBTYPE OF (product_definition_formation); 
  SELF\Product_definition_formation.of_product : Part; 
END_ENTITY; 
 
RULE part_version_constraint FOR  
(product_definition_formation); 
WHERE 
  WR1: SIZEOF ( QUERY ( pv <* product_definition_formation | ( NOT ( 'Part_and_version_identification_xim.' + 'PART_VERSION' IN TYPEOF ( pv) ) ) AND ( 'Part_and_version_identification_xim.' + 'PART' IN TYPEOF ( pv.of_product) ) ) ) =0 ; 
END_RULE;  
 
END_SCHEMA;  -- Part_and_version_identification_xim 

