(*
 * $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 person_organization(Person_organization_arm, Person_organization_mim);*)

uof_mapping Person_Organization(Person_Organization);

entity_mapping Organization_relationship__hierarchy(Organization_relationship__hierarchy, organization_relationship);

mapping_constraints;

			organization_relationship
			{organization_relationship.name = 'hierarchy'} 
		
end_mapping_constraints;

end_entity_mapping;

entity_mapping Organization_relationship__legal_succession(Organization_relationship__legal_succession, organization_relationship);

mapping_constraints;

			organization_relationship
			{organization_relationship.name = 'legal succession'} 
		
end_mapping_constraints;

end_entity_mapping;

entity_mapping Organization_relationship__reorganization(Organization_relationship__reorganization, organization_relationship);

mapping_constraints;

			organization_relationship
			{organization_relationship.name = 'reorganization'} 
		
end_mapping_constraints;

end_entity_mapping;

(* Everyting below is taken from AIM
entity_mapping Address(Address, address);

attribute_mapping street_number(street_number, address.street_number);

end_attribute_mapping;

attribute_mapping street(street, address.street);

end_attribute_mapping;

attribute_mapping postal_box(postal_box, address.postal_box);

end_attribute_mapping;

attribute_mapping town(town, address.town);

end_attribute_mapping;

attribute_mapping region(region, address.region);

end_attribute_mapping;

attribute_mapping postal_code(postal_code, address.postal_code);

end_attribute_mapping;

attribute_mapping country(country, address.country);

end_attribute_mapping;

attribute_mapping internal_location(internal_location, address.internal_location);

end_attribute_mapping;

attribute_mapping facsimile_number(facsimile_number, address.facsimile_number);

end_attribute_mapping;

attribute_mapping telephone_number(telephone_number, address.telephone_number);

end_attribute_mapping;

attribute_mapping electronic_mail_address(electronic_mail_address, address.electronic_mail_address);

end_attribute_mapping;

attribute_mapping telex_number(telex_number, address.telex_number);

end_attribute_mapping;

attribute_mapping url(url, id_attribute.attribute_value);

			address = id_attribute_select
			id_attribute_select <- id_attribute.identified_item
			id_attribute.attribute_value
			
end_attribute_mapping;

attribute_mapping name(name, name_attribute.attribute_value);

			address = name_attribute_select
			name_attribute_select <- name_attribute.named_item
			name_attribute.attribute_value
			
end_attribute_mapping;

end_entity_mapping;

entity_mapping Address_assignment(Address_assignment, (
			(person_and_organization_address)
			)(
			(organizational_address)
			));

mapping_constraints;

			(person_and_organization_address <=
					 [personal_address]
			     [organizational_address])
			
end_mapping_constraints;

attribute_mapping assigned_address(assigned_address, ($IDENTICAL_MAPPING)($IDENTICAL_MAPPING), Address);
(
          (person_and_organization_address <= 					 [personal_address <= address]
         [organizational_address <= address])
				)(
					(organizational_address <= address)
				)
end_attribute_mapping;

attribute_mapping address_type(address_type, (
				organizational_address.description
				)(
				organizational_address.description
				));

				(person_and_organization_address <= organizational_address
					   organizational_address.description)
        
end_attribute_mapping;

attribute_mapping located_person_organizations(located_person_organizations, $PATH, person_and_organization);

        person_and_organization_address <= personal_address
        personal_address.people[i] -> person
				person <- person_and_organization.the_person
				{person_and_organization.the_organization -> organization  
        organization <- organizational_address.organizations[i]
				organizational_address => person_and_organization_address}
			  
end_attribute_mapping;

attribute_mapping located_person_organizations(located_person_organizations, $PATH, Organization);

				organizational_address.organizations[i] -> organization
				
end_attribute_mapping;

end_entity_mapping;

entity_mapping Organization(Organization, organization);

attribute_mapping id(id, organization.id);

end_attribute_mapping;

attribute_mapping name(name, organization.name);

end_attribute_mapping;

end_entity_mapping;

entity_mapping Organization_relationship(Organization_relationship, organization_relationship);

attribute_mapping relation_type(relation_type, organization_relationship.name);

end_attribute_mapping;

attribute_mapping description(description, organization_relationship.description);

end_attribute_mapping;

attribute_mapping relating_organization(relating_organization, $PATH, Organization);

			organization_relationship.relating_organization -> organization
			
end_attribute_mapping;

attribute_mapping related_organization(related_organization, $PATH, Organization);

			organization_relationship.related_organization -> organization
			
end_attribute_mapping;

end_entity_mapping;

entity_mapping Person(Person, person);

attribute_mapping last_name(last_name, person.last_name);

end_attribute_mapping;

attribute_mapping first_name(first_name, person.first_name);

end_attribute_mapping;

attribute_mapping middle_names(middle_names, person.middle_names);

end_attribute_mapping;

attribute_mapping prefix_titles(prefix_titles, person.prefix_titles);

end_attribute_mapping;

attribute_mapping suffix_titles(suffix_titles, person.suffix_titles);

end_attribute_mapping;

end_entity_mapping;

entity_mapping Person_in_organization(Person_in_organization, person_and_organization);

attribute_mapping concerned_person(concerned_person, $PATH, Person);

				  person_and_organization.the_person -> person
        
end_attribute_mapping;

attribute_mapping containing_organization(containing_organization, $PATH, Organization);

				  person_and_organization.the_organization -> organization
        
end_attribute_mapping;

attribute_mapping role(role, name_attribute.attribute_value);

				person_and_organization = name_attribute_select
				name_attribute_select <- name_attribute.named_item
				name_attribute.attribute_value
				
end_attribute_mapping;

end_entity_mapping; *)
end_uof_mapping;

(*end_schema_mapping;*)
