Index: ruby/trunk/lib/open_ehr/rm/data_types/basic.rb
===================================================================
--- ruby/trunk/lib/open_ehr/rm/data_types/basic.rb	(revision 295)
+++ ruby/trunk/lib/open_ehr/rm/data_types/basic.rb	(revision 297)
@@ -2,5 +2,5 @@
 # http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109067591791_562382_3151Report.html
 # Ticket refs #52
-module OpenEhr
+module OpenEHR
   module RM
     module DataTypes
@@ -10,11 +10,22 @@
 
         class DataValue
-          include OpenEhr::RM::Support::Definition::BasicDefinition
+          include OpenEHR::RM::Support::Definition::BasicDefinition
+          attr_accessor :value
+          alias :v :value
+
+          def initialize(args = {})
+            self.value = args[:value]
+          end
+
+          def ==(other)
+            return self.value == other.value
+          end
         end
 
         class DvBoolean < DataValue
-          def initialize(value)
-            self.value = value
+          def initialize(args)
+            super(args)
           end
+
           def value=(value)
             raise ArgumentError, "value must not be nil" if value.nil?
@@ -25,4 +36,5 @@
             end
           end
+
           def value?
             @value == true
@@ -31,17 +43,20 @@
 
         class DvState < DataValue
-          attr_reader :value
+          attr_reader :is_terminal
 
-          def initialize(value, is_terminal)
-            self.value=value
-            self.is_terminal=is_terminal
+          def initialize(args)            
+            super(args)
+            self.is_terminal = args[:is_terminal]
           end
+
           def value=(v)
             raise ArgumentError, "value should not be nil" if v.nil?
             @value = v
           end
+
           def is_terminal?
             @is_terminal
           end
+
           def is_terminal=(s)
             raise ArgumentError, "terminal should not be nil" if s.nil?
@@ -50,15 +65,39 @@
         end # end of DvState
 
-        class DvIdentifier
-          attr_accessor :issuer, :assigner, :id, :type
-          def initialize(assigner, id, issuer, type)
-            if assigner.nil? or assigner.empty?\
-              or id.nil? or id.empty? or issuer.nil? or issuer.empty?\
-              or type.nil? or type.empty?
-              raise ArgumentError, "invalid argument"
+        class DvIdentifier < DataValue
+          attr_reader :issuer, :assigner, :id, :type
+
+          def initialize(args = {})
+            self.issuer = args[:issuer]
+            self.assigner = args[:assigner]
+            self.id = args[:id]
+            self.type = args[:type]
+          end
+
+          def issuer=(issuer)
+            if issuer.nil? or issuer.empty?
+              raise ArgumentError, 'issuer is mandatory'
             end
             @issuer = issuer
+          end
+
+          def assigner=(assigner)
+            if assigner.nil? or assigner.empty?
+              raise ArgumentError, 'assigner is mandatory'
+            end
             @assigner = assigner
+          end
+
+          def id=(id)
+            if id.nil? or id.empty?
+              raise ArgumentError, 'id is manadtory'
+            end
             @id = id
+          end
+
+          def type=(type)
+            if type.nil? or type.empty?
+              raise ArgumentError, 'type is mandatory'
+            end
             @type = type
           end
Index: ruby/trunk/lib/open_ehr/rm/data_types/encapsulated.rb
===================================================================
--- ruby/trunk/lib/open_ehr/rm/data_types/encapsulated.rb	(revision 295)
+++ ruby/trunk/lib/open_ehr/rm/data_types/encapsulated.rb	(revision 297)
@@ -5,25 +5,23 @@
 require 'locale/info'
 
-module OpenEhr
+module OpenEHR
   module RM
     module DataTypes
       module Encapsulated
-        class DvEncapsulated  < OpenEhr::RM::DataTypes::Basic::DataValue
-          attr_reader :language, :charset, :size
-          def initialize(charset, language, size)
-            self.charset = charset
-            self.language = language
-            self.size = size
+        class DvEncapsulated  < OpenEHR::RM::DataTypes::Basic::DataValue
+          attr_reader :language, :charset
+
+          def initialize(args = {})
+            super(args)
+            self.charset = args[:charset]
+            self.language = args[:language]
           end
 
-          def size=(size)
-            if size < 0
-              raise ArgumentError, "negative size"
-            end
-            @size = size
+          def size
+            @value.size
           end
 
           def language=(language)
-            if language.nil? ||
+            if !language.nil? &&
                 !Locale::Info.language_code?(language.code_string)
               raise ArgumentError, 'invalid language code'
@@ -33,5 +31,5 @@
 
           def charset=(charset)
-            if charset.nil? || !charset_valid?(charset.code_string)
+            if !charset.nil? && !charset_valid?(charset.code_string)
               raise ArgumentError, 'invalid charset'
             end
@@ -40,11 +38,8 @@
 
           private
-          def size_positive
-            raise ArgumentError, "size must be positive" if size < 0
-          end
 
           def charset_valid?(charset)
             result = false
-            open('rm/data_types/charset.lst') do |file|
+            open('lib/open_ehr/rm/data_types/charset.lst') do |file|
               while line = file.gets
                 if charset == line.chomp
@@ -63,17 +58,16 @@
           attr_accessor :uri, :data, :compression_algorithm,
           :integrity_check, :integrity_check_algorithm, :alternate_text
