(*
 * $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 part_template_extension(Part_template_extension_arm, Part_template_extension_mim);*)

(* Mapping of entity not existing in the ARM *)
entity_mapping Path_area_with_parameters_armx(Path_area_with_parameters_armx, path_area_with_parameters);

mapping_constraints;
path_area_with_parameters <=
[complex_area]
[mapped_item]

end_mapping_constraints;

attribute_mapping parameters(parameters, $PATH, Curve_style_parameters);
path_area_with_parameters <=
mapped_item
mapped_item.mapping_source ->
representation_map
representation_map.mapped_representation ->
representation =>
curve_style_parameters_representation

end_attribute_mapping;

end_entity_mapping;


entity_mapping Closed_curve_style_parameters_armx(Closed_curve_style_parameters_armx, closed_curve_style_parameters);

mapping_constraints;
closed_curve_style_parameters <=
curve_style_parameters_representation <=
representation
[representation
representation.context_of_items ->
representation_context
[representation_context
representation_context =>
global_uncertainty_assigned_context]
[representation_context
representation_context =>
parametric_representation_context]]
[representation
representation.context_of_items ->
representation_context
representation_context.context_type
representation_context.context_type = 'curve style parametric context']

end_mapping_constraints;

end_entity_mapping;

entity_mapping Curve_style_parameters(Curve_style_parameters, curve_style_parameters_representation);

mapping_constraints;
curve_style_parameters_representation <=
representation
[representation
representation.context_of_items ->
representation_context
[representation_context
representation_context =>
global_uncertainty_assigned_context]
[representation_context
representation_context =>
parametric_representation_context]]
[representation
representation.context_of_items ->
representation_context
representation_context.context_type
representation_context.context_type = 'curve style parametric context']

end_mapping_constraints;

attribute_mapping name_x(name_x, descriptive_representation_item.description);
curve_style_parameters_representation <=
representation
representation.items[i] ->
representation_item
{representation_item.name = 'curve style name'}
representation_item =>
descriptive_representation_item
descriptive_representation_item.description

end_attribute_mapping;

attribute_mapping corner_style(corner_style, $PATH);
curve_style_parameters_representation <=
representation
representation.items[i] ->
representation_item
{{representation_item.name = 'corner style'}
representation_item =>
descriptive_representation_item
(descriptive_representation_item.description = 'chord 2 extend')
(descriptive_representation_item.description = 'extend')
(descriptive_representation_item.description = 'round')
(descriptive_representation_item.description = 'truncate')
}

end_attribute_mapping;

attribute_mapping curve_width(curve_width, $PATH, length_measure_with_unit);
curve_style_parameters_representation <=
representation
representation.items[i] ->
representation_item
{representation_item
representation_item.name = 'curve width'}
representation_item =>
measure_representation_item <= 
measure_with_unit =>
length_measure_with_unit

end_attribute_mapping;

attribute_mapping width_uncertainty(width_uncertainty, $PATH, length_measure_with_unit);
curve_style_parameters_representation <=
representation
representation.context_of_items ->
representation_context
representation_context =>
global_uncertainty_assigned_context
global_uncertainty_assigned_context.uncertainty[i] ->
uncertainty_measure_with_unit <=
measure_with_unit =>
length_measure_with_unit

end_attribute_mapping;

end_entity_mapping;

entity_mapping Curve_style_parameters_with_ends_armx(Curve_style_parameters_with_ends_armx, curve_style_parameters_with_ends);

mapping_constraints;
curve_style_parameters_with_ends <=
curve_style_parameters_representation <=
representation
[representation
representation.context_of_items ->
representation_context
[representation_context
representation_context =>
global_uncertainty_assigned_context]
[representation_context
representation_context =>
parametric_representation_context]]
[representation
representation.context_of_items ->
representation_context
representation_context.context_type
representation_context.context_type = 'curve style parametric context']

end_mapping_constraints;

