Index: ruby/trunk/lib/open_ehr/rm/common/archetyped.rb
===================================================================
--- ruby/trunk/lib/open_ehr/rm/common/archetyped.rb	(revision 369)
+++ ruby/trunk/lib/open_ehr/rm/common/archetyped.rb	(revision 370)
@@ -65,33 +65,24 @@
 
           def name=(name)
-            raise ArgumentError, 'name should not be empty' if name.nil? or name.value.empty?
+            if name.nil? or name.value.empty?
+              raise ArgumentError, 'name should not be empty'
+            end
             @name = name
           end
+
           def links=(links)
-            raise ArgumentError, "links shoud not be empty" if !links.nil? and links.empty?
+            if !links.nil? and links.empty?
+              raise ArgumentError, "links shoud not be empty"
+            end
             @links = links
           end
 
-          def item_at_path(path)
-            if !@path.nil?
-              if @path == ""
-                raise ArgumentError, "path is not valid"
-              end
+          def concept
+            if self.is_archetype_root?
+              return DvText.new(:value => 
+                                @archetype_details.archetype_id.concept_name)
+            else
+              raise ArgumentError, 'this is not root'
             end
-          end
-
-          def items_at_path(path)
-            raise NotImplementError, "items_at_path must be implemented"
-          end
-
-          def path_exists?
-            raise NotImplementError, "path_exists? must be implemented"
-          end
-
-          def path_unique
-            raise NotImplementError, "path_unique must be implemented"
-          end
-
-          def concept
           end
 
@@ -104,15 +95,20 @@
           attr_reader :archetype_id, :rm_version
           attr_accessor :template_id
-          def initialize(archetype_id, rm_version, template_id = nil)            
-            self.archetype_id = archetype_id
-            self.rm_version = rm_version
-            self.template_id = template_id
+
+          def initialize(args = { })
+            self.archetype_id = args[:archetype_id]
+            self.rm_version = args[:rm_version]
+            self.template_id = args[:template_id]
           end
+
           def archetype_id=(archetype_id)
             raise ArgumentError, "invalid archetype_id" if archetype_id.nil?
             @archetype_id = archetype_id
           end
+
           def rm_version=(rm_version)
-            raise ArgumentError, "invalid rm_version" if rm_version.nil? or rm_version.empty?
+            if rm_version.nil? or rm_version.empty?
+              raise ArgumentError, "invalid rm_version"
+            end
             @rm_version = rm_version
           end
@@ -121,8 +117,8 @@
         class Link
           attr_reader :meaning, :target, :type
-          def initialize(meaning, target, type)
-            self.meaning = meaning
-            self.target = target
-            self.type = type
+          def initialize(args = { })
+            self.meaning = args[:meaning]
+            self.target = args[:target]
+            self.type = args[:type]
           end
           def meaning=(meaning)
@@ -165,5 +161,5 @@
           attr_accessor :provider, :location, :time, :subject, :version_id
 
-          def initialize(args ={ })
+          def initialize(args = { })
             self.system_id = args[:system_id]
             self.provider = args[:provider]
@@ -175,5 +171,7 @@
 
           def system_id=(system_id)
-            raise ArgumentError, 'system_id invalid' if system_id.nil? or system_id.empty?
+            if system_id.nil? or system_id.empty?
+              raise ArgumentError, 'system_id invalid'
+            end
             @system_id = system_id
           end
Index: ruby/trunk/lib/open_ehr/rm/common/change_control.rb
===================================================================
--- ruby/trunk/lib/open_ehr/rm/common/change_control.rb	(revision 369)
+++ ruby/trunk/lib/open_ehr/rm/common/change_control.rb	(revision 370)
@@ -2,6 +2,6 @@
 # http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109326589721_134411_997Report.html
 # Ticket refs #64
-
-module OpenEhr
+include OpenEHR::RM::Common::Generic
+module OpenEHR
   module RM
     module Common
@@ -88,10 +88,16 @@
 
           def contribution=(contribution)
-            raise ArgumentError, "contribution should not be nil" if contribution.nil? or contribution.type.empty?
-            @contribution = contribution
+            if contribution.nil? or contribution.type.empty?
+              raise ArgumentError, "contribution is invalid"
+            end
+            if contribution.type == 'CONTRIBUTION'
+              @contribution = contribution
+            else
+              raise ArgumentError, 'contribution is invalid'
+            end
           end
 
           def owner_id
-            return HierObjectId.new(@uid.object_id.value)
+            return HierObjectID.new(:value => @uid.value)
           end
 
@@ -101,5 +107,5 @@
 
           def canonical_form
-            raise NotImplementedError, 'canonical form not implemented'
+            raise NotImplementedError, 'canonical form is not determined'
           end
         end
@@ -116,6 +122,5 @@
                   :contribution => args[:contribution],
                   :lifecycle_state => @item.lifecycle_state,
-                  :signature => args[:signature])
-                  
+                  :signature => args[:signature])                  
           end
 
@@ -150,6 +155,5 @@
 
           def is_merged?
-# Java implementation has is_merged attribute, Eiffel implementation does
-# nothing
+            return !other_input_version_uids.nil?
           end
         end
@@ -275,18 +279,22 @@
                                           :version_id => ver.uid)
             end
-            return RevisionHistory.new(revision_history_items)
+            return RevisionHistory.new(:items => revision_history_items)
           end
 
           def commit_original_version(args={ })
