Index: ruby/trunk/config/environment.rb
===================================================================
--- ruby/trunk/config/environment.rb	(revision 296)
+++ ruby/trunk/config/environment.rb	(revision 297)
@@ -6,5 +6,5 @@
 
 # Specifies gem version of Rails to use when vendor/rails is not present
-RAILS_GEM_VERSION = '2.1.0' unless defined? RAILS_GEM_VERSION
+#RAILS_GEM_VERSION = '2.1.0' unless defined? RAILS_GEM_VERSION
 
 # Bootstrap the Rails environment, frameworks, and default configuration
Index: ruby/trunk/lib/open_ehr/assumed_library_types.rb
===================================================================
--- ruby/trunk/lib/open_ehr/assumed_library_types.rb	(revision 296)
+++ ruby/trunk/lib/open_ehr/assumed_library_types.rb	(revision 297)
@@ -3,5 +3,5 @@
 require 'time'
 
-module OpenEhr
+module OpenEHR
   module AssumedLibraryTypes
     class Any < Object
@@ -12,9 +12,8 @@
       attr_reader :lower, :upper
       
-      def initialize(lower, upper, 
-                     lower_included = nil, upper_included = nil)
-        check_lower_upper(lower, upper)
-        self.lower_included = lower_included
-        self.upper_included = upper_included
+      def initialize(args = {})
+        check_lower_upper(args[:lower], args[:upper])
+        self.lower_included = args[:lower_included]
+        self.upper_included = args[:upper_included]
       end
 
@@ -47,5 +46,5 @@
 
       def upper_included=(upper_included)
-        if (upper == nil) && (upper_included != nil)
+        if (@upper.nil?) && (upper_included != nil)
           raise ArgumentError, "upper is not set"
         end
@@ -58,7 +57,6 @@
 
       def has?(value)
-        if ((@lower < value) && (value < @upper) ||
-            (@lower_included == true) && (@lower == value) ||
-            (@upper_included == true) && (@upper == value))
+        if ((@lower.nil?||@lower < value||((@lower_included == true) && (@lower == value)))&&
+            (@upper.nil?||value < @upper||((@upper_included == true) && (@upper == value))))
           true
         else
@@ -70,5 +68,5 @@
 
       def check_lower_upper(lower, upper)
-        if (lower == nil) && (upper == nil)
+        if lower.nil? && upper.nil?
           raise ArgumentError, "Either lower or upper must be assigned"
         end
@@ -83,5 +81,5 @@
     end # end of Interval
   
-    class TIME_DEFINITIONS < Any
+    class TimeDefinitions < Any
       DAYS_IN_LEAP_YEAR = 366
       DAYS_IN_WEEK = 7
@@ -97,12 +95,21 @@
 
       def self.valid_year?(year)
-        year >= 0
+        return !year.nil? && year >= 0
       end
 
       def self.valid_day?(y, m, d)
-        Date.valid_date?(y,m,d) and valid_year? y
+        unless y.nil? || m.nil? || d.nil?
+          return Date.valid_date?(y,m,d)
+        end
+        if (y.nil?) || (m.nil? && !d.nil?)
+          return false
+        end
+        return self.valid_year?(y) && self.valid_month?(m)
       end
 
       def self.valid_hour?(h,m = nil, s = nil)
+        if h.nil?
+          return false
+        end
         if !m.nil? and !valid_minute?(m)
           return false
@@ -113,28 +120,36 @@
         (h >= 0 and h < HOURS_IN_DAY) or (h == HOURS_IN_DAY and m == 0 and s == 0)
       end
+
       def self.valid_minute?(mi)
         mi >= 0 and mi < MINUTES_IN_HOUR
       end
+
       def self.valid_second?(s)
         s >= 0 and s < SECONDS_IN_MINUTE
       end
+
       def self.valid_month?(mo)
         mo >= 1 and mo <= MONTH_IN_YEAR
       end
-    end # end of TIME_DEFINITIONS
-
-    module ISO8601_DATE_MODULE
+    end # end of TimeDefinitions
+
+    module ISO8601DateModule
       attr_reader :year, :month, :day
+
       def year=(year)
-        raise ArgumentError, "Year is not valid" unless ISO8601_DATE.valid_year?(year)
+        unless ISO8601Date.valid_year?(year)
+          raise ArgumentError, "Year is not valid"
+        end
         @year = year
       end
+
       def month=(month)
-        raise ArgumentError, "Month is not valid" unless month.nil? or ISO8601_DATE.valid_month?(month)
+        raise ArgumentError, "Month is not valid" unless month.nil? or ISO8601Date.valid_month?(month)
         @month = month
       end
 
       def day=(day)
-        raise ArgumentError, "Day is not valid" unless day.nil? or ISO8601_DATE.valid_day?(@year, @month, day)
+        
+        raise ArgumentError, "Day is not valid" unless day.nil? or ISO8601Date.valid_day?(@year, @month, day)
         @day = day
       end
