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

SCHEMA Physical_unit_interconnect_definition_xim;

USE FROM Part_occurrence_xim;

USE FROM product_property_definition_schema(property_definition);

USE FROM Physical_unit_interconnect_definition_mim;

ENTITY Connector_based_interconnect_definition_armx
	(* CONNOTATIONAL *) SUBTYPE OF (connector_based_interconnect_definition);
   SELF\property_definition.definition RENAMED associated_definition : Physical_unit_interconnect_definition_armx;
   connector_in_uv_1                                                 : next_assembly_usage_occurrence;
   connector_in_uv_2                                                 : next_assembly_usage_occurrence;
   component_1                                                       : next_assembly_usage_occurrence;
   component_2                                                       : next_assembly_usage_occurrence;   
  DERIVE
    SELF\property_definition.description : text := ?;
  UNIQUE
    UR1 : name, associated_definition;
WHERE
  WR1: 'ASSEMBLY_MODULE_WITH_PACKAGED_CONNECTOR_COMPONENT_XIM.PACKAGED_CONNECTOR_COMPONENT_ARMX' IN 
        TYPEOF(connector_in_uv_1\product_definition_relationship.related_product_definition);      
  WR2: 'ASSEMBLY_MODULE_WITH_PACKAGED_CONNECTOR_COMPONENT_XIM.PACKAGED_CONNECTOR_COMPONENT_ARMX' IN 
        TYPEOF(connector_in_uv_2\product_definition_relationship.related_product_definition);
  WR3: 'PHYSICAL_UNIT_USAGE_VIEW_XIM.PART_USAGE_VIEW' IN 
        TYPEOF(connector_in_uv_1\product_definition_relationship.relating_product_definition);
  WR4: 'PHYSICAL_UNIT_USAGE_VIEW_XIM.PART_USAGE_VIEW' IN 
        TYPEOF(connector_in_uv_2\product_definition_relationship.relating_product_definition);
  WR5: EXISTS(connector_in_uv_1\assembly_component_usage.location_indicator);
  WR6: EXISTS(connector_in_uv_2\assembly_component_usage.location_indicator);
  WR7: EXISTS(component_1\assembly_component_usage.location_indicator);
  WR8: EXISTS(component_2\assembly_component_usage.location_indicator);
  WR9: NOT EXISTS(connector_in_uv_1.quantity);
 WR10: NOT EXISTS(connector_in_uv_2.quantity);
 WR11: NOT EXISTS(component_1.quantity);
 WR12: NOT EXISTS(component_2.quantity);
 WR13: component_1\product_definition_usage.related_product_definition\Definition_based_product_occurrence.derived_from = 
       connector_in_uv_1\product_definition_relationship.relating_product_definition;
 WR14: component_2\product_definition_usage.related_product_definition\Definition_based_product_occurrence.derived_from = 
       connector_in_uv_2\product_definition_relationship.relating_product_definition;
 WR15: component_1 <> component_2;
 WR16: component_1 <> connector_in_uv_1;
 WR17: connector_in_uv_1 <> component_2;
 WR18: component_1 <> connector_in_uv_2;
 WR19: connector_in_uv_2 <> component_2;
 WR20: 'PHYSICAL_UNIT_INTERCONNECT_DEFINITION_XIM.DEFINITION_BASED_PRODUCT_OCCURRENCE' IN 
        TYPEOF(component_1\product_definition_relationship.related_product_definition);      
 WR21: 'PHYSICAL_UNIT_INTERCONNECT_DEFINITION_XIM.DEFINITION_BASED_PRODUCT_OCCURRENCE' IN 
        TYPEOF(component_2\product_definition_relationship.related_product_definition);
 WR22: associated_definition = component_1\product_definition_relationship.relating_product_definition;
 WR23: associated_definition = component_2\product_definition_relationship.relating_product_definition;
END_ENTITY;

  ENTITY Physical_unit_interconnect_definition_armx
    (* CONNOTATIONAL *) SUBTYPE OF (Part_view_definition, physical_unit_interconnect_definition);
  WHERE
    WR1 : SIZEOF(QUERY(nauo <* USEDIN(SELF, 'PRODUCT_VIEW_DEFINITION_RELATIONSHIP_XIM.PRODUCT_DEFINITION_RELATIONSHIP.RELATING_PRODUCT_DEFINITION') |
                 (('PHYSICAL_UNIT_DESIGN_VIEW_XIM.NEXT_ASSEMBLY_USAGE_OCCURRENCE_RELATIONSHIP' IN TYPEOF(nauo)) XOR
                  ('ASSEMBLY_STRUCTURE_XIM.NEXT_ASSEMBLY_USAGE_OCCURRENCE' IN TYPEOF(nauo)))                 
                 )) = 0;    
  END_ENTITY;



END_SCHEMA;

