(*
 * $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 production_rule(Production_rule_arm, Production_rule_mim);*)


entity_mapping Abstract_variable_armx(Abstract_variable_armx, abstract_variable);

mapping_constraints;
abstract_variable <=
					[property_definition]
					[property_definition_representation]
					[representation]
					[representation_item]
			
end_mapping_constraints;

attribute_mapping name(name, property_definition.name);
abstract_variable <=
					property_definition
					property_definition.name
				
end_attribute_mapping;

attribute_mapping scope(scope, $PATH, scope_select);
abstract_variable <=
property_definition
					property_definition.definition -> 
					characterized_definition = characterized_product_definition
					characterized_product_definition = product_definition
					product_definition =>
					rule_software_definition =>
					(rule_definition)
					(rule_set)
					(rule_set_group)
				
end_attribute_mapping;

attribute_mapping scope(scope, $PATH, Rule_definition_armx);
abstract_variable <=
property_definition
					property_definition.definition -> 
					characterized_definition = characterized_product_definition
					characterized_product_definition = product_definition
					product_definition =>
					rule_software_definition =>
					rule_definition
				
end_attribute_mapping;

attribute_mapping scope(scope, $PATH, Rule_set_armx);
abstract_variable <=
property_definition
					property_definition.definition -> 
					characterized_definition = characterized_product_definition
					characterized_product_definition = product_definition
					product_definition =>
					rule_software_definition =>
					rule_set
				
end_attribute_mapping;

attribute_mapping scope(scope, $PATH, Rule_set_group_armx);
abstract_variable <=
property_definition
					property_definition.definition -> 
					characterized_definition = characterized_product_definition
					characterized_product_definition = product_definition
					product_definition =>
					rule_software_definition =>
					rule_set_group
				
end_attribute_mapping;

end_entity_mapping;

entity_mapping Atomic_formula_armx(Atomic_formula_armx, atomic_formula);

mapping_constraints;
atomic_formula <=
					compound_representation_item
					{compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item}
					compound_representation_item <=
					representation_item
			
end_mapping_constraints;

attribute_mapping predicate_symbol(predicate_symbol, $PATH, predicate_symbol);
atomic_formula <=
					compound_representation_item
					compound_representation_item <=
					representation_item
					representation_item.name
				
end_attribute_mapping;

attribute_mapping terms(terms, $PATH, term_select);
atomic_formula <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
				
end_attribute_mapping;

attribute_mapping terms(terms, $PATH, Symbol_armx);
atomic_formula <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					symbol
				
end_attribute_mapping;

attribute_mapping terms(terms, $PATH, constants);
atomic_formula <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
				
end_attribute_mapping;

attribute_mapping terms(terms, $PATH, count_measure);
atomic_formula <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					measure_representation_item <=
					measure_with_unit
					measure_with_unit.value_component ->
					measure_value = count_measure
				
end_attribute_mapping;

attribute_mapping terms(terms, $PATH, descriptive_measure);
atomic_formula <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					measure_representation_item <=
					measure_with_unit
					measure_with_unit.value_component ->
					measure_value = descriptive_measure
				
end_attribute_mapping;

attribute_mapping terms(terms, $PATH, Logical_representation_item);
atomic_formula <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					descriptive_representation_item
				
end_attribute_mapping;

attribute_mapping terms(terms, $PATH, Func_armx);
atomic_formula <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					compound_representation_item =>
					func
				
end_attribute_mapping;

attribute_mapping terms(terms, $PATH, Scalar_variable_armx);
atomic_formula <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					abstract_variable =>
					scalar_variable
				
end_attribute_mapping;

attribute_mapping terms(terms, $PATH, Row_value_armx);
atomic_formula <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					compound_representation_item =>
					row_value					
				
end_attribute_mapping;

attribute_mapping terms(terms, $PATH, Row_variable_Armx);
atomic_formula <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					abstract_variable =>
					row_variable
				
end_attribute_mapping;

end_entity_mapping;

entity_mapping Attribute_assertion_armx(Attribute_assertion_armx, attribute_assertion);

mapping_constraints;
attribute_assertion <=
				[fact_type]
				[property_definition_representation]
				[representation]
			
end_mapping_constraints;

attribute_mapping entity_type(entity_type, $PATH);
attribute_assertion <=
					representation
					representation.items[i] ->
					representation_item
					{representation_item.name = 'entity type'}
					representation_item =>
					descriptive_representation_item
					descriptive_representation_item.description
				