attribute_mapping end_extension(end_extension, $PATH);
curve_style_parameters_with_ends <=
curve_style_parameters_representation <=
representation
representation.items[i] ->
representation_item
{{representation_item.name = 'end extension'}
representation_item =>
descriptive_representation_item
(descriptive_representation_item.description = 'extend')
(descriptive_representation_item.description = 'truncate')}

end_attribute_mapping;

attribute_mapping end_style(end_style, $PATH);
curve_style_parameters_with_ends <=
curve_style_parameters_representation <=
representation
representation.items[i] ->
representation_item
{{representation_item.name = 'end style'}
representation_item =>
descriptive_representation_item
(descriptive_representation_item.description = 'round')
(descriptive_representation_item.description = 'square')}

end_attribute_mapping;

end_entity_mapping;

entity_mapping Default_trace_template_armx(Default_trace_template_armx, default_trace_template);

mapping_constraints;
default_trace_template <=
trace_template <=
parametric_template <=
part_template_definition <=
product_definition

end_mapping_constraints;

attribute_mapping of_stratum_technology(of_stratum_technology, $PATH, Stratum_technology_armx);
default_trace_template <=
trace_template <=
parametric_template <=
part_template_definition <=
product_definition_shape <-
shape_aspect.of_shape
shape_aspect <-
shape_aspect_relationship.related_shape_aspect
shape_aspect_relationship
{shape_aspect_relationship
shape_aspect_relationship.name = 'of stratum technology'}
shape_aspect_relationship.relating_shape_aspect ->
shape_aspect
shape_aspect.of_shape ->
product_definition_shape =>
stratum_technology

end_attribute_mapping;

end_entity_mapping;

entity_mapping Fill_area_template_armx(Fill_area_template_armx, fill_area_template);

mapping_constraints;

fill_area_template <=
parametric_template <=
part_template_definition

end_mapping_constraints;

attribute_mapping outer_boundary_style(outer_boundary_style, $PATH, Closed_curve_style_parameters_armx);
fill_area_template <=
parametric_template <=
part_template_definition <=
product_definition
characterized_product_definition = product_definition
characterized_product_definition
characterized_definition = characterized_product_definition
characterized_definition <-
property_definition.definition
property_definition <-
{property_definition
property_definition.name = 'outer boundary style'}
property_definition_representation.definition
property_definition_representation
property_definition_representation.used_representation ->
representation =>
curve_style_parameters_representation =>
closed_curve_style_parameters


end_attribute_mapping;

attribute_mapping inner_boundary_style(inner_boundary_style, $PATH, Closed_curve_style_parameters_armx);
fill_area_template <=
parametric_template <=
part_template_definition <=
product_definition
characterized_product_definition = product_definition
characterized_product_definition
characterized_definition = characterized_product_definition
characterized_definition <-
property_definition.definition
property_definition <-
{property_definition
property_definition.name = 'inner boundary style'}
property_definition_representation.definition
property_definition_representation
property_definition_representation.used_representation ->
representation =>
curve_style_parameters_representation =>
closed_curve_style_parameters

end_attribute_mapping;

attribute_mapping fill_area_style(fill_area_style, $PATH, Hatch_style);
fill_area_template <=
parametric_template <=
part_template_definition <=
product_definition
characterized_product_definition = product_definition
characterized_product_definition
characterized_definition = characterized_product_definition
characterized_definition <-
property_definition.definition
property_definition <-
{property_definition
property_definition.name = 'fill area style'}
property_definition_representation.definition
property_definition_representation
property_definition_representation.used_representation ->
representation
representation.items[i] ->
representation_item =>
geometric_representation_item =>
(fill_area_style_hatching)
(externally_defined_hatch_style)

end_attribute_mapping;

attribute_mapping fill_area_style(fill_area_style, $PATH, Tile_style);
fill_area_template <=
parametric_template <=
part_template_definition <=
product_definition
characterized_product_definition = product_definition
characterized_product_definition
characterized_definition = characterized_product_definition
characterized_definition <-
property_definition.definition
property_definition <-
{property_definition
property_definition.name = 'fill area style'}
property_definition_representation.definition
property_definition_representation
property_definition_representation.used_representation ->
representation
representation.items[i] ->
representation_item =>
geometric_representation_item =>
(fill_area_style_tiles) 
(externally_defined_tile_style) 

