Index: /ruby/trunk/lib/models/rm.rb
===================================================================
--- /ruby/trunk/lib/models/rm.rb	(revision 89)
+++ /ruby/trunk/lib/models/rm.rb	(revision 90)
@@ -20,12 +20,6 @@
     module Support
       autoload :Definition, "rm/support/definition.rb"
-
-      module Identification
-        autoload :OBJECT_ID, "rm/support/identification.rb"
-      end
-
-      module Terminology
-        autoload :Terminology, "rm/support/terminology.rb"
-      end
+      autoload :Identification, "rm/support/identification.rb"
+      autoload :Terminology, "rm/support/terminology.rb"
     end
 
Index: /ruby/trunk/lib/models/rm/data_types/text.rb
===================================================================
--- /ruby/trunk/lib/models/rm/data_types/text.rb	(revision 89)
+++ /ruby/trunk/lib/models/rm/data_types/text.rb	(revision 90)
@@ -30,9 +30,9 @@
           end
           private
-          def match_valid(mach)
-            raise ArgumentError, "match is not valid" if self.is_valid_mach_code? match
+          def match_valid(match)
+            raise ArgumentError, "match is not valid" if !Term_Mapping.is_valid_mach_code? match
           end
           def purpose_valid(purpose)
-            if !purpose.nil? and !purpose.instance_of? DV_Coded_Text
+            if purpose.nil? or !purpose.instance_of? DV_Coded_Text
               raise ArgumentError, "purpose is not valid"
             end
Index: /ruby/trunk/lib/models/rm/support/identification.rb
===================================================================
--- /ruby/trunk/lib/models/rm/support/identification.rb	(revision 89)
+++ /ruby/trunk/lib/models/rm/support/identification.rb	(revision 90)
@@ -1,2 +1,5 @@
+# This module is an implementation of this UML:
+# http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109331021343_528780_2066Report.html
+# Ticket refs #39
 module OpenEHR
   module RM
@@ -4,28 +7,25 @@
       module Identification
 
-        class OBJECT_ID
-          attr_accessor :value
+        class Object_ID
+          attr_reader :value
 
-          def initiallize(value)
-            raise "empty value" unless value
-            @value = value
+          def initialize(value)
+            self.value=value
+          end
+
+          def value=(value)
+            raise "empty value" if value.nil? or value.empty?
+            @value = value            
           end
         end # of ObjectID
-
-        class ARCHETYPE_ID < OBJECT_ID
+        
+        class Archetype_ID < Object_ID
         end
 
-        class TERMINOLOGY_ID < OBJECT_ID
+        class Terminology_ID < Object_ID
           attr_reader :name
 
           def initialize(name , version_id)
             @name , @version_id = name , version_id
-#             if arg1 == nil
-#               super(arg0)
-#             else
-#               super(toValue(arg0, arg1))
-#               @name = arg0
-#               @version = arg1      
-#             end
           end
 
@@ -57,5 +57,5 @@
             name + (version == nil ? "" : "(" + version + ")")
           end
-        end # of TerminologyID
+        end # of Terminology_ID
       end # of Definition
     end # of Support
Index: /ruby/trunk/lib/models/rm/support/measurement.rb
===================================================================
--- /ruby/trunk/lib/models/rm/support/measurement.rb	(revision 90)
+++ /ruby/trunk/lib/models/rm/support/measurement.rb	(revision 90)
@@ -0,0 +1,17 @@
+module OpenEHR
+  module RM
+    module Support
+      module Measurement
+        class Measurement_Service
+        end
+        module External_Environment_Access
+          def eea_terminology_svc
+          end
+          
+          def eea_measurement_svc
+          end
+        end
+      end # of Measurment
+    end # of Support
+  end # of RM
+end # of OpenEHR
Index: by/trunk/lib/models/rm/support/support.rb
===================================================================
--- /ruby/trunk/lib/models/rm/support/support.rb	(revision 89)
+++ 	(revision )
@@ -1,17 +1,0 @@
-module OpenEHR
-  module RM
-    module Support
-      module Measurement
-        class Measurement_Service
-        end
-        module External_Environment_Access
-          def eea_terminology_svc
-          end
-          
-          def eea_measurement_svc
-          end
-        end
-      end # of Measurment
-    end # of Support
-  end # of RM
-end # of OpenEHR
Index: /ruby/trunk/lib/models/tests/test_reference_model.rb
===================================================================
--- /ruby/trunk/lib/models/tests/test_reference_model.rb	(revision 89)
+++ /ruby/trunk/lib/models/tests/test_reference_model.rb	(revision 90)
@@ -18,4 +18,6 @@
     @dv_coded_text = OpenEHR::RM::Data_Types::Text::DV_Coded_Text.new("valid value", "AT1000")
     @dv_paragraph = OpenEHR::RM::Data_Types::Text::DV_Paragraph.new(Set.new(["test1", "test2"]))