end_attribute_mapping;

attribute_mapping Attribute(Attribute, $PATH);
attribute_assertion <=
					representation
					representation.items[i] ->
					representation_item
					{representation_item.name = 'attribute'}
					representation_item =>
					descriptive_representation_item
					descriptive_representation_item.description
				
end_attribute_mapping;

end_entity_mapping;

entity_mapping Back_chaining_rule_armx(Back_chaining_rule_armx, back_chaining_rule);

mapping_constraints;
back_chaining_rule <=
				rule_definition
			
end_mapping_constraints;

attribute_mapping head(head, $PATH, Rule_condition_armx);
back_chaining_rule <=
				rule_definition <=
				rule_software_definition <=
				product_definition
				characterized_product_definition = product_definition				
				characterized_definition = characterized_product_definition				
				characterized_definition <-
				property_definition.definition 
				property_definition =>
				back_chaining_rule_body <=
				representation
				representation.items[i] ->
				representation_item =>
				compound_representation_item =>
				atomic_formula =>
				rule_condition
				
end_attribute_mapping;

attribute_mapping body(body, $PATH, Rule_condition_armx);
back_chaining_rule <=
				rule_definition <=
				rule_software_definition <=
				product_definition
				characterized_product_definition = product_definition				
				characterized_definition = characterized_product_definition				
				characterized_definition <-
				property_definition.definition 
				property_definition =>
				back_chaining_rule_body <=
				representation
				representation.items[i] ->
				representation_item =>
				compound_representation_item
				compound_representation_item.item_element ->
				compound_item_definition = list_representation_item
				list_representation_item[i] ->
				representation_item =>
				compound_representation_item =>
				atomic_formula =>
				rule_condition
				
end_attribute_mapping;

end_entity_mapping;

entity_mapping Complex_clause_armx(Complex_clause_armx, complex_clause);

mapping_constraints;
complex_clause <=
					compound_representation_item
					{compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item}
					compound_representation_item <=
					representation_item
			
end_mapping_constraints;

attribute_mapping clauses(clauses, $PATH, Simple_clause_armx);
complex_clause <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					compound_representation_item =>
					simple_clause
				
end_attribute_mapping;

attribute_mapping clauses(clauses, $PATH, Complex_clause_armx);
complex_clause <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					compound_representation_item =>
					complex_clause
				
end_attribute_mapping;

attribute_mapping clauses(clauses, $PATH, clause_select);
complex_clause <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					compound_representation_item
				
end_attribute_mapping;

end_entity_mapping;

entity_mapping Complex_conjunctive_clause_armx(Complex_conjunctive_clause_armx, complex_conjunctive_clause);

mapping_constraints;
complex_conjunctive_clause <=
					complex_clause <=
					compound_representation_item <=
					representation_item
			
end_mapping_constraints;

end_entity_mapping;

entity_mapping Complex_disjunctive_clause_armx(Complex_disjunctive_clause_armx, complex_disjunctive_clause);

mapping_constraints;
complex_disjunctive_clause <=
					complex_clause <=
					compound_representation_item <=
					representation_item
			
end_mapping_constraints;

end_entity_mapping;

entity_mapping Entity_assertion_armx(Entity_assertion_armx, entity_assertion);

mapping_constraints;
entity_assertion <=
				fact_type <=
				property_definition
			
end_mapping_constraints;

end_entity_mapping;

entity_mapping Enum_reference_prefix_armx(Enum_reference_prefix_armx, enum_reference_prefix);

mapping_constraints;
enum_reference_prefix <=
				descriptive_representation_item <=
				representation_item
			
end_mapping_constraints;

attribute_mapping prefix(prefix, $PATH);
enum_reference_prefix <=
					descriptive_representation_item
					descriptive_representation_item.description
				
end_attribute_mapping;

end_entity_mapping;

entity_mapping Extent_armx(Extent_armx, extent);

mapping_constraints;
extent <=
				characterized_object
			
end_mapping_constraints;

attribute_mapping source(source, $PATH);
extent <=
					characterized_object
					characterized_definition = characterized_object
					characterized_definition <-
					property_definition.definition
					property_definition
					{property_definition.description = 'source'}
					property_definition.name
				
end_attribute_mapping;

