(*
 * $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 Model parameter - EXPRESS ARM
   by LKSoftWare GmbH for implementation purpose within IDA-STEP(TM)
*)



SCHEMA Model_parameter_xim;

USE FROM Activity_method_assignment_xim;

USE FROM Group_xim;

USE FROM Classification_with_attributes_xim;

USE FROM Independent_property_representation_xim;

USE FROM Characteristic_xim;

USE FROM Model_parameter_mim;

REFERENCE FROM Specification_document_xim(get_document_definition);	-- ISO/TS 10303-1747

USE FROM product_property_representation_schema(represented_definition);

    TYPE mp_activity_method_item_select = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON action_method_items WITH 
	   (Test_method_based_parameter_assignment_armx);
	END_TYPE; 
	
	TYPE mp_documented_element_select = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON documented_element_select WITH 
	   (Model_parameter_armx);
	END_TYPE; 

  ENTITY Category_model_parameter_armx
    (* CONNOTATIONAL *) SUBTYPE OF (Model_parameter_armx, category_model_parameter);
    INVERSE 
      associated_attribute : SET[1:1] OF Classification_attribute FOR attribute_definition;
  END_ENTITY;
  
  ENTITY Independent_property_with_unit 
    SUBTYPE OF (general_property);
      unit_of_measure: SET [1:?] OF Unit;
  END_ENTITY;

  ENTITY Model_parameter_armx
   (* CONNOTATIONAL *) SUBTYPE OF (model_parameter);
      valid_range        : OPTIONAL SET[1:?] OF Value_range; --coordinated_characteristic; 
      default_value      : OPTIONAL scalar_or_coordinated_characteristics;
	DERIVE
  		reference_document: SET[0:?] OF Document_definition :=
  			get_document_definition(SELF, 'reference document', 
  			'DOCUMENT_DEFINITION_XIM.DOCUMENT_DEFINITION');
	WHERE
   		WR1 : EXISTS (reference_document) AND SIZEOF(reference_document) = 1;
  END_ENTITY;

	ENTITY Parameter_assignment_armx
	   (* CONNOTATIONAL *) SUBTYPE OF (parameter_assignment);
	    SELF\property_definition_representation.definition RENAMED property : Model_parameter_armx;
      DERIVE
        SELF\representation.items : SET [1:?] OF representation_item := ?;
--        SELF\property_definition_representation.used_representation : representation := ?;
        SELF\representation.context_of_items : representation_context := ?;
        SELF\representation.name : label := ?;
	END_ENTITY; 

  ENTITY Parameter_assignment_override_armx
  		(* CONNOTATIONAL *) SUBTYPE OF (parameter_assignment_override);
      SELF\Representation_relationship.rep_1 RENAMED overridden_parameter_assignment : Parameter_assignment_armx;
      SELF\Representation_relationship.rep_2 RENAMED overriding_parameter_assignment : Parameter_assignment_armx;
    DERIVE
      SELF\representation.items : SET [1:?] OF representation_item := ?;
      SELF\representation.context_of_items : representation_context := ?;
      SELF\representation.name : label := ?;
  END_ENTITY;

  ENTITY Schema_based_model_parameter_armx
  	(* CONNOTATIONAL *) SUBTYPE OF (schema_based_model_parameter, Model_parameter_armx);
      entity_name    : general_property;
      attribute_name : OPTIONAL general_property;
      schema_identifier : general_property;
    UNIQUE
      UR1 : entity_name,
 attribute_name,
 schema_identifier;
  END_ENTITY;

  ENTITY Product_specific_parameter_value_assignment_armx
  	(* CONNOTATIONAL *) SUBTYPE OF (product_specific_parameter_value_assignment);
      assigned_parameter : Parameter_assignment_armx;
      of_product : product;
    DERIVE
      the_model_parameter : model_parameter_armx := assigned_parameter.assigned_parameter;
      (* Overlaps with of_product - just cardinality is not allowing to make it redeclared *)
      SELF\product_related_product_category.products : SET [1:?] OF product := ?;
      SELF\characterized_object.description : text := ?;
      SELF\characterized_object.name : label := ?;
    UNIQUE
      UR1 : the_model_parameter, products;
  END_ENTITY;

  ENTITY Test_method_based_parameter_assignment_armx
    SUBTYPE OF (Parameter_assignment_armx, test_method_based_parameter_assignment);
   WHERE
    WR1 : SIZEOF(USEDIN(SELF,'ACTIVITY_METHOD_ASSIGNMENT_XIM.ACTIVITY_METHOD_ASSIGNMENT.ITEMS')) = 1;
  END_ENTITY;

END_SCHEMA;


