Index: ruby/branches/0.5/lib/open_ehr/assumed_library_types.rb
===================================================================
--- ruby/branches/0.5/lib/open_ehr/assumed_library_types.rb	(revision 256)
+++ ruby/branches/0.5/lib/open_ehr/assumed_library_types.rb	(revision 259)
@@ -95,9 +95,15 @@
 
       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
 
@@ -126,5 +132,5 @@
 
       def year=(year)
-        unless !year.nil? && ISO8601Date.valid_year?(year)
+        unless ISO8601Date.valid_year?(year)
           raise ArgumentError, "Year is not valid"
         end
@@ -138,4 +144,5 @@
 
       def day=(day)
+        
         raise ArgumentError, "Day is not valid" unless day.nil? or ISO8601Date.valid_day?(@year, @month, day)
         @day = day
@@ -548,4 +555,5 @@
       end
     end
+
     class ISO8601_DURATION < TimeDefinitions
       include ISO8601_DURATION_MODULE
Index: ruby/branches/0.5/lib/open_ehr/rm/support/identification.rb
===================================================================
--- ruby/branches/0.5/lib/open_ehr/rm/support/identification.rb	(revision 256)
+++ ruby/branches/0.5/lib/open_ehr/rm/support/identification.rb	(revision 259)
@@ -6,9 +6,9 @@
     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,4 +17,5 @@
             @value = value            
           end
+
           def ==(object_id)
             @value == object_id.value
@@ -32,5 +33,5 @@
 
           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]|[_-\:\/\&\+\?])*/
+            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|[v0-9]|[_-\:\/\&\+\?])*/
             @namespace = namespace
           end
@@ -47,5 +48,5 @@
         end
 
-        class ArchetypeId < ObjectId
+        class ArchetypeID < ObjectID
           attr_reader :domain_concept, :rm_name, :rm_entity, :rm_originator, :specialisation, :version_id
 
@@ -90,9 +91,9 @@
         end
 
-        class TerminologyId < ObjectId
+        class TerminologyID < ObjectID
           attr_reader :name, :version_id
 
-          def initialize(value)
-            super(value)
+          def initialize(args = {})
+            super(args)
           end
 
@@ -129,5 +130,5 @@
         end # of Terminology_ID
 
-        class GenericId < ObjectId
+        class GenericID < ObjectID
           attr_reader :scheme
 
@@ -143,9 +144,9 @@
         end # of Generic_ID
 
-        class TemplateId < ObjectId
-
-        end
-
-        class UidBasedId < ObjectId
+        class TemplateID < ObjectID
+
+        end
+
+        class UIDBasedID < ObjectID
           def initialize(value)
             super(value)
@@ -173,5 +174,5 @@
         end
 
-        class ObjectVersionId < UidBasedId
+        class ObjectVersionID < UIDBasedID
           attr_reader :object_id, :creating_system_id, :version_tree_id
 
@@ -183,7 +184,7 @@
             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)
+              self.object_id = UID.new($1)
+              self.creating_system_id = UID.new($2)
+              self.version_tree_id = VersionTreeID.new($3)
             else
               raise ArgumentError, 'invalid format'
@@ -249,9 +250,9 @@
         end
 
-        class HierObjectId < UidBasedId
-
-        end
-
-        class VersionTreeId
+        class HierObjectID < UIDBasedID
+
+        end
+
+        class VersionTreeID
           attr_reader :value, :trunk_version, :branch_number, :branch_version
 
@@ -302,5 +303,5 @@
         end
 
-        class Uid
+        class UID
           attr_reader :value
 
@@ -315,13 +316,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/branches/0.5/spec/lib/open_ehr/assumed_library_types/interval_spec.rb
===================================================================
--- ruby/branches/0.5/spec/lib/open_ehr/assumed_library_types/interval_spec.rb	(revision 256)
+++ ruby/branches/0.5/spec/lib/open_ehr/assumed_library_types/interval_spec.rb	(revision 259)
@@ -1,3 +1,2 @@
-<<<<<<< .mine
 require File.dirname(__FILE__) + '/../../../spec_helper'
 include OpenEHR::AssumedLibraryTypes
@@ -139,143 +138,3 @@
   end
 end
-=======
-require File.dirname(__FILE__) + '/../../../spec_helper'
-include OpenEHR::AssumedLibraryTypes
 