attribute_mapping variable_id(variable_id, $PATH);
extent <=
					characterized_object
					characterized_definition = characterized_object
					characterized_definition <-
					property_definition.definition
					property_definition
					{property_definition.description = 'variable id'}
					property_definition.name
				
end_attribute_mapping;

attribute_mapping query_expression(query_expression, $PATH);
extent <=
					characterized_object
					characterized_definition = characterized_object
					characterized_definition <-
					property_definition.definition
					property_definition
					{property_definition.description = 'query expression'}
					property_definition.name
				
end_attribute_mapping;

attribute_mapping syntax(syntax, $PATH, expression_syntax);
extent <=
					characterized_object
					characterized_definition = characterized_object
					characterized_definition <-
					property_definition.definition
					property_definition
					{property_definition.description = 'syntax'}
					property_definition.name
					(property_definition.name = 'express')
				
end_attribute_mapping;

end_entity_mapping;

entity_mapping Fact_type_armx(Fact_type_armx, fact_type);

mapping_constraints;
fact_type <=
				property_definition
			
end_mapping_constraints;

attribute_mapping source(source, $PATH, Extent_armx);
fact_type <=
					property_definition
					property_definition.definition ->
					characterized_definition 				
					characterized_definition = characterized_object
					characterized_object =>
					extent
				
end_attribute_mapping;

attribute_mapping predicate_symbol(predicate_symbol, $PATH);
fact_type <=
					property_definition
					property_definition.name
				
end_attribute_mapping;

end_entity_mapping;

entity_mapping Forward_chaining_rule_armx(Forward_chaining_rule_armx, forward_chaining_rule);

mapping_constraints;
forward_chaining_rule <=
				rule_definition <=
				rule_software_definition <=
				product_definition
			
end_mapping_constraints;

attribute_mapping premise(premise, $PATH, clause_select);
forward_chaining_rule <=
				rule_definition <=
				rule_software_definition <=
				product_definition
				characterized_product_definition = product_definition				
				characterized_definition = characterized_product_definition				
				characterized_definition <-
				property_definition.definition 
				property_definition =>
				forward_chaining_rule_premise <=
				representation
				representation.items[i] ->
				representation_item =>
				compound_representation_item
				
end_attribute_mapping;

attribute_mapping premise(premise, $PATH, Complex_clause_armx);
forward_chaining_rule <=
				rule_definition <=
				rule_software_definition <=
				product_definition
				characterized_product_definition = product_definition				
				characterized_definition = characterized_product_definition				
				characterized_definition <-
				property_definition.definition 
				property_definition =>
				forward_chaining_rule_premise <=
				representation
				representation.items[i] ->
				representation_item =>
				compound_representation_item =>
				complex_clause
				
end_attribute_mapping;

attribute_mapping premise(premise, $PATH, Simple_clause_armx);
forward_chaining_rule <=
				rule_definition <=
				rule_software_definition <=
				product_definition
				characterized_product_definition = product_definition				
				characterized_definition = characterized_product_definition				
				characterized_definition <-
				property_definition.definition 
				property_definition =>
				forward_chaining_rule_premise <=
				representation
				representation.items[i] ->
				representation_item =>
				compound_representation_item =>
				simple_clause
				
end_attribute_mapping;

attribute_mapping conclusion(conclusion, $PATH, Literal_conjunction_armx);
forward_chaining_rule <=
				rule_definition <=
				rule_software_definition <=
				product_definition
				characterized_product_definition = product_definition				
				characterized_definition = characterized_product_definition				
				characterized_definition <-
				property_definition.definition 
				property_definition =>
				forward_chaining_rule_premise <=
				representation
				representation.items[i] ->
				representation_item =>
				compound_representation_item =>
				simple_clause =>
				literal_conjunction
				
end_attribute_mapping;

end_entity_mapping;

entity_mapping Func_armx(Func_armx, func);

mapping_constraints;
func <=
				compound_representation_item
				{compound_representation_item.item_element ->
				compound_item_definition
				compound_item_definition = list_representation_item}
				compound_representation_item <=
				representation_item
			
end_mapping_constraints;

attribute_mapping func_sym(func_sym, $PATH);
func <=
				compound_representation_item <=
				representation_item
				representation_item.name
				
end_attribute_mapping;

attribute_mapping terms(terms, $PATH, term_select);
func <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
				
end_attribute_mapping;

attribute_mapping terms(terms, $PATH, Symbol_armx);
func <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					symbol
				
