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

SCHEMA Assembly_technology_xim;

USE FROM Component_grouping_xim;

USE FROM Assembly_module_design_xim;

USE FROM Product_identification_extension_xim;

USE FROM Assembly_technology_mim;

-- Mim already have this extention - it just contains ARM supertype
-- 	TYPE at_external_identification_item = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON external_identification_item WITH  
--		(Assembly_bond_definition_armx);
--	END_TYPE;

	TYPE at_material_item_select = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON material_item_select WITH
		(Assembly_bond_definition_armx);
	END_TYPE;

  TYPE at_property_assignment_select = SELECT BASED_ON property_assignment_select WITH 
    (Assembly_bond_definition_armx);
  END_TYPE; 

  TYPE bond_feature = SELECT
    (Connection_zone_in_layout_template,
    Connection_zone_in_usage_view,
    Default_attachment_size_based_land_physical_template_armx,
    Feature_definition_with_connection_area,
    Part_feature);
  END_TYPE;     
  
	TYPE at_requirement_assignment_item = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON requirement_assignment_item WITH 
	    (Assembly_joint_armx);
	END_TYPE; 
	
  TYPE degree_of_freedom_armx = ENUMERATION OF
    (x,
     y,
     z,
     u,
     v,
     w);
  END_TYPE;

	SUBTYPE_CONSTRAINT process_specification_subtypes FOR Process_specification;   
		(ONEOF (Assembly_technology_specification,
		Fabrication_technology_specification));
	END_SUBTYPE_CONSTRAINT; 

  ENTITY Assembled_with_bonding
    (* CONNOTATIONAL *) SUBTYPE OF (Assembly_joint_armx);
      default_bond_definition : Assembly_bond_definition_armx;
    WHERE
      WR1 : SELF\Assembly_joint_armx.assembly_feature_1.definition :=: default_bond_definition.bonded_feature_1;
      WR2 : SELF\Assembly_joint_armx.assembly_feature_2.definition :=: default_bond_definition.bonded_feature_2;
  END_ENTITY;

  ENTITY Assembled_with_fasteners
    (* CONNOTATIONAL *) SUBTYPE OF (Assembly_joint_armx);
    WHERE
      WR1 : 'COMPONENT_GROUPING_XIM.ASSEMBLY_GROUP_COMPONENT_ARMX' in TYPEOF(SELF\Component_feature_joint.associated_definition);                   
  END_ENTITY;

 ENTITY Assembly_bond_definition_armx
	(* CONNOTATIONAL *) SUBTYPE OF (assembly_bond_definition); 
      analytical_assembly_bond_representation : OPTIONAL SET[1:?] OF Analytical_model_application;
      associated_definition                   : Externally_defined_view_definition;
      bonded_feature_1                        : bond_feature;
      bonded_feature_2                        : bond_feature;
    DERIVE
      SELF\shape_aspect.of_shape : product_definition_shape := ?;
      SELF\shape_aspect.description : text := ?;
      SELF\shape_aspect.product_definitional : LOGICAL := ?;
    INVERSE
      default_shape : SET[0:1] OF default_assembly_bond_shape_model FOR shape_characterized_definition;
	  	bond_category	: External_source_identification FOR items;
	  	bond_material : material_designation FOR definitions; 
    UNIQUE
      UR1 : name;
      UR2 : associated_definition;
    WHERE
      WR1 : bonded_feature_1 <> bonded_feature_2;
      WR2 : 'CONDUCTIVITY_MATERIAL_ASPECTS_XIM.'+ 'MATERIAL_IDENTIFICATION_WITH_CONDUCTIVITY_CLASSIFICATION' IN TYPEOF (bond_material); 
      WR3 : NOT(('PHYSICAL_UNIT_USAGE_VIEW_XIM.PART_FEATURE' IN TYPEOF (bonded_feature_1)) XOR
        ('PHYSICAL_UNIT_USAGE_VIEW_XIM.PART_FEATURE' IN TYPEOF(bonded_feature_2)));
      WR4 : NOT(('PHYSICAL_UNIT_USAGE_VIEW_XIM.CONNECTION_ZONE_IN_USAGE_VIEW' IN TYPEOF (bonded_feature_1)) XOR 
        ('PHYSICAL_UNIT_USAGE_VIEW_XIM.CONNECTION_ZONE_IN_USAGE_VIEW' IN TYPEOF(bonded_feature_2)));
      WR5 : NOT((('PHYSICAL_LAYOUT_TEMPLATE_XIM.CONNECTION_ZONE_IN_LAYOUT_TEMPLATE' IN
        TYPEOF (bonded_feature_1)) OR
        ('FABRICATION_TECHNOLOGY_XIM.DEFAULT_ATTACHMENT_SIZE_BASED_LAND_PHYSICAL_TEMPLATE_ARMX' IN TYPEOF
        (bonded_feature_1)) OR
        ('FEATURE_AND_CONNECTION_ZONE_XIM.FEATURE_DEFINITION_WITH_CONNECTION_AREA' IN TYPEOF(bonded_feature_2)))
        XOR 
        (('PHYSICAL_LAYOUT_TEMPLATE_XIM.CONNECTION_ZONE_IN_LAYOUT_TEMPLATE' IN TYPEOF(bonded_feature_2)) OR
        ('FABRICATION_TECHNOLOGY_XIM.DEFAULT_ATTACHMENT_SIZE_BASED_LAND_PHYSICAL_TEMPLATE_ARMX' IN TYPEOF
        (bonded_feature_1)) OR
        ('FEATURE_AND_CONNECTION_ZONE_XIM.FEATURE_DEFINITION_WITH_CONNECTION_AREA' IN TYPEOF(bonded_feature_2))));            
  END_ENTITY;

  ENTITY Assembly_joint_armx
    SUPERTYPE OF (assembled_with_fasteners ANDOR
 Assembled_with_bonding)
 		(* CONNOTATIONAL *) SUBTYPE OF (Component_feature_joint_armx, assembly_joint); 
      SELF\Component_feature_joint_armx.feature_1 RENAMED assembly_feature_1 : assembled_feature_select;
      SELF\Component_feature_joint_armx.feature_2 RENAMED assembly_feature_2 : assembled_feature_select;
      SELF\Component_feature_joint_armx.associated_definition RENAMED associated_assembly : assembly_module_or_assembly_group_component;
    UNIQUE
      UR1 : SELF\Shape_element.element_name,
        associated_assembly;
    WHERE
      WR1 : assembly_feature_1 :<>: assembly_feature_2;
      WR2 : ('ASSEMBLY_TECHNOLOGY_xim.ASSEMBLED_WITH_FASTENERS' IN TYPEOF(SELF)) OR (('ASSEMBLY_TECHNOLOGY_xim.Component_feature_armx' IN TYPEOF(assembly_feature_1)) AND (SIZEOF(QUERY(ay <* assembly_feature_1\Shape_element.containing_shape\Definition_based_product_occurrence.occurrence_contexts | ay.related_product_definition <> associated_assembly)) = 0));
      WR3 : ('ASSEMBLY_TECHNOLOGY_xim.ASSEMBLED_WITH_FASTENERS' IN TYPEOF(SELF)) OR (('ASSEMBLY_TECHNOLOGY_xim.Component_feature_armx' IN TYPEOF(assembly_feature_2)) AND (SIZEOF(QUERY(ay <* assembly_feature_2\Shape_element.containing_shape\Definition_based_product_occurrence.occurrence_contexts | ay.related_product_definition <> associated_assembly)) = 0));
      WR4 : ['ASSEMBLY_MODULE_DESIGN_XIM.ASSEMBLY_MODULE', 
        'COMPONENT_GROUPING_XIM.ASSEMBLY_GROUP_COMPONENT_ARMX'] in TYPEOF(SELF\Component_feature_joint_armx.associated_definition);                   
  END_ENTITY;

  ENTITY Assembly_technology_specification
    (* CONNOTATIONAL *) SUBTYPE OF (Process_specification);
  END_ENTITY;

  ENTITY Component_mating_constraint_condition_armx
  	(* CONNOTATIONAL *) SUBTYPE OF (component_mating_constraint_condition);
      constraining_joint            : SET[1:3] OF Assembly_joint_armx;
      constrained_degree_of_freedom : SET[1:6] OF degree_of_freedom_armx;
      of_context                    : Part_design_view;
    DERIVE
      SELF\shape_aspect.of_shape : product_definition_shape := ?;
      SELF\shape_aspect.description : text := ?;
      SELF\shape_aspect.product_definitional : LOGICAL := ?;
    UNIQUE
      UR1 : name,
 of_context;
  END_ENTITY;

  ENTITY Connection_zone_based_assembly_joint_armx
    (* CONNOTATIONAL *) SUBTYPE OF (Assembly_joint_armx, connection_zone_based_assembly_joint);
      zone_1 : Connection_zone_in_design_view;
      zone_2 : Connection_zone_in_design_view;
    WHERE
      WR1 : zone_1 :<>: zone_2;
  END_ENTITY;

  ENTITY Default_assembly_bond_shape_model
    (* CONNOTATIONAL *) SUBTYPE OF (Shape_representation);
      shape_characterized_definition : Assembly_bond_definition_armx;
    WHERE
      WR1 : SIZEOF(USEDIN(SELF, 'SHAPE_PROPERTY_ASSIGNMENT_XIM.SHAPE_DESCRIPTION_ASSOCIATION.REPRESENTATION'))=0;        
  END_ENTITY;

END_SCHEMA;


