(*
 * $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 file_identification(File_identification_arm, File_identification_mim);*)

uof_mapping File_Identification(File_Identification);

entity_mapping Digital_file(Digital_file, document_file);

mapping_constraints;
 document_file <=
 [document
 {document <- document_representation_type.represented_document
 document_representation_type.name = 'digital'}]
 [characterized_object] 
end_mapping_constraints;

end_entity_mapping;

entity_mapping File(File, document_file);

mapping_constraints;
document_file <=
[document
{document <- document_representation_type.represented_document
(document_representation_type.name = 'digital')
(document_representation_type.name = 'physical')}]
[characterized_object
{characterized_object.name=''}] 
end_mapping_constraints;

attribute_mapping id(id,  document.id);
document_file <= document
				 document.id
end_attribute_mapping;

attribute_mapping version(version, identification_assignment.assigned_id);
document_file
identification_item = document_file
identification_item <-
applied_identification_assignment.items[i] 
applied_identification_assignment <=
identification_assignment  
{identification_assignment.role ->
identification_role
identification_role.name = 'version'}
identification_assignment.assigned_id 
end_attribute_mapping;

attribute_mapping contained_data_type(contained_data_type,  document_type.product_data_type);
document_file <= document
document.kind -> document_type
document_type.product_data_type

end_attribute_mapping;

end_entity_mapping;

entity_mapping Hardcopy(Hardcopy, document_file);

mapping_constraints;
document_file <=
[document
{document <- document_representation_type.represented_document
document_representation_type.name = 'physical'}]
[characterized_object] 
end_mapping_constraints;

end_entity_mapping;

entity_mapping File_location_identification(File_location_identification, /SUPERTYPE(External_source_identification)/);

end_entity_mapping;
end_uof_mapping;


entity_mapping External_source_identification(External_source_identification, applied_external_identification_assignment)
extended;

attribute_mapping item(item, $PATH, File);
 
external_identification_item *> file_location_select
file_location_select = document_file
end_attribute_mapping;

end_entity_mapping;
(*end_schema_mapping;*)