end_attribute_mapping;

attribute_mapping terms(terms, $PATH, constants);
func <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
				
end_attribute_mapping;

attribute_mapping terms(terms, $PATH, count_measure);
func <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					measure_representation_item <=
					measure_with_unit
					measure_with_unit.value_component ->
					measure_value = count_measure
				
end_attribute_mapping;

attribute_mapping terms(terms, $PATH, descriptive_measure);
func <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					measure_representation_item <=
					measure_with_unit
					measure_with_unit.value_component ->
					measure_value = descriptive_measure
				
end_attribute_mapping;

attribute_mapping terms(terms, $PATH, Logical_representation_item);
func <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					descriptive_representation_item
				
end_attribute_mapping;

attribute_mapping terms(terms, $PATH, Func_armx);
func <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					compound_representation_item =>
					func
				
end_attribute_mapping;

attribute_mapping terms(terms, $PATH, Scalar_variable_armx);
func <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					abstract_variable =>
					scalar_variable
				
end_attribute_mapping;

attribute_mapping terms(terms, $PATH, Row_value_armx);
func <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					compound_representation_item =>
					row_value					
				
end_attribute_mapping;

attribute_mapping terms(terms, $PATH, Row_variable_armx);
func <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					abstract_variable =>
					row_variable
				
end_attribute_mapping;

end_entity_mapping;

entity_mapping Global_assignment_armx(Global_assignment_armx, global_assignment);

mapping_constraints;
global_assignment <=
				representation_item_relationship
			
end_mapping_constraints;

attribute_mapping variable(variable, $PATH, Abstract_variable_armx);
global_assignment <=
				representation_item_relationship
				representation_item_relationship.relating_representation_item ->
				representation_item =>
				abstract_variable
				
end_attribute_mapping;

attribute_mapping val(val, $PATH, term_select);
global_assignment <=
				representation_item_relationship
				representation_item_relationship.related_representation_item ->
				representation_item
				
end_attribute_mapping;

attribute_mapping val(val, $PATH, Symbol_armx);
global_assignment <=
				representation_item_relationship
				representation_item_relationship.related_representation_item ->
				representation_item =>
				symbol
				
end_attribute_mapping;

attribute_mapping val(val, $PATH, constants);
global_assignment <=
				representation_item_relationship
				representation_item_relationship.related_representation_item ->
				representation_item
				
end_attribute_mapping;

attribute_mapping val(val, $PATH, count_measure);
global_assignment <=
				representation_item_relationship
				representation_item_relationship.related_representation_item ->
				representation_item =>
				measure_representation_item <=
				measure_with_unit
				measure_with_unit.value_component ->
				measure_value = count_measure
				
end_attribute_mapping;

attribute_mapping val(val, $PATH, descriptive_measure);
global_assignment <=
				representation_item_relationship
				representation_item_relationship.related_representation_item ->
				representation_item =>
				measure_representation_item <=
				measure_with_unit
				measure_with_unit.value_component ->
				measure_value = descriptive_measure
				
end_attribute_mapping;

attribute_mapping val(val, $PATH, Logical_representation_item);
global_assignment <=
				representation_item_relationship
				representation_item_relationship.related_representation_item ->
				representation_item =>
				descriptive_representation_item
				
end_attribute_mapping;

attribute_mapping val(val, $PATH, Func_armx);
global_assignment <=
				representation_item_relationship
				representation_item_relationship.related_representation_item ->
				representation_item =>
				compound_representation_item =>
				func
				
end_attribute_mapping;

attribute_mapping val(val, $PATH, Scalar_variable_armx);
global_assignment <=
				representation_item_relationship
				representation_item_relationship.related_representation_item ->
				representation_item =>
				abstract_variable =>
				scalar_variable
				
end_attribute_mapping;

attribute_mapping val(val, $PATH, Row_value_armx);
global_assignment <=
				representation_item_relationship
				representation_item_relationship.related_representation_item ->
				representation_item =>
				compound_representation_item =>
				row_value					
				
end_attribute_mapping;

attribute_mapping val(val, $PATH, Row_variable_armx);
global_assignment <=
				representation_item_relationship
				representation_item_relationship.related_representation_item ->
				representation_item =>
				abstract_variable =>
				row_variable
				
end_attribute_mapping;

end_entity_mapping;