@@ -176,6 +191,6 @@
     end
 
-    class ISO8601_DATE < TIME_DEFINITIONS
-      include ISO8601_DATE_MODULE
+    class ISO8601Date < TimeDefinitions
+      include ISO8601DateModule
       def initialize(string)
         /(\d{4})(?:-(\d{2})(?:-(\d{2})?)?)?/ =~ string
@@ -207,9 +222,11 @@
     end # end of ISO8601_DATE
 
-    module ISO8601_TIME_MODULE
+    module ISO8601TimeModule
       attr_reader :hour, :minute, :second, :fractional_second, :timezone
 
       def hour=(hour)
-        raise ArgumentError, "hour is not valid" if !ISO8601_TIME.valid_hour?(hour, @minute, @second)
+        unless ISO8601Time.valid_hour?(hour, @minute, @second)
+          raise ArgumentError, "hour is not valid"
+        end
         @hour = hour
       end
@@ -220,5 +237,5 @@
 
       def minute=(minute)
-        raise ArgumentError, "minute is not valid" if !minute.nil? and !ISO8601_TIME.valid_minute?(minute)
+        raise ArgumentError, "minute is not valid" if !minute.nil? and !ISO8601Time.valid_minute?(minute)
         @minute = minute
       end
@@ -230,5 +247,5 @@
       def second=(second)
         raise ArgumentError, "minute not defined" if @minute.nil? and !second.nil?
-        raise ArgumentError, "second is not valid" if !second.nil? and !ISO8601_TIME.valid_second?(second)
+        raise ArgumentError, "second is not valid" if !second.nil? and !ISO8601Time.valid_second?(second)
         @second = second
       end
@@ -237,14 +254,13 @@
         raise ArgumentError, "minute not defined" if minute_unknown? and !fractional_second.nil?
         raise ArgumentError, "second not defined" if second_unknown? and !fractional_second.nil?
-        raise ArgumentError, "fractional second should be lower than 1.0" if !fractional_second.nil? and fractional_second >= 1.0
+        if !fractional_second.nil? &&
+            (fractional_second < 0.0 || fractional_second >= 1.0)
+          raise ArgumentError, 'fractional second should be between 0.0 - 1.0'
+        end
         @fractional_second = fractional_second
       end
 
       def has_fractional_second?
-        if @fractional_second.nil?
-          return false
-        else
-          return true
-        end
+        return !@fractional_second.nil?
       end
 
@@ -291,6 +307,6 @@
     end
 
-    class ISO8601_TIME < TIME_DEFINITIONS
-      include ISO8601_TIME_MODULE
+    class ISO8601Time < TimeDefinitions
+      include ISO8601TimeModule
       def initialize(string)
         /(\d{2}):?(\d{2})?(:?)(\d{2})?((\.|,)(\d+))?(Z|([+-](\d{2}):?(\d{2})))?/ =~ string
@@ -321,6 +337,7 @@
         end
       end
+
       def self.valid_iso8601_time?(s)
-        if /(\d{2}):?(\d{2})?(:?)(\d{2})?((\.|,)(\d+))?(Z|([+-](\d{2}):?(\d{2})))?/ =~ s
+        if /^(\d{2}):?(\d{2})?(:?)(\d{2})?((\.|,)(\d+))?(Z|([+-](\d{2}):?(\d{2})))?$/ =~ s
 # ISO 8601 regular expression by H. Yuki
 #  http://digit.que.ne.jp/work/wiki.cgi?Perl%E3%83%A1%E3%83%A2%2FW3C%E5%BD%A2%E5%BC%8F%E3%81%AE%E6%97%A5%E6%99%82%E3%81%AE%E8%A7%A3%E6%9E%90
@@ -352,6 +369,4 @@
                 return false
               end
-            else
-              return false
             end
           end
@@ -363,6 +378,6 @@
     end # end of ISO8601_TIME
 
-    module ISO8601_DATE_TIME_MODULE
-      include ISO8601_DATE_MODULE, ISO8601_TIME_MODULE
+    module ISO8601DateTimeModule
+      include ISO8601DateModule, ISO8601TimeModule
       def as_string
         if (!@year.nil? and !@month.nil? and !@day.nil?)
@@ -392,9 +407,8 @@
     end
 
-    class ISO8601_DATE_TIME < ISO8601_DATE
-      include ISO8601_DATE_TIME_MODULE
+    class ISO8601DateTime < ISO8601Date
+      include ISO8601DateTimeModule
       def initialize(string)
-        /(\d{4})(?:-(\d{2})(?:-(\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(Z|([+-]\d{2}):?(\d{2}))?)?)?)?/ =~ string
-        if $1.empty?
+        unless /(\d{4})(?:-(\d{2})(?:-(\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(Z|([+-]\d{2}):?(\d{2}))?)?)?)?/ =~ string
           raise ArgumentError, 'format invalid'
         else