-            @all_versions << OriginalVersion.new(:uid => args[:uid],
-                                                  :preceding_version_uid => args[:preceding_version_uid],
-                                                  :contribution => args[:contribution],
-                                                  :commit_audit => args[:commit_audit],
-                                                  :lifecycle_state => args[:lifecycle_state],
-                                                  :data => args[:data],
-                                                  :attestations => args[:attestations],
-                                                  :signature => args[:signature])
-          end
-
+            if has_version_id?(args[:preceding_version_uid]) or self.version_count == 0
+              @all_versions << OriginalVersion.new(:uid => args[:uid],
+                                                   :preceding_version_uid => args[:preceding_version_uid],
+                                                   :contribution => args[:contribution],
+                                                   :commit_audit => args[:commit_audit],
+                                                   :lifecycle_state => args[:lifecycle_state],
+                                                   :data => args[:data],
+                                                   :attestations => args[:attestations],
+                                                   :signature => args[:signature])
+            else
+              raise ArgumentError, 'invalid preceding uid'
+            end
+          end
+            
           def commit_original_merged_version(args = { })
             @all_versions << OriginalVersion.new(:uid => args[:uid],
@@ -303,6 +311,6 @@
           def commit_imported_version(args = { })
             @all_versions << ImportedVersion.new(:item => args[:item],
-                                                  :contribution => args[:contribution],
-                                                  :commit_audit => args[:commit_audit])
+                                                 :contribution => args[:contribution],
+                                                 :commit_audit => args[:commit_audit])
           end
 
Index: ruby/trunk/lib/open_ehr/rm/common/generic.rb
===================================================================
--- ruby/trunk/lib/open_ehr/rm/common/generic.rb	(revision 369)
+++ ruby/trunk/lib/open_ehr/rm/common/generic.rb	(revision 370)
@@ -2,7 +2,7 @@
 # http://www.openehr.org/uml/release-1.0.1/Browsable/_9_5_1_76d0249_1140169202660_257304_813Report.html
 # Related to the ticket #62
-include OpenEhr::RM::Support::Identification
-include OpenEhr::RM::DataTypes::Basic
-module OpenEhr
+include OpenEHR::RM::Support::Identification
+include OpenEHR::RM::DataTypes::Basic
+module OpenEHR
   module RM
     module Common
@@ -34,9 +34,9 @@
           def time_committed=(time_committed)
             if time_committed.nil?
-              raise ArgumentError, 'time_commited is mandatory'
+              raise ArgumentError, 'time_committed is mandatory'
             end
             @time_committed = time_committed
           end
-
+             
           def change_type=(change_type)
             raise ArgumentError, 'change_type is mandatory' if change_type.nil?
@@ -48,6 +48,6 @@
           attr_reader :items
 
-          def initialize(items)
-            self.items = items
+          def initialize(args = { })
+            self.items = args[:items]
           end
 
@@ -103,4 +103,5 @@
         class PartyIdentified < PartyProxy
           attr_reader :name, :identifier
+
           def initialize(args = { })
             if args[:external_ref].nil? && args[:name].nil? &&
@@ -108,7 +109,7 @@
               raise ArgumentError, 'cannot identified'
             end
-            super(:external_ref => args[:external_ref])
             self.name = args[:name]
             self.identifier = args[:identifier]
+            super(args)
           end
 
@@ -125,8 +126,15 @@
               raise ArgumentError, 'cannot identified'
             end
-            unless identifier.nil? || !identifier.empty?
+            if !identifier.nil? && identifier.empty?
               raise ArgumentError, 'invaild identifier'
             end
             @identifier = identifier
+          end
+
+          def external_ref=(external_ref)
+            if @name.nil? && @identifier.nil? && external_ref.nil?
+              raise ArgumentError, 'invalid external_ref'
+            end
+            @external_ref = external_ref
           end
         end
@@ -176,5 +184,5 @@
         class Attestation < AuditDetails
           attr_reader :reason
-          attr_accessor :proof, :items
+          attr_accessor :proof, :attested_view, :is_pending, :items
 
           def initialize(args = { })
@@ -183,4 +191,6 @@
             self.proof = args[:proof]
             self.items = args[:items]
+            self.attested_view = args[:attested_view]
+            self.is_pending = args[:is_pending]
           end
 
@@ -188,4 +198,15 @@
             raise ArgumentError, 'reason is mandatory' if reason.nil?
             @reason = reason
+          end
+
+          def items=(items)
+            if !items.nil? && items.empty?
+              raise ArgumentError, 'items should not be empty'
+            end
+            @items = items
+          end
+          
+          def is_pending?
+            return is_pending
           end
         end
Index: ruby/trunk/lib/open_ehr/rm/common/resource.rb
===================================================================
--- ruby/trunk/lib/open_ehr/rm/common/resource.rb	(revision 369)
+++ ruby/trunk/lib/open_ehr/rm/common/resource.rb	(revision 370)
@@ -1,4 +1,4 @@
 require 'set'
-module OpenEhr
+module OpenEHR
   module RM
     module Common
@@ -29,10 +29,10 @@
           end
 
-          def current_version
-            @revision_history.most_recent_revision
+          def current_revision
+            @revision_history.most_recent_version
           end
 
           def languages_available
-            return Set.new(@translations.keys)
+            return Set.new(@translations.keys) << original_language.code_string
           end
 