entity_mapping Ground_fact_armx(Ground_fact_armx, ground_fact);

mapping_constraints;
ground_fact <=
				atomic_formula <=
				compound_representation_item <=
				representation_item
			
end_mapping_constraints;

end_entity_mapping;

entity_mapping Literal_conjunction_armx(Literal_conjunction_armx, literal_conjunction);

mapping_constraints;
literal_conjunction <=
				simple_clause <=
				compound_representation_item <=
				representation_item
			
end_mapping_constraints;

end_entity_mapping;

entity_mapping Literal_disjunction_armx(Literal_disjunction_armx, literal_disjunction);

mapping_constraints;
literal_disjunction <=
				simple_clause <=
				compound_representation_item <=
				representation_item
			
end_mapping_constraints;

end_entity_mapping;

entity_mapping Row_value_armx(Row_value_armx, row_value);

mapping_constraints;
row_value <=
				compound_representation_item
				{compound_representation_item.item_element ->
				compound_item_definition
				compound_item_definition = list_representation_item}
				compound_representation_item <=
				representation_item
			
end_mapping_constraints;

attribute_mapping values(values, $PATH, term_select);
row_value <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
				
end_attribute_mapping;

attribute_mapping values(values, $PATH, Symbol_armx);
row_value <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					symbol
				
end_attribute_mapping;

attribute_mapping values(values, $PATH, constants);
row_value <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
				
end_attribute_mapping;

attribute_mapping values(values, $PATH, count_measure);
row_value <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					measure_representation_item <=
					measure_with_unit
					measure_with_unit.value_component ->
					measure_value = count_measure
				
end_attribute_mapping;

attribute_mapping values(values, $PATH, descriptive_measure);
row_value <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					measure_representation_item <=
					measure_with_unit
					measure_with_unit.value_component ->
					measure_value = descriptive_measure
				
end_attribute_mapping;

attribute_mapping values(values, $PATH, Logical_representation_item);
row_value <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					descriptive_representation_item
				
end_attribute_mapping;

attribute_mapping values(values, $PATH, Func_armx);
row_value <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					compound_representation_item =>
					func
				
end_attribute_mapping;

attribute_mapping values(values, $PATH, Scalar_variable_armx);
row_value <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					abstract_variable =>
					scalar_variable
				
end_attribute_mapping;

attribute_mapping values(values, $PATH, Row_value_armx);
row_value <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					compound_representation_item =>
					row_value					
				
end_attribute_mapping;

attribute_mapping values(values, $PATH, Row_variable_armx);
row_value <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					abstract_variable =>
					row_variable
				
end_attribute_mapping;

end_entity_mapping;

entity_mapping Row_variable_armx(Row_variable_armx, row_variable);

mapping_constraints;
row_variable <=
				abstract_variable <=
				[property_definition]
				[property_definition_representation]
				[representation]
				[representation_item]
			
end_mapping_constraints;

end_entity_mapping;

entity_mapping Rule_action_armx(Rule_action_armx, rule_action);

mapping_constraints;
rule_action <=
action

end_mapping_constraints;

attribute_mapping subject_rule(subject_rule, $PATH, Rule_version);
rule_action <=
action <-
action_assignment.assigned_action
action_assignment =>
applied_action_assignment
applied_action_assignment.items[i] ->
action_items
action_items = product_definition_formation
product_definition_formation
{product_definition_formation.description = 'rule version'}
				
end_attribute_mapping;

end_entity_mapping;

entity_mapping Rule_adoption(Rule_adoption, rule_action);

mapping_constraints;
rule_action <=
action
{action
action.name = 'rule adoption'}

end_mapping_constraints;

end_entity_mapping;

entity_mapping Rule_change_request(Rule_change_request, rule_action);

mapping_constraints;
rule_action <=
action
{action
action.name = 'rule change request'}

end_mapping_constraints;

attribute_mapping change_reason(change_reason, action.description);
rule_action <=
action
action.description

end_attribute_mapping;

end_entity_mapping;

entity_mapping Rule_condition_armx(Rule_condition_armx, rule_condition);

mapping_constraints;
rule_condition <=
					atomic_formula <=
					compound_representation_item <=
					representation_item
			
end_mapping_constraints;

attribute_mapping positive(positive, $PATH);
rule_condition <=
					atomic_formula <=
					compound_representation_item
					compound_representation_item <=
					representation_item
					representation_item.name					
					(representation_item.name = 'TRUE')
					(representation_item.name = 'FALSE')

				
