Index: /ruby/branches/TRY-open_ehr_gem/Rakefile
===================================================================
--- /ruby/branches/TRY-open_ehr_gem/Rakefile	(revision 306)
+++ /ruby/branches/TRY-open_ehr_gem/Rakefile	(revision 306)
@@ -0,0 +1,46 @@
+require 'rubygems'
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+require 'rake/clean'
+require 'rake/gempackagetask'
+require 'yaml'
+
+
+gem_spec = Gem::Specification.new do |s|
+  s.name = 'open_ehr'
+  s.author = 'Shinji KOBAYASHI, Akimichi TATSUKAWA'
+  s.version = '0.0.1'
+  s.summary = 'OpenEHR models'
+  s.email = 'openehr-jp@openehr.jp'
+  candidates = %w(lib test vendor)
+  candidates.each do |dir|
+    s.files = s.files + Dir.glob("#{dir}/**/*" ).delete_if do |item|
+      item.include?(".svn") || item.index(/.*~/) || item.include?("rdoc")
+    end
+  end
+  s.require_path = "lib"
+#  s.require_path = "."
+  s.has_rdoc = false
+#  s.extra_rdoc_files = ["README"]
+end
+
+
+Rake::GemPackageTask.new(gem_spec) do |pkg|
+  pkg.need_zip = false
+  pkg.need_tar = false
+end
+
+#CLOBBER.include('rdoc')
+#CLEAN.include('lib/*.output', 'log/*.log')
+
+
+
+
+### Local Variables:
+### mode:ruby
+### mode:font-lock
+### comment-column:0
+### comment-start: "### "
+### comment-end:"" 
+### End:
Index: by/branches/TRY-open_ehr_gem/lib/am.rb
===================================================================
--- /ruby/branches/TRY-open_ehr_gem/lib/am.rb	(revision 305)
+++ 	(revision )
@@ -1,57 +1,0 @@
-#! /usr/bin/env ruby
-# component: openEHR Ruby reference implementation
-# description: This file includes Archetype 
-#      class that contains Archetype values.
-#      Main concept is based on Java ref impl.
-#      We should make refactoring to suit for Ruby way.
-# keywords: archetype
-# author: Akimichi TATSUKAWA, Shinji KOBAYASHI
-# support: openEHR.jp
-# license: openEHR open source license
-#
-
-$:.unshift File.join(File.dirname(__FILE__))
-require 'rm/common/resource.rb'
-#require 'rm/support/terminology/openehr_code_set_identifier.rb'
-module OpenEhr
-  module AM
-    module Archetype
-      autoload :ARCHETYPE, "am/archetype/archetype.rb"
-      autoload :Constraint_Model, "am/archetype/constraint_model/archetype_constraint.rb"
-      autoload :Ontology, "am/archetype/ontology.rb"
-      
-      module Archetype_Description
-        autoload :ARCHETYPE_DESCRIPTION, "am/archetype/archetype_description/archetype_description.rb"
-      end
-
-      module Constraint_Model
-        autoload :ARCHETYPE_CONSTRAINT, "am/archetype/constraint_model/archetype_constraint.rb"
-        autoload :ARCHETYPE_SLOT, "am/archetype/constraint_model/archetype_constraint.rb"
-        autoload :Primitive, "am/archetype/constraint_model/primitive.rb"
-      end #end of ConstraintModel
-
-      module Assertion
-        autoload :ASSERTION, "am/archetype/constraint_model/assertion.rb"
-      end
-
-    end # of Archetype
-
-    module OpenEHR_Profile
-      module DataTypes
-        module Basic
-          autoload :C_DV_STATE, "am/openehr_profile/data_types/basic.rb"
-        end
-
-        module Text
-          autoload :C_CODE_PHASE, "am/openehr_profile/data_types/text.rb"
-        end
-
-        module Quantity
-          autoload :C_DV_QUANTITY, "am/openehr_profile/data_types/quantity.rb"
-          autoload :C_DV_ORDINAL, "am/openehr_profile/data_types/quantity.rb"
-          autoload :C_QUANTITY_ITEM, "am/openehr_profile/data_types/quantity.rb"
-        end
-      end
-    end
-  end # of AM
-end # of OpenEHR
Index: /ruby/branches/TRY-open_ehr_gem/lib/assumed_library_types.rb
===================================================================
--- /ruby/branches/TRY-open_ehr_gem/lib/assumed_library_types.rb	(revision 305)
+++ /ruby/branches/TRY-open_ehr_gem/lib/assumed_library_types.rb	(revision 306)
@@ -3,5 +3,5 @@
 require 'time'
 