@@ -439,22 +453,33 @@
     end
   
-    class ISO8601_TIMEZONE
+    class ISO8601Timezone
       attr_accessor :sign, :hour, :minute
 
+      def initialize(string)
+        unless /(Z|(([+-])(\d{2}):?(\d{2})))/ =~ string
+          raise ArgumentError, 'invaild format'
+        end
+        if $1 == 'Z'
+          @sign, @hour, @minute = +1, 0, 0
+        else
+          @sign, @hour, @minute = ($3+'1').to_i, $4.to_i , $5.to_i
+        end
+      end
+
       def is_gmt?
-        @sign == "+1" and @hour == 0 and @minute == 0
+        @sign == +1 and @hour == 0 and @minute == 0
       end
 
       def as_string
-        if @sign == "+1"
+        if @sign == +1
           s = "+"
-        elsif @sign == "-1"
+        elsif @sign == -1
           s = "-"
         end
-        sprintf("Z%s%02d%02d", s, @hour, @minute)
-      end
-    end # end of ISO8601_TIMEZONE
-
-    module ISO8601_DURATION_MODULE
+        sprintf("%s%02d%02d", s, @hour, @minute)
+      end
+    end # end of ISO8601Timezone
+
+    module ISO8601DurationModule
       attr_reader :years, :months, :weeks, :days
       attr_reader :hours, :minutes, :seconds, :fractional_second
@@ -546,6 +571,7 @@
       end
     end
-    class ISO8601_DURATION < TIME_DEFINITIONS
-      include ISO8601_DURATION_MODULE
+
+    class ISO8601Duration < TimeDefinitions
+      include ISO8601DurationModule
       def initialize(str)
         /^P((\d+)Y)?((\d+)M)?((\d+)W)?((\d)D)?(T((\d+)H)?((\d+)M)?((\d+)(\.\d+)?S)?)?$/ =~ str
@@ -559,5 +585,5 @@
         self.fractional_second = $16.to_f
       end
-    end # end of ISO8601_DURATION
+    end # end of ISO8601Duration
   end # end of Assumed_Types
 end # end of OpenEHR
Index: ruby/trunk/lib/open_ehr/rm.rb
===================================================================
--- ruby/trunk/lib/open_ehr/rm.rb	(revision 296)
+++ ruby/trunk/lib/open_ehr/rm.rb	(revision 297)
@@ -9,5 +9,5 @@
 
 # OpenEHR::RM
-module OpenEhr
+module OpenEHR
 
   autoload :Assumed_Library_Types, "assumed_library_types.rb"
Index: ruby/trunk/lib/open_ehr/rm/common/archetyped.rb
===================================================================
--- ruby/trunk/lib/open_ehr/rm/common/archetyped.rb	(revision 296)
+++ ruby/trunk/lib/open_ehr/rm/common/archetyped.rb	(revision 297)
@@ -2,5 +2,5 @@
 # http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109318114715_211173_0Report.html
 # Ticket refs #65
-module OpenEhr
+module OpenEHR
   module RM
     module Common
@@ -17,26 +17,26 @@
           attr_accessor :parent
 
-          def initialize(parent = nil)
-            @parent = parent
+          def initialize(args = { })
+            self.parent = args[:parent]
           end
 
           def item_at_path(path)
-            raise NotImplementError, "item_at_path must be implemented"
+            raise NotImplementedError, "item_at_path must be implemented"
           end
 
           def items_at_path(path)
-            raise NotImplementError, "items_at_path must be implemented"
+            raise NotImplementedError, "items_at_path must be implemented"
           end
 
           def path_exists?(path)
-            raise NotImplementError, "path_exists? must be implemented"
+            raise NotImplementedError, "path_exists? must be implemented"
           end
 
           def path_of_item(item)
-            raise NotImplementError, "path_of_item must be implemented"
+            raise NotImplementedError, "path_of_item must be implemented"
           end
 
-          def path_unique(path)
-            raise NotImplementError, "path_unique must be implemented"
+          def path_unique?(path)
+            raise NotImplementedError, "path_unique? must be implemented"
           end
         end
@@ -48,5 +48,5 @@
 
           def initialize(args = { })
-            super(args[:parent])
+            super(args)
             self.archetype_node_id = args[:archetype_node_id]
             self.name = args[:name]
@@ -58,5 +58,7 @@
           
           def archetype_node_id=(archetype_node_id)
-            raise ArgumentError, 'archetype_node_id should not be nil' if archetype_node_id.nil?
+            if archetype_node_id.nil? or archetype_node_id.empty?
+              raise ArgumentError, 'archetype_node_id should not be nil'
+            end
             @archetype_node_id = archetype_node_id
           end