end_attribute_mapping;

end_entity_mapping;

entity_mapping Inter_stratum_feature_edge_segment_template_armx(Inter_stratum_feature_edge_segment_template_armx, inter_stratum_feature_edge_segment_template);

mapping_constraints;
[inter_stratum_feature_edge_segment_template <=
part_template_definition]
[inter_stratum_feature_edge_segment_template <=
shape_aspect_relationship]

end_mapping_constraints;

attribute_mapping composed_edge(composed_edge, $PATH, Inter_stratum_feature_edge_template_armx);
inter_stratum_feature_edge_segment_template <=
part_template_definition <=
product_definition <-
product_definition_relationship.related_product_definition
product_definition_relationship.relating_product_definition ->
product_definition =>
part_template_definition =>
inter_stratum_feature_edge_template

end_attribute_mapping;

attribute_mapping end_vertex(end_vertex, $PATH, Edge_segment_vertex_armx);
inter_stratum_feature_edge_segment_template <=
shape_aspect_relationship
shape_aspect_relationship.related_shape_aspect ->
shape_aspect
{shape_aspect
shape_aspect.name = 'single datum'}
shape_aspect =>
datum =>
edge_segment_vertex

end_attribute_mapping;

attribute_mapping start_vertex(start_vertex, $PATH, Edge_segment_vertex_armx);
inter_stratum_feature_edge_segment_template <=
shape_aspect_relationship
shape_aspect_relationship.relating_shape_aspect ->
shape_aspect
{shape_aspect
shape_aspect.name = 'single datum'}
shape_aspect =>
datum =>
edge_segment_vertex

end_attribute_mapping;

attribute_mapping reference_path(reference_path, $PATH, Trimmed_curve);
inter_stratum_feature_edge_segment_template <=
part_template_definition <=
product_definition_shape <=
property_definition <-
property_definition_representation.definition
property_definition_representation.used_representation ->
representation.items[i] ->
representation_item =>
geometric_representation_item =>
curve =>
bounded_curve =>
trimmed_curve

end_attribute_mapping;

end_entity_mapping;

entity_mapping Inter_stratum_feature_edge_template_armx(Inter_stratum_feature_edge_template_armx, inter_stratum_feature_edge_template);

mapping_constraints;
inter_stratum_feature_edge_template <=
part_template_definition <=
product_definition

end_mapping_constraints;

end_entity_mapping;


entity_mapping Parametric_template_armx(Parametric_template_armx, parametric_template);

mapping_constraints;

parametric_template <=
part_template_definition

end_mapping_constraints;

end_entity_mapping;


entity_mapping Planar_path_shape_model_with_parameters(Planar_path_shape_model_with_parameters, planar_path_shape_representation_with_parameters);

mapping_constraints;
{planar_path_shape_representation_with_parameters<=
single_area_csg_2d_shape_representation <=
csg_2d_shape_representation <=
shape_representation <=
representation}

end_mapping_constraints;

end_entity_mapping;


entity_mapping Planar_closed_path_shape_model_with_parameters(Planar_closed_path_shape_model_with_parameters, planar_path_shape_representation_with_parameters);

mapping_constraints;
{planar_path_shape_representation_with_parameters <=
single_area_csg_2d_shape_representation <=
csg_2d_shape_representation <=
shape_representation <=
representation 
representation.items[i] ->
representation_item
representation_item =>
geometric_representation_item =>
solid_model =>
csg_solid
{csg_solid =>
csg_solid_2d =>
csg_primitive_solid_2d}
csg_solid.tree_root_expression ->
csg_select = csg_primitive
csg_primitive = primitive_2d
primitive_2d =>
complex_area =>
path_area_with_parameters <=
mapped_item
mapped_item.mapping_source ->
representation_map
representation_map.mapped_representation ->
representation =>
curve_style_parameters_representation =>
closed_curve_style_parameters}