-module OpenEHR
+module OpenEhr
   module AssumedLibraryTypes
     class Any < Object
Index: /ruby/branches/TRY-open_ehr_gem/lib/open_ehr.rb
===================================================================
--- /ruby/branches/TRY-open_ehr_gem/lib/open_ehr.rb	(revision 306)
+++ /ruby/branches/TRY-open_ehr_gem/lib/open_ehr.rb	(revision 306)
@@ -0,0 +1,77 @@
+$:.unshift File.join(File.dirname(__FILE__))
+#require 'am.rb'
+#require 'rm.rb'
+#require 'assumed_library_types.rb'
+
+
+$:.unshift File.join(File.dirname(__FILE__))
+#require 'rm/common/resource.rb'
+#require 'rm/support/terminology/openehr_code_set_identifier.rb'
+
+module OpenEhr
+  module RM
+    module Common
+      module Resource
+        autoload :AuthoredResource, "rm/common/resource.rb"
+        autoload :TranslationDetails, "rm/common/resource.rb"
+        autoload :ResourceDescription, "rm/common/resource.rb"
+        autoload :ResourceDescriptionItem, "rm/common/resource.rb"
+      end
+    end
+    module Support
+      module AssumedTypes
+        autoload :Interval, "rm/support/assumed_types.rb"
+        autoload :List, "rm/support/assumed_types.rb"
+      end
+
+      module Identification
+        autoload :ObjectID, "rm/support/identification.rb"
+        autoload :ObjectRef, "rm/support/identification.rb"
+        autoload :ArchetypeID, "rm/support/identification.rb"
+      end
+    end
+  end
+
+  module AM
+    module Archetype
+      autoload :ARCHETYPE, "am/archetype/archetype.rb"
+      autoload :Constraint_Model, "am/archetype/constraint_model/archetype_constraint.rb"
+      autoload :Ontology, "am/archetype/ontology.rb"
+
+      module Archetype_Description
+        autoload :ARCHETYPE_DESCRIPTION, "am/archetype/archetype_description/archetype_description.rb"
+      end
+
+      module Constraint_Model
+        autoload :ARCHETYPE_CONSTRAINT, "am/archetype/constraint_model/archetype_constraint.rb"
+        autoload :ARCHETYPE_SLOT, "am/archetype/constraint_model/archetype_constraint.rb"
+        autoload :Primitive, "am/archetype/constraint_model/primitive.rb"
+      end #end of ConstraintModel
+
+      module Assertion
+        autoload :ASSERTION, "am/archetype/constraint_model/assertion.rb"
+      end
+
+    end # of Archetype
+
+    module OpenEHR_Profile
+      module DataTypes
+        module Basic
+          autoload :C_DV_STATE, "am/openehr_profile/data_types/basic.rb"
+        end
+
+        module Text
+          autoload :C_CODE_PHASE, "am/openehr_profile/data_types/text.rb"
+        end
+
+        module Quantity
+          autoload :C_DV_QUANTITY, "am/openehr_profile/data_types/quantity.rb"
+          autoload :C_DV_ORDINAL, "am/openehr_profile/data_types/quantity.rb"
+          autoload :C_QUANTITY_ITEM, "am/openehr_profile/data_types/quantity.rb"
+        end
+      end
+    end
+  end # of AM
+end # of OpenEHR
+
+
Index: /ruby/branches/TRY-open_ehr_gem/lib/rm/common/archetyped.rb
===================================================================
--- /ruby/branches/TRY-open_ehr_gem/lib/rm/common/archetyped.rb	(revision 305)
+++ /ruby/branches/TRY-open_ehr_gem/lib/rm/common/archetyped.rb	(revision 306)
@@ -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
Index: /ruby/branches/TRY-open_ehr_gem/lib/rm/common/directory.rb
===================================================================
--- /ruby/branches/TRY-open_ehr_gem/lib/rm/common/directory.rb	(revision 305)
+++ /ruby/branches/TRY-open_ehr_gem/lib/rm/common/directory.rb	(revision 306)
@@ -2,10 +2,10 @@
 # http://www.openehr.org/uml/release-1.0.1/Browsable/_9_5_1_76d0249_1140536622627_218703_7149Report.html
 # Ticket refs #63