end_attribute_mapping;

end_entity_mapping;

entity_mapping Rule_creation(Rule_creation, rule_action);

mapping_constraints;
rule_action <=
action
{action
action.name = 'rule creation'}

end_mapping_constraints;

end_entity_mapping;

entity_mapping Rule_definition_armx(Rule_definition_armx, rule_definition);

mapping_constraints;
{rule_definition <=
rule_software_definition <=				
product_definition}

end_mapping_constraints;

end_entity_mapping;

entity_mapping Rule_expiration(Rule_expiration, rule_action);

mapping_constraints;
rule_action <=
action
{action
action.name = 'rule expiration'}

end_mapping_constraints;

attribute_mapping expiration_rationale(expiration_rationale, action.description);
rule_action <=
action
action.description

end_attribute_mapping;

end_entity_mapping;

entity_mapping Rule_justification(Rule_justification, rule_action);

mapping_constraints;
rule_action <=
action
{action
action.name = 'rule justification'}

end_mapping_constraints;

attribute_mapping justification_rationale(justification_rationale, action.description);
rule_action <=
action
action.description

end_attribute_mapping;

attribute_mapping justified_action(justified_action, $PATH, Rule_action_armx);
rule_action <=
action <-
action_relationship.related_action
{action_relationship
action_relationship.name = 'justified action'}
action_relationship
action_relationship.relating_action ->
action =>
rule_action

end_attribute_mapping;

end_entity_mapping;

entity_mapping Rule_modification(Rule_modification, rule_action);

mapping_constraints;
rule_action <=
action
{action
action.name = 'rule modification'}

end_mapping_constraints;

attribute_mapping modification_rationale(modification_rationale, $PATH, Rule_change_request);
rule_action <=
action <-
action_relationship.related_action
{action_relationship
action_relationship.name = 'modification rationale'}
action_relationship
action_relationship.relating_action ->
{action
action.name = 'rule change request'}
action =>
rule_action

end_attribute_mapping;

end_entity_mapping;

entity_mapping Rule_priority(Rule_priority, representation);

mapping_constraints;
{representation
representation.name = 'rule priority'}

end_mapping_constraints;

attribute_mapping priority(priority, $PATH);
representation
representation.items[i] ->
representation_item =>
{representation_item
representation_item.name = 'priority'}
measure_representation_item <=
measure_with_unit
measure_with_unit.value_component ->
measure_value = count_measure

end_attribute_mapping;

attribute_mapping prioritized_rule(prioritized_rule, $PATH, Rule_definition_armx);
representation <-
property_definition_representation.used_representation
property_definition_representation
{property_definition_representation
property_definition_representation.name = 'prioritized rule'}
property_definition_representation.definition ->
property_definition
property_definition.definition ->
characterized_definition
characterized_definition = characterized_product_definition
characterized_product_definition =  product_definition
product_definition =>
rule_software_definition =>
rule_definition

end_attribute_mapping;

end_entity_mapping;

entity_mapping Rule_product(Rule_product, product);

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

end_mapping_constraints;

end_entity_mapping;

entity_mapping Rule_rejection(Rule_rejection, rule_action);

mapping_constraints;
rule_action <=
action
{action
action.name = 'rule rejection'}

end_mapping_constraints;

attribute_mapping rejection_reason(rejection_reason, action.description);
rule_action <=
action
action.description

end_attribute_mapping;

end_entity_mapping;

entity_mapping Rule_request(Rule_request, rule_action);

mapping_constraints;
rule_action <=
action
{action
action.name = 'rule request'}

end_mapping_constraints;

end_entity_mapping;

entity_mapping Rule_set_armx(Rule_set_armx, rule_set);

mapping_constraints;
rule_set <=
rule_software_definition <=
product_definition

end_mapping_constraints;

attribute_mapping rule_member(rule_member, $PATH, Rule_priority);
rule_set <=
rule_software_definition <=					
product_definition
characterized_product_definition = product_definition 
characterized_definition = characterized_product_definition 
characterized_definition <-
property_definition.definition
property_definition <-
property_definition_representation.definition
property_definition_representation
{property_definition_representation
property_definition_representation.name = 'rule member'}
property_definition_representation.used_representation ->
representation
{representation
representation.name = 'rule priority'}

end_attribute_mapping;