-describe Interval do
-  before(:each) do
-    @interval = Interval.new(:upper => 10,
-                             :lower => 1)
-  end
-
-  it 'should be an instance of Interval' do
-    @interval.should be_an_instance_of Interval
-  end
-
-  it 's upper should be greater than lower' do
-    @interval.upper.should be > @interval.lower
-  end
-
-  it 's upper should be equal 10' do
-    @interval.upper.should == 10
-  end
-
-  it 's lower should be equal 1' do
-    @interval.lower.should == 1
-  end
-
-  it 'should raise ArgumentError with smaller upper' do
-    lambda {@interval.upper = -1}.should raise_error ArgumentError
-  end
-
-  it 'should raise ArgumentError with greater lower' do
-    lambda {@interval.lower = 11}.should raise_error ArgumentError
-  end
-
-  it 'should have 5' do
-    @interval.has?(5).should be_true
-  end
-
-  it 'should not have 11' do
-    @interval.has?(11).should_not be_true
-  end
-
-  it 'should not have -1' do
-    @interval.has?(-1).should_not be_true
-  end
-
-  it 'should not have 10' do
-    @interval.has?(10).should_not be_true
-  end
-
-  it 'should have not have 1' do
-    @interval.has?(1).should_not be_true
-  end
-
-  describe Interval, 'when lower included' do
-    before do
-      @interval.lower_included = true
-    end
-
-    it 'should be lower_included' do
-      @interval.should be_lower_included
-    end
-
-    it 'should have 1 when lower included' do
-      @interval.has?(1).should be_true
-    end
-
-    after do
-      @interval.lower_included = false
-    end
-  end
-
-  describe Interval, 'when upper included' do
-    before do
-      @interval.upper_included = true
-    end
-
-    it 'should be upper uncluded' do
-      @interval.should be_upper_included
-    end
-
-    it 'should have 10 when upper included' do
-      @interval.has?(10).should be_true
-    end
-
-    after do
-      @interval.upper_included = false
-    end
-  end
-
-  describe Interval, 'when upper unbounded' do
-    before do
-      @interval.upper = nil
-    end
-
-    it 'should be upper unbounded' do
-      @interval.should be_upper_unbounded
-    end
-
-    it 'should have 11' do
-      @interval.has?(11).should be_true
-    end
-
-    it 'should raise ArgumentError, when upper_included is assigned' do
-      lambda{
-        @interval.upper_included = true
-      }.should raise_error ArgumentError
-    end
-
-    after do
-      @interval.upper = 10
-    end
-  end
-
-  describe Interval, 'when lower unbounded' do
-    before do
-      @interval.lower = nil
-    end
-
-    it 'should be lower unbounded' do
-      @interval.should be_lower_unbounded
-    end
-
-    it 'should  have -10' do
-      @interval.has?(-10).should be_true
-    end
-
-    it 'should raise ArgumentError, when lower_included is assigned' do
-      lambda{
-        @interval.lower_included = true
-      }.should raise_error ArgumentError
-    end
-  end
-
-  it 'should raise ArgumentError both upper and lower is nil' do
-    lambda {
-      Interval.new
-    }.should raise_error ArgumentError
-  end
-end
->>>>>>> .r255
Index: ruby/branches/0.5/spec/lib/open_ehr/assumed_library_types/iso_8601_date_spec.rb
===================================================================
--- ruby/branches/0.5/spec/lib/open_ehr/assumed_library_types/iso_8601_date_spec.rb	(revision 256)
+++ ruby/branches/0.5/spec/lib/open_ehr/assumed_library_types/iso_8601_date_spec.rb	(revision 259)
@@ -25,4 +25,8 @@
   it 'should be 2009-09-10 as_string' do
     @iso8601date.as_string.should == '2009-09-10'
+  end
+
+  it 'should be extended ' do
+    @iso8601date.is_extended?.should be_true
   end
 
@@ -65,15 +69,21 @@
   end
 
-  describe 'January behavior' do
-    before do
-      @iso8601date.month = 1
-    end
+  [1,3,5,7,8,10,12].each do |m|
+    describe '#{m}th month behavior' do
+      before do
+        @iso8601date.month = m
+      end
+      
+      it 'should have 31 days' do
+        lambda{
+          @iso8601date.day = 31
+        }.should_not raise_error ArgumentError
+      end
 
-    it 'January should have 31 days' do
-      lambda{@iso8601date.day = 31}.should_not raise_error ArgumentError
-    end
-
-    it 'January should not have 32 days' do
-      lambda{@iso8601date.month = 32}.should raise_error ArgumentError
+      it 'should not have 32 days' do
+        lambda{
+          @iso8601date.day = 32
+        }.should raise_error ArgumentError
+      end
     end
   end
@@ -127,30 +137,60 @@
   end
 
-  describe 'March behavior' do
-    before do
-      @iso8601date.month = 3
-    end
+  [4,6,9,11].each do |month|
+    describe "#{month}th month behavior" do
+      before do
+        @iso8601date.month = month
+      end
 
-    it '31 day should not raise ArgumentError' do
-      lambda{@iso8601date.day = 31}.should_not raise_error ArgumentError
-    end
+      it '30 day should not raise ArgumentError' do
+        lambda{
+          @iso8601date.day = 30
+        }.should_not raise_error ArgumentError
+      end
 
-    it '32 day should raise ArgumentError' do
-      lambda{@iso8601date.day = 32}.should raise_error ArgumentError
+      it '31 day should raise ArgumentError' do
+        lambda{
+          @iso8601date.day = 31
+        }.should raise_error ArgumentError
+      end
     end
   end
 
