(*
 * $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/
 *)

(*schema_mapping physical_layout_template(Physical_layout_template_arm, Physical_layout_template_mim);*)


entity_mapping Connection_zone_in_layout_template(Connection_zone_in_layout_template, instanced_feature);

mapping_constraints;
instanced_feature <=
[shape_aspect
{shape_aspect
shape_aspect.name = 'connection zone in layout template'}]
[shape_feature_definition <=
characterized_object]

end_mapping_constraints;

attribute_mapping containing_shape(containing_shape, $PATH, Template_definition);
instanced_feature <= 
shape_aspect.of_shape ->
product_definition_shape =>
part_template_definition

end_attribute_mapping;

attribute_mapping connection_zone_category(connection_zone_category, $PATH);
instanced_feature <=
shape_feature_definition <=
characterized_object
characterized_definition = characterized_object
characterized_definition <-
property_definition.definition
property_definition
{property_definition.name = 'connection zone category'}
property_definition.description
{(property_definition.description = 'surface point class')
(property_definition.description = 'edge curve class')
(property_definition.description = 'edge point class')
(property_definition.description = 'surface area class')}

end_attribute_mapping;

end_entity_mapping;

entity_mapping Reference_part_template_for_analytical_model(Reference_part_template_for_analytical_model, property_definition_representation);

mapping_constraints;
{property_definition_representation
property_definition_representation.name =  'reference part template for analytical model'}

end_mapping_constraints;

attribute_mapping template(template, $PATH, Template_definition);
property_definition_representation
property_definition_representation.definition ->
represented_definition = property_definition
property_definition =>
product_definition_shape =>
part_template_definition

end_attribute_mapping;

attribute_mapping analytical_representation(analytical_representation, $PATH, Analytical_model_definition_armx);
property_definition_representation
property_definition_representation.used_representation ->
representation <-
{representation =>
analytical_model}
property_definition_representation.used_representation
property_definition_representation
property_definition_representation.definition ->
property_definition
property_definition.definition ->
characterized_definition
characterized_definition = characterized_product_definition
characterized_product_definition = product_definition
product_definition =>
analytical_model_definition

end_attribute_mapping;

end_entity_mapping;

entity_mapping Template(Template, product);

mapping_constraints;
product
{product <-
product_related_product_category.products[i] 
product_related_product_category <= 
product_category 
product_category.name = 'template model'}

end_mapping_constraints;

end_entity_mapping;

entity_mapping Template_definition(Template_definition, part_template_definition);

mapping_constraints;
part_template_definition <=
product_definition
{product_definition <-
product_definition_context_association.definition
product_definition_context_association
{product_definition_context_association.role ->
product_definition_context_role
product_definition_context_role.name = 'part definition type'}
product_definition_context_association.frame_of_reference ->
product_definition_context <=
application_context_element
application_context_element.name = 'template definition'}

end_mapping_constraints;

attribute_mapping defined_version(defined_version, $PATH, Template_version);
part_template_definition <=
product_definition
product_definition.formation -> 
product_definition_formation
{product_definition_formation.of_product -> 
product <- 
product_related_product_category.products[i] 
product_related_product_category <= 
product_category 
product_category.name = 'template model'}

end_attribute_mapping;

attribute_mapping physical_characteristic(physical_characteristic, $PATH, characteristic);
part_template_definition <=
product_definition_shape <=
property_definition <-
property_definition_representation.definition
property_definition_representation
property_definition_representation.used_representation ->
representation
representation.items[i] ->
representation_item
{representation_item
groupable_item = representation_item
groupable_item <-
applied_group_assignment.items[i]
applied_group_assignment <=
group_assignment
group_assignment.assigned_group ->
group =>
characteristic_type}

end_attribute_mapping;

attribute_mapping physical_characteristic(physical_characteristic, $PATH, measure_representation_item);
part_template_definition <=
				product_definition_shape <=
				property_definition <-
				property_definition_representation.definition
				property_definition_representation
				property_definition_representation.used_representation ->
				representation
				!{representation => curve_style_parameters_representation} (* Our specific constraint in order to avoid wrong hits *)
				representation.items[i] ->
				representation_item => 
				measure_representation_item
				
end_attribute_mapping;

attribute_mapping physical_characteristic(physical_characteristic, $PATH, Value_list);
part_template_definition <=
				product_definition_shape <=
				property_definition <-
				property_definition_representation.definition
				property_definition_representation
				property_definition_representation.used_representation ->
				representation
				!{representation => curve_style_parameters_representation} (* Our specific constraint in order to avoid wrong hits *)
				representation.items[i] ->
				representation_item =>
				compound_representation_item
				
end_attribute_mapping;

attribute_mapping physical_characteristic(physical_characteristic, $PATH, Value_set);
part_template_definition <=
				product_definition_shape <=
				property_definition <-
				property_definition_representation.definition
				property_definition_representation
				property_definition_representation.used_representation ->
				representation
				!{representation => curve_style_parameters_representation} (* Our specific constraint in order to avoid wrong hits *)
				representation.items[i] ->
				representation_item =>
				compound_representation_item
				
end_attribute_mapping;
(* Problematic case - comment out, hopefully nobody will use it
attribute_mapping physical_characteristic(physical_characteristic, $PATH, Property_value_representation);
part_template_definition <=
				product_definition_shape <=
				property_definition <-
				property_definition_representation.definition
				property_definition_representation
				property_definition_representation.used_representation ->
				representation 
				
end_attribute_mapping;
*)
end_entity_mapping;

entity_mapping Template_version(Template_version, product_definition_formation);

mapping_constraints;
product_definition_formation
{product_definition_formation.of_product -> 
product <- 
product_related_product_category.products[i] 
product_related_product_category <= 
product_category 
product_category.name = 'template model'}

end_mapping_constraints;

attribute_mapping of_product(of_product, $PATH, Template);
product_definition_formation
product_definition_formation.of_product -> 
product
{product <- 
product_related_product_category.products[i] 
product_related_product_category <= 
product_category 
product_category.name = 'template model'}

end_attribute_mapping;

end_entity_mapping;
(*end_schema_mapping;*)