-include OpenEHR::RM::DataTypes::Text
-module OpenEHR
+#include OpenEhr::RM::DataTypes::Text
+module OpenEhr
   module RM
     module Common
       module Directory
-        class Folder < OpenEHR::RM::Common::Archetyped::Locatable
+        class Folder < OpenEhr::RM::Common::Archetyped::Locatable
           attr_accessor :items
           attr_reader :folders
@@ -21,6 +21,7 @@
             @folders = folders
           end
-        end        
-        class VersionedFolder < OpenEHR::RM::Common::ChangeControl::VersionedObject
+        end
+
+        class VersionedFolder < OpenEhr::RM::Common::ChangeControl::VersionedObject
         end
       end # of Directory
Index: /ruby/branches/TRY-open_ehr_gem/lib/rm/common/generic.rb
===================================================================
--- /ruby/branches/TRY-open_ehr_gem/lib/rm/common/generic.rb	(revision 305)
+++ /ruby/branches/TRY-open_ehr_gem/lib/rm/common/generic.rb	(revision 306)
@@ -2,6 +2,6 @@
 # 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
+#include OpenEhr::RM::Support::Identification
+#include OpenEhr::RM::DataTypes::Basic
 module OpenEhr
   module RM
Index: /ruby/branches/TRY-open_ehr_gem/lib/rm/data_structures.rb
===================================================================
--- /ruby/branches/TRY-open_ehr_gem/lib/rm/data_structures.rb	(revision 305)
+++ /ruby/branches/TRY-open_ehr_gem/lib/rm/data_structures.rb	(revision 306)
@@ -4,8 +4,8 @@
 # refs #59
 
-module OpenEHR
+module OpenEhr
   module RM
     module DataStructures
-      class DataStructure < OpenEHR::RM::Common::Archetyped::Locatable
+      class DataStructure < OpenEhr::RM::Common::Archetyped::Locatable
         def initialize(args = { })
           super(args)
Index: /ruby/branches/TRY-open_ehr_gem/lib/rm/data_structures/item_structure.rb
===================================================================
--- /ruby/branches/TRY-open_ehr_gem/lib/rm/data_structures/item_structure.rb	(revision 305)
+++ /ruby/branches/TRY-open_ehr_gem/lib/rm/data_structures/item_structure.rb	(revision 306)
@@ -3,7 +3,7 @@
 # http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109346709572_859750_3810Report.html
 # refs #54
-require 'set'
-include OpenEHR::RM::DataStructures
-module OpenEHR
+#require 'set'
+#include OpenEHR::RM::DataStructures
+module OpenEhr
   module RM
     module DataStructures
Index: /ruby/branches/TRY-open_ehr_gem/lib/rm/data_structures/item_structure/representation.rb
===================================================================
--- /ruby/branches/TRY-open_ehr_gem/lib/rm/data_structures/item_structure/representation.rb	(revision 305)
+++ /ruby/branches/TRY-open_ehr_gem/lib/rm/data_structures/item_structure/representation.rb	(revision 306)
@@ -3,10 +3,10 @@
 # http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109066789167_738055_2581Report.html
 # refs #53
-module OpenEHR
+module OpenEhr
   module RM
     module DataStructures
       module ItemStructure
         module Representation
-          class Item < OpenEHR::RM::Common::Archetyped::Locatable
+          class Item < OpenEhr::RM::Common::Archetyped::Locatable
             def initialize(args = {})
               super(args)