-          def initialize(charset, language, size, media_type, uri=nil,
-                         data=nil, compression_algorithm=nil,
-                         integrity_check=nil, integrity_check_algorithm=nil,
-                         alternate_text=nil)
-            super(charset, language, size)
-            self.media_type = media_type
-            @uri = uri
-            @data = data
-            @compression_algorithm = compression_algorithm
-            @integrity_check = integrity_check
-            @integrity_check_algorithm = integrity_check_algorithm
-            @alternate_text = alternate_text
+
+          def initialize(args = {})
+            super(args)
+            self.media_type = args[:media_type]
+            self.uri = args[:uri]
+            self.data = args[:data]
+            self.compression_algorithm = args[:compression_algorithm]
+            self.integrity_check = args[:integrity_check]
+            self.integrity_check_algorithm = args[:integrity_check_algorithm]
+            self.alternate_text = args[:alternate_text]
           end
+
           def media_type=(media_type)
             if media_type.code_string.nil?
@@ -85,21 +79,14 @@
 
         class DvParsable < DvEncapsulated
-          attr_reader :value, :formalism
-          def initialize(charset, language, size, formalism, value)
-            super(charset, language, size)
-            self.formalism = formalism
-            self.value = value
-          end
+          attr_reader :formalism
 
-          def value=(value)
-            raise ArgumentError, 'value must not be nil' if value.nil?
-            @value = value
+          def initialize(args = {})
+            super(args)
+            self.formalism = args[:formalism]
           end
 
           def formalism=(formalism)
-            if formalism.nil?
-              raise ArgumentError, "formalism must not be nil"
-            elsif formalism.empty?
-              raise ArgumentError, "formalism must nto be empty"
+            if formalism.nil? || formalism.empty?
+              raise ArgumentError, 'formalism is mandatory'
             end
             @formalism = formalism
Index: ruby/trunk/lib/open_ehr/rm/data_types/quantity.rb
===================================================================
--- ruby/trunk/lib/open_ehr/rm/data_types/quantity.rb	(revision 295)
+++ ruby/trunk/lib/open_ehr/rm/data_types/quantity.rb	(revision 297)
@@ -3,5 +3,5 @@
 # Ticket refs #50
 require 'assumed_library_types'
-module OpenEhr
+module OpenEHR
   module RM
     module DataTypes
@@ -10,5 +10,5 @@
         autoload :Date_Time, "rm/data_types/quantity/date_time.rb"
 
-        class DvOrdered < OpenEhr::RM::DataTypes::Basic::DataValue
+        class DvOrdered < OpenEHR::RM::DataTypes::Basic::DataValue
           include Comparable
           attr_accessor :normal_range, :other_refference_ranges, :normal_status
@@ -51,5 +51,5 @@
         end
 
-        class DvInterval < OpenEhr::AssumedLibraryTypes::Interval
+        class DvInterval < OpenEHR::AssumedLibraryTypes::Interval
 
         end
Index: ruby/trunk/lib/open_ehr/rm/data_types/text.rb
===================================================================
--- ruby/trunk/lib/open_ehr/rm/data_types/text.rb	(revision 295)
+++ ruby/trunk/lib/open_ehr/rm/data_types/text.rb	(revision 297)
@@ -2,5 +2,5 @@
 # http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109067605961_209522_3179Report.html
 # Ticket refs #48
-module OpenEhr
+module OpenEHR
   module RM
     module DataTypes
@@ -62,5 +62,5 @@
         end # of CodePhrase
 
-        class DvText < OpenEhr::RM::DataTypes::Basic::DataValue
+        class DvText < OpenEHR::RM::DataTypes::Basic::DataValue
           attr_reader :value, :formatting, :hyperlink, :mappings
           attr_reader :language, :encoding
@@ -146,5 +146,5 @@
         end
 
-        class DvParagraph < OpenEhr::RM::DataTypes::Basic::DataValue
+        class DvParagraph < OpenEHR::RM::DataTypes::Basic::DataValue
           attr_reader :items
           def initialize(items)
Index: ruby/trunk/lib/open_ehr/rm/data_types/uri.rb
===================================================================
--- ruby/trunk/lib/open_ehr/rm/data_types/uri.rb	(revision 295)
+++ ruby/trunk/lib/open_ehr/rm/data_types/uri.rb	(revision 297)
@@ -4,52 +4,63 @@
 
 require 'uri'
-#require 'uri/generic'
-module Uri
-  class Ehr < ::URI::Generic
+
+module URI
+  class EHR < ::URI::Generic
     COMPONENT = [
       :scheme, :path, :fragment, :query
     ].freeze
+
     def self.build(args)
       tmp = Util::make_components_hash(self, args)
       super(tmp)
     end
+
     def initialize(*arg)
       super(*arg)
     end
+
     def self.use_registry
       true
     end
   end
-  @@schemes['EHR'] = Ehr
+  @@schemes['EHR'] = EHR
 end
 
-module OpenEhr
+module OpenEHR
   module RM
     module DataTypes
       module Uri
-        class DvUri < OpenEhr::RM::DataTypes::Basic::DataValue
-          def initialize(value)
-            self.value = value
+        class DvUri < OpenEHR::RM::DataTypes::Basic::DataValue
+          def initialize(args = {})
+            self.value = args[:value]
           end
+
+          def value
+            @value.to_s
+          end
+
           def fragment_id
             @value.fragment
           end
+
           def path
             @value.path
           end
+
           def query
             @value.query
           end
+
           def scheme
             @value.scheme
           end
+
           def value=(value)
             raise ArgumentError, "value is empty" if value.nil?
             parse(value)
           end
-          def value
-            @value.to_s
-          end
+
           private
+
           def parse(value)
             @value = ::URI.parse(value)
@@ -61,7 +72,8 @@
             super(value)
           end
+
           def value=(value)
             raise ArgumentError, "scheme must be ehr" if !(value =~ /^ehr/i)
-            parse(value)
+            @value = parse(value)
           end
         end # of DV_EHR_URI
