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

SCHEMA Sequential_laminate_assembly_design_xim;

USE FROM Layered_interconnect_module_design_xim;

USE FROM Sequential_laminate_assembly_design_mim;

  TYPE slad_material_item_select = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON material_item_select WITH 
    (Definition_based_part_occurrence);
  END_TYPE;
  
  TYPE slad_requirement_assignment_item = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON requirement_assignment_item WITH 
     (Derived_laminate_assignment_armx,
     Sequential_laminate_assembly_relationship);
  END_TYPE; 

  TYPE stack_or_sub_stack = SELECT
     (Design_stack_model_armx, 
     Stratum_sub_stack_armx);
  END_TYPE; 

  TYPE stratum_assembly_relationship_or_stratum_technology_occurrence = SELECT
     (Interconnect_module_stratum_assembly_relationship,
     Stratum_technology_occurrence_armx);
  END_TYPE; 

  ENTITY Adjacent_stratum_surface_embedded_sequential_laminate_surface_definition
     SUBTYPE OF(Adjacent_stratum_surface_embedded_physical_component_surface_definition);
     WHERE
      WR1 : NOT ('COMPONENT_FEATURE_XIM.COMPONENT_FEATURE_ARMX' IN TYPEOF(precedent_item)) OR 
                ('INTERCONNECT_MODULE_USAGE_VIEW_XIM.INTERCONNECT_MODULE_SECONDARY_SURFACE' IN TYPEOF(precedent_item.definition));
      WR2 : NOT ('COMPONENT_FEATURE_XIM.COMPONENT_FEATURE_ARMX' IN TYPEOF(subsequent_item)) OR 
                ('INTERCONNECT_MODULE_USAGE_VIEW_XIM.INTERCONNECT_MODULE_PRIMARY_SURFACE' IN TYPEOF(subsequent_item.definition));
  END_ENTITY;

  ENTITY Derived_laminate_assignment_armx
    SUBTYPE OF(derived_laminate_assignment, Requirement_view_definition, Requirement_assignment_armx);
     oem_requirement : stratum_assembly_relationship_or_stratum_technology_occurrence;
     solution_definition : Sequential_laminate_assembly_relationship;
  END_ENTITY;

  ENTITY Interconnect_module_component_stratum_based_terminal
    (* CONNOTATIONAL *) SUBTYPE OF (Interconnect_module_component_terminal);
      SELF\Component_feature_armx.definition : Interconnect_module_stratum_based_terminal_armx;
  END_ENTITY;

  ENTITY Interconnect_module_product_assembly_view_fabrication_joint
  	(* CONNOTATIONAL *) SUBTYPE OF (sequential_laminate_passage_based_fabrication_joint);
      joined_terminal : SET[1:?] OF Interconnect_module_component_stratum_based_terminal;
    DERIVE
      SELF\shape_aspect.of_shape : product_definition_shape := ?;
      SELF\shape_aspect.description : text := ?;
      SELF\shape_aspect.product_definitional : LOGICAL := ?;
      SELF\shape_aspect.name : label := ?;
  END_ENTITY;

  ENTITY Interconnect_module_stratum_based_terminal_armx
    (* CONNOTATIONAL *) SUBTYPE OF (Interconnect_module_terminal_armx, interconnect_module_stratum_based_terminal);
    WHERE
      WR1 : SIZEOF(QUERY(imtscr <* USEDIN(SELF,
                        'INTERCONNECT_MODULE_USAGE_VIEW_XIM.' + 
                        'INTERCONNECT_MODULE_TERMINAL_SURFACE_CONSTITUENT_RELATIONSHIP.' + 
                        'RELATED') | 
                        NOT (SIZEOF(['INTERCONNECT_MODULE_USAGE_VIEW_XIM.' + 
                            'INTERCONNECT_MODULE_PRIMARY_SURFACE',
                            'INTERCONNECT_MODULE_USAGE_VIEW_XIM.' + 
                            'INTERCONNECT_MODULE_SECONDARY_SURFACE'] * TYPEOF(imtscr.relating)) = 1))) = 0;
      WR2 : SIZEOF(USEDIN(SELF,
                         'INTERCONNECT_MODULE_USAGE_VIEW_XIM.' + 
                         'INTERCONNECT_MODULE_TERMINAL_SURFACE_CONSTITUENT_RELATIONSHIP.' + 'RELATED')) = 1;
      WR3 : SIZEOF(QUERY(sct <* USEDIN(SELF,
          'DESIGN_SPECIFIC_ASSIGNMENT_TO_INTERCONNECT_USAGE_VIEW_XIM.' +
          'STRATUM_CONCEPT_TO_PHYSICAL_USAGE_VIEW_ASSIGNMENT.DEFINED_PART_FEATURE') |
          'LAND_XIM.LAND_ARMX' IN TYPEOF(sct.assigned_design_object)
             )) = 1;
  END_ENTITY;

  ENTITY Sequential_laminate_assembly_relationship
    SUBTYPE OF(Assembled_part_association);
      SELF\product_definition_relationship.relating_product_definition RENAMED assembly : Sequential_laminate_stackup_definition_armx;
      SELF\product_definition_relationship.related_product_definition RENAMED component : Sequential_laminate_stackup_component_armx;
    DERIVE
      SELF\product_definition_relationship.name : label := 'sequential laminate assembly relationship';       
    WHERE
      WR1: related_product_definition\Definition_based_product_occurrence.derived_from <> relating_product_definition;
  END_ENTITY;

  ENTITY Sequential_laminate_stackup_component_armx 
    SUBTYPE OF(sequential_laminate_stackup_component, Physical_component_armx, Single_instance);
    WHERE
      WR1 : NOT EXISTS(SELF\Product_view_definition.name);
      WR2 : SIZEOF(USEDIN(SELF\Definition_based_part_occurrence.derived_from, 'PHYSICAL_UNIT_DESIGN_VIEW_XIM.PART_DESIGN_VIEW.USAGE_VIEW')) > 0;      
  END_ENTITY;

  ENTITY Sequential_laminate_stackup_definition_armx 
    SUBTYPE of (sequential_laminate_stackup_definition, Assembly_definition_armx); 
      associated_stratum_stack : stack_or_sub_stack;    
  END_ENTITY;

  ENTITY Stackup_requirement_to_design_relationship  
    SUBTYPE OF(product_definition_relationship);
      SELF\product_definition_relationship.relating_product_definition : Interconnect_module;
      SELF\product_definition_relationship.related_product_definition : Sequential_laminate_stackup_definition_armx;
      -- note that the reference is the design view! no need for usage view
    DERIVE
      SELF\product_definition_relationship.name : label := 'stackup requirement to design relationship';       
  END_ENTITY;

END_SCHEMA;