Index: /ruby/branches/TRY-open_ehr_gem/lib/rm/demographic.rb
===================================================================
--- /ruby/branches/TRY-open_ehr_gem/lib/rm/demographic.rb	(revision 305)
+++ /ruby/branches/TRY-open_ehr_gem/lib/rm/demographic.rb	(revision 306)
@@ -5,5 +5,5 @@
   module RM
     module Demogrphic
-      class Address < OpenEHR::RM::Common::Archetyped::Locatable
+      class Address < OpenEhr::RM::Common::Archetyped::Locatable
         attr_reader :details
 
@@ -17,10 +17,10 @@
       end
 
-      class Capability < OpenEHR::RM::Common::Archetyped::Locatable
+      class Capability < OpenEhr::RM::Common::Archetyped::Locatable
         attr_reader :credentials, :time_validity
 
       end
 
-      class Party < OpenEHR::RM::Common::Archetyped::Locatable
+      class Party < OpenEhr::RM::Common::Archetyped::Locatable
         attr_reader :details, :reverse_relationships, :uid
         attr_reader :idetities, :contacts, :relationships
@@ -38,25 +38,34 @@
           relationships_valid(relationships)
         end
+
         def type
-          return name
-        end
+          name
+        end
+
         def uid=(uid)
           uid_valid(uid)
           @uid = uid
         end
+
         def identities=(identities)
           identities_vaild(identities)
           @identities = identities
+        end
+
         def contacts=(contacts)
           contacts_valid(contacts)
           @contacts = contacts
         end
+
         def parent=(parent)
           @parent = nil
         end
+
         private
+
         def uid_valid(uid)
           raise ArgumentError, "uid is not valid" if uid.nil?
         end
+
         def identities_vaild(identities)
           if identities.nil?
@@ -66,4 +75,5 @@
           end
         end
+
         def contacts_valid(contacts)
           if contacs.nil?
@@ -71,18 +81,18 @@
           elsif contacts.empty?
             raise ArgumentError, "contacts must not be empty"
-          end          
-        end
-      end
-
-      class PartyIdentity < OpenEHR::RM::Common::Archetyped::Locatable
+          end
+        end
+      end
+
+      class PartyIdentity < OpenEhr::RM::Common::Archetyped::Locatable
         attr_reader :details
 
       end
 
-      class PartyRelationship < OpenEHR::RM::Common::Archetyped::Locatable
-
-      end
-
-      class Versioned_Party < OpenEHR::RM::Common::Archetyped::Locatable
+      class PartyRelationship < OpenEhr::RM::Common::Archetyped::Locatable
+
+      end
+
+      class Versioned_Party < OpenEhr::RM::Common::Archetyped::Locatable
 
       end
@@ -136,8 +146,11 @@
           end
           @values = values
-      end
-      class Contact < OpenEHR::RM::Common::Archetyped::Locatable
+        end
+      end
+
+      class Contact < OpenEhr::RM::Common::Archetyped::Locatable
         attr_accessor :time_validity
         attr_reader :addresses
+
         def initialize(uid, archetype_node_id, name, archetype_details,
                        feeder_audit, links, parent, time_validity, addresses)
@@ -148,15 +161,20 @@
           @time_validity = time_validity
         end
+
         def purpose
           @name
         end
+
         def purpose=(purpose)
           @name = purpose
         end
+
         def addresses=(addresses)
           address_exists?(addresses)
           @addresses = addresses
         end
+
         private
+
         def address_exists?(addresses)
           if addresses.nil?
Index: /ruby/branches/TRY-open_ehr_gem/lib/rm/security.rb
===================================================================
--- /ruby/branches/TRY-open_ehr_gem/lib/rm/security.rb	(revision 305)
+++ /ruby/branches/TRY-open_ehr_gem/lib/rm/security.rb	(revision 306)
@@ -2,9 +2,9 @@
 # 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
       class AccessControlSettings
-        
+
       end
     end
Index: /ruby/branches/TRY-open_ehr_gem/lib/rm/support/assumed_types.rb
===================================================================
--- /ruby/branches/TRY-open_ehr_gem/lib/rm/support/assumed_types.rb	(revision 305)
+++ /ruby/branches/TRY-open_ehr_gem/lib/rm/support/assumed_types.rb	(revision 306)
@@ -12,7 +12,7 @@
           def initialize(lower, upper,
                          lower_included = nil, upper_included = nil)