-  describe 'April behavior' do
-    before do
-      @iso8601date.month = 4
+  describe 'partial date data' do
+    describe 'day unknown' do
+      before do
+        @iso8601date.day = nil
+      end
+      
+      it 'day should be unknown' do
+        @iso8601date.should be_day_unknown
+      end
+      
+      it 'should be 2009-09 as string' do
+        @iso8601date.as_string.should == '2009-09'
+      end
+      
+      it 'should be partial' do
+        @iso8601date.is_partial?.should be_true
+      end
+      
+      after do
+        @iso8601date.day = 10
+      end
     end
-
-    it '30 day should not raise ArgumentError' do
-      lambda{@iso8601date.day = 30}.should_not raise_error ArgumentError
-    end
-
-    it '31 day should raise ArgumentError' do
-      lambda{@iso8601date.day = 31}.should raise_error ArgumentError
+    
+    describe 'month unknown' do
+      before do
+        @iso8601date.day = nil
+        @iso8601date.month = nil
+      end
+      
+      it 'should raise ArgumentError with nil month and not nil day' do
+        lambda {
+          @iso8601date.day = 11
+        }.should raise_error ArgumentError
+      end
     end
   end
+
 end
Index: ruby/branches/0.5/spec/lib/open_ehr/rm/data_types/basic/dv_state_spec.rb
===================================================================
--- ruby/branches/0.5/spec/lib/open_ehr/rm/data_types/basic/dv_state_spec.rb	(revision 256)
+++ ruby/branches/0.5/spec/lib/open_ehr/rm/data_types/basic/dv_state_spec.rb	(revision 259)
@@ -6,5 +6,5 @@
 describe DvState do
   before(:each) do
-    @terminology_id = TerminologyId.new('openher')
+    @terminology_id = TerminologyID.new(:value => 'openher')
     code_phrase = CodePhrase.new(:code_string => '524',
                                  :terminology_id => @terminology_id)
Index: ruby/branches/0.5/spec/lib/open_ehr/rm/data_types/quantity/dv_ordinal_spec.rb
===================================================================
--- ruby/branches/0.5/spec/lib/open_ehr/rm/data_types/quantity/dv_ordinal_spec.rb	(revision 256)
+++ ruby/branches/0.5/spec/lib/open_ehr/rm/data_types/quantity/dv_ordinal_spec.rb	(revision 259)
@@ -6,5 +6,5 @@
 describe DvOrdinal do
   before(:each) do
-    terminology_id = stub(TerminologyId, :value => 'urine:prot')
+    terminology_id = stub(TerminologyID, :value => 'urine:prot')
     code_phrase = stub(CodePhrase, :terminology_id => terminology_id)
     symbol = stub(DvCodedText, :code_string => '+',
@@ -35,5 +35,5 @@
 
   it 'should be strictry comperable to other DvOrdinal' do
-    terminology_id = stub(TerminologyId, :value => 'urine:prot')
+    terminology_id = stub(TerminologyID, :value => 'urine:prot')
     code_phrase = stub(CodePhrase, :terminology_id => terminology_id)
     symbol = stub(DvCodedText, :defining_code => code_phrase)
Index: ruby/branches/0.5/spec/lib/open_ehr/rm/data_types/text/code_phrase_spec.rb
===================================================================
--- ruby/branches/0.5/spec/lib/open_ehr/rm/data_types/text/code_phrase_spec.rb	(revision 256)
+++ ruby/branches/0.5/spec/lib/open_ehr/rm/data_types/text/code_phrase_spec.rb	(revision 259)
@@ -5,5 +5,5 @@
 describe CodePhrase do
   before(:each) do
-    terminology_id = TerminologyId.new('openehr')
+    terminology_id = TerminologyID.new(:value => 'openehr')
     @code_phrase = CodePhrase.new(:code_string => '535',
                                   :terminology_id => terminology_id)
Index: ruby/branches/0.5/spec/lib/open_ehr/rm/data_types/text/dv_text_spec.rb
===================================================================
--- ruby/branches/0.5/spec/lib/open_ehr/rm/data_types/text/dv_text_spec.rb	(revision 256)
+++ ruby/branches/0.5/spec/lib/open_ehr/rm/data_types/text/dv_text_spec.rb	(revision 259)
@@ -5,5 +5,5 @@
 describe DvText do
   before(:each) do
-    terminology_id = TerminologyId.new('openehr')
+    terminology_id = TerminologyID.new(:value => 'openehr')
     language = CodePhrase.new(:terminology_id => terminology_id,
                               :code_string => 'ja')
Index: ruby/branches/0.5/spec/spec.opts
===================================================================
--- ruby/branches/0.5/spec/spec.opts	(revision 256)
+++ ruby/branches/0.5/spec/spec.opts	(revision 259)
@@ -1,4 +1,4 @@
 --colour
---format specdoc
+--format progress
 --loadby mtime
 --reverse
