(*
 * $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 WG12N2592 - ISO/TS 10303-1109 Alternative solution - Express ARM 
   by LKSoftWare GmbH for implementation purpose within IDA-STEP(TM)
*) 

SCHEMA Alternative_solution_xim;

USE FROM Person_organization_assignment_xim;

USE FROM Product_occurrence_xim;

USE FROM Physical_breakdown_xim;

USE FROM support_resource_schema (label);

TYPE complex_product_select = SELECT
      (Alternative_solution, Functional_element_definition, Physical_element_definition);
END_TYPE;


ENTITY Alternative_solution
	(* CONNOTATIONAL *) SUBTYPE OF (product_definition_formation);
  id_x : STRING; (* it would be in conflict with product_definition_formation.id *)
  SELF\product_definition_formation.id RENAMED version_id : OPTIONAL identifier;
  base_element : complex_product_select;
  DERIVE
  	SELF\product_definition_formation.of_product : product := ?;
END_ENTITY;

ENTITY Solution_element
	(* CONNOTATIONAL *) SUBTYPE OF (product_definition_usage);
  resolved_requirement                                                            : complex_product_select;
  SELF\product_definition_relationship.related_product_definition RENAMED element : Part_occurrence;
	DERIVE
  	SELF\product_definition_relationship.name                        : label              := 'realization';  
  	SELF\product_definition_relationship.relating_product_definition : product_definition := ?; (* Need to enforce to not set this attribute *)
END_ENTITY;

(* I this this is a SEDS, supertype maps to product_definition_formation, while subtype to product_definition - this is in conflict *)
ENTITY Supplier_solution
SUBTYPE OF (Alternative_solution);
  supplier : Organization;
  probability_rate : OPTIONAL REAL;
DERIVE
  actual_rate : REAL := NVL(probability_rate, 1.);
WHERE
WR1: { 0. <= actual_rate <= 1. };
END_ENTITY;

ENTITY Technical_solution
SUBTYPE OF (Alternative_solution);
  SELF\product_definition_formation.description : text;
END_ENTITY;

END_SCHEMA;