end_mapping_constraints;
(* Made derived
attribute_mapping parameters(parameters, $PATH, Trace_template_armx);
single_area_csg_2d_shape_representation <=
csg_2d_shape_representation <=
shape_representation <=
representation <-
representation_relationship.rep_1
representation_relationship
{representation_relationship.name = 'parameters'}
representation_relationship.rep_2 ->
representation <-
property_definition_representation.used_representation
property_definition_representation
property_definition_representation.definition ->
property_definition =>
product_definition_shape =>
part_template_definition =>
parametric_template =>
trace_template

end_attribute_mapping;
*)
(* Not allowed for XIMs
attribute_mapping items(items, $PATH, primitive_2d_planar_path_with_parameters_or_axis_placement_2d);
single_area_csg_2d_shape_representation <=
csg_2d_shape_representation <=
shape_representation <=
representation 
representation.items[i] ->
representation_item
(representation_item =>
mapped_item =>
primitive_2d_planar_path_with_parameters)
(representation_item =>
geometric_representation_item =>
placement =>
axis2_placement_2d)
end_attribute_mapping;

attribute_mapping items(items, $PATH, Primitive_2d_planar_path_with_parameters_armx);
single_area_csg_2d_shape_representation <=
csg_2d_shape_representation <=
shape_representation <=
representation 
representation.items[i] ->
representation_item =>
mapped_item =>
primitive_2d_planar_path_with_parameters

end_attribute_mapping;

attribute_mapping items(items, $PATH, axis2_placement_2d);
single_area_csg_2d_shape_representation <=
csg_2d_shape_representation <=
shape_representation <=
representation 
representation.items[i] ->
representation_item =>
geometric_representation_item =>
placement =>
axis2_placement_2d

end_attribute_mapping;
*)
end_entity_mapping;

entity_mapping Part_string_template_armx(Part_string_template_armx, part_string_template);

mapping_constraints;
part_string_template <=
part_template_definition <=
product_definition

end_mapping_constraints;

attribute_mapping string_alignment(string_alignment, $PATH, text_alignment);
part_string_template <=
part_template_definition <=
product_definition
characterized_product_definition = product_definition
characterized_definition = characterized_product_definition
characterized_definition <-
property_definition.definition
{property_definition.name = 'string alignment'}
{(property_definition.description = 'top right')
(property_definition.description = 'top centre')
(property_definition.description = 'top left')
(property_definition.description = 'centre right')
(property_definition.description = 'centre centre')
(property_definition.description = 'centre left')
(property_definition.description = 'bottom right')
(property_definition.description = 'bottom centre')
(property_definition.description = 'bottom left')}

end_attribute_mapping;

end_entity_mapping;


entity_mapping Part_text_template_armx(Part_text_template_armx, part_text_template);

mapping_constraints;
part_text_template <=
part_template_definition <=
product_definition

end_mapping_constraints;

attribute_mapping of_character(of_character, $PATH, Character_glyph_symbol);
part_text_template <=
part_template_definition <=
product_definition
characterized_product_definition = product_definition
characterized_definition = characterized_product_definition
characterized_definition <-
property_definition.definition
{property_definition.description = 'of character'}
property_definition <-
property_definition_representation.definition
property_definition_representation
property_definition_representation.used_representation ->
representation =>
symbol_representation =>
generic_character_glyph_symbol

end_attribute_mapping;

end_entity_mapping;
(* Now we use entity from AIM
entity_mapping Solid_character_glyph_2d_symbol_armx(Solid_character_glyph_2d_symbol_armx, solid_character_glyph_2d_symbol);

mapping_constraints;
solid_character_glyph_2d_symbol <=
generic_character_glyph_symbol <=
symbol_representation <=
representation

end_mapping_constraints;

end_entity_mapping;
*)
entity_mapping Snowball_template_armx(Snowball_template_armx, snowball_template);

mapping_constraints;
snowball_template <=
teardrop_template <=
parametric_template <=
part_template_definition <=
product_definition

end_mapping_constraints;

