(*
 * $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 contextual_shape_positioning(Contextual_shape_positioning_arm, Contextual_shape_positioning_mim);*)

uof_mapping Contextual_shape_positioning(Contextual_shape_positioning);
end_uof_mapping;


entity_mapping Contextual_shape_representation(Contextual_shape_representation, context_dependent_shape_representation);

attribute_mapping contextual_shape(contextual_shape, $PATH, Contextual_item_shape);

context_dependent_shape_representation.represented_product_relation  -> product_definition_shape
{product_definition_shape <= property_definition
property_definition.definition -> characterized_definition
characterized_definition = characterized_product_definition
characterized_product_definition = product_definition_relationship
product_definition_relationship => product_definition_usage}

end_attribute_mapping;

attribute_mapping representing_relationship(representing_relationship, $PATH, Shape_representation_relationship);

context_dependent_shape_representation.representation_relation -> shape_representation_relationship
			 
end_attribute_mapping;

end_entity_mapping;

entity_mapping Geometric_composition_with_operator_transformation(Geometric_composition_with_operator_transformation, 
				[shape_representation_relationship]
				[representation_relationship_with_transformation]
				[definitional_representation_relationship]);

mapping_constraints;
	
				[shape_representation_relationship <=]
				[representation_relationship_with_transformation <=]
				[definitional_representation_relationship <=]
				representation_relationship
			
end_mapping_constraints;

end_entity_mapping;

entity_mapping Geometric_composition_with_placement_transformation(Geometric_composition_with_placement_transformation, 
				[shape_representation_relationship]
				[representation_relationship_with_transformation]
				[definitional_representation_relationship]);

mapping_constraints;
	
				[shape_representation_relationship <=]
				[representation_relationship_with_transformation <=]
				[definitional_representation_relationship <=]
				representation_relationship
			
end_mapping_constraints;

end_entity_mapping;

entity_mapping Geometric_model_relationship_with_transformation(Geometric_model_relationship_with_transformation, [shape_representation_relationship][representation_relationship_with_transformation]);

mapping_constraints;
	
				[shape_representation_relationship <=]
				[representation_relationship_with_transformation <=]
				representation_relationship
			
end_mapping_constraints;

end_entity_mapping;

entity_mapping Geometric_operator_transformation(Geometric_operator_transformation, mapped_item);

attribute_mapping target(target, $PATH, Cartesian_transformation_operator);

mapped_item
mapped_item.mapping_target -> 
representation_item =>
geometric_representation_item =>
cartesian_transformation_operator

end_attribute_mapping;

end_entity_mapping;

entity_mapping Geometric_placement(Geometric_placement, mapped_item);

attribute_mapping target(target, $PATH, axis2_placement);

mapped_item
mapped_item.mapping_target -> 
representation_item =>
geometric_representation_item =>
placement
(placement =>
axis1_placement)
(placement =>
axis2_placement_2d)
(placement =>
axis2_placement_3d)

end_attribute_mapping;

end_entity_mapping;

entity_mapping Geometric_placement_model(Geometric_placement_model, 
				shape_representation
			);

mapping_constraints;

					{shape_representation <=
					representation  
					representation.items[1] ->
					representation_item =>
					mapped_item}
			
end_mapping_constraints;

attribute_mapping items(items, $PATH, Geometric_placement_operation);

					shape_representation <=
					representation  
					representation.items[1] ->
					representation_item =>
					mapped_item
				
end_attribute_mapping;

end_entity_mapping;

entity_mapping Geometric_placement_operation(Geometric_placement_operation, mapped_item);

attribute_mapping source(source, $PATH, axis2_placement);

mapped_item
mapped_item.mapping_source -> 
representation_map
representation_map.mapping_origin ->
representation_item =>
geometric_representation_item =>
placement
(placement =>
axis1_placement)
(placement =>
axis2_placement_2d)
(placement =>
axis2_placement_3d)

end_attribute_mapping;

attribute_mapping template_definition(template_definition, $PATH, template_definition_select);

mapped_item
mapped_item.mapping_source -> 
representation_map
representation_map.mapped_representation ->
(* GL - add shape_rep as it is really the only option in select and should avoid some problems with wrong hits *)
representation =>
shape_representation
			 
end_attribute_mapping;

attribute_mapping template_definition(template_definition, $PATH, Shape_representation);

mapped_item
mapped_item.mapping_source -> 
representation_map
representation_map.mapped_representation ->
representation =>
shape_representation
			 
end_attribute_mapping;

end_entity_mapping;

entity_mapping Geometric_relationship_with_operator_transformation(Geometric_relationship_with_operator_transformation, [shape_representation_relationship][representation_relationship_with_transformation]);

mapping_constraints;
	
				[shape_representation_relationship <=]
				[representation_relationship_with_transformation <=]
				representation_relationship
			
end_mapping_constraints;

attribute_mapping transformation(transformation, $PATH, Cartesian_transformation_operator);

					representation_relationship_with_transformation
					representation_relationship_with_transformation.transformation_operator ->
					transformation = functionally_defined_transformation
					functionally_defined_transformation =>
					cartesian_transformation_operator
				
end_attribute_mapping;

end_entity_mapping;

entity_mapping Geometric_relationship_with_placement_transformation(Geometric_relationship_with_placement_transformation, [shape_representation_relationship][representation_relationship_with_transformation]);

mapping_constraints;
	
				[shape_representation_relationship <=]
				[representation_relationship_with_transformation <=]
				representation_relationship
			
end_mapping_constraints;

attribute_mapping source(source, $PATH, axis2_placement);

					representation_relationship_with_transformation
					representation_relationship_with_transformation.transformation_operator ->
					transformation = item_defined_transformation
					item_defined_transformation.transform_item_1 ->
					representation_item =>
					placement
					(placement =>
					axis1_placement)
					(placement =>
					axis2_placement_2d)
					(placement =>
					axis2_placement_3d)
				
end_attribute_mapping;

attribute_mapping target(target, $PATH, axis2_placement);

					representation_relationship_with_transformation
					representation_relationship_with_transformation.transformation_operator ->
					transformation = item_defined_transformation
					item_defined_transformation.transform_item_2 ->
					representation_item =>
					placement
					(placement =>
					axis1_placement)
					(placement =>
					axis2_placement_2d)
					(placement =>
					axis2_placement_3d)
				
end_attribute_mapping;

end_entity_mapping;

entity_mapping Shape_placement_association(Shape_placement_association, 
				shape_definition_representation
			);

attribute_mapping representation(representation, $PATH, Geometric_placement_model);

					shape_definition_representation <= 
					property_definition_representation
					property_definition_representation.used_representation -> 
					representation
					{representation => 
					shape_representation}
					{representation.items[1] ->
					representation_item =>
					mapped_item}
				
end_attribute_mapping;

attribute_mapping represented_characteristic(represented_characteristic, $PATH, Contextual_item_shape);

					shape_definition_representation <=
					property_definition_representation
					property_definition_representation.definition -> 
					represented_definition = property_definition
					property_definition => product_definition_shape
					product_definition_shape
				
end_attribute_mapping;

end_entity_mapping;
(*end_schema_mapping;*)
