Index: ruby/branches/0.5/lib/open_ehr/rm/support/identification.rb
===================================================================
--- ruby/branches/0.5/lib/open_ehr/rm/support/identification.rb	(revision 261)
+++ ruby/branches/0.5/lib/open_ehr/rm/support/identification.rb	(revision 262)
@@ -49,19 +49,59 @@
 
         class ArchetypeID < ObjectID
-          attr_reader :domain_concept, :rm_name, :rm_entity, :rm_originator, :specialisation, :version_id
-
-          def initialize(value, domain_concept, rm_name, rm_entity, rm_originator, specialisation, version_id)
-            super(value)
-            self.domain_concept = domain_concept
-            self.rm_name = rm_name
-            self.rm_entity = rm_entity
-            self.rm_originator = rm_originator
-            self.specialisation = specialisation
-            self.version_id = version_id
+          attr_reader :rm_originator, :rm_name, :rm_entity,
+                      :concept_name, :specialisation, :version_id
+          
+          def initialize(args = {})
+            super(args)
+            if args[:value].nil?
+              self.rm_originator = args[:rm_originator]
+              self.rm_name = args[:rm_name]
+              self.rm_entity = args[:rm_entity]
+              self.concept_name = args[:concept_name]
+              self.version_id = args[:version_id]
+              self.specialisation = args[:specialisation]
+            else
+              self.value = args[:value]
+            end
+          end
+
+          def value=(value)
+            if /([a-zA-Z]\w+)-([a-zA-Z]\w+)-([a-zA-Z]\w+)\.([a-zA-Z]\w+)(-([a-zA-Z]\w+))?\.(v[1-9]\d*)/ =~ value
+              self.rm_originator = $1
+              self.rm_name = $2
+              self.rm_entity = $3
+              self.concept_name = $4
+              self.specialisation = $6
+              self.version_id = $7
+            else
+              raise ArgumentError, 'invalid archetype id form'
+            end
+          end
+
+          def qualified_rm_entity
+            return @rm_originator + '-' + @rm_name + '-' + @rm_entity
+          end
+
+          def domain_concept
+            return @concept_name + '-' + @specialisation
+          end
+
+          def concept_name=(concept_name)
+            if concept_name.nil? or concept_name.empty?
+              raise ArgumentError, 'concept_name is mandatory'
+            end
+            @concept_name = concept_name
           end
 
           def domain_concept=(domain_concept)
-            raise ArgumentError, "domain concept not valid" if domain_concept.nil? or domain_concept.empty?
-            @domain_concept = domain_concept
+            if domain_concept.nil? or domain_concept.empty?
+              raise ArgumentError, "domain concept not valid"
+            end
+            if /([a-zA-Z]\w+)(-([a-zA-Z]\w))?/ =~ domain_concept
+              self.concept_name = $1
+              self.specialisation = $3
+            else
+              raise ArgumentError, 'invalid domain concept form'
+            end
           end
 
@@ -72,15 +112,21 @@
 
           def rm_entity=(rm_entity)
-            raise ArgumentError, "rm_entity not valid" if rm_entity.nil? or rm_entity.empty?
+            if rm_entity.nil? or rm_entity.empty?
+              raise ArgumentError, "rm_entity is mandatory"
+            end
             @rm_entity = rm_entity
           end
 
           def rm_originator=(rm_originator)
-            raise ArgumentError, "rm_originator not valid" if rm_originator.nil? or rm_originator.empty?
+            if rm_originator.nil? or rm_originator.empty?
+              raise ArgumentError, "rm_originator not valid"
+            end
             @rm_originator = rm_originator
           end
 
           def specialisation=(specialisation)
-            raise ArgumentError, "rm_specialisation not valid" if specialisation.nil? or specialisation.empty?
+            if !specialisation.nil? and specialisation.empty?
+              raise ArgumentError, "rm_specialisation not valid" 
+            end
             @specialisation = specialisation
           end
Index: ruby/branches/0.5/spec/lib/open_ehr/rm/support/identification/archetype_id_spec.rb
===================================================================
--- ruby/branches/0.5/spec/lib/open_ehr/rm/support/identification/archetype_id_spec.rb	(revision 262)
+++ ruby/branches/0.5/spec/lib/open_ehr/rm/support/identification/archetype_id_spec.rb	(revision 262)
@@ -0,0 +1,44 @@
+require File.dirname(__FILE__) + '/../../../../../spec_helper'
+include OpenEHR::RM::Support::Identification
+
+describe ArchetypeID do
+  before(:each) do
+    @archetype_id = ArchetypeID.new(:value => 'openEHR-EHR-SECTION.physical_examination-prenatal.v2')
+  end
+
+  it 'should be an instance of ArchetypeID' do
+    @archetype_id.should be_an_instance_of ArchetypeID
+  end
+
+  it 's qualified_rm_entity should be openEHR-EHR-SECTION' do
+    @archetype_id.qualified_rm_entity.should == 'openEHR-EHR-SECTION'
+  end
+
+  it 's rm_originator should be openEHR' do
+    @archetype_id.rm_originator.should == 'openEHR'
+  end
+
+  it 's rm_name should be EHR' do
+    @archetype_id.rm_name.should == 'EHR'
+  end
+
+  it 'rm_entity should be SECTION' do
+    @archetype_id.rm_entity.should == 'SECTION'
+  end
+
+  it 's domain_concept should be physical_examination-prenatal' do
+    @archetype_id.domain_concept.should == 'physical_examination-prenatal'
+  end
+
+  it 's concept name should be physical_examination' do
+    @archetype_id.concept_name.should == 'physical_examination'
+  end
+
+  it 's specialisation should be prenatal' do
+    @archetype_id.specialisation.should == 'prenatal'
+  end
+
+  it 's version_id should == v2' do
+    @archetype_id.version_id.should == 'v2'
+  end
+end
Index: ruby/branches/0.5/spec/lib/open_ehr/rm/support/identification/object_id_spec.rb
===================================================================
--- ruby/branches/0.5/spec/lib/open_ehr/rm/support/identification/object_id_spec.rb	(revision 261)
+++ ruby/branches/0.5/spec/lib/open_ehr/rm/support/identification/object_id_spec.rb	(revision 262)
@@ -1,3 +1,3 @@
-require File.dirname(__FILE__) + '/../../../../spec_helper'
+require File.dirname(__FILE__) + '/../../../../../spec_helper'
 include OpenEHR::RM::Support::Identification
 
