(*
 * $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 resource_item(Resource_item_arm, Resource_item_mim);*)

uof_mapping Resource_item(Resource_item);

entity_mapping Resource_item(Resource_item, action_resource);

mapping_constraints;
action_resource
	{action_resource.kind ->
	action_resource_type
	action_resource_type.name = 'resource item'}
    
end_mapping_constraints;

attribute_mapping name(name, action_resource.name);

end_attribute_mapping;

attribute_mapping description(description, action_resource.description);

end_attribute_mapping;

attribute_mapping resource_items(resource_items, $PATH, resource_item_select);
action_resource.usage[i] ->
      	supported_item 
	supported_item = action_method
	action_method
	[{action_method.name = 'resource management'}
	 {action_method.consequence = 'resource item'}
	 {action_method.purpose = 'standard action method'}]
	action_method <- action_method_assignment.assigned_action_method
	action_method_assignment
	{action_method_assignment.role -> action_method_role
	action_method_role
	action_method_role.name = 'resource item'}
	action_method_assignment => applied_action_method_assignment
	applied_action_method_assignment
	applied_action_method_assignment.items[i] -> action_method_items
      
end_attribute_mapping;

end_entity_mapping;

entity_mapping Resource_item_assignment(Resource_item_assignment, action_method);

mapping_constraints;
[{action_method.name = 'resource management'}
	 {action_method.consequence = 'resource item assignment'}
	 {action_method.purpose = 'standard action method'}]
    
end_mapping_constraints;

attribute_mapping assigned_resource(assigned_resource, $PATH, Resource_item);
action_method
	supported_item = action_method
	supported_item
	supported_item <- action_resource.usage[i]
	action_resource
      
end_attribute_mapping;

attribute_mapping item(item, $PATH, resource_assignment_item);
	action_method <- action_method_assignment.assigned_action_method
	action_method_assignment
	{action_method_assignment.role -> action_method_role
	action_method_role
	action_method_role.name = 'resource item assignment'}
	action_method_assignment => applied_action_method_assignment
	applied_action_method_assignment
	applied_action_method_assignment.items[i] -> action_method_items
      
end_attribute_mapping;

end_entity_mapping;

entity_mapping Resource_item_relationship(Resource_item_relationship, action_resource_relationship);

mapping_constraints;
{action_resource_relationship.name = 'resource item relationship'}
    
end_mapping_constraints;

attribute_mapping name(name, action_resource_relationship.name);

end_attribute_mapping;

attribute_mapping description(description, action_resource_relationship.description);

end_attribute_mapping;

attribute_mapping relating(relating, action_resource_relationship.relating_resource, Resource_item);

end_attribute_mapping;

attribute_mapping related(related, action_resource_relationship.related_resource, Resource_item);

end_attribute_mapping;

end_entity_mapping;
end_uof_mapping;

(* AIM entity is taken instead
entity_mapping Classification_assignment(Classification_assignment, applied_classification_assignment)
extended;

attribute_mapping items(items, , Resource_item);

         classification_item
         classification_item *> resource_item_classification_item
	 resource_item_classification_item
	 resource_item_classification_item = action_resource
       
end_attribute_mapping;

attribute_mapping items(items, , Resource_item_assignment);

         classification_item
         classification_item *> resource_item_classification_item
	 resource_item_classification_item
	 resource_item_classification_item = action_method
       
end_attribute_mapping;

attribute_mapping items(items, , Resource_item_relationship);

         classification_item
         classification_item *> resource_item_classification_item
	 resource_item_classification_item
	 resource_item_classification_item = action_resource_relationship
       
end_attribute_mapping;

end_entity_mapping;
*)
entity_mapping Resource_group_relationship(Resource_group_relationship, action_resource_relationship);

mapping_constraints;

      action_resource_relationship
      {action_resource_relationship.name = 'resource group relationship'}
    
end_mapping_constraints;

attribute_mapping quantity(quantity, $PATH, measure_with_unit);
action_resource_relationship
	characterized_resource_definition = action_resource_relationship
	characterized_resource_definition
	characterized_resource_definition <-
	resource_property.resource
	resource_property
	{resource_property.name = 'quantity'}
	resource_property <-
	resource_property_representation.property 
	resource_property_representation
	{resource_property_representation.name = 'quantity'}
	resource_property_representation.representation ->
	representation
	[{representation.context_of_items ->
	representation_context
	representation_context.context_identifier = ''}
	{representation.context_of_items ->
	representation_context
	representation_context.context_type = 'resource group relationship'}]
	representation.items[i] ->
	representation_item
	representation_item =>
	value_representation_item
	value_representation_item.value_component ->
	measure_value 
	measure_value <-
	measure_with_unit.value_component
  measure_with_unit    
end_attribute_mapping;

end_entity_mapping;
(*end_schema_mapping;*)