attribute_mapping snowball_quantity_per_trace(snowball_quantity_per_trace, $PATH);
snowball_template <=
teardrop_template <=
parametric_template <=
part_template_definition <=
product_definition
characterized_product_definition = product_definition
characterized_definition = characterized_product_definition
characterized_definition <-
property_definition.definition
property_definition
{property_definition.name = 'snowball quantity per trace'}
property_definition <-
property_definition_representation.definition
property_definition_representation
property_definition_representation.used_representation ->
representation
representation.items[i] ->
representation_item =>
measure_representation_item <=
measure_with_unit
{measure_with_unit.unit_component ->
unit
unit = named_unit
named_unit =>
context_dependent_unit}
measure_with_unit.value_component ->
measure_value
measure_value = count_measure
count_measure

end_attribute_mapping;

attribute_mapping snowball_start_distance(snowball_start_distance, $PATH, length_measure_with_unit);
snowball_template <=
teardrop_template <=
parametric_template <=
part_template_definition <=
product_definition
characterized_product_definition = product_definition
characterized_definition = characterized_product_definition
characterized_definition <-
property_definition.definition
property_definition
{property_definition.name = 'snowball start distance'}
property_definition <-
property_definition_representation.definition
property_definition_representation
property_definition_representation.used_representation ->
representation
representation.items[i] ->
representation_item =>
measure_representation_item <=
measure_with_unit =>
length_measure_with_unit

end_attribute_mapping;

attribute_mapping snowball_end_distance(snowball_end_distance, $PATH, length_measure_with_unit);
snowball_template <=
teardrop_template <=
parametric_template <=
part_template_definition <=
product_definition
characterized_product_definition = product_definition
characterized_definition = characterized_product_definition
characterized_definition <-
property_definition.definition
property_definition
{property_definition.name = 'snowball end distance'}
property_definition <-
property_definition_representation.definition
property_definition_representation
property_definition_representation.used_representation ->
representation
representation.items[i] ->
representation_item =>
measure_representation_item <=
measure_with_unit =>
length_measure_with_unit

end_attribute_mapping;

attribute_mapping snowball_initial_spacing(snowball_initial_spacing, $PATH, length_measure_with_unit);
snowball_template <=
teardrop_template <=
parametric_template <=
part_template_definition <=
product_definition
characterized_product_definition = product_definition
characterized_definition = characterized_product_definition
characterized_definition <-
property_definition.definition
property_definition
{property_definition.name = 'snowball initial spacing'}
property_definition <-
property_definition_representation.definition
property_definition_representation
property_definition_representation.used_representation ->
representation
representation.items[i] ->
representation_item =>
measure_representation_item <=
measure_with_unit =>
length_measure_with_unit

end_attribute_mapping;

attribute_mapping snowball_end_spacing(snowball_end_spacing, $PATH, length_measure_with_unit);
snowball_template <=
teardrop_template <=
parametric_template <=
part_template_definition <=
product_definition
characterized_product_definition = product_definition
characterized_definition = characterized_product_definition
characterized_definition <-
property_definition.definition
property_definition
{property_definition.name = 'snowball end spacing'}
property_definition <-
property_definition_representation.definition
property_definition_representation
property_definition_representation.used_representation ->
representation
representation.items[i] ->
representation_item =>
measure_representation_item <=
measure_with_unit =>
length_measure_with_unit

end_attribute_mapping;

attribute_mapping snowball_initial_radius(snowball_initial_radius, $PATH, length_measure_with_unit);
snowball_template <=
teardrop_template <=
parametric_template <=
part_template_definition <=
product_definition
characterized_product_definition = product_definition
characterized_definition = characterized_product_definition
characterized_definition <-
property_definition.definition
property_definition
{property_definition.name = 'snowball initial radius'}
property_definition <-
property_definition_representation.definition
property_definition_representation
property_definition_representation.used_representation ->
representation
representation.items[i] ->
representation_item =>
measure_representation_item <=
measure_with_unit =>
length_measure_with_unit

end_attribute_mapping;

