Index: /ruby/branches/0.5/lib/open_ehr/rm/support/identification.rb
===================================================================
--- /ruby/branches/0.5/lib/open_ehr/rm/support/identification.rb	(revision 272)
+++ /ruby/branches/0.5/lib/open_ehr/rm/support/identification.rb	(revision 273)
@@ -213,26 +213,23 @@
 
         class UIDBasedID < ObjectID
-          def initialize(value)
+          attr_reader :root, :extension
+
+          def initialize(args = {})
+            super(args)
+          end
+
+          def value=(value)
             super(value)
-          end
-
-          def extension
-            if self.has_extension?
-              @value[/::.*/][2..-1]
-            else
-              ''
+            if /(\S+)::(\S+)/ =~ value
+              @root = UID.new(:value => $1)
+              @extension = $2
+            else
+              @root = UID.new(:value => value)
+              @extension = ''
             end
           end
 
           def has_extension?
-            @value.include? '::'
-          end
-
-          def root
-            if self.has_extension?
-              @value[/.*::/][0..-3]
-            else
-              @value
-            end
+            return !@extension.empty?
           end
         end
Index: /ruby/branches/0.5/spec/lib/open_ehr/rm/support/identification/hier_object_id_spec.rb
===================================================================
--- /ruby/branches/0.5/spec/lib/open_ehr/rm/support/identification/hier_object_id_spec.rb	(revision 273)
+++ /ruby/branches/0.5/spec/lib/open_ehr/rm/support/identification/hier_object_id_spec.rb	(revision 273)
@@ -0,0 +1,12 @@
+require File.dirname(__FILE__) + '/../../../../../spec_helper'
+include OpenEHR::RM::Support::Identification
+
+describe HierObjectID do
+  before(:each) do
+    @hier_object_id = HierObjectID.new(:value => '2003045')
+  end
+
+  it 'should be an instance of HierObjectID' do
+    @hier_object_id.should be_an_instance_of HierObjectID
+  end
+end
Index: /ruby/branches/0.5/spec/lib/open_ehr/rm/support/identification/uid_based_id_spec.rb
===================================================================
--- /ruby/branches/0.5/spec/lib/open_ehr/rm/support/identification/uid_based_id_spec.rb	(revision 273)
+++ /ruby/branches/0.5/spec/lib/open_ehr/rm/support/identification/uid_based_id_spec.rb	(revision 273)
@@ -0,0 +1,50 @@
+require File.dirname(__FILE__) + '/../../../../../spec_helper'
+include OpenEHR::RM::Support::Identification
+
+describe UIDBasedID do
+  before(:each) do
+    @uid_based_id = UIDBasedID.new(:value => 'rrip::0.0.3')
+  end
+
+  it 'should be an instance of UIDBasedID' do
+    @uid_based_id.should be_an_instance_of UIDBasedID
+  end
+
+  it 'value should be rrip::0.0.3' do
+    @uid_based_id.value.should == 'rrip::0.0.3'
+  end
+
+  it 'root should be rrip' do
+    @uid_based_id.root.value.should == 'rrip'
+  end
+
+  it 'extention should be 0.0.3' do
+    @uid_based_id.extension.should == '0.0.3'
+  end
+
+  it 'should have extension' do
+    @uid_based_id.has_extension?.should be_true
+  end
+
+  describe 'when extension is empty' do
+    before(:each) do
+      @uid_based_id = UIDBasedID.new(:value => '10001')
+    end
+
+    it 'value should be 10001' do
+      @uid_based_id.value.should == '10001'
+    end
+
+    it 'has_extension? should not be true' do
+      @uid_based_id.has_extension?.should_not be_true
+    end
+
+    it 's extention should be empty' do
+      @uid_based_id.extension.should == ''
+    end
+
+    it 's root should be 10001' do
+      @uid_based_id.root.value.should == '10001'
+    end
+  end
+end
Index: /ruby/branches/0.5/spec/lib/open_ehr/rm/support/identification/uid_spec.rb
===================================================================
--- /ruby/branches/0.5/spec/lib/open_ehr/rm/support/identification/uid_spec.rb	(revision 272)
+++ /ruby/branches/0.5/spec/lib/open_ehr/rm/support/identification/uid_spec.rb	(revision 273)
@@ -4,5 +4,5 @@
 describe UID do
   before(:each) do
-    @uid = UID.new('1001')
+    @uid = UID.new(:value => '1001')
   end
 