+    @term_mapping = OpenEHR::RM::Data_Types::Text::Term_Mapping.new('=',@dv_coded_text,"TEST")
+#    @code_phrase = OpenEHR::RM::Data_Types::Text::Code_Phrase.new
 #    @agent = OpenEHR::RM::Demogrphic::Agent.new
 #    @organisation = OpenEHR::RM::Demogrphic::Organisation.new
@@ -34,4 +36,5 @@
     assert_instance_of OpenEHR::RM::Data_Types::Text::DV_Text, @dv_text
     assert_instance_of OpenEHR::RM::Data_Types::Text::DV_Coded_Text, @dv_coded_text
+    assert_instance_of OpenEHR::RM::Data_Types::Text::Term_Mapping, @term_mapping
 #    assert_instance_of OpenEHR::RM::Demogrphic::Agent, @agent
 #    assert_instance_of OpenEHR::RM::Demogrphic::Organisation, @organisation
@@ -125,22 +128,32 @@
   end
 
-  def test_terminology_mapping
-    
+  def test_term_mapping
+    assert_equal '=', @term_mapping.match
+    assert OpenEHR::RM::Data_Types::Text::Term_Mapping.is_valid_mach_code?('>')
+    assert OpenEHR::RM::Data_Types::Text::Term_Mapping.is_valid_mach_code?('=')
+    assert OpenEHR::RM::Data_Types::Text::Term_Mapping.is_valid_mach_code?('<')
+    assert OpenEHR::RM::Data_Types::Text::Term_Mapping.is_valid_mach_code?('?')
+    assert !OpenEHR::RM::Data_Types::Text::Term_Mapping.is_valid_mach_code?('!')
+    assert_equal @dv_coded_text, @term_mapping.purpose
+    assert_equal "TEST", @term_mapping.target
+    assert_raise(ArgumentError){OpenEHR::RM::Data_Types::Text::Term_Mapping.new}
+    assert_raise(ArgumentError){OpenEHR::RM::Data_Types::Text::Term_Mapping.new('!',@dv_coded_text, "invalid case")}
+    assert_raise(ArgumentError){OpenEHR::RM::Data_Types::Text::Term_Mapping.new('=',nil , "invalid case")}
+    assert_raise(ArgumentError){OpenEHR::RM::Data_Types::Text::Term_Mapping.new('=',@dv_coded_text, nil)}
   end
 end
 
-
 class ReferenceModelSupportIdentificationTest < Test::Unit::TestCase
   def setup
-    @object_id = OpenEHR::RM::Support::Identification::OBJECT_ID.new
-    @terminology_id = OpenEHR::RM::Support::Identification::TERMINOLOGY_ID.new('terminology','version')
-    @archetype_id = OpenEHR::RM::Support::Identification::ARCHETYPE_ID.new
+    assert_nothing_raised(Exception){@object_id = OpenEHR::RM::Support::Identification::Object_ID.new("0.0.3")}
+    @terminology_id = OpenEHR::RM::Support::Identification::Terminology_ID.new('terminology','version')
+    @archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.3")
   end
   
   def test_init
-    assert_instance_of OpenEHR::RM::Support::Identification::OBJECT_ID, @object_id
-    assert_instance_of OpenEHR::RM::Support::Identification::TERMINOLOGY_ID, @terminology_id
-    assert_instance_of OpenEHR::RM::Support::Identification::ARCHETYPE_ID, @archetype_id
+    assert_instance_of OpenEHR::RM::Support::Identification::Object_ID, @object_id
+    assert_instance_of OpenEHR::RM::Support::Identification::Terminology_ID, @terminology_id
+    assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, @archetype_id
+  end
 
-  end
 end