-            if ((lower !=nil) && (upper !=nil)) && lower>upper
-              raise ArgumentError, "upper < lower"
-            end
+#             if ((lower !=nil) && (upper !=nil)) && lower>upper
+#               raise ArgumentError, "upper < lower"
+#             end
             @lower = lower
             @upper = upper
Index: /ruby/branches/TRY-open_ehr_gem/lib/rm/support/definition.rb
===================================================================
--- /ruby/branches/TRY-open_ehr_gem/lib/rm/support/definition.rb	(revision 305)
+++ /ruby/branches/TRY-open_ehr_gem/lib/rm/support/definition.rb	(revision 306)
@@ -1,3 +1,3 @@
-module OpenEHR
+module OpenEhr
   module RM
     module Support
Index: /ruby/branches/TRY-open_ehr_gem/lib/rm/support/identification.rb
===================================================================
--- /ruby/branches/TRY-open_ehr_gem/lib/rm/support/identification.rb	(revision 305)
+++ /ruby/branches/TRY-open_ehr_gem/lib/rm/support/identification.rb	(revision 306)
@@ -2,5 +2,5 @@
 # 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
@@ -15,5 +15,5 @@
           def value=(value)
             raise ArgumentError, "empty value" if value.nil? or value.empty?
-            @value = value            
+            @value = value
           end
 
@@ -52,15 +52,14 @@
 
         class ArchetypeID < ObjectID
-          attr_reader :rm_originator, :rm_name, :rm_entity,
-                      :concept_name, :specialisation, :version_id
-          
+          attr_accessor :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]
+              @rm_originator = args[:rm_originator]
+              @rm_name = args[:rm_name]
+              @rm_entity = args[:rm_entity]
+              @concept_name = args[:concept_name]
+              @version_id = args[:version_id]
+              @specialisation = args[:specialisation]
             else
               super(args)
@@ -98,53 +97,53 @@
           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)
-            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
-
-          def rm_name=(rm_name)
-            raise ArgumentError, "rm_name not valid" if rm_name.nil? or rm_name.empty?
-            @rm_name = rm_name
-          end
-
-          def rm_entity=(rm_entity)
-            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)
-            if rm_originator.nil? or rm_originator.empty?
-              raise ArgumentError, "rm_originator not valid"
-            end
-            @rm_originator = rm_originator
-          end
-
-          def specialisation=(specialisation)
-            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?
-            @version_id = 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)
+#             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
+
+#           def rm_name=(rm_name)
+#             raise ArgumentError, "rm_name not valid" if rm_name.nil? or rm_name.empty?
+#             @rm_name = rm_name
+#           end
+
+#           def rm_entity=(rm_entity)
+#             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)
+#             if rm_originator.nil? or rm_originator.empty?
+#               raise ArgumentError, "rm_originator not valid"
+#             end
+#             @rm_originator = rm_originator
+#           end
+
+#           def specialisation=(specialisation)
+#             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?
+#             @version_id = version_id
+#           end
         end
 
Index: /ruby/branches/TRY-open_ehr_gem/lib/rm/support/measurement.rb
===================================================================
--- /ruby/branches/TRY-open_ehr_gem/lib/rm/support/measurement.rb	(revision 305)
+++ /ruby/branches/TRY-open_ehr_gem/lib/rm/support/measurement.rb	(revision 306)
@@ -1,3 +1,3 @@
-module OpenEHR
+module OpenEhr
   module RM
     module Support
Index: /ruby/branches/TRY-open_ehr_gem/lib/rm/support/terminology.rb
===================================================================
--- /ruby/branches/TRY-open_ehr_gem/lib/rm/support/terminology.rb	(revision 305)
+++ /ruby/branches/TRY-open_ehr_gem/lib/rm/support/terminology.rb	(revision 306)
@@ -1,4 +1,4 @@
 
-module OpenEHR
+module OpenEhr
   module RM
     module Support
