(*
 * $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 document_definition(Document_definition_arm, Document_definition_mim);*)

uof_mapping Document_Definition(Document_Definition);

entity_mapping Digital_document_definition(Digital_document_definition, product_definition);

mapping_constraints;
{product_definition
product_definition.frame_of_reference -> product_definition_context
<= application_context_element application_context_element.name =
'digital document definition'}
       		
end_mapping_constraints;

attribute_mapping files(files, $PATH, Digital_file);
product_definition =>
product_definition_with_associated_documents
product_definition_with_associated_documents.documentation_ids[i]
-> document {document <-
document_representation_type.represented_document
document_representation_type.name = 'digital'} document =>
document_file
	
end_attribute_mapping;

end_entity_mapping;

entity_mapping Document_definition(Document_definition, product_definition);

mapping_constraints;
{product_definition
     product_definition.frame_of_reference ->
     product_definition_context <=
     application_context_element 
     (application_context_element.name = 'digital document definition') 
     (application_context_element.name = 'physical document definition')
     (application_context_element.name = 'generic document definition')}
       		
end_mapping_constraints;

attribute_mapping associated_document_version(associated_document_version, $PATH, Document_version);
product_definition
(* This is totally redundant
{product_definition.frame_of_reference ->
product_definition_context <= application_context_element
(application_context_element.name = 'digital document definition')
(application_context_element.name = 'physical document definition')}
*)
product_definition.formation -> product_definition_formation
{product_definition_formation.of_product -> product <-
product_related_product_category.products
product_related_product_category <= product_category
product_category.name='document'}
	
end_attribute_mapping;

attribute_mapping description_x(description_x, product_definition.description);

end_attribute_mapping;

end_entity_mapping;

entity_mapping Physical_document_definition(Physical_document_definition, product_definition);

mapping_constraints;
{product_definition
product_definition.frame_of_reference -> product_definition_context
<= application_context_element application_context_element.name =
'physical document definition'}
       		
end_mapping_constraints;

attribute_mapping components(components, $PATH, Hardcopy);
product_definition =>
product_definition_with_associated_documents
product_definition_with_associated_documents.documentation_ids[i]
-> document {document <-
document_representation_type.represented_document
document_representation_type.name = 'physical'} document =>
document_file
	
end_attribute_mapping;

end_entity_mapping;
end_uof_mapping;


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

end_entity_mapping;

entity_mapping External_source_identification(External_source_identification, applied_external_identification_assignment)
extended;

attribute_mapping item(item, $PATH, Document_definition);

external_identification_item *> document_location_select
document_location_select = product_definition
end_attribute_mapping;

end_entity_mapping;
(*end_schema_mapping;*)
