(*
 * $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_management(Resource_management_arm, Resource_management_mim);*)

uof_mapping Resource_management(Resource_management);

entity_mapping Managed_resource(Managed_resource, action_resource);

mapping_constraints;
action_resource
	[{action_resource.usage[1] ->
        supported_item
	supported_item = action_method
	action_method
	action_method.name = 'resource management'}
	{action_resource.kind ->
	action_resource_type
	action_resource_type.name = 'managed resource'}]
     
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 quantity(quantity, $PATH, measure_with_unit);
action_resource
	[{action_resource.usage[1] ->
        supported_item
	supported_item = action_method
	action_method
	action_method.name = 'resource management'}
	{action_resource.kind ->
	action_resource_type
	action_resource_type.name = 'managed resource'}] 
        action_resource
	characterized_resource_definition = action_resource
	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 = 'managed resource'}]
	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;

attribute_mapping item(item, $PATH, Resource_item);
action_resource <-
	action_resource_relationship.relating_resource
	action_resource_relationship
	{action_resource_relationship.name = 'managed resource'}
	action_resource_relationship.related_resource ->
	action_resource
      
end_attribute_mapping;

end_entity_mapping;

entity_mapping Resource_event(Resource_event, action);

mapping_constraints;
action 
	{action.chosen_method -> 
	action_method
	action_method.name = 'resource event'}
    
end_mapping_constraints;

attribute_mapping name(name, action.name);

end_attribute_mapping;

attribute_mapping description(description, action.description);

end_attribute_mapping;

attribute_mapping quantity(quantity, $PATH, measure_with_unit);
action
	characterized_action_definition = action
	characterized_action_definition
	characterized_action_definition <-
	action_property.definition
	action_property
	{action_property.name = 'quantity'}
	action_property <-
	action_property_representation.property 
	action_property_representation
	{action_property_representation.name = 'quantity'}
	action_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 event'}
	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;

attribute_mapping resource(resource, $PATH, Managed_resource);
action
	  supported_item = action
	  supported_item <-
	  action_resource.usage[1]
	  action_resource
	
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, , Managed_resource);

         classification_item
         classification_item *> resource_management_classification_item
	 resource_management_classification_item
	 resource_management_classification_item = action_resource
       
end_attribute_mapping;

attribute_mapping items(items, , Managed_resource_relationship);

         classification_item
         classification_item *> resource_management_classification_item
	 resource_management_classification_item
	 resource_management_classification_item = action_resource_relationship
       
end_attribute_mapping;

attribute_mapping items(items, , Resource_event);

         classification_item
         classification_item *> resource_management_classification_item
	 resource_management_classification_item
	 resource_management_classification_item = action
       
end_attribute_mapping;

attribute_mapping items(items, , Resource_event_correspondence_relationship);

         classification_item
         classification_item *> resource_management_classification_item
	 resource_management_classification_item
	 resource_management_classification_item = action_property
       
end_attribute_mapping;

attribute_mapping items(items, , Resource_event_relationship);

         classification_item
         classification_item *> resource_management_classification_item
	 resource_management_classification_item
	 resource_management_classification_item = action_relationship
       
end_attribute_mapping;

end_entity_mapping;
*)
entity_mapping Location_assignment_armx(Location_assignment_armx, applied_location_assignment)
extended;

attribute_mapping entity_for_location(entity_for_location, , Managed_resource);

          location_item *> resource_management_location_item
	  resource_management_location_item = action_resource	 	 
       
end_attribute_mapping;

end_entity_mapping;

entity_mapping Decreasing_resource_event(Decreasing_resource_event, action);

mapping_constraints;
action 
	{action.chosen_method -> 
	action_method
	action_method.name = 'decreasing resource event'}
    
end_mapping_constraints;

end_entity_mapping;

entity_mapping Increasing_resource_event(Increasing_resource_event, action);

mapping_constraints;
action 
	{action.chosen_method -> 
	action_method
	action_method.name = 'increasing resource event'}
    
end_mapping_constraints;

end_entity_mapping;

entity_mapping Managed_resource_relationship(Managed_resource_relationship, action_resource_relationship);

mapping_constraints;
{action_resource_relationship.name = 'managed resource 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, Managed_resource);

end_attribute_mapping;

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

end_attribute_mapping;

end_entity_mapping;

entity_mapping Resource_event_correspondence_relationship(Resource_event_correspondence_relationship, action_property);

mapping_constraints;
{action_property.name = 'resource event correspondence relationship'}
end_mapping_constraints;

attribute_mapping name(name, action_property.name);

end_attribute_mapping;

attribute_mapping description(description, action_property.description);

end_attribute_mapping;

attribute_mapping relating(relating, $PATH, Resource_event);
action_property.definition ->
	   characterized_action_definition
	   characterized_action_definition = 
	   action
	
end_attribute_mapping;

attribute_mapping related(related, ($PATH)($PATH), Required_resource);
(action_property.definition ->
	        characterized_action_definition
	        characterized_action_definition = action
	      	action
	        characterized_action_definition = action
		characterized_action_definition <-
		action_resource_requirement.operations[i]
		action_resource_requirement
		{action_resource_requirement =>
		requirement_for_action_resource}
	    )(action_property.definition ->
	        characterized_action_definition
	        characterized_action_definition = action
	      	action
	        characterized_action_definition = action
		characterized_action_definition <-
		action_resource_requirement.operations[i]
		action_resource_requirement
	    )
end_attribute_mapping;

end_entity_mapping;

entity_mapping Resource_event_relationship(Resource_event_relationship, action_relationship);

mapping_constraints;
{action_relationship.name = 'resource event relationship'}
end_mapping_constraints;

attribute_mapping name(name, action_relationship.name);

end_attribute_mapping;

attribute_mapping description(description, action_relationship.description);

end_attribute_mapping;

attribute_mapping relating(relating, action_relationship.relating_action, Resource_event);

end_attribute_mapping;

attribute_mapping related(related, action_relationship.related_action, Resource_event);

end_attribute_mapping;

end_entity_mapping;
(*end_schema_mapping;*)