Index: ruby/trunk/lib/open_ehr/rm/data_types/basic.rb
===================================================================
--- ruby/trunk/lib/open_ehr/rm/data_types/basic.rb	(revision 296)
+++ 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 296)
+++ 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 296)
+++ 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 296)
+++ 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 296)
+++ 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
Index: ruby/trunk/lib/open_ehr/rm/security.rb
===================================================================
--- ruby/trunk/lib/open_ehr/rm/security.rb	(revision 296)
+++ ruby/trunk/lib/open_ehr/rm/security.rb	(revision 297)
@@ -2,5 +2,5 @@
 # http://www.openehr.org/uml/release-1.0.1/Browsable/_9_5_1_76d0249_1155650882301_836618_5314Report.html
 # Ticket refs #41
-module OpenEhr
+module OpenEHR
   module RM
     module Security
Index: ruby/trunk/lib/open_ehr/rm/support/definition.rb
===================================================================
--- ruby/trunk/lib/open_ehr/rm/support/definition.rb	(revision 296)
+++ ruby/trunk/lib/open_ehr/rm/support/definition.rb	(revision 297)
@@ -1,3 +1,3 @@
-module OpenEhr
+module OpenEHR
   module RM
     module Support
Index: ruby/trunk/lib/open_ehr/rm/support/identification.rb
===================================================================
--- ruby/trunk/lib/open_ehr/rm/support/identification.rb	(revision 296)
+++ ruby/trunk/lib/open_ehr/rm/support/identification.rb	(revision 297)
@@ -2,13 +2,13 @@
 # http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109331021343_528780_2066Report.html
 # Ticket refs #39
-module OpenEhr
+module OpenEHR
   module RM
     module Support
       module Identification
-        class ObjectId
+        class ObjectID
           attr_reader :value
 
-          def initialize(value)
-            self.value=value
+          def initialize(args = {})
+            self.value=args[:value]
           end
 
@@ -17,6 +17,7 @@
             @value = value            
           end
+
           def ==(object_id)
-            @value == object_id.value
+            self.value == object_id.value
           end
         end # of ObjectID
@@ -25,12 +26,15 @@
           attr_reader :namespace, :type, :id
 
-          def initialize(namespace, type, id)
-            self.namespace = namespace
-            self.type = type
-            self.id = id
+          def initialize(args = {})
+            self.namespace = args[:namespace]
+            self.type = args[:type]
+            self.id = args[:id]
           end
 
           def namespace=(namespace)
-            raise ArgumentError if namespace.nil? or namespace.empty? or !(/([a-z]|[A-Z]).*/ =~ namespace) # error original is =~ #([a-z][A-Z])([a-z]|[A-Z]|\s|[0-9]|[_-\:\/\&\+\?])*/
+            if namespace.nil? or namespace.empty? or 
+                !(/^[a-zA-Z][a-zA-Z0-9_\-\:\/\&\+\?]*$/ =~ namespace)
+              raise ArgumentError
+            end
             @namespace = namespace
           end
@@ -47,20 +51,68 @@
         end
 