attribute_mapping snowball_end_radius(snowball_end_radius, $PATH, length_measure_with_unit);
snowball_template <=
teardrop_template <=
parametric_template <=
part_template_definition <=
product_definition
characterized_product_definition = product_definition
characterized_definition = characterized_product_definition
characterized_definition <-
property_definition.definition
property_definition
{property_definition.name = 'snowball end radius'}
property_definition <-
property_definition_representation.definition
property_definition_representation
property_definition_representation.used_representation ->
representation
representation.items[i] ->
representation_item =>
measure_representation_item <=
measure_with_unit =>
length_measure_with_unit

end_attribute_mapping;

end_entity_mapping;

entity_mapping Teardrop_by_angle_template_armx(Teardrop_by_angle_template_armx, teardrop_by_angle_template);

mapping_constraints;
teardrop_by_angle_template <=
teardrop_template <=
parametric_template <=
part_template_definition <=
product_definition

end_mapping_constraints;

attribute_mapping teardrop_angle(teardrop_angle, $PATH, plane_angle_measure_with_unit);
teardrop_by_angle_template <=
teardrop_template <=
parametric_template <=
part_template_definition <=
product_definition
characterized_product_definition = product_definition
characterized_definition = characterized_product_definition
characterized_definition <-
property_definition.definition
{property_definition.name = 'teardrop angle'}
property_definition <-
property_definition_representation.definition
property_definition_representation
property_definition_representation.used_representation ->
representation
representation.items[i] ->
representation_item
representation_item =>
measure_representation_item <=
measure_with_unit =>
plane_angle_measure_with_unit

end_attribute_mapping;

end_entity_mapping;

entity_mapping Teardrop_by_length_template_armx(Teardrop_by_length_template_armx, teardrop_by_length_template);

mapping_constraints;
teardrop_by_length_template <=
teardrop_template <=
parametric_template <=
part_template_definition <=
product_definition


end_mapping_constraints;

attribute_mapping teardrop_taper_start_distance(teardrop_taper_start_distance, $PATH, length_measure_with_unit);
teardrop_by_length_template <=
teardrop_template <=
parametric_template <=
part_template_definition <=
product_definition
characterized_product_definition = product_definition
characterized_definition = characterized_product_definition
characterized_definition <-
property_definition.definition
{property_definition.name = 'teardrop taper start distance'}
property_definition <-
property_definition_representation.definition
property_definition_representation
property_definition_representation.used_representation ->
representation
representation.items[i] ->
representation_item
representation_item =>
measure_representation_item <=
measure_with_unit =>
length_measure_with_unit

end_attribute_mapping;

attribute_mapping teardrop_taper_end_distance(teardrop_taper_end_distance, $PATH, length_measure_with_unit);
teardrop_by_length_template <=
teardrop_template <=
parametric_template <=
part_template_definition <=
product_definition
characterized_product_definition = product_definition
characterized_definition = characterized_product_definition
characterized_definition <-
property_definition.definition
{property_definition.name = 'teardrop taper end distance'}
property_definition <-
property_definition_representation.definition
property_definition_representation
property_definition_representation.used_representation ->
representation
representation.items[i] ->
representation_item
representation_item =>
measure_representation_item <=
measure_with_unit =>
length_measure_with_unit

end_attribute_mapping;

end_entity_mapping;


entity_mapping Teardrop_template_armx(Teardrop_template_armx, teardrop_template);

mapping_constraints;
teardrop_template <=
parametric_template <=
part_template_definition <=
product_definition
end_mapping_constraints;

end_entity_mapping;


entity_mapping Trace_template_armx(Trace_template_armx, trace_template);

mapping_constraints;
trace_template <=
parametric_template <=
part_template_definition <=
product_definition

end_mapping_constraints;

attribute_mapping trace_style(trace_style, $PATH, Curve_style_parameters);
trace_template <=
parametric_template <=
part_template_definition <=
product_definition_shape <=
property_definition <-
property_definition_representation.definition
property_definition_representation
property_definition_representation.used_representation ->
representation =>
curve_style_parameters_representation

end_attribute_mapping;

end_entity_mapping;
(*end_schema_mapping;*)