attribute_mapping conflict_resolution_strategy(conflict_resolution_strategy, $PATH);
rule_set <=
rule_software_definition <=					
product_definition
characterized_product_definition = product_definition 
characterized_definition = characterized_product_definition 
characterized_definition <-
property_definition.definition
{property_definition.description = 'conflict resolution strategy'}
property_definition.name

end_attribute_mapping;

end_entity_mapping;

entity_mapping Rule_set_group_armx(Rule_set_group_armx, rule_set_group);

mapping_constraints;
rule_set_group <=
rule_software_definition <=				
product_definition

end_mapping_constraints;

attribute_mapping elements(elements, $PATH, Rule_set_armx);
rule_set_group <=
rule_software_definition <=					
product_definition <-
product_definition_relationship.relating_product_definition
{product_definition_relationship
product_definition_relationship.name = 'rule set group element'}
product_definition_relationship
product_definition_relationship.related_product_definition ->
product_definition =>
rule_software_definition =>
rule_set

end_attribute_mapping;

end_entity_mapping;

entity_mapping Rule_software_definition_armx(Rule_software_definition_armx, rule_software_definition);

mapping_constraints;
rule_software_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 = 'rule'}

end_mapping_constraints;

attribute_mapping defined_version(defined_version, $PATH, Rule_version);
rule_software_definition <=		
product_definition
product_definition.formation ->
product_definition_formation
{product_definition_formation.description = 'rule version'}

end_attribute_mapping;

end_entity_mapping;

entity_mapping Rule_submission(Rule_submission, rule_action);

mapping_constraints;
rule_action <=
action
{action
action.name = 'rule submission'}

end_mapping_constraints;

attribute_mapping submission_rationale(submission_rationale, action.description);
rule_action <=
action
action.description

end_attribute_mapping;

end_entity_mapping;

entity_mapping Rule_supersedence_armx(Rule_supersedence_armx, rule_supersedence);

mapping_constraints;
rule_supersedence <=
rule_action <=
action
{action <-
action_assignment.assigned_action
action_assignment =>
rule_superseded_assignment
rule_superseded_assignment.items[i] ->
rule_superseded_item
rule_superseded_item = product_definition_formation 
product_definition_formation
{product_definition_formation.description = 'rule version'}}
			
end_mapping_constraints;

attribute_mapping superseded_rule(superseded_rule, $PATH, Rule_version);

rule_supersedence <=
rule_action <=
action <-
action_assignment.assigned_action
action_assignment =>
rule_superseded_assignment
rule_superseded_assignment.items[i] ->
rule_superseded_item
rule_superseded_item = product_definition_formation 
product_definition_formation
{product_definition_formation.description = 'rule version'}
				
end_attribute_mapping;

end_entity_mapping;

entity_mapping Rule_version(Rule_version, product_definition_formation);

mapping_constraints;
{product_definition_formation
product_definition_formation.description = 'rule version'}

end_mapping_constraints;

attribute_mapping of_product(of_product, $PATH, Rule_product);
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 = 'rule'}

end_attribute_mapping;

end_entity_mapping;

entity_mapping Scalar_variable_armx(Scalar_variable_armx, scalar_variable);

mapping_constraints;
scalar_variable <=
					abstract_variable <=
					[property_definition]
					[property_definition_representation]
					[representation]
					[representation_item]
			
end_mapping_constraints;

end_entity_mapping;

entity_mapping Simple_clause_armx(Simple_clause_armx, simple_clause);

mapping_constraints;
simple_clause <=
					compound_representation_item
					{compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item}
					compound_representation_item <=
					representation_item
			
end_mapping_constraints;

attribute_mapping formulas(formulas, $PATH, Rule_condition_armx);
simple_clause <=
					compound_representation_item
					compound_representation_item.item_element ->
					compound_item_definition
					compound_item_definition = list_representation_item
					list_representation_item[i] ->
					representation_item =>
					compound_representation_item =>
					atomic_formula =>
					rule_condition
				
end_attribute_mapping;

end_entity_mapping;

entity_mapping Symbol_armx(Symbol_armx, symbol);

mapping_constraints;
symbol <=
				representation_item
			
end_mapping_constraints;

attribute_mapping name(name, $PATH);
symbol <=
				representation_item
				representation_item.name				
				
end_attribute_mapping;

end_entity_mapping;

(*end_schema_mapping;*)