-        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
+        class ArchetypeID < ObjectID
+          attr_reader :rm_originator, :rm_name, :rm_entity,
+                      :concept_name, :specialisation, :version_id
+          
+          def initialize(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
+              super(args)
+            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
+            if @specialisation.nil?
+              return @concept_name
+            else
+              return @concept_name + '-' + @specialisation
+            end
+          end
+
+          def value
+            return self.qualified_rm_entity + '.' +
+              self.domain_concept + '.' + @version_id
+          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
 
@@ -71,17 +123,24 @@
 
           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
+
           def version_id=(version_id)
             raise ArgumentError, "version_id not valid" if version_id.nil? or version_id.empty?
@@ -90,9 +149,14 @@
         end
 
-        class TerminologyId < ObjectId
+        class TerminologyID < ObjectID
           attr_reader :name, :version_id
 
-          def initialize(value)
-            super(value)
+          def initialize(args = {})
+            if args[:value].nil?
+              self.name = args[:name]
+              self.version_id = args[:version_id]
+            else
+              super(args)
+            end
           end
 
@@ -108,12 +172,11 @@
           def value=(value)
             raise ArgumentError, "value not valid" if value.nil? or value.empty?
-            if /(.*)\((.*)\)$/ =~ value
-              @name = $1
-              @version_id = $2
-            else
-              @name = value
-              @version_id = ''
-            end
-            @value = value
+            if /(.*)\((.*)\)/ =~ value
+              self.name = $1
+              self.version_id = $2
+            else
+              self.name = value
+              self.version_id = ''
+            end
           end
 
@@ -124,69 +187,76 @@
 
           def version_id=(version_id)
-            raise ArgumentError, "version_id not valid" if version_id.nil?
-            @version_id = version_id
+            if version_id.nil?
+              @version_id = ''
+            else
+              @version_id = version_id
+            end
           end
         end # of Terminology_ID
 
-        class GenericId < ObjectId
+        class GenericID < ObjectID
           attr_reader :scheme
 
-          def initialize(value, scheme)
+          def initialize(args)
+            super(args)
+            self.scheme = args[:scheme]
+          end
+
+          def scheme=(scheme)
+            if scheme.nil? or scheme.empty?
+              raise ArgumentError, "scheme not valid"
+            end
+            @scheme = scheme
+          end
+        end # of Generic_ID
+
+        class TemplateID < ObjectID
+
+        end
+
+        class UIDBasedID < ObjectID
+          attr_reader :root, :extension
+
+          def initialize(args = {})
+            super(args)
+          end
+
+          def value=(value)
             super(value)
-            self.scheme = scheme
-          end
-
-          def scheme=(scheme)
-            raise ArgumentError, "scheme not valid" if scheme.nil? or scheme.empty?
-            @scheme = scheme
-          end
-        end # of Generic_ID
-
-        class TemplateId < ObjectId
-
-        end
-
-        class UidBasedId < ObjectId
-          def initialize(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
-          end
-        end
-
-        class ObjectVersionId < UidBasedId
+            return !@extension.empty?
+          end
+        end
+
+        class ObjectVersionID < UIDBasedID
           attr_reader :object_id, :creating_system_id, :version_tree_id
 
-          def initialize(value)
-            super(value)
-          end
-
-          def value=(value)
-            super(value)
-            if /^(\w+)::(\w+)::((\d|\.)+)$/ =~ value
-              self.object_id = Uid.new($1)
-              self.creating_system_id = Uid.new($2)
-              self.version_tree_id = VersionTreeId.new($3)
+          def initialize(args= {})
+            super(args)
+          end
+
+          def value=(value)
+            if /^(\S+)::(\S+)::((\d|\.)+)$/ =~ value
+              self.object_id = UID.new(:value => $1)
+              self.creating_system_id = UID.new(:value => $2)
+              self.version_tree_id = VersionTreeID.new(:value => $3)
             else
               raise ArgumentError, 'invalid format'
             end
+          end
+
+          def value
+            return @object_id.value + '::' + 
+              @creating_system_id.value + '::' +
+              @version_tree_id.value
           end
 
@@ -216,9 +286,9 @@
 
         class LocatableRef < ObjectRef
-          attr_reader :namespace, :type, :id, :path
-
-          def initialize(namespace, type, id, path)
-            super(namespace, type, id)
-            self.path = path
+          attr_reader :path
+
+          def initialize(args = {})
+            super(args)
+            self.path = args[:path]
           end
 
@@ -234,7 +304,6 @@
 
         class PartyRef < ObjectRef
-
           def type=(type)
-            parties = ['PERSON', 'ORGANISATION', 'GROUP', 'AGENT', 'ROLE','PARTY', 'ACTOR']
+            parties = %w[PERSON ORGANISATION GROUP AGENT ROLE PARTY ACTOR]
             raise ArgumentError, 'type invalid' unless parties.include? type
             @type = type
@@ -243,24 +312,26 @@
 
         class AccessGroupRef < ObjectRef
+          def initialize(args = {})
+            super(args)
+            @type = 'ACCESS_GROUP'
+          end
+
           def type=(type)
-            raise ArgumentError, 'type invalid' unless type == 'ACCESS_GROUP'
-            @type = type
-          end
-        end
-
-        class HierObjectId < UidBasedId
-
-        end
-
-        class VersionTreeId
-          attr_reader :value, :trunk_version, :branch_number, :branch_version
-
-          def initialize(value)
-            self.value = value
+          end
+        end
+
+        class HierObjectID < UIDBasedID
+
+        end
+
+        class VersionTreeID
+          attr_reader :trunk_version, :branch_number, :branch_version
+
+          def initialize(args = {})
+            self.value = args[:value]
           end
 
           def value=(value)
             raise ArgumentError, 'value invalid' if value.nil? or value.empty?
-            @trunk_version = @branch_number = @branch_version = nil
             (trunk_version, branch_number, branch_version) = value.split '.'
             self.trunk_version = trunk_version
@@ -269,42 +340,47 @@
           end
 
-          def trunk_version=(trunk_version)
-            raise ArgumentError, 'trunk_version invalid' if trunk_version.nil? and !trunk_version.to_i >= 1
-            @trunk_version = trunk_version
-            set_value
-          end
-
-          def branch_number=(branch_number)
-            raise ArgumentError, 'branch number invalid' unless branch_number.nil? or branch_number.to_i >= 1
-            @branch_number = branch_number
-            set_value
-          end
-
-          def branch_version=(branch_version)
-            raise ArgumentError, 'branch version invalid' if (!branch_version.nil? and !( branch_version.to_i >= 1)) or (!branch_version.nil? and @branch_number.nil?)
-            @branch_version = branch_version
-            set_value
-          end
-          def is_branch?
-            !@branch_version.nil? and !@branch_number.nil?
-          end
-
-          def is_first?
-            trunk_version == '1'
-          end
-
-          private
-          def set_value
+          def value
             @value = trunk_version
             @value = @value + '.' + @branch_number unless @branch_number.nil?
             @value = @value + '.' + @branch_version unless @branch_version.nil?
-          end
-        end
-
-        class Uid
+            return @value
+          end
+
+          def trunk_version=(trunk_version)
+            if trunk_version.nil? || (trunk_version.to_i < 1)
+              raise ArgumentError, 'trunk_version invalid'
+            end
+            @trunk_version = trunk_version
+          end
+
+          def branch_number=(branch_number)
+            unless branch_number.nil? or branch_number.to_i >= 1
+              raise ArgumentError, 'branch number invalid'
+            end
+            @branch_number = branch_number
+          end
+
+          def branch_version=(branch_version)
+            if (!branch_version.nil? and !(branch_version.to_i >= 1)) or
+                (!branch_version.nil? and @branch_number.nil?)
+              raise ArgumentError, 'branch version invalid'
+            end
+            @branch_version = branch_version
+          end
+
+          def is_branch?
+            !@branch_version.nil? and !@branch_number.nil?
+          end
+
+          def is_first?
+            trunk_version == '1'
+          end
+        end
+
+        class UID
           attr_reader :value
 
-          def initialize(value)
-            self.value = value
+          def initialize(args = {})
+            self.value = args[:value]
           end
 
@@ -315,13 +391,13 @@
         end
 
-        class Uuid < Uid
-
-        end
-
-        class InternetId <Uid
+        class UUID < UID
+
+        end
+
+        class InternetID <UID
           
         end
 
-        class IsoOid <Uid
+        class IsoOID <UID
 
         end        
Index: ruby/trunk/lib/tasks/rspec.rake
===================================================================
--- ruby/trunk/lib/tasks/rspec.rake	(revision 297)
+++ ruby/trunk/lib/tasks/rspec.rake	(revision 297)
@@ -0,0 +1,182 @@
+gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
+rspec_gem_dir = nil
+Dir["#{RAILS_ROOT}/vendor/gems/*"].each do |subdir|
+  rspec_gem_dir = subdir if subdir.gsub("#{RAILS_ROOT}/vendor/gems/","") =~ /^(\w+-)?rspec-(\d+)/ && File.exist?("#{subdir}/lib/spec/rake/spectask.rb")
+end
+rspec_plugin_dir = File.expand_path(File.dirname(__FILE__) + '/../../vendor/plugins/rspec')
+
+if rspec_gem_dir && (test ?d, rspec_plugin_dir)
+  raise "\n#{'*'*50}\nYou have rspec installed in both vendor/gems and vendor/plugins\nPlease pick one and dispose of the other.\n#{'*'*50}\n\n"
+end
+
+if rspec_gem_dir
+  $LOAD_PATH.unshift("#{rspec_gem_dir}/lib")
+elsif File.exist?(rspec_plugin_dir)
+  $LOAD_PATH.unshift("#{rspec_plugin_dir}/lib")
+end
+
+# Don't load rspec if running "rake gems:*"
+unless ARGV.any? {|a| a =~ /^gems/}
+
+begin
+  require 'spec/rake/spectask'
+rescue MissingSourceFile
+  module Spec
+    module Rake
+      class SpecTask
+        def initialize(name)
+          task name do
+            # if rspec-rails is a configured gem, this will output helpful material and exit ...
+            require File.expand_path(File.dirname(__FILE__) + "/../../config/environment")
+
+            # ... otherwise, do this:
+            raise <<-MSG
+
+#{"*" * 80}
+*  You are trying to run an rspec rake task defined in
+*  #{__FILE__},
+*  but rspec can not be found in vendor/gems, vendor/plugins or system gems.
+#{"*" * 80}
+MSG
+          end
+        end
+      end
+    end
+  end
+end
+
+Rake.application.instance_variable_get('@tasks').delete('default')
+
+spec_prereq = File.exist?(File.join(RAILS_ROOT, 'config', 'database.yml')) ? "db:test:prepare" : :noop
+task :noop do
+end
+
+task :default => :spec
+task :stats => "spec:statsetup"
+
+desc "Run all specs in spec directory (excluding plugin specs)"
+Spec::Rake::SpecTask.new(:spec => spec_prereq) do |t|
+  t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+  t.spec_files = FileList['spec/**/*_spec.rb']
+end
+
+namespace :spec do
+  desc "Run all specs in spec directory with RCov (excluding plugin specs)"
+  Spec::Rake::SpecTask.new(:rcov) do |t|
+    t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+    t.spec_files = FileList['spec/**/*_spec.rb']
+    t.rcov = true
+    t.rcov_opts = lambda do
+      IO.readlines("#{RAILS_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
+    end
+  end
+
+  desc "Print Specdoc for all specs (excluding plugin specs)"
+  Spec::Rake::SpecTask.new(:doc) do |t|
+    t.spec_opts = ["--format", "specdoc", "--dry-run"]
+    t.spec_files = FileList['spec/**/*_spec.rb']
+  end
+
+  desc "Print Specdoc for all plugin examples"
+  Spec::Rake::SpecTask.new(:plugin_doc) do |t|
+    t.spec_opts = ["--format", "specdoc", "--dry-run"]
+    t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*')
+  end
+
+  [:models, :controllers, :views, :helpers, :lib, :integration].each do |sub|
+    desc "Run the code examples in spec/#{sub}"
+    Spec::Rake::SpecTask.new(sub => spec_prereq) do |t|
+      t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+      t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
+    end
+  end
+
+  desc "Run the code examples in vendor/plugins (except RSpec's own)"
+  Spec::Rake::SpecTask.new(:plugins => spec_prereq) do |t|
+    t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+    t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*').exclude("vendor/plugins/rspec-rails/*")
+  end
+
+  namespace :plugins do
+    desc "Runs the examples for rspec_on_rails"
+    Spec::Rake::SpecTask.new(:rspec_on_rails) do |t|
+      t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
+      t.spec_files = FileList['vendor/plugins/rspec-rails/spec/**/*_spec.rb']
+    end
+  end
+
+  # Setup specs for stats
+  task :statsetup do
+    require 'code_statistics'
+    ::STATS_DIRECTORIES << %w(Model\ specs spec/models) if File.exist?('spec/models')
+    ::STATS_DIRECTORIES << %w(View\ specs spec/views) if File.exist?('spec/views')
+    ::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) if File.exist?('spec/controllers')
+    ::STATS_DIRECTORIES << %w(Helper\ specs spec/helpers) if File.exist?('spec/helpers')
+    ::STATS_DIRECTORIES << %w(Library\ specs spec/lib) if File.exist?('spec/lib')
+    ::STATS_DIRECTORIES << %w(Routing\ specs spec/routing) if File.exist?('spec/routing')
+    ::STATS_DIRECTORIES << %w(Integration\ specs spec/integration) if File.exist?('spec/integration')
+    ::CodeStatistics::TEST_TYPES << "Model specs" if File.exist?('spec/models')
+    ::CodeStatistics::TEST_TYPES << "View specs" if File.exist?('spec/views')
+    ::CodeStatistics::TEST_TYPES << "Controller specs" if File.exist?('spec/controllers')
+    ::CodeStatistics::TEST_TYPES << "Helper specs" if File.exist?('spec/helpers')
+    ::CodeStatistics::TEST_TYPES << "Library specs" if File.exist?('spec/lib')
+    ::CodeStatistics::TEST_TYPES << "Routing specs" if File.exist?('spec/routing')
+    ::CodeStatistics::TEST_TYPES << "Integration specs" if File.exist?('spec/integration')
+  end
+
+  namespace :db do
+    namespace :fixtures do
+      desc "Load fixtures (from spec/fixtures) into the current environment's database.  Load specific fixtures using FIXTURES=x,y. Load from subdirectory in test/fixtures using FIXTURES_DIR=z."
+      task :load => :environment do
+        ActiveRecord::Base.establish_connection(Rails.env)
+        base_dir = File.join(Rails.root, 'spec', 'fixtures')
+        fixtures_dir = ENV['FIXTURES_DIR'] ? File.join(base_dir, ENV['FIXTURES_DIR']) : base_dir
+
+        require 'active_record/fixtures'
+        (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/).map {|f| File.join(fixtures_dir, f) } : Dir.glob(File.join(fixtures_dir, '*.{yml,csv}'))).each do |fixture_file|
+          Fixtures.create_fixtures(File.dirname(fixture_file), File.basename(fixture_file, '.*'))
+        end
+      end
+    end
+  end
+
+  namespace :server do
+    daemonized_server_pid = File.expand_path("#{RAILS_ROOT}/tmp/pids/spec_server.pid")
+
+    desc "start spec_server."
+    task :start do
+      if File.exist?(daemonized_server_pid)
+        $stderr.puts "spec_server is already running."
+      else
+        $stderr.puts %Q{Starting up spec_server ...}
+        FileUtils.mkdir_p('tmp/pids') unless test ?d, 'tmp/pids'
+        system("ruby", "script/spec_server", "--daemon", "--pid", daemonized_server_pid)
+      end
+    end
+
+    desc "stop spec_server."
+    task :stop do
+      unless File.exist?(daemonized_server_pid)
+        $stderr.puts "No server running."
+      else
+        $stderr.puts "Shutting down spec_server ..."
+        system("kill", "-s", "TERM", File.read(daemonized_server_pid).strip) &&
+        File.delete(daemonized_server_pid)
+      end
+    end
+
+    desc "restart spec_server."
+    task :restart => [:stop, :start]
+
+    desc "check if spec server is running"
+    task :status do
+      if File.exist?(daemonized_server_pid)
+        $stderr.puts %Q{spec_server is running (PID: #{File.read(daemonized_server_pid).gsub("\n","")})}
+      else
+        $stderr.puts "No server running."
+      end
+    end
+  end
+end
+
+end
Index: ruby/trunk/log/development.log
===================================================================
--- ruby/trunk/log/development.log	(revision 296)
+++ ruby/trunk/log/development.log	(revision 297)
@@ -1640,2 +1640,25 @@
   [4;36;1mTerminology Load (0.001251)[0m   [0;1mSELECT * FROM "terminologies" WHERE ("terminologies"."lang" = 'ja' AND "terminologies"."code" = '3' AND "terminologies"."name" = 'openehr') LIMIT 1[0m
 Completed in 0.01486 (67 reqs/sec) | Rendering: 0.00061 (4%) | DB: 0.00125 (8%) | 404 Not Found [http://localhost/terminology/openehr/ja/3]
+  [4;36;1mSQL (0.8ms)[0m   [0;1m SELECT name
+ FROM sqlite_master
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
+[0m
+  [4;35;1mSQL (0.4ms)[0m   [0mSELECT version FROM schema_migrations[0m
+  [4;36;1mSQL (0.3ms)[0m   [0;1mselect sqlite_version(*)[0m
+  [4;35;1mSQL (0.6ms)[0m   [0m SELECT name
+ FROM sqlite_master
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
+[0m
+  [4;36;1mSQL (37.7ms)[0m   [0;1mCREATE TABLE "terminologies" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "code" varchar(255), "name" varchar(255), "lang" varchar(255), "group" text, "rubric" varchar(255), "description" text, "mappings" varchar(255)) [0m
+  [4;35;1mSQL (0.2ms)[0m   [0m SELECT name
+ FROM sqlite_master
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
+[0m
+  [4;36;1mSQL (2.2ms)[0m   [0;1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
+  [4;35;1mSQL (2.9ms)[0m   [0mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
+  [4;36;1mSQL (0.2ms)[0m   [0;1m SELECT name
+ FROM sqlite_master
+ WHERE type = 'table' AND NOT name = 'sqlite_sequence'
+[0m
+  [4;35;1mSQL (0.1ms)[0m   [0mSELECT version FROM "schema_migrations"[0m
+  [4;36;1mSQL (2.3ms)[0m   [0;1mINSERT INTO "schema_migrations" (version) VALUES ('20090725052538')[0m
Index: ruby/trunk/script/autospec
===================================================================
--- ruby/trunk/script/autospec	(revision 297)
+++ ruby/trunk/script/autospec	(revision 297)
@@ -0,0 +1,6 @@
+#!/usr/bin/env ruby
+gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
+ENV['RSPEC'] = 'true'     # allows autotest to discover rspec
+ENV['AUTOTEST'] = 'true'  # allows autotest to run w/ color on linux
+system((RUBY_PLATFORM =~ /mswin|mingw/ ? 'autotest.bat' : 'autotest'), *ARGV) ||
+  $stderr.puts("Unable to find autotest.  Please install ZenTest or fix your PATH")
Index: ruby/trunk/script/spec
===================================================================
--- ruby/trunk/script/spec	(revision 297)
+++ ruby/trunk/script/spec	(revision 297)
@@ -0,0 +1,10 @@
+#!/usr/bin/env ruby
+if ARGV.any? {|arg| %w[--drb -X --generate-options -G --help -h --version -v].include?(arg)}
+  require 'rubygems' unless ENV['NO_RUBYGEMS']
+else
+  gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
+  ENV["RAILS_ENV"] ||= 'test'
+  require File.expand_path(File.dirname(__FILE__) + "/../config/environment") unless defined?(RAILS_ROOT)
+end
+require 'spec/autorun'
+exit ::Spec::Runner::CommandLine.run
Index: ruby/trunk/script/spec_server
===================================================================
--- ruby/trunk/script/spec_server	(revision 297)
+++ ruby/trunk/script/spec_server	(revision 297)
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
+
+puts "Loading Rails environment"
+ENV["RAILS_ENV"] ||= 'test'
+require File.expand_path(File.dirname(__FILE__) + "/../config/environment") unless defined?(RAILS_ROOT)
+
+require 'optparse'
+require 'spec/rails/spec_server'
