Changeset 167


Ignore:
Timestamp:
Aug 6, 2009, 1:20:05 AM (11 years ago)
Author:
KOBAYASHI, Shinji
Message:

adjust for rails

Location:
ruby/branches
Files:
11 added
88 edited
7 moved

Legend:

Unmodified
Added
Removed
  • ruby/branches/0.0/adl_parser/bin/adl_validator.rb

    r4 r167  
    77require 'net/http'
    88
    9 module OpenEHR
     9module OpenEhr
    1010  module CommandLine
    1111    class Arguments < Hash
     
    4040            when /\A(http:\/\/.*)/
    4141              name = $1
    42               input = case response = Net::HTTP.get_response(URI.parse($1))
     42              input = case response = Net::HTTP.get_response(Uri.parse($1))
    4343                      when Net::HTTPSuccess   
    4444                        response.body
     
    7474if __FILE__ == $0
    7575  begin
    76     arguments = OpenEHR::CommandLine::Arguments.new(ARGV)
    77     validator = OpenEHR::CommandLine::ADLValidator.new(arguments)
     76    arguments = OpenEhr::CommandLine::Arguments.new(ARGV)
     77    validator = OpenEhr::CommandLine::ADLValidator.new(arguments)
    7878    validator.run
    7979  end
  • ruby/branches/0.0/adl_parser/lib/model.rb

    r19 r167  
    22
    33
    4 module OpenEHR
     4module OpenEhr
    55  module ADL
    66    module Model
  • ruby/branches/0.0/adl_parser/lib/parser.rb

    r33 r167  
    2020
    2121
    22 module OpenEHR
     22module OpenEhr
    2323
    2424  module ADL
  • ruby/branches/0.0/adl_parser/lib/scanner.rb

    r33 r167  
    55
    66
    7 module OpenEHR
     7module OpenEhr
    88  module ADL
    99    module Scanner
     
    138138            @parser = lambda do |input|
    139139              Yaparc::Alt.new(Reserved.new,
    140                               OpenEHR::ADL::Scanner::Common::V_QUALIFIED_TERM_CODE_REF.new,
    141                               OpenEHR::ADL::Scanner::Common::V_LOCAL_TERM_CODE_REF.new,
    142                               OpenEHR::ADL::Scanner::Common::ERR_V_QUALIFIED_TERM_CODE_REF.new,
    143                               OpenEHR::ADL::Scanner::Common::V_TYPE_IDENTIFIER.new,
    144                               OpenEHR::ADL::Scanner::Common::V_GENERIC_TYPE_IDENTIFIER.new,
    145                               OpenEHR::ADL::Scanner::Common::V_STRING.new,
    146                               OpenEHR::ADL::Scanner::Common::V_LOCAL_CODE.new,
    147                               OpenEHR::ADL::Scanner::Common::V_REAL.new,
    148                               OpenEHR::ADL::Scanner::Common::V_ISO8601_DURATION.new
     140                              OpenEhr::ADL::Scanner::Common::V_QUALIFIED_TERM_CODE_REF.new,
     141                              OpenEhr::ADL::Scanner::Common::V_LOCAL_TERM_CODE_REF.new,
     142                              OpenEhr::ADL::Scanner::Common::ERR_V_QUALIFIED_TERM_CODE_REF.new,
     143                              OpenEhr::ADL::Scanner::Common::V_TYPE_IDENTIFIER.new,
     144                              OpenEhr::ADL::Scanner::Common::V_GENERIC_TYPE_IDENTIFIER.new,
     145                              OpenEhr::ADL::Scanner::Common::V_STRING.new,
     146                              OpenEhr::ADL::Scanner::Common::V_LOCAL_CODE.new,
     147                              OpenEhr::ADL::Scanner::Common::V_REAL.new,
     148                              OpenEhr::ADL::Scanner::Common::V_ISO8601_DURATION.new
    149149                              )
    150150            end
     
    157157          def initialize
    158158            @parser = lambda do |input|
    159               reserved_parsers = OpenEHR::ADL::Scanner::DADL::RESERVED.map do |keyword|
     159              reserved_parsers = OpenEhr::ADL::Scanner::DADL::RESERVED.map do |keyword|
    160160                Yaparc::Tokenize.new(
    161161                                     Yaparc::Literal.new(keyword[0])
     
    163163              end
    164164              Yaparc::Alt.new(Yaparc::Apply.new(Yaparc::Alt.new(*reserved_parsers)) do |match|
    165                                 OpenEHR::ADL::Scanner::Common::LOG.info("Reserved: #{match}")
    166                                 [OpenEHR::ADL::Scanner::DADL::RESERVED[match], OpenEHR::ADL::Scanner::DADL::RESERVED[match]]
     165                                OpenEhr::ADL::Scanner::Common::LOG.info("Reserved: #{match}")
     166                                [OpenEhr::ADL::Scanner::DADL::RESERVED[match], OpenEhr::ADL::Scanner::DADL::RESERVED[match]]
    167167                              end,
    168168                              Yaparc::Apply.new(Yaparc::Regex.new(/\A[a-z][a-zA-Z0-9_]*/)) do |match|
    169                                 OpenEHR::ADL::Scanner::Common::LOG.info("V_ATTRIBUTE_IDENTIFIER: #{match}")
     169                                OpenEhr::ADL::Scanner::Common::LOG.info("V_ATTRIBUTE_IDENTIFIER: #{match}")
    170170                                [:V_ATTRIBUTE_IDENTIFIER, match]
    171171                              end)
     
    215215            @parser = lambda do |input|
    216216              Yaparc::Apply.new(Yaparc::Regex.new(/\A[yY][yY][yY][yY]-[mM?X][mM?X]-[dD?X][dD?X][T\t][hH?X][hH?X]:[mM?X][mM?X]:[sS?X][sS?X]/)) do |match|
    217                 OpenEHR::ADL::Scanner::Common::LOG.info("V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN: #{match}")
     217                OpenEhr::ADL::Scanner::Common::LOG.info("V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN: #{match}")
    218218                [:V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN, match]
    219219              end
     
    228228            @parser = lambda do |input|
    229229              Yaparc::Apply.new(Yaparc::Regex.new(/\A[yY][yY][yY][yY]-[mM?X][mM?X]-[dD?X][dD?X]/)) do |match|
    230                 OpenEHR::ADL::Scanner::Common::LOG.info("V_ISO8601_DATE_CONSTRAINT_PATTERN: #{match}")
     230                OpenEhr::ADL::Scanner::Common::LOG.info("V_ISO8601_DATE_CONSTRAINT_PATTERN: #{match}")
    231231                [:V_ISO8601_DATE_CONSTRAINT_PATTERN, match]
    232232              end
     
    241241            @parser = lambda do |input|
    242242              Yaparc::Apply.new(Yaparc::Regex.new(/\A[hH][hH]:[mM?X][mM?X]:[sS?X][sS?X]/)) do |match|
    243                 OpenEHR::ADL::Scanner::Common::LOG.info("V_ISO8601_TIME_CONSTRAINT_PATTERN: #{match}")
     243                OpenEhr::ADL::Scanner::Common::LOG.info("V_ISO8601_TIME_CONSTRAINT_PATTERN: #{match}")
    244244                [:V_ISO8601_TIME_CONSTRAINT_PATTERN, match]
    245245              end
     
    255255              Yaparc::Apply.new(Yaparc::Alt.new(Yaparc::Regex.new(/\AP[yY]?[mM]?[wW]?[dD]?T[hH]?[mM]?[sS]?/),
    256256                                                Yaparc::Regex.new(/\AP[yY]?[mM]?[wW]?[dD]?/))) do |match|
    257                 OpenEHR::ADL::Scanner::Common::LOG.info("V_ISO8601_DURATION_CONSTRAINT_PATTERN: #{match}")
     257                OpenEhr::ADL::Scanner::Common::LOG.info("V_ISO8601_DURATION_CONSTRAINT_PATTERN: #{match}")
    258258                [:V_ISO8601_DURATION_CONSTRAINT_PATTERN, match]
    259259              end
     
    268268            @parser = lambda do |input|
    269269              Yaparc::Apply.new(Yaparc::Regex.new(/\A[A-Z][a-zA-Z0-9_]*[ \n]*\</)) do |match|
    270                 OpenEHR::ADL::Scanner::Common::LOG.info("V_C_DOMAIN_TYPE: #{match}")
     270                OpenEhr::ADL::Scanner::Common::LOG.info("V_C_DOMAIN_TYPE: #{match}")
    271271                [:START_V_C_DOMAIN_TYPE_BLOCK, match]
    272272              end
     
    282282                              V_ISO8601_DATE_CONSTRAINT_PATTERN.new,
    283283                              V_ISO8601_TIME_CONSTRAINT_PATTERN.new,
    284                               OpenEHR::ADL::Scanner::Common::V_ISO8601_DURATION.new,
     284                              OpenEhr::ADL::Scanner::Common::V_ISO8601_DURATION.new,
    285285                              V_C_DOMAIN_TYPE.new,
    286286                              V_ISO8601_DURATION_CONSTRAINT_PATTERN.new,
    287287                              Reserved.new,
    288                               OpenEHR::ADL::Scanner::Common::V_QUALIFIED_TERM_CODE_REF.new,
    289                               OpenEHR::ADL::Scanner::Common::V_LOCAL_TERM_CODE_REF.new,
    290                               OpenEHR::ADL::Scanner::Common::ERR_V_QUALIFIED_TERM_CODE_REF.new,
    291                               OpenEHR::ADL::Scanner::Common::V_TYPE_IDENTIFIER.new,
    292                               OpenEHR::ADL::Scanner::Common::V_GENERIC_TYPE_IDENTIFIER.new,
    293                               OpenEHR::ADL::Scanner::Common::V_STRING.new,
    294                               OpenEHR::ADL::Scanner::Common::V_LOCAL_CODE.new,
    295                               OpenEHR::ADL::Scanner::Common::V_REAL.new,
    296                               OpenEHR::ADL::Scanner::Common::V_ISO8601_DURATION.new
     288                              OpenEhr::ADL::Scanner::Common::V_QUALIFIED_TERM_CODE_REF.new,
     289                              OpenEhr::ADL::Scanner::Common::V_LOCAL_TERM_CODE_REF.new,
     290                              OpenEhr::ADL::Scanner::Common::ERR_V_QUALIFIED_TERM_CODE_REF.new,
     291                              OpenEhr::ADL::Scanner::Common::V_TYPE_IDENTIFIER.new,
     292                              OpenEhr::ADL::Scanner::Common::V_GENERIC_TYPE_IDENTIFIER.new,
     293                              OpenEhr::ADL::Scanner::Common::V_STRING.new,
     294                              OpenEhr::ADL::Scanner::Common::V_LOCAL_CODE.new,
     295                              OpenEhr::ADL::Scanner::Common::V_REAL.new,
     296                              OpenEhr::ADL::Scanner::Common::V_ISO8601_DURATION.new
    297297                              )
    298298            end
     
    310310              end
    311311              Yaparc::Alt.new(Yaparc::Apply.new(Yaparc::Alt.new(*reserved_parsers)) do |match|
    312                                 OpenEHR::ADL::Scanner::Common::LOG.info("Reserved: #{match}")
    313                                 [OpenEHR::ADL::Scanner::CADL::RESERVED[match], OpenEHR::ADL::Scanner::CADL::RESERVED[match]]
     312                                OpenEhr::ADL::Scanner::Common::LOG.info("Reserved: #{match}")
     313                                [OpenEhr::ADL::Scanner::CADL::RESERVED[match], OpenEhr::ADL::Scanner::CADL::RESERVED[match]]
    314314                              end,
    315315                              Yaparc::Apply.new(Yaparc::Regex.new(/\A[a-z][a-zA-Z0-9_]*/)) do |match|
    316                                 OpenEHR::ADL::Scanner::Common::LOG.info("V_ATTRIBUTE_IDENTIFIER: #{match}")
     316                                OpenEhr::ADL::Scanner::Common::LOG.info("V_ATTRIBUTE_IDENTIFIER: #{match}")
    317317                                [:V_ATTRIBUTE_IDENTIFIER, match]
    318318                              end)
  • ruby/branches/0.0/adl_parser/lib/shell.rb

    r4 r167  
    33require 'stringio'
    44
    5 module OpenEHR
     5module OpenEhr
    66  module Application
    77    class Shell
  • ruby/branches/0.0/adl_parser/lib/validator.rb

    r4 r167  
    33
    44
    5 module OpenEHR
     5module OpenEhr
    66  module ADL
    77
  • ruby/branches/0.0/adl_parser/tests/parser_test.rb

    r23 r167  
    1515    assert_nothing_raised do
    1616      result = @parser.parse(laboratory_request, 'openEHR-EHR-ITEM_TREE.Laboratory_request.v1.adl')
    17       assert_instance_of OpenEHR::AM::Archetype::ARCHETYPE, result
    18       assert_instance_of OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION, result.description
    19       assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, result.definition
     17      assert_instance_of OpenEhr::AM::Archetype::ARCHETYPE, result
     18      assert_instance_of OpenEhr::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION, result.description
     19      assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, result.definition
    2020#      assert_equal '', result.definition
    2121    end
     
    2424    assert_nothing_raised do
    2525      result = @parser.parse(apgar, 'openEHR-EHR-OBSERVATION.apgar.v1.adl')
    26       assert_instance_of OpenEHR::AM::Archetype::ARCHETYPE, result
    27       assert_instance_of OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION, result.description
    28       assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, result.definition
     26      assert_instance_of OpenEhr::AM::Archetype::ARCHETYPE, result
     27      assert_instance_of OpenEhr::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION, result.description
     28      assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, result.definition
    2929    end
    3030
  • ruby/branches/0.0/adl_parser/tests/scanner_test.rb

    r20 r167  
    44class YaparcParserTest < Test::Unit::TestCase
    55  def test_RootScanner
    6     parser = OpenEHR::ADL::Scanner::DADL::RootScanner.new
    7     assert_instance_of OpenEHR::ADL::Scanner::DADL::RootScanner,parser
     6    parser = OpenEhr::ADL::Scanner::DADL::RootScanner.new
     7    assert_instance_of OpenEhr::ADL::Scanner::DADL::RootScanner,parser
    88    result = parser.parse('')
    99  end
    1010
    1111  def test_V_LOCAL_TERM_CODE_REF
    12     parser = OpenEHR::ADL::Scanner::Common::V_LOCAL_TERM_CODE_REF.new
    13     assert_instance_of OpenEHR::ADL::Scanner::Common::V_LOCAL_TERM_CODE_REF,parser
     12    parser = OpenEhr::ADL::Scanner::Common::V_LOCAL_TERM_CODE_REF.new
     13    assert_instance_of OpenEhr::ADL::Scanner::Common::V_LOCAL_TERM_CODE_REF,parser
    1414    result = parser.parse('[en-us]')
    1515    assert_instance_of Yaparc::Result::OK, result
     
    1717
    1818  def test_V_QUALIFIED_TERM_CODE_REF
    19     parser = OpenEHR::ADL::Scanner::Common::V_QUALIFIED_TERM_CODE_REF.new
    20     assert_instance_of OpenEHR::ADL::Scanner::Common::V_QUALIFIED_TERM_CODE_REF,parser
     19    parser = OpenEhr::ADL::Scanner::Common::V_QUALIFIED_TERM_CODE_REF.new
     20    assert_instance_of OpenEhr::ADL::Scanner::Common::V_QUALIFIED_TERM_CODE_REF,parser
    2121    result = parser.parse('[ISO_639::en]')
    2222    assert_instance_of Yaparc::Result::OK, result
     
    2626
    2727  def test_V_STRING
    28     parser = OpenEHR::ADL::Scanner::Common::V_STRING.new
    29     assert_instance_of OpenEHR::ADL::Scanner::Common::V_STRING,parser
     28    parser = OpenEhr::ADL::Scanner::Common::V_STRING.new
     29    assert_instance_of OpenEhr::ADL::Scanner::Common::V_STRING,parser
    3030    result = parser.parse('"this is a string"')
    3131    assert_instance_of Yaparc::Result::OK, result
     
    3535
    3636  def test_V_REAL
    37     parser = OpenEHR::ADL::Scanner::Common::V_REAL.new
    38     assert_instance_of OpenEHR::ADL::Scanner::Common::V_REAL,parser
     37    parser = OpenEhr::ADL::Scanner::Common::V_REAL.new
     38    assert_instance_of OpenEhr::ADL::Scanner::Common::V_REAL,parser
    3939    result = parser.parse('0.1')
    4040    assert_instance_of Yaparc::Result::OK, result
     
    4646
    4747  def test_V_ISO8601_DURATION
    48     parser = OpenEHR::ADL::Scanner::Common::V_ISO8601_DURATION.new
    49     assert_instance_of OpenEHR::ADL::Scanner::Common::V_ISO8601_DURATION,parser
     48    parser = OpenEhr::ADL::Scanner::Common::V_ISO8601_DURATION.new
     49    assert_instance_of OpenEhr::ADL::Scanner::Common::V_ISO8601_DURATION,parser
    5050    result = parser.parse('PT1M')
    5151    assert_instance_of Yaparc::Result::OK, result
     
    5656
    5757  def test_V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN
    58     parser = OpenEHR::ADL::Scanner::CADL::V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN.new
    59     assert_instance_of OpenEHR::ADL::Scanner::CADL::V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN,parser
     58    parser = OpenEhr::ADL::Scanner::CADL::V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN.new
     59    assert_instance_of OpenEhr::ADL::Scanner::CADL::V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN,parser
    6060    result = parser.parse('yyyy-??-??T??:??:??')
    6161    assert_instance_of Yaparc::Result::OK, result
     
    6363
    6464  def test_V_ISO8601_DATE_CONSTRAINT_PATTERN
    65     parser = OpenEHR::ADL::Scanner::CADL::V_ISO8601_DATE_CONSTRAINT_PATTERN.new
    66     assert_instance_of OpenEHR::ADL::Scanner::CADL::V_ISO8601_DATE_CONSTRAINT_PATTERN,parser
     65    parser = OpenEhr::ADL::Scanner::CADL::V_ISO8601_DATE_CONSTRAINT_PATTERN.new
     66    assert_instance_of OpenEhr::ADL::Scanner::CADL::V_ISO8601_DATE_CONSTRAINT_PATTERN,parser
    6767    result = parser.parse('yyyy-mm-XX-dd')
    6868    assert_instance_of Yaparc::Result::OK, result
     
    7070
    7171  def test_V_ISO8601_TIME_CONSTRAINT_PATTERN
    72     parser = OpenEHR::ADL::Scanner::CADL::V_ISO8601_TIME_CONSTRAINT_PATTERN.new
    73     assert_instance_of OpenEHR::ADL::Scanner::CADL::V_ISO8601_TIME_CONSTRAINT_PATTERN,parser
     72    parser = OpenEhr::ADL::Scanner::CADL::V_ISO8601_TIME_CONSTRAINT_PATTERN.new
     73    assert_instance_of OpenEhr::ADL::Scanner::CADL::V_ISO8601_TIME_CONSTRAINT_PATTERN,parser
    7474    result = parser.parse('hh:mm:ss:??')
    7575    assert_instance_of Yaparc::Result::OK, result
     
    7777
    7878  def test_dadl_reserved
    79     parser = OpenEHR::ADL::Scanner::DADL::RootScanner.new
     79    parser = OpenEhr::ADL::Scanner::DADL::RootScanner.new
    8080    result = parser.parse('then')
    8181    assert_instance_of Yaparc::Result::OK, result
     
    8686
    8787  def test_cadl
    88     parser = OpenEHR::ADL::Scanner::CADL::RootScanner.new
    89     assert_instance_of OpenEHR::ADL::Scanner::CADL::RootScanner,parser
     88    parser = OpenEhr::ADL::Scanner::CADL::RootScanner.new
     89    assert_instance_of OpenEhr::ADL::Scanner::CADL::RootScanner,parser
    9090    result = parser.parse('PT1M')
    9191    assert_instance_of Yaparc::Result::OK, result
     
    9797
    9898  def test_cadl_reserved
    99     parser = OpenEHR::ADL::Scanner::CADL::RootScanner.new
     99    parser = OpenEhr::ADL::Scanner::CADL::RootScanner.new
    100100    result = parser.parse('then')
    101101    assert_instance_of Yaparc::Result::OK, result
  • ruby/branches/0.0/models/am.rb

    r23 r167  
    1414require 'rm/common/resource.rb'
    1515#require 'rm/support/terminology/openehr_code_set_identifier.rb'
    16 module OpenEHR
     16module OpenEhr
    1717  module AM
    1818    module Archetype
     
    3737
    3838    module OpenEHR_Profile
    39       module Data_Types
     39      module DataTypes
    4040        module Basic
    4141          autoload :C_DV_STATE, "am/openehr_profile/data_types/basic.rb"
  • ruby/branches/0.0/models/am/archetype/archetype.rb

    r26 r167  
    11require 'rm/support/terminology.rb'
    22
    3 module OpenEHR
     3module OpenEhr
    44  module AM
    55    module Archetype
    66      module ADL_Definition
    77#        include OpenEHR::RM::Support::Terminology::OpenEHR_Code_Set_Identifier
    8         include OpenEHR::RM::Support::Terminology
     8        include OpenEhr::RM::Support::Terminology
    99        CURRENT_ADL_VERSION = "1.4"
    1010      end
    1111
    12       class ARCHETYPE < OpenEHR::RM::Common::Resource::AUTHORED_RESOURCE
     12      class ARCHETYPE < OpenEhr::RM::Common::Resource::AUTHORED_RESOURCE
    1313        include ADL_Definition
    1414        attr_accessor :archetype_id, :concept_code, :is_controlled, :original_language, :parent_archtype_id, :uid
  • ruby/branches/0.0/models/am/archetype/archetype_description/archetype_description.rb

    r23 r167  
    11
    2 module OpenEHR
     2module OpenEhr
    33  module AM
    44    module Archetype
  • ruby/branches/0.0/models/am/archetype/constraint_model/archetype_constraint.rb

    r23 r167  
    11
    2 module OpenEHR
     2module OpenEhr
    33  module AM
    44    module Archetype
  • ruby/branches/0.0/models/am/archetype/constraint_model/assertion.rb

    r23 r167  
    1 module OpenEHR
     1module OpenEhr
    22  module AM
    33    module Archetype
  • ruby/branches/0.0/models/am/archetype/constraint_model/primitive.rb

    r26 r167  
    1 module OpenEHR
     1module OpenEhr
    22  module AM
    33    module Archetype
  • ruby/branches/0.0/models/am/archetype/ontology.rb

    r23 r167  
    1 module OpenEHR
     1module OpenEhr
    22  module AM
    33    module Archetype
  • ruby/branches/0.0/models/am/openehr_profile/data_types/basic.rb

    r23 r167  
    1 module OpenEHR
     1module OpenEhr
    22  module AM
    33    module OpenEHR_Profile
    4       module Data_Types
     4      module DataTypes
    55        module Basic
    66          class C_DV_STATE
  • ruby/branches/0.0/models/am/openehr_profile/data_types/quantity.rb

    r23 r167  
    1 module OpenEHR
     1module OpenEhr
    22  module AM
    33    module OpenEHR_Profile
    4       module Data_Types
     4      module DataTypes
    55
    66        module Quantity
    7           class C_DV_QUANTITY < OpenEHR::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE
     7          class C_DV_QUANTITY < OpenEhr::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE
    88          end
    99         
    10           class C_DV_ORDINAL < OpenEHR::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE
     10          class C_DV_ORDINAL < OpenEhr::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE
    1111          end
    1212
  • ruby/branches/0.0/models/am/openehr_profile/data_types/text.rb

    r23 r167  
    1 module OpenEHR
     1module OpenEhr
    22  module AM
    33    module OpenEHR_Profile
    4       module Data_Types
     4      module DataTypes
    55        module Text
    6           class C_CODE_PHASE < OpenEHR::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE
     6          class C_CODE_PHASE < OpenEhr::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE
    77          end
    88        end
  • ruby/branches/0.0/models/assumed_library_types.rb

    r21 r167  
    1 module OpenEHR
    2   module Assumed_Library_Types
     1module OpenEhr
     2  module AssumedLibraryTypes
    33    class Interval
    44      attr_reader :lower, :lower_included, :lower_unbounded
  • ruby/branches/0.0/models/rm.rb

    r26 r167  
    1010
    1111# OpenEHR::RM
    12 module OpenEHR
     12module OpenEhr
    1313  module RM
    1414    autoload :Demographic, "rm/demographic.rb"
     
    3030    end
    3131
    32     module Data_Types
     32    module DataTypes
    3333      autoload :Basic, "rm/data_types/basic.rb"
    3434      autoload :Text, "rm/data_types/text.rb"
  • ruby/branches/0.0/models/rm/common/archetyped.rb

    r8 r167  
    1 module OpenEHR
     1module OpenEhr
    22  module RM
    33    module Common
    44      module Archetyped
    5         module Locater_Constants
     5        module LocaterConstants
    66          CURRENT_TRANSACTION_ID = "current"
    77          FRAGMENT_SEPARATOR = "#"
     
    3232        end
    3333        class Locatable < Pathable
    34           include Locater_Constants
     34          include LocaterConstants
    3535          attr_accessor :uid, :archetype_node_id, :archetype_details
    3636          attr_accessor :feeder_audit, :links, :parent
  • ruby/branches/0.0/models/rm/common/generic.rb

    r4 r167  
    1 module OpenEHR
     1module OpenEhr
    22  module RM
    33    module Common
    44      module Generic
    5         class Revision_History
    6         end # of Revision_History
     5        class RevisionHistory
     6        end # of RevisionHistory
    77      end # of Generic
    88    end # of Common
  • ruby/branches/0.0/models/rm/common/resource.rb

    r24 r167  
    11require 'set'
    2 module OpenEHR
     2module OpenEhr
    33  module RM
    44    module Common
  • ruby/branches/0.0/models/rm/composition/content/entry.rb

    r4 r167  
    1 module OpenEHR
     1module OpenEhr
    22  module RM
    33    module Content
     
    55        class Entry < Content_Item
    66        end
    7         class Care_Entry < Entry
     7        class CareEntry < Entry
    88        end
    9         class Action < Care_Entry
     9        class Action < CareEntry
    1010          attr_accessor :description, :time
    1111          attr_accessor :ism_transition, :instruction_details
  • ruby/branches/0.0/models/rm/data_types/basic.rb

    r4 r167  
    1 module OpenEHR
     1module OpenEhr
    22  module RM
    3     module Data_Types
     3    module DataTypes
    44      module Basic
    5         module Canonical_Fragment
     5        module CanonicalFragment
    66        end
    77
    8         class Data_Value
    9           include OpenEHR::RM::Support::Definition::Basic_Definition
     8        class DataValue
     9          include OpenEhr::RM::Support::Definition::BasicDefinition
    1010        end
    1111
    12         class DV_Boolean < Data_Value
     12        class DvBoolean < DataValue
    1313          def initialize(value)
    1414            check_not_nil(value)
     
    3232            end
    3333          end
    34         end  # end of DV_Boolean
     34        end  # end of DvBoolean
    3535
    36         class DV_State < Data_Value
     36        class DvState < DataValue
    3737          attr_accessor :value
    3838          attr_writer :terminal
     
    4747            @terminal == true
    4848          end
    49         end # end of DV_State
     49        end # end of DvState
    5050
    51         class DV_Identifier
     51        class DvIdentifier
    5252          attr_accessor :issuer, :assigner, :id, :type
    5353          def initialize(assigner, id, issuer, type)
     
    6060            @type = type
    6161          end
    62         end #end of DV_Identifier
     62        end #end of DvIdentifier
    6363      end # end of Basic
    6464    end # end of Data_types
  • ruby/branches/0.0/models/rm/data_types/encapslated.rb

    r4 r167  
    1 module OpenEHR
     1module OpenEhr
    22  module RM
    3     module Data_Types
     3    module DataTypes
    44      module Encapsulated
    5         class DV_Encapsulated  < OpenEHR::RM::Data_Types::Basic::Data_Value
     5        class DvEncapsulated  < OpenEhr::RM::DataTypes::Basic::DataValue
    66          attr_accessor :charset, :language
    77          def size
     
    1313          end
    1414        end
    15         class DV_Multimedia < DV_Encapsulated
     15        class DvMultimedia < DvEncapsulated
    1616         
    1717        end
    18         class DV_Parsable < DV_Encapsulated
     18        class DvParsable < DvEncapsulated
    1919          attr_reader :value, :formalism
    2020          def initialize(value, formalism, charset = nil, language = nil)
  • ruby/branches/0.0/models/rm/data_types/quantity/data_time.rb

    r4 r167  
    1 module OpenEHR
     1module OpenEhr
    22  module RM
    3     module Data_Types
     3    module DataTypes
    44      module Quantity
    55        module Date_
  • ruby/branches/0.0/models/rm/data_types/text.rb

    r4 r167  
    1 module OpenEHR
     1module OpenEhr
    22  module RM
    3     module Data_Types
     3    module DataTypes
    44      module Text
    5         class Term_Mapping
     5        class TermMapping
    66          attr_reader :match, :purpose, :target
    77          def initialize(match, purpose, target)
     
    2323            match == '?'
    2424          end
    25           def Term_Mapping.is_valid_mach_code?(c)
     25          def TermMapping.is_valid_mach_code?(c)
    2626            c == '>' or c == '=' or c == '<' or c == '?'
    2727          end
     
    3131          end
    3232          def purpose_valid(purpose)
    33             if !purpose.nil? and !purpose.instance_of? DV_Coded_Text
     33            if !purpose.nil? and !purpose.instance_of? DvCodedText
    3434              raise ArgumentError, "purpose is not valid"
    3535            end
     
    4141        end
    4242
    43         class Code_Phrase
     43        class CodePhrase
    4444          attr_reader :terminology_id, :code_string
    4545          def initialize(terminology_id, code_string)
     
    5050              raise Exception.new("empty codeString")
    5151            end
    52             if terminology_id.instance_of?(Terminology_ID)
     52            if terminology_id.instance_of?(TerminologyId)
    5353              @terminology_id = terminology_id
    5454            else
    55               @terminologyID = Terminology_ID.new(terminology_id)
     55              @terminologyID = TerminologyId.new(terminology_id)
    5656            end
    5757            @code_string = code_string
    5858          end
    59         end # of Code_Phrase
     59        end # of CodePhrase
    6060
    61         class DV_Text < OpenEHR::RM::Data_Types::Basic::Data_Value
     61        class DvText < OpenEhr::RM::DataTypes::Basic::DataValue
    6262          attr_reader :value, :formatting, :hyperlink, :mappings
    6363          attr_reader :language, :encoding
     
    6565                         mappings = nil, language = nil, encoding = nil)
    6666            value_valid(value)
    67             DV_Text.formatting_valid(formatting)
    68             DV_Text.encoding_valid(encoding)
    69             DV_Text.mapping_valid(mappings)
    70             DV_Text.language_valid(language)
     67            DvText.formatting_valid(formatting)
     68            DvText.encoding_valid(encoding)
     69            DvText.mapping_valid(mappings)
     70            DvText.language_valid(language)
    7171            @value, @formatting, @encoding = value, formatting, encoding
    7272            @mappings, @language = mappings, language
     
    7777          end
    7878          def formatting=(formatting)
    79             DV_Text.formatting_valid(formatting)
     79            DvText.formatting_valid(formatting)
    8080            @formatting = formatting
    8181          end
    8282          def encoding=(encoding)
    83             DV_Text.encoding_valid(encoding)
     83            DvText.encoding_valid(encoding)
    8484            @encoding = encoding
    8585          end
    8686          def mappings=(mappings)
    87             DV_Text.mapping_valid(mappings)
     87            DvText.mapping_valid(mappings)
    8888            @mappings = mappings
    8989          end
    9090          def language=(language)
    91             DV_Text.language_valid(language)
     91            DvText.language_valid(language)
    9292            @language = language
    9393          end
     
    9696            if value.nil? or value.empty? or value.include? CR or value.include? LF
    9797              raise ArgumentError, "value is not valid"
    98               # CR and LF are defined in Basic_Definition inherited Data_Value.
     98              # CR and LF are defined in Basic_Definition inherited DataValue.
    9999            end
    100100          end
     
    125125        end
    126126
    127         class DV_Coded_Text < DV_Text
     127        class DvCodedText < DvText
    128128          attr_reader :defining_code
    129129          def initialize(value, defining_code, formatting = nil,
     
    144144        end
    145145
    146         class DV_Paragraph < OpenEHR::RM::Data_Types::Basic::Data_Value
     146        class DvParagraph < OpenEhr::RM::DataTypes::Basic::DataValue
    147147          attr_reader :items
    148148          def initialize(items)
  • ruby/branches/0.0/models/rm/data_types/time_specification.rb

    r5 r167  
    1 module OpenEHR
     1module OpenEhr
    22  module RM
    3     module Data_Types
    4       module Time_Specification
    5         class DV_Time_Specification < OpenEHR::RM::Data_Types::Basic::Data_Value
     3    module DataTypes
     4      module TimeSpecification
     5        class DvTimeSpecification < OpenEhr::RM::DataTypes::Basic::DataValue
    66          def initialize(value)
    77            @value = value
     
    1818        end
    1919       
    20         class DV_General_Time_Specification < DV_Time_Specification
     20        class DvGeneralTimeSpecification < DvTimeSpecification
    2121          attr_reader :value
    2222          def initialize(value)
     
    3434        end
    3535
    36         class DV_Periodic_Time_Specification < DV_Time_Specification
     36        class DvPeriodicTimeSpecification < DvTimeSpecification
    3737          attr_reader :value
    3838          def initialize(value)
  • ruby/branches/0.0/models/rm/data_types/uri.rb

    r4 r167  
    11require 'uri'
    22#require 'uri/generic'
    3 module URI
    4   class EHR < ::URI::Generic
     3module Uri
     4  class Ehr < ::URI::Generic
    55    COMPONENT = [
    66      :scheme, :path, :fragment, :query
     
    1717    end
    1818  end
    19   @@schemes['EHR'] = EHR
     19  @@schemes['EHR'] = Ehr
    2020end
    21 module OpenEHR
     21module OpenEhr
    2222  module RM
    23     module Data_Types
    24       module URI
    25         class DV_URI < OpenEHR::RM::Data_Types::Basic::Data_Value
     23    module DataTypes
     24      module Uri
     25        class DvUri < OpenEhr::RM::DataTypes::Basic::DataValue
    2626          def initialize(value)
    2727            raise ArgumentError, "value is empty" if value.nil?
     
    5151          end
    5252        end
    53         class DV_EHR_URI < DV_URI
     53        class DvEhrUri < DvUri
    5454          def initialize(value)
    5555            check_value(value)
  • ruby/branches/0.0/models/rm/demographic.rb

    r10 r167  
    1 module OpenEHR
     1module OpenEhr
    22  module RM
    33    module Demogrphic
    4       class Party < OpenEHR::RM::Common::Archetyped::Locatable
     4      class Party < OpenEhr::RM::Common::Archetyped::Locatable
    55        attr_reader :details, :reverse_relationships, :uid
    66        attr_reader :idetities, :contacts, :relationships
  • ruby/branches/0.0/models/rm/support/assumed_types.rb

    r4 r167  
    1 module OpenEHR
     1module OpenEhr
    22  module RM
    33    module Support
    4       module Assumed_Types
     4      module AssumedTypes
    55        class Interval
    66          attr_accessor :lower, :upper
  • ruby/branches/0.0/models/rm/support/definition.rb

    r4 r167  
    1 module OpenEHR
     1module OpenEhr
    22  module RM
    33    module Support
    44      module Definition
    5         module Basic_Definition
     5        module BasicDefinition
    66          CR = "\015"
    77          LF = "\012"
    88        end
    9         class OpenEHR_Definitions
    10           include Basic_Definition         
     9        class OpenEHRDefinitions
     10          include BasicDefinition
    1111        end
    1212      end
  • ruby/branches/0.0/models/rm/support/identification.rb

    r26 r167  
    1 module OpenEHR
     1module OpenEhr
    22  module RM
    33    module Support
  • ruby/branches/0.0/models/rm/support/terminology.rb

    r4 r167  
    11
    2 module OpenEHR
     2module OpenEhr
    33  module RM
    44    module Support
    55      module Terminology
    6         class Code_Set_Access
     6        class CodeSetAccess
    77          def all_codes
    88            raise NotImplementedError, "all_codes must be implemented"
     
    1818          end
    1919        end
    20         module OpenEHR_Code_Set_Identifier
     20        module OpenEhrCodeSetIdentifier
    2121          CODE_SET_ID_CHARACER_SETS = "character sets".freeze
    2222          CODE_SET_ID_COMPRESSION_ALGORITHMS = "compression algorithms".freeze
     
    2929          end
    3030        end
    31         module OpenEHR_Terminology_Group_Identifiers
     31        module OpenEhrTerminologyGroupIdentifiers
    3232          GROUP_ID_ATTESTATION_REASON = "attestation reason".freeze
    3333          GROUP_ID_AUDIT_CHANGE_TYPE = "audit change type".freeze
     
    4646          TERMINOLOGY_ID = "openehr".freeze
    4747        end
    48         class Terminology_Access
     48        class TerminologyAccess
    4949          def all_codes
    5050            raise NotImplementedError, "all_codes is not implemented"
     
    7474          end
    7575        end
    76         class Terminology_Service
    77           include OpenEHR_Code_Set_Identifier, OpenEHR_Terminology_Group_Identifiers
     76        class TerminologyService
     77          include OpenEhrCodeSetIdentifier, OpenEhrTerminologyGroupIdentifiers
    7878          def code_set(name)
    7979            raise NotImplementedError, "code_set is not implemented"
  • ruby/branches/0.0/models/tests/test_archetype_model.rb

    r24 r167  
    55class ArchetypeModelTest < Test::Unit::TestCase
    66  def setup
    7     @archetype = OpenEHR::AM::Archetype::ARCHETYPE.new
    8     @validity_kind = OpenEHR::AM::Archetype::VALIDITY_KIND.new
     7    @archetype = OpenEhr::AM::Archetype::ARCHETYPE.new
     8    @validity_kind = OpenEhr::AM::Archetype::VALIDITY_KIND.new
    99
    10     @archetype_description = OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION.new
    11     @archetype_description_item = OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION_ITEM.new
     10    @archetype_description = OpenEhr::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION.new
     11    @archetype_description_item = OpenEhr::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION_ITEM.new
    1212  end
    1313 
    1414  def test_init
    15     assert_instance_of OpenEHR::AM::Archetype::ARCHETYPE, @archetype
    16     assert_instance_of OpenEHR::AM::Archetype::VALIDITY_KIND, @validity_kind
    17     assert_instance_of OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION, @archetype_description
    18     assert_instance_of OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION_ITEM, @archetype_description_item
    19     assert_instance_of OpenEHR::AM::Archetype::ARCHETYPE, @archetype
     15    assert_instance_of OpenEhr::AM::Archetype::ARCHETYPE, @archetype
     16    assert_instance_of OpenEhr::AM::Archetype::VALIDITY_KIND, @validity_kind
     17    assert_instance_of OpenEhr::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION, @archetype_description
     18    assert_instance_of OpenEhr::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION_ITEM, @archetype_description_item
     19    assert_instance_of OpenEhr::AM::Archetype::ARCHETYPE, @archetype
    2020  end
    2121
    2222  def test_create
    23     archetype_instance = OpenEHR::AM::Archetype::ARCHETYPE.create() do |archetype|
     23    archetype_instance = OpenEhr::AM::Archetype::ARCHETYPE.create() do |archetype|
    2424      archetype.adl_version = '1.4'
    2525    end
    2626
    27     assert_instance_of OpenEHR::AM::Archetype::ARCHETYPE, archetype_instance
     27    assert_instance_of OpenEhr::AM::Archetype::ARCHETYPE, archetype_instance
    2828  end
    2929end
     
    3131class ArchetypeModelConstraintTest < Test::Unit::TestCase
    3232  def setup
    33     @archetype_constraint = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT.new
    34     @cardinality = OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY.new   
     33    @archetype_constraint = OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT.new
     34    @cardinality = OpenEhr::AM::Archetype::Constraint_Model::CARDINALITY.new
    3535   
    36     @archetype_constraint = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT.new
    37     @c_object = OpenEHR::AM::Archetype::Constraint_Model::C_OBJECT.new
    38     @c_defined_object = OpenEHR::AM::Archetype::Constraint_Model::C_DEFINED_OBJECT.new
    39     @c_attribute = OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE.new
    40     @c_single_attribute = OpenEHR::AM::Archetype::Constraint_Model::C_SINGLE_ATTRIBUTE.new
    41     @c_multiple_attribute = OpenEHR::AM::Archetype::Constraint_Model::C_MULTIPLE_ATTRIBUTE.new(:rm_attribute_name => 'attribute_name', :cardinality => @cardinality)
    42     @c_primitive_object = OpenEHR::AM::Archetype::Constraint_Model::C_PRIMITIVE_OBJECT.new
    43     @c_reference_object =  OpenEHR::AM::Archetype::Constraint_Model::C_REFERENCE_OBJECT.new
    44     @archetype_internal_ref =  OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF.new
    45     @archetype_slot = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT.new
    46     @constraint_ref = OpenEHR::AM::Archetype::Constraint_Model::CONSTRAINT_REF.new
    47     @c_domain_type = OpenEHR::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE.new
    48     @c_complex_object = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new(:attributes => [@c_single_attribute])
     36    @archetype_constraint = OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT.new
     37    @c_object = OpenEhr::AM::Archetype::Constraint_Model::C_OBJECT.new
     38    @c_defined_object = OpenEhr::AM::Archetype::Constraint_Model::C_DEFINED_OBJECT.new
     39    @c_attribute = OpenEhr::AM::Archetype::Constraint_Model::C_ATTRIBUTE.new
     40    @c_single_attribute = OpenEhr::AM::Archetype::Constraint_Model::C_SINGLE_ATTRIBUTE.new
     41    @c_multiple_attribute = OpenEhr::AM::Archetype::Constraint_Model::C_MULTIPLE_ATTRIBUTE.new(:rm_attribute_name => 'attribute_name', :cardinality => @cardinality)
     42    @c_primitive_object = OpenEhr::AM::Archetype::Constraint_Model::C_PRIMITIVE_OBJECT.new
     43    @c_reference_object =  OpenEhr::AM::Archetype::Constraint_Model::C_REFERENCE_OBJECT.new
     44    @archetype_internal_ref =  OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF.new
     45    @archetype_slot = OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT.new
     46    @constraint_ref = OpenEhr::AM::Archetype::Constraint_Model::CONSTRAINT_REF.new
     47    @c_domain_type = OpenEhr::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE.new
     48    @c_complex_object = OpenEhr::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new(:attributes => [@c_single_attribute])
    4949  end
    5050
    5151  def test_init
    52     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT, @archetype_constraint
    53     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_OBJECT, @c_object
    54     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_DEFINED_OBJECT, @c_defined_object
    55     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE, @c_attribute
    56     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_SINGLE_ATTRIBUTE, @c_single_attribute
    57     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_MULTIPLE_ATTRIBUTE, @c_multiple_attribute
     52    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT, @archetype_constraint
     53    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_OBJECT, @c_object
     54    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_DEFINED_OBJECT, @c_defined_object
     55    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_ATTRIBUTE, @c_attribute
     56    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_SINGLE_ATTRIBUTE, @c_single_attribute
     57    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_MULTIPLE_ATTRIBUTE, @c_multiple_attribute
    5858    assert_equal 'attribute_name', @c_multiple_attribute.rm_attribute_name
    59     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY, @c_multiple_attribute.cardinality
    60     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_PRIMITIVE_OBJECT, @c_primitive_object
    61     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_REFERENCE_OBJECT, @c_reference_object
    62     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF, @archetype_internal_ref
    63     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT, @archetype_slot
    64     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::CONSTRAINT_REF, @constraint_ref
    65     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE, @c_domain_type
    66     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, @c_complex_object
     59    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::CARDINALITY, @c_multiple_attribute.cardinality
     60    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_PRIMITIVE_OBJECT, @c_primitive_object
     61    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_REFERENCE_OBJECT, @c_reference_object
     62    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF, @archetype_internal_ref
     63    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT, @archetype_slot
     64    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::CONSTRAINT_REF, @constraint_ref
     65    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE, @c_domain_type
     66    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, @c_complex_object
    6767    assert_instance_of Array, @c_complex_object.attributes
    68     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT, @archetype_constraint
    69     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY, @cardinality
     68    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT, @archetype_constraint
     69    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::CARDINALITY, @cardinality
    7070  end
    7171
    7272  def test_create
    73     c_complex_object = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.create(:node_id => 'test_node',
     73    c_complex_object = OpenEhr::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.create(:node_id => 'test_node',
    7474                                                                                         :attributes => [1,2],
    7575                                                                                         :assumed_value => Array
    7676                                                                                         )
    77     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, c_complex_object
     77    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, c_complex_object
    7878    assert_equal 'test_node', c_complex_object.node_id
    7979  end
     
    8282class ArchetypeModelPrimitiveTest < Test::Unit::TestCase
    8383  def setup
    84     @c_primitive = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_PRIMITIVE.new
    85     @c_boolean = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true,
     84    @c_primitive = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_PRIMITIVE.new
     85    @c_boolean = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true,
    8686                                                                                    :false_valid => true,
    8787                                                                                    :assumed_value => true)
    88     @c_string = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_STRING.new
    89     @c_integer = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_INTEGER.new
    90     @c_real = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_REAL.new
    91     @c_time = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_TIME.new
    92     @c_date = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE.new
    93     @c_date_time = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE_TIME.new
    94     @c_duration = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DURATION.new
     88    @c_string = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_STRING.new
     89    @c_integer = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_INTEGER.new
     90    @c_real = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_REAL.new
     91    @c_time = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_TIME.new
     92    @c_date = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_DATE.new
     93    @c_date_time = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_DATE_TIME.new
     94    @c_duration = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_DURATION.new
    9595  end
    9696
    9797  def test_init
    98     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_PRIMITIVE, @c_primitive
    99     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN, @c_boolean
    100     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_STRING, @c_string
    101     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_INTEGER, @c_integer
    102     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_REAL, @c_real
    103     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_TIME, @c_time
    104     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE, @c_date
    105     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE_TIME, @c_date_time
    106     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DURATION, @c_duration
     98    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_PRIMITIVE, @c_primitive
     99    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN, @c_boolean
     100    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_STRING, @c_string
     101    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_INTEGER, @c_integer
     102    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_REAL, @c_real
     103    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_TIME, @c_time
     104    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_DATE, @c_date
     105    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_DATE_TIME, @c_date_time
     106    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_DURATION, @c_duration
    107107  end
    108108
     
    119119    end
    120120    assert_raise(ArgumentError) do
    121       OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid =>false,
     121      OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid =>false,
    122122                                                                         :false_valid => false,
    123123                                                                         :assumed_value => false)
     
    129129class ArchetypeModelOntologyTest < Test::Unit::TestCase
    130130  def setup
    131     @archetype_ontology = OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY.new
    132     @archetype_term = OpenEHR::AM::Archetype::Ontology::ARCHETYPE_TERM.new(:code => '', :items => '')
     131    @archetype_ontology = OpenEhr::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY.new
     132    @archetype_term = OpenEhr::AM::Archetype::Ontology::ARCHETYPE_TERM.new(:code => '', :items => '')
    133133  end
    134134
    135135  def test_init
    136     assert_instance_of OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY, @archetype_ontology
    137     assert_instance_of OpenEHR::AM::Archetype::Ontology::ARCHETYPE_TERM, @archetype_term
     136    assert_instance_of OpenEhr::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY, @archetype_ontology
     137    assert_instance_of OpenEhr::AM::Archetype::Ontology::ARCHETYPE_TERM, @archetype_term
    138138  end
    139139end
     
    141141class ArchetypeModelAssertionTest < Test::Unit::TestCase
    142142  def setup
    143     @assertion = OpenEHR::AM::Archetype::Assertion::ASSERTION.new
    144     @assertion_variable = OpenEHR::AM::Archetype::Assertion::ASSERTION_VARIABLE.new
    145     @operator_kind = OpenEHR::AM::Archetype::Assertion::OPERATOR_KIND.new
    146     @expr_item = OpenEHR::AM::Archetype::Assertion::EXPR_ITEM.new
    147     @expr_leaf = OpenEHR::AM::Archetype::Assertion::EXPR_LEAF.new
    148     @expr_operator = OpenEHR::AM::Archetype::Assertion::EXPR_OPERATOR.new
    149     @expr_unary_operator = OpenEHR::AM::Archetype::Assertion::EXPR_UNARY_OPERATOR.new
    150     @expr_binary_operator = OpenEHR::AM::Archetype::Assertion::EXPR_BINARY_OPERATOR.new
     143    @assertion = OpenEhr::AM::Archetype::Assertion::ASSERTION.new
     144    @assertion_variable = OpenEhr::AM::Archetype::Assertion::ASSERTION_VARIABLE.new
     145    @operator_kind = OpenEhr::AM::Archetype::Assertion::OPERATOR_KIND.new
     146    @expr_item = OpenEhr::AM::Archetype::Assertion::EXPR_ITEM.new
     147    @expr_leaf = OpenEhr::AM::Archetype::Assertion::EXPR_LEAF.new
     148    @expr_operator = OpenEhr::AM::Archetype::Assertion::EXPR_OPERATOR.new
     149    @expr_unary_operator = OpenEhr::AM::Archetype::Assertion::EXPR_UNARY_OPERATOR.new
     150    @expr_binary_operator = OpenEhr::AM::Archetype::Assertion::EXPR_BINARY_OPERATOR.new
    151151  end
    152152
    153153  def test_init
    154     assert_instance_of OpenEHR::AM::Archetype::Assertion::ASSERTION, @assertion
    155     assert_instance_of OpenEHR::AM::Archetype::Assertion::ASSERTION_VARIABLE, @assertion_variable
    156     assert_instance_of OpenEHR::AM::Archetype::Assertion::OPERATOR_KIND, @operator_kind
    157     assert_instance_of OpenEHR::AM::Archetype::Assertion::EXPR_ITEM, @expr_item
    158     assert_instance_of OpenEHR::AM::Archetype::Assertion::EXPR_LEAF, @expr_leaf
    159     assert_instance_of OpenEHR::AM::Archetype::Assertion::EXPR_OPERATOR, @expr_operator
    160     assert_instance_of OpenEHR::AM::Archetype::Assertion::EXPR_UNARY_OPERATOR, @expr_unary_operator
    161     assert_instance_of OpenEHR::AM::Archetype::Assertion::EXPR_BINARY_OPERATOR, @expr_binary_operator
     154    assert_instance_of OpenEhr::AM::Archetype::Assertion::ASSERTION, @assertion
     155    assert_instance_of OpenEhr::AM::Archetype::Assertion::ASSERTION_VARIABLE, @assertion_variable
     156    assert_instance_of OpenEhr::AM::Archetype::Assertion::OPERATOR_KIND, @operator_kind
     157    assert_instance_of OpenEhr::AM::Archetype::Assertion::EXPR_ITEM, @expr_item
     158    assert_instance_of OpenEhr::AM::Archetype::Assertion::EXPR_LEAF, @expr_leaf
     159    assert_instance_of OpenEhr::AM::Archetype::Assertion::EXPR_OPERATOR, @expr_operator
     160    assert_instance_of OpenEhr::AM::Archetype::Assertion::EXPR_UNARY_OPERATOR, @expr_unary_operator
     161    assert_instance_of OpenEhr::AM::Archetype::Assertion::EXPR_BINARY_OPERATOR, @expr_binary_operator
    162162  end
    163163end
     
    165165class ArchetypeModelProfileTest < Test::Unit::TestCase
    166166  def setup
    167     @c_dv_state = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::C_DV_STATE.new
    168     @state_machine = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::STATE_MACHINE.new
    169     @state = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::STATE.new
    170     @terminal_state = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::TERMINAL_STATE.new
    171     @non_terminal_state = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::NON_TERMINAL_STATE.new
    172     @transition = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::TRANSITION.new
     167    @c_dv_state = OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::C_DV_STATE.new
     168    @state_machine = OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::STATE_MACHINE.new
     169    @state = OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::STATE.new
     170    @terminal_state = OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::TERMINAL_STATE.new
     171    @non_terminal_state = OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::NON_TERMINAL_STATE.new
     172    @transition = OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::TRANSITION.new
    173173
    174     @c_code_phase = OpenEHR::AM::OpenEHR_Profile::Data_Types::Text::C_CODE_PHASE.new
     174    @c_code_phase = OpenEhr::AM::OpenEHR_Profile::DataTypes::Text::C_CODE_PHASE.new
    175175
    176     @c_dv_quantity = OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_DV_QUANTITY.new
    177     @c_dv_ordinal = OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_DV_ORDINAL.new
    178     @c_quantity_item = OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_QUANTITY_ITEM.new
     176    @c_dv_quantity = OpenEhr::AM::OpenEHR_Profile::DataTypes::Quantity::C_DV_QUANTITY.new
     177    @c_dv_ordinal = OpenEhr::AM::OpenEHR_Profile::DataTypes::Quantity::C_DV_ORDINAL.new
     178    @c_quantity_item = OpenEhr::AM::OpenEHR_Profile::DataTypes::Quantity::C_QUANTITY_ITEM.new
    179179  end
    180180
    181181  def test_init
    182     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::C_DV_STATE, @c_dv_state
    183     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::STATE_MACHINE, @state_machine
    184     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::STATE, @state
    185     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::TERMINAL_STATE, @terminal_state
    186     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::NON_TERMINAL_STATE, @non_terminal_state
    187     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::TRANSITION, @transition
    188     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Text::C_CODE_PHASE, @c_code_phase
    189     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_DV_QUANTITY, @c_dv_quantity
    190     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_DV_ORDINAL, @c_dv_ordinal
    191     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_QUANTITY_ITEM, @c_quantity_item
     182    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::C_DV_STATE, @c_dv_state
     183    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::STATE_MACHINE, @state_machine
     184    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::STATE, @state
     185    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::TERMINAL_STATE, @terminal_state
     186    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::NON_TERMINAL_STATE, @non_terminal_state
     187    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::TRANSITION, @transition
     188    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Text::C_CODE_PHASE, @c_code_phase
     189    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Quantity::C_DV_QUANTITY, @c_dv_quantity
     190    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Quantity::C_DV_ORDINAL, @c_dv_ordinal
     191    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Quantity::C_QUANTITY_ITEM, @c_quantity_item
    192192  end
    193193end
  • ruby/branches/0.0/models/tests/test_assumed_library_types.rb

    r4 r167  
    44class Assumed_Library_Test < Test::Unit::TestCase
    55  def setup
    6     @interval = OpenEHR::Assumed_Library_Types::Interval.new(1,2)
     6    @interval = OpenEhr::AssumedLibraryTypes::Interval.new(1,2)
    77  end
    88  def test_initialize
    9     assert_instance_of OpenEHR::Assumed_Library_Types::Interval, @interval
     9    assert_instance_of OpenEhr::AssumedLibraryTypes::Interval, @interval
    1010  end
    1111  def test_limits_comparable
  • ruby/branches/0.0/models/tests/test_reference_model.rb

    r26 r167  
    55class ReferenceModelTest < Test::Unit::TestCase
    66  def setup
    7     @authored_resource = OpenEHR::RM::Common::Resource::AUTHORED_RESOURCE.new(:original_language => "ja",
     7    @authored_resource = OpenEhr::RM::Common::Resource::AUTHORED_RESOURCE.new(:original_language => "ja",
    88                                                                              :translations => "en",
    99                                                                              :description => "test")
    10     @translation_details = OpenEHR::RM::Common::Resource::TRANSLATION_DETAILS.new(nil,nil,nil,nil,nil)
     10    @translation_details = OpenEhr::RM::Common::Resource::TRANSLATION_DETAILS.new(nil,nil,nil,nil,nil)
    1111#    @openehr_definitions = OpenEHR::RM::Support::Definition::OpenEHR_Definitions.new
    12     @dv_boolean = OpenEHR::RM::Data_Types::Basic::DV_Boolean.new("TRUE")
    13     @dv_state = OpenEHR::RM::Data_Types::Basic::DV_State.new("code1",true)
    14     @dv_identifier = OpenEHR::RM::Data_Types::Basic::DV_Identifier.new("Ruby Hospital","0123456-0", "Information office", "personal id")
    15     @dv_uri = OpenEHR::RM::Data_Types::URI::DV_URI.new("http://www.openehr.jp/changeset/test?cmd=93#file0")
    16     @dv_ehr_uri = OpenEHR::RM::Data_Types::URI::DV_EHR_URI.new("ehr://1234567/87284370-2D4B-4e3d-A3F3-F303D2F4F34B@2005-08-02T04:30:00")
    17     @dv_text = OpenEHR::RM::Data_Types::Text::DV_Text.new("valid value")
    18     @dv_coded_text = OpenEHR::RM::Data_Types::Text::DV_Coded_Text.new("valid value", "AT1000")
    19     @dv_paragraph = OpenEHR::RM::Data_Types::Text::DV_Paragraph.new(Set.new(["test1", "test2"]))
     12    @dv_boolean = OpenEhr::RM::DataTypes::Basic::DvBoolean.new("TRUE")
     13    @dv_state = OpenEhr::RM::DataTypes::Basic::DvState.new("code1",true)
     14    @dv_identifier = OpenEhr::RM::DataTypes::Basic::DvIdentifier.new("Ruby Hospital","0123456-0", "Information office", "personal id")
     15    @dv_uri = OpenEhr::RM::DataTypes::Uri::DvUri.new("http://www.openehr.jp/changeset/test?cmd=93#file0")
     16    @dv_ehr_uri = OpenEhr::RM::DataTypes::Uri::DvEhrUri.new("ehr://1234567/87284370-2D4B-4e3d-A3F3-F303D2F4F34B@2005-08-02T04:30:00")
     17    @dv_text = OpenEhr::RM::DataTypes::Text::DvText.new("valid value")
     18    @dv_coded_text = OpenEhr::RM::DataTypes::Text::DvCodedText.new("valid value", "AT1000")
     19    @dv_paragraph = OpenEhr::RM::DataTypes::Text::DvParagraph.new(Set.new(["test1", "test2"]))
    2020  end
    2121 
    2222  def test_init
    23     assert_instance_of OpenEHR::RM::Common::Resource::AUTHORED_RESOURCE, @authored_resource
    24     assert_instance_of OpenEHR::RM::Common::Resource::TRANSLATION_DETAILS, @translation_details
    25     assert_instance_of OpenEHR::RM::Data_Types::Basic::DV_Boolean, @dv_boolean
    26     assert_instance_of OpenEHR::RM::Data_Types::Basic::DV_State, @dv_state
    27     assert_instance_of OpenEHR::RM::Data_Types::Basic::DV_Identifier, @dv_identifier
    28     assert_instance_of OpenEHR::RM::Data_Types::URI::DV_URI, @dv_uri
    29     assert_instance_of OpenEHR::RM::Data_Types::URI::DV_EHR_URI, @dv_ehr_uri
    30     assert_instance_of OpenEHR::RM::Data_Types::Text::DV_Text, @dv_text
    31     assert_instance_of OpenEHR::RM::Data_Types::Text::DV_Coded_Text, @dv_coded_text
     23    assert_instance_of OpenEhr::RM::Common::Resource::AUTHORED_RESOURCE, @authored_resource
     24    assert_instance_of OpenEhr::RM::Common::Resource::TRANSLATION_DETAILS, @translation_details
     25    assert_instance_of OpenEhr::RM::DataTypes::Basic::DvBoolean, @dv_boolean
     26    assert_instance_of OpenEhr::RM::DataTypes::Basic::DvState, @dv_state
     27    assert_instance_of OpenEhr::RM::DataTypes::Basic::DvIdentifier, @dv_identifier
     28    assert_instance_of OpenEhr::RM::DataTypes::Uri::DvUri, @dv_uri
     29    assert_instance_of OpenEhr::RM::DataTypes::Uri::DvEhrUri, @dv_ehr_uri
     30    assert_instance_of OpenEhr::RM::DataTypes::Text::DvText, @dv_text
     31    assert_instance_of OpenEhr::RM::DataTypes::Text::DvCodedText, @dv_coded_text
    3232  end
    3333
    3434  def test_constant
    35     assert_equal("\r", OpenEHR::RM::Support::Definition::OpenEHR_Definitions::CR)
    36     assert_equal("\n", OpenEHR::RM::Support::Definition::OpenEHR_Definitions::LF)
    37     assert_equal("\r", OpenEHR::RM::Data_Types::Basic::Data_Value::CR)
    38     assert_equal("\n", OpenEHR::RM::Data_Types::Basic::Data_Value::LF)
     35    assert_equal("\r", OpenEhr::RM::Support::Definition::OpenEHRDefinitions::CR)
     36    assert_equal("\n", OpenEhr::RM::Support::Definition::OpenEHRDefinitions::LF)
     37    assert_equal("\r", OpenEhr::RM::DataTypes::Basic::DataValue::CR)
     38    assert_equal("\n", OpenEhr::RM::DataTypes::Basic::DataValue::LF)
    3939  end
    4040
     
    4545    # Constraints Value_exists
    4646    assert_raise(ArgumentError){@dv_boolean.value=nil}
    47     assert_raise(ArgumentError){OpenEHR::RM::Data_Types::Basic::DV_Boolean.new(nil)}
     47    assert_raise(ArgumentError){OpenEhr::RM::DataTypes::Basic::DvBoolean.new(nil)}
    4848  end
    4949
     
    5555    @dv_state.terminal = false
    5656    assert !@dv_state.is_terminal?
    57     assert_raise(ArgumentError) {OpenEHR::RM::Data_Types::Basic::DV_State.new(nil,nil)}
     57    assert_raise(ArgumentError) {OpenEhr::RM::DataTypes::Basic::DvState.new(nil,nil)}
    5858  end
    5959
     
    7171    @dv_identifier.type = "test id"
    7272    assert_equal("test id", @dv_identifier.type)
    73     assert_raise(ArgumentError) {OpenEHR::RM::Data_Types::Basic::DV_Identifier.new(nil, nil, nil, nil)}
     73    assert_raise(ArgumentError) {OpenEhr::RM::DataTypes::Basic::DvIdentifier.new(nil, nil, nil, nil)}
    7474  end
    7575
     
    123123class ReferenceModelSupportIdentificationTest < Test::Unit::TestCase
    124124  def setup
    125     @object_id = OpenEHR::RM::Support::Identification::OBJECT_ID.new
    126     @terminology_id = OpenEHR::RM::Support::Identification::TERMINOLOGY_ID.new('terminology','version')
    127     @archetype_id = OpenEHR::RM::Support::Identification::ARCHETYPE_ID.new
     125    @object_id = OpenEhr::RM::Support::Identification::OBJECT_ID.new
     126    @terminology_id = OpenEhr::RM::Support::Identification::TERMINOLOGY_ID.new('terminology','version')
     127    @archetype_id = OpenEhr::RM::Support::Identification::ARCHETYPE_ID.new
    128128  end
    129129 
    130130  def test_init
    131     assert_instance_of OpenEHR::RM::Support::Identification::OBJECT_ID, @object_id
    132     assert_instance_of OpenEHR::RM::Support::Identification::TERMINOLOGY_ID, @terminology_id
    133     assert_instance_of OpenEHR::RM::Support::Identification::ARCHETYPE_ID, @archetype_id
     131    assert_instance_of OpenEhr::RM::Support::Identification::OBJECT_ID, @object_id
     132    assert_instance_of OpenEhr::RM::Support::Identification::TERMINOLOGY_ID, @terminology_id
     133    assert_instance_of OpenEhr::RM::Support::Identification::ARCHETYPE_ID, @archetype_id
    134134
    135135  end
  • ruby/branches/0.5.0/COPYING

    r42 r167  
    11openEHR Open Source Software License
    22
    3 The openEHR Foundation uses the Mozilla Tri-license 1.1 on all software copyrighted to the Foundation. This licence essentially provides the user a choice of licence conditions under which to operate with any given piece of software, being: the Mozilla Public licence (MPL), and the Free Software Foundation GNU General Public Licence (GPL) and Lesser GNU Public Licence (LGPL). See the Mozilla relicensing FAQ for details of this license. This in no way constrains the way in which software created by other organisations is licenced.
     3The openEHR Foundation uses the Mozilla Tri-license 1.1 on all software
     4copyrighted to the Foundation. This licence essentially provides the user
     5a choice of licence conditions under which to operate with any given piece
     6of software, being: the Mozilla Public licence (MPL), and the Free Software
     7Foundation GNU General Public Licence (GPL) and Lesser GNU Public Licence
     8(LGPL). See the Mozilla relicensing FAQ for details of this license.
     9This in no way constrains the way in which software created by other
     10organisations is licenced.
  • ruby/branches/0.5.0/bin/adl_validator.rb

    r49 r167  
    66require 'net/http'
    77
    8 module OpenEHR
     8module OpenEhr
    99  module CommandLine
    1010    class Arguments < Hash
     
    3939            when /\A(http:\/\/.*)/
    4040              name = $1
    41               input = case response = Net::HTTP.get_response(URI.parse($1))
     41              input = case response = Net::HTTP.get_response(Uri.parse($1))
    4242                      when Net::HTTPSuccess   
    4343                        response.body
     
    7373if __FILE__ == $0
    7474  begin
    75     arguments = OpenEHR::CommandLine::Arguments.new(ARGV)
    76     validator = OpenEHR::CommandLine::ADLValidator.new(arguments)
     75    arguments = OpenEhr::CommandLine::Arguments.new(ARGV)
     76    validator = OpenEhr::CommandLine::ADLValidator.new(arguments)
    7777    validator.run
    7878  end
  • ruby/branches/0.5.0/lib/adl_parser/lib/adl_parser.rb

    r49 r167  
    99require 'logger'
    1010
    11 module OpenEHR
     11module OpenEhr
    1212
    1313  if $DEBUG
  • ruby/branches/0.5.0/lib/adl_parser/lib/parser.rb

    r116 r167  
    2020
    2121
    22 module OpenEHR
     22module OpenEhr
    2323  module ADL
    2424    class Parser < Racc::Parser
  • ruby/branches/0.5.0/lib/adl_parser/lib/scanner.rb

    r49 r167  
    44
    55
    6 module OpenEHR
     6module OpenEhr
    77  module ADL
    88    module Scanner
     
    1313            @parser = lambda do |input|
    1414              Yaparc::Apply.new(Yaparc::Regex.new(/\A\[[a-zA-Z0-9()\._-]+::[a-zA-Z0-9\._-]+\]/)) do |match|
    15                 OpenEHR::LOG.debug("V_QUALIFIED_TERM_CODE_REF: #{match}")
     15                OpenEhr::LOG.debug("V_QUALIFIED_TERM_CODE_REF: #{match}")
    1616                [:V_QUALIFIED_TERM_CODE_REF, match]
    1717              end
     
    2525            @parser = lambda do |input|
    2626              Yaparc::Apply.new(Yaparc::Regex.new(/\A\[[a-zA-Z0-9][a-zA-Z0-9._\-]*\]/)) do |match|
    27                 OpenEHR::LOG.debug("V_TERM_CODE_REF: #{match}")
     27                OpenEhr::LOG.debug("V_TERM_CODE_REF: #{match}")
    2828                [:V_LOCAL_TERM_CODE_REF, match]
    2929              end
     
    3737            @parser = lambda do |input|
    3838              Yaparc::Apply.new(Yaparc::Regex.new(/\A\[[a-zA-Z0-9._\- ]+::[a-zA-Z0-9._\- ]+\]/)) do |match|
    39                 OpenEHR::LOG.debug("ERR_V_QUALIFIED_TERM_CODE_REF: #{match}")
     39                OpenEhr::LOG.debug("ERR_V_QUALIFIED_TERM_CODE_REF: #{match}")
    4040                [:ERR_V_QUALIFIED_TERM_CODE_REF, match]
    4141              end
     
    4949            @parser = lambda do |input|
    5050              Yaparc::Apply.new(Yaparc::Regex.new(/\A[A-Z][a-zA-Z0-9_]*/)) do |match|
    51                 OpenEHR::LOG.debug("V_TYPE_IDENTIFIER: #{match}")
     51                OpenEhr::LOG.debug("V_TYPE_IDENTIFIER: #{match}")
    5252                [:V_TYPE_IDENTIFIER, match]
    5353              end
     
    6161            @parser = lambda do |input|
    6262              Yaparc::Apply.new(Yaparc::Regex.new(/\A[A-Z][a-zA-Z0-9_]*<[a-zA-Z0-9,_<>]+>/)) do |match|
    63                 OpenEHR::LOG.debug("V_GENERIC_TYPE_IDENTIFIER: #{match}")
     63                OpenEhr::LOG.debug("V_GENERIC_TYPE_IDENTIFIER: #{match}")
    6464                [:V_GENERIC_TYPE_IDENTIFIER, match]
    6565              end
     
    7474            @parser = lambda do |input|
    7575              Yaparc::Apply.new(Yaparc::Regex.new(/\Aa[ct][0-9.]+/)) do |match|
    76                 OpenEHR::LOG.debug("V_LOCAL_CODE: #{match}")
     76                OpenEhr::LOG.debug("V_LOCAL_CODE: #{match}")
    7777                [:V_LOCAL_CODE, match]
    7878              end
     
    8686            @parser = lambda do |input|
    8787              Yaparc::Apply.new(Yaparc::Regex.new(/\A"([^"]*)"/m)) do |match|
    88                 OpenEHR::LOG.debug("V_STRING: #{match}")
     88                OpenEhr::LOG.debug("V_STRING: #{match}")
    8989                [:V_STRING, match]
    9090              end
     
    9898            @parser = lambda do |input|
    9999              Yaparc::Apply.new(Yaparc::Regex.new(/\A[0-9]+\.[0-9]+|[0-9]+\.[0-9]+[eE][+-]?[0-9]+/)) do |match|
    100                 OpenEHR::LOG.debug("V_REAL: #{match}")
     100                OpenEhr::LOG.debug("V_REAL: #{match}")
    101101                [:V_REAL, match]
    102102              end
     
    113113                                Yaparc::Alt.new(Yaparc::Regex.new(/\AP([0-9]+|[yY])?([0-9]+|[mM])?([0-9]+|[wW])?([0-9]+|[dD])?T([0-9]+|[hH])?([0-9]+|[mM])?([0-9]+|[sS])?/),
    114114                                                Yaparc::Regex.new(/\AP([0-9]+|[yY])?([0-9]+|[mM])?([0-9]+|[wW])?([0-9]+|[dD])?/))) do |match|
    115                 OpenEHR::LOG.debug("V_ISO8601_DURATION: #{match}")
     115                OpenEhr::LOG.debug("V_ISO8601_DURATION: #{match}")
    116116                [:V_ISO8601_DURATION, match]
    117117              end
     
    135135            @parser = lambda do |input|
    136136              Yaparc::Alt.new(Reserved.new,
    137                               OpenEHR::ADL::Scanner::Common::V_QUALIFIED_TERM_CODE_REF.new,
    138                               OpenEHR::ADL::Scanner::Common::V_LOCAL_TERM_CODE_REF.new,
    139                               OpenEHR::ADL::Scanner::Common::ERR_V_QUALIFIED_TERM_CODE_REF.new,
    140                               OpenEHR::ADL::Scanner::Common::V_TYPE_IDENTIFIER.new,
    141                               OpenEHR::ADL::Scanner::Common::V_GENERIC_TYPE_IDENTIFIER.new,
    142                               OpenEHR::ADL::Scanner::Common::V_STRING.new,
    143                               OpenEHR::ADL::Scanner::Common::V_LOCAL_CODE.new,
    144                               OpenEHR::ADL::Scanner::Common::V_REAL.new,
    145                               OpenEHR::ADL::Scanner::Common::V_ISO8601_DURATION.new
     137                              OpenEhr::ADL::Scanner::Common::V_QUALIFIED_TERM_CODE_REF.new,
     138                              OpenEhr::ADL::Scanner::Common::V_LOCAL_TERM_CODE_REF.new,
     139                              OpenEhr::ADL::Scanner::Common::ERR_V_QUALIFIED_TERM_CODE_REF.new,
     140                              OpenEhr::ADL::Scanner::Common::V_TYPE_IDENTIFIER.new,
     141                              OpenEhr::ADL::Scanner::Common::V_GENERIC_TYPE_IDENTIFIER.new,
     142                              OpenEhr::ADL::Scanner::Common::V_STRING.new,
     143                              OpenEhr::ADL::Scanner::Common::V_LOCAL_CODE.new,
     144                              OpenEhr::ADL::Scanner::Common::V_REAL.new,
     145                              OpenEhr::ADL::Scanner::Common::V_ISO8601_DURATION.new
    146146                              )
    147147            end
     
    155155          def initialize
    156156            @parser = lambda do |input|
    157               reserved_parsers = OpenEHR::ADL::Scanner::DADL::RESERVED.map do |keyword|
     157              reserved_parsers = OpenEhr::ADL::Scanner::DADL::RESERVED.map do |keyword|
    158158                Yaparc::Tokenize.new(
    159159                                     Yaparc::Literal.new(keyword[0],false)
     
    161161              end
    162162              Yaparc::Alt.new(Yaparc::Apply.new(Yaparc::Alt.new(*reserved_parsers)) do |match|
    163                                 OpenEHR::LOG.debug("Reserved: #{match}")
    164                                 [OpenEHR::ADL::Scanner::DADL::RESERVED[match], OpenEHR::ADL::Scanner::DADL::RESERVED[match]]
     163                                OpenEhr::LOG.debug("Reserved: #{match}")
     164                                [OpenEhr::ADL::Scanner::DADL::RESERVED[match], OpenEhr::ADL::Scanner::DADL::RESERVED[match]]
    165165                              end,
    166166                              Yaparc::Apply.new(Yaparc::Regex.new(/\A[a-z][a-zA-Z0-9_]*/)) do |match|
    167                                 OpenEHR::LOG.debug("V_ATTRIBUTE_IDENTIFIER: #{match}")
     167                                OpenEhr::LOG.debug("V_ATTRIBUTE_IDENTIFIER: #{match}")
    168168                                [:V_ATTRIBUTE_IDENTIFIER, match]
    169169                              end)
     
    213213            @parser = lambda do |input|
    214214              Yaparc::Apply.new(Yaparc::Regex.new(/\A[yY][yY][yY][yY]-[mM?X][mM?X]-[dD?X][dD?X][T\t][hH?X][hH?X]:[mM?X][mM?X]:[sS?X][sS?X]/)) do |match|
    215                 OpenEHR::LOG.debug("V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN: #{match}")
     215                OpenEhr::LOG.debug("V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN: #{match}")
    216216                [:V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN, match]
    217217              end
     
    226226            @parser = lambda do |input|
    227227              Yaparc::Apply.new(Yaparc::Regex.new(/\A[yY][yY][yY][yY]-[mM?X][mM?X]-[dD?X][dD?X]/)) do |match|
    228                 OpenEHR::LOG.debug("V_ISO8601_DATE_CONSTRAINT_PATTERN: #{match}")
     228                OpenEhr::LOG.debug("V_ISO8601_DATE_CONSTRAINT_PATTERN: #{match}")
    229229                [:V_ISO8601_DATE_CONSTRAINT_PATTERN, match]
    230230              end
     
    239239            @parser = lambda do |input|
    240240              Yaparc::Apply.new(Yaparc::Regex.new(/\A[hH][hH]:[mM?X][mM?X]:[sS?X][sS?X]/)) do |match|
    241                 OpenEHR::LOG.debug("V_ISO8601_TIME_CONSTRAINT_PATTERN: #{match}")
     241                OpenEhr::LOG.debug("V_ISO8601_TIME_CONSTRAINT_PATTERN: #{match}")
    242242                [:V_ISO8601_TIME_CONSTRAINT_PATTERN, match]
    243243              end
     
    253253              Yaparc::Apply.new(Yaparc::Alt.new(Yaparc::Regex.new(/\AP[yY]?[mM]?[wW]?[dD]?T[hH]?[mM]?[sS]?/),
    254254                                                Yaparc::Regex.new(/\AP[yY]?[mM]?[wW]?[dD]?/))) do |match|
    255                 OpenEHR::LOG.debug("V_ISO8601_DURATION_CONSTRAINT_PATTERN: #{match}")
     255                OpenEhr::LOG.debug("V_ISO8601_DURATION_CONSTRAINT_PATTERN: #{match}")
    256256                [:V_ISO8601_DURATION_CONSTRAINT_PATTERN, match]
    257257              end
     
    266266            @parser = lambda do |input|
    267267              Yaparc::Apply.new(Yaparc::Regex.new(/\A[A-Z][a-zA-Z0-9_]*[ \n]*\</)) do |match|
    268                 OpenEHR::LOG.debug("V_C_DOMAIN_TYPE: #{match}")
     268                OpenEhr::LOG.debug("V_C_DOMAIN_TYPE: #{match}")
    269269                [:START_V_C_DOMAIN_TYPE_BLOCK, match]
    270270              end
     
    280280                              V_ISO8601_DATE_CONSTRAINT_PATTERN.new,
    281281                              V_ISO8601_TIME_CONSTRAINT_PATTERN.new,
    282                               OpenEHR::ADL::Scanner::Common::V_ISO8601_DURATION.new,
     282                              OpenEhr::ADL::Scanner::Common::V_ISO8601_DURATION.new,
    283283                              V_C_DOMAIN_TYPE.new,
    284284                              V_ISO8601_DURATION_CONSTRAINT_PATTERN.new,
    285285                              Reserved.new,
    286                               OpenEHR::ADL::Scanner::Common::V_QUALIFIED_TERM_CODE_REF.new,
    287                               OpenEHR::ADL::Scanner::Common::V_LOCAL_TERM_CODE_REF.new,
    288                               OpenEHR::ADL::Scanner::Common::ERR_V_QUALIFIED_TERM_CODE_REF.new,
    289                               OpenEHR::ADL::Scanner::Common::V_TYPE_IDENTIFIER.new,
    290                               OpenEHR::ADL::Scanner::Common::V_GENERIC_TYPE_IDENTIFIER.new,
    291                               OpenEHR::ADL::Scanner::Common::V_STRING.new,
    292                               OpenEHR::ADL::Scanner::Common::V_LOCAL_CODE.new,
    293                               OpenEHR::ADL::Scanner::Common::V_REAL.new,
    294                               OpenEHR::ADL::Scanner::Common::V_ISO8601_DURATION.new
     286                              OpenEhr::ADL::Scanner::Common::V_QUALIFIED_TERM_CODE_REF.new,
     287                              OpenEhr::ADL::Scanner::Common::V_LOCAL_TERM_CODE_REF.new,
     288                              OpenEhr::ADL::Scanner::Common::ERR_V_QUALIFIED_TERM_CODE_REF.new,
     289                              OpenEhr::ADL::Scanner::Common::V_TYPE_IDENTIFIER.new,
     290                              OpenEhr::ADL::Scanner::Common::V_GENERIC_TYPE_IDENTIFIER.new,
     291                              OpenEhr::ADL::Scanner::Common::V_STRING.new,
     292                              OpenEhr::ADL::Scanner::Common::V_LOCAL_CODE.new,
     293                              OpenEhr::ADL::Scanner::Common::V_REAL.new,
     294                              OpenEhr::ADL::Scanner::Common::V_ISO8601_DURATION.new
    295295                              )
    296296            end
     
    310310              end
    311311              Yaparc::Alt.new(Yaparc::Apply.new(Yaparc::Alt.new(*reserved_parsers)) do |match|
    312                                 OpenEHR::LOG.debug("Reserved: #{match}")
    313                                 [OpenEHR::ADL::Scanner::CADL::RESERVED[match], OpenEHR::ADL::Scanner::CADL::RESERVED[match]]
     312                                OpenEhr::LOG.debug("Reserved: #{match}")
     313                                [OpenEhr::ADL::Scanner::CADL::RESERVED[match], OpenEhr::ADL::Scanner::CADL::RESERVED[match]]
    314314                              end,
    315315                              Yaparc::Apply.new(Yaparc::Regex.new(/\A[a-z][a-zA-Z0-9_]*/)) do |match|
    316                                 OpenEHR::LOG.debug("V_ATTRIBUTE_IDENTIFIER: #{match}")
     316                                OpenEhr::LOG.debug("V_ATTRIBUTE_IDENTIFIER: #{match}")
    317317                                [:V_ATTRIBUTE_IDENTIFIER, match]
    318318                              end)
  • ruby/branches/0.5.0/lib/adl_parser/lib/shell.rb

    r164 r167  
    33require 'stringio'
    44
    5 module OpenEHR
     5module OpenEhr
    66  module Application
    77    class Shell
  • ruby/branches/0.5.0/lib/adl_parser/lib/validator.rb

    r49 r167  
    33
    44
    5 module OpenEHR
     5module OpenEhr
    66  module ADL
    77
  • ruby/branches/0.5.0/lib/adl_parser/test/parser_test.rb

    r116 r167  
    1616    assert_nothing_raised do
    1717      result = @parser.parse(laboratory_request, 'openEHR-EHR-ITEM_TREE.Laboratory_request.v1.adl')
    18       assert_instance_of OpenEHR::AM::Archetype::ARCHETYPE, result
    19       assert_instance_of OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION, result.description
    20       assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, result.definition
     18      assert_instance_of OpenEhr::AM::Archetype::ARCHETYPE, result
     19      assert_instance_of OpenEhr::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION, result.description
     20      assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, result.definition
    2121#      assert_equal '', result.definition
    2222    end
     
    2525    assert_nothing_raised do
    2626      result = @parser.parse(apgar, 'openEHR-EHR-OBSERVATION.apgar.v1.adl')
    27       assert_instance_of OpenEHR::AM::Archetype::ARCHETYPE, result
    28       assert_instance_of OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION, result.description
    29       assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, result.definition
     27      assert_instance_of OpenEhr::AM::Archetype::ARCHETYPE, result
     28      assert_instance_of OpenEhr::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION, result.description
     29      assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, result.definition
    3030    end
    3131
  • ruby/branches/0.5.0/lib/adl_parser/test/scanner_test.rb

    r116 r167  
    55class YaparcParserTest < Test::Unit::TestCase
    66  def test_RootScanner
    7     parser = OpenEHR::ADL::Scanner::DADL::RootScanner.new
    8     assert_instance_of OpenEHR::ADL::Scanner::DADL::RootScanner,parser
     7    parser = OpenEhr::ADL::Scanner::DADL::RootScanner.new
     8    assert_instance_of OpenEhr::ADL::Scanner::DADL::RootScanner,parser
    99    result = parser.parse('')
    1010  end
    1111
    1212  def test_V_LOCAL_TERM_CODE_REF
    13     parser = OpenEHR::ADL::Scanner::Common::V_LOCAL_TERM_CODE_REF.new
    14     assert_instance_of OpenEHR::ADL::Scanner::Common::V_LOCAL_TERM_CODE_REF,parser
     13    parser = OpenEhr::ADL::Scanner::Common::V_LOCAL_TERM_CODE_REF.new
     14    assert_instance_of OpenEhr::ADL::Scanner::Common::V_LOCAL_TERM_CODE_REF,parser
    1515    result = parser.parse('[en-us]')
    1616    assert_instance_of Yaparc::Result::OK, result
     
    1818
    1919  def test_V_QUALIFIED_TERM_CODE_REF
    20     parser = OpenEHR::ADL::Scanner::Common::V_QUALIFIED_TERM_CODE_REF.new
    21     assert_instance_of OpenEHR::ADL::Scanner::Common::V_QUALIFIED_TERM_CODE_REF,parser
     20    parser = OpenEhr::ADL::Scanner::Common::V_QUALIFIED_TERM_CODE_REF.new
     21    assert_instance_of OpenEhr::ADL::Scanner::Common::V_QUALIFIED_TERM_CODE_REF,parser
    2222    result = parser.parse('[ISO_639::en]')
    2323    assert_instance_of Yaparc::Result::OK, result
     
    2727
    2828  def test_V_STRING
    29     parser = OpenEHR::ADL::Scanner::Common::V_STRING.new
    30     assert_instance_of OpenEHR::ADL::Scanner::Common::V_STRING,parser
     29    parser = OpenEhr::ADL::Scanner::Common::V_STRING.new
     30    assert_instance_of OpenEhr::ADL::Scanner::Common::V_STRING,parser
    3131    result = parser.parse('"this is a string"')
    3232    assert_instance_of Yaparc::Result::OK, result
     
    3636
    3737  def test_V_REAL
    38     parser = OpenEHR::ADL::Scanner::Common::V_REAL.new
    39     assert_instance_of OpenEHR::ADL::Scanner::Common::V_REAL,parser
     38    parser = OpenEhr::ADL::Scanner::Common::V_REAL.new
     39    assert_instance_of OpenEhr::ADL::Scanner::Common::V_REAL,parser
    4040    result = parser.parse('0.1')
    4141    assert_instance_of Yaparc::Result::OK, result
     
    4747
    4848  def test_V_ISO8601_DURATION
    49     parser = OpenEHR::ADL::Scanner::Common::V_ISO8601_DURATION.new
    50     assert_instance_of OpenEHR::ADL::Scanner::Common::V_ISO8601_DURATION,parser
     49    parser = OpenEhr::ADL::Scanner::Common::V_ISO8601_DURATION.new
     50    assert_instance_of OpenEhr::ADL::Scanner::Common::V_ISO8601_DURATION,parser
    5151    result = parser.parse('PT1M')
    5252    assert_instance_of Yaparc::Result::OK, result
     
    5757
    5858  def test_V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN
    59     parser = OpenEHR::ADL::Scanner::CADL::V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN.new
    60     assert_instance_of OpenEHR::ADL::Scanner::CADL::V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN,parser
     59    parser = OpenEhr::ADL::Scanner::CADL::V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN.new
     60    assert_instance_of OpenEhr::ADL::Scanner::CADL::V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN,parser
    6161    result = parser.parse('yyyy-??-??T??:??:??')
    6262    assert_instance_of Yaparc::Result::OK, result
     
    6464
    6565  def test_V_ISO8601_DATE_CONSTRAINT_PATTERN
    66     parser = OpenEHR::ADL::Scanner::CADL::V_ISO8601_DATE_CONSTRAINT_PATTERN.new
    67     assert_instance_of OpenEHR::ADL::Scanner::CADL::V_ISO8601_DATE_CONSTRAINT_PATTERN,parser
     66    parser = OpenEhr::ADL::Scanner::CADL::V_ISO8601_DATE_CONSTRAINT_PATTERN.new
     67    assert_instance_of OpenEhr::ADL::Scanner::CADL::V_ISO8601_DATE_CONSTRAINT_PATTERN,parser
    6868    result = parser.parse('yyyy-mm-XX-dd')
    6969    assert_instance_of Yaparc::Result::OK, result
     
    7171
    7272  def test_V_ISO8601_TIME_CONSTRAINT_PATTERN
    73     parser = OpenEHR::ADL::Scanner::CADL::V_ISO8601_TIME_CONSTRAINT_PATTERN.new
    74     assert_instance_of OpenEHR::ADL::Scanner::CADL::V_ISO8601_TIME_CONSTRAINT_PATTERN,parser
     73    parser = OpenEhr::ADL::Scanner::CADL::V_ISO8601_TIME_CONSTRAINT_PATTERN.new
     74    assert_instance_of OpenEhr::ADL::Scanner::CADL::V_ISO8601_TIME_CONSTRAINT_PATTERN,parser
    7575    result = parser.parse('hh:mm:ss:??')
    7676    assert_instance_of Yaparc::Result::OK, result
     
    7878
    7979  def test_dadl_reserved
    80     parser = OpenEHR::ADL::Scanner::DADL::RootScanner.new
     80    parser = OpenEhr::ADL::Scanner::DADL::RootScanner.new
    8181    result = parser.parse('then')
    8282    assert_instance_of Yaparc::Result::OK, result
     
    8787
    8888  def test_cadl
    89     parser = OpenEHR::ADL::Scanner::CADL::RootScanner.new
    90     assert_instance_of OpenEHR::ADL::Scanner::CADL::RootScanner,parser
     89    parser = OpenEhr::ADL::Scanner::CADL::RootScanner.new
     90    assert_instance_of OpenEhr::ADL::Scanner::CADL::RootScanner,parser
    9191    result = parser.parse('PT1M')
    9292    assert_instance_of Yaparc::Result::OK, result
     
    9898
    9999  def test_cadl_reserved
    100     parser = OpenEHR::ADL::Scanner::CADL::RootScanner.new
     100    parser = OpenEhr::ADL::Scanner::CADL::RootScanner.new
    101101    result = parser.parse('then')
    102102    assert_instance_of Yaparc::Result::OK, result
  • ruby/branches/0.5.0/lib/models/tests/rm/quantity/ts_date_time.rb

    r151 r167  
    11require 'test/unit'
    22require 'rm'
    3 include OpenEHR::RM::Data_Types::Quantity::Date_Time
     3include OpenEhr::RM::DataTypes::Quantity::DateTime
    44
    55class DateTimeTest < Test::Unit::TestCase
    66  def setup
    77    assert_nothing_raised(Exception){
    8       @dv_temporal = DV_Temporal.new('2008')}
     8      @dv_temporal = DvTemporal.new('2008')}
    99    assert_nothing_raised(Exception){
    10       @dv_date = DV_Date.new('2009-06-29')}
     10      @dv_date = DvDate.new('2009-06-29')}
    1111    assert_nothing_raised(Exception){
    12       @dv_time = DV_Time.new('12:34:56.78')}
     12      @dv_time = DvTime.new('12:34:56.78')}
    1313    assert_nothing_raised(Exception){
    14       @dv_date_time = DV_Date_Time.new('2009-06-29T12:34:56.78')}
     14      @dv_date_time = DvDateTime.new('2009-06-29T12:34:56.78')}
    1515    assert_nothing_raised(Exception){
    16       @dv_duration = DV_Duration.new('P1Y2M3W4DT5H6M7.8S')}
     16      @dv_duration = DvDuration.new('P1Y2M3W4DT5H6M7.8S')}
    1717  end
    1818
    1919  def test_init
    20     assert_instance_of DV_Temporal, @dv_temporal
    21     assert_instance_of DV_Date, @dv_date
    22     assert_instance_of DV_Time, @dv_time
    23     assert_instance_of DV_Date_Time, @dv_date_time
    24     assert_instance_of DV_Duration, @dv_duration
     20    assert_instance_of DvTemporal, @dv_temporal
     21    assert_instance_of DvDate, @dv_date
     22    assert_instance_of DvTime, @dv_time
     23    assert_instance_of DvDateTime, @dv_date_time
     24    assert_instance_of DvDuration, @dv_duration
    2525  end
    2626
     
    3636    assert_equal 29, @dv_date.day
    3737    assert_equal 733954, @dv_date.magnitude
    38     date2 = DV_Date.new('2009-07-08')
     38    date2 = DvDate.new('2009-07-08')
    3939    assert_equal 'P0Y0M1W9D',@dv_date.diff(date2).value
    40     date2 = DV_Date.new('2004-02-28')
    41     date3 = DV_Date.new('2004-03-01')
     40    date2 = DvDate.new('2004-02-28')
     41    date3 = DvDate.new('2004-03-01')
    4242    assert_equal 'P0Y0M0W2D', date2.diff(date3).value
    43     date4 = DV_Date.new('2003-12-31')
     43    date4 = DvDate.new('2003-12-31')
    4444    assert_equal 'P0Y1M4W28D', date2.diff(date4).value
    45     birthday = DV_Date.new('1970-04-19')
    46     assert_equal 'P39Y2M1W11D', birthday.diff(DV_Date.new('2009-06-30')).value
     45    birthday = DvDate.new('1970-04-19')
     46    assert_equal 'P39Y2M1W11D', birthday.diff(DvDate.new('2009-06-30')).value
    4747  end
    4848
     
    5454    assert_equal 0.78, @dv_time.fractional_second
    5555    assert_equal((12*60*60 + 34 * 60 + 56 + 0.78), @dv_time.magnitude)
    56     dv_time2 = DV_Time.new('15:36:48.05')
     56    dv_time2 = DvTime.new('15:36:48.05')
    5757    assert_equal 'P0Y0M0W0DT3H1M51.27S', @dv_time.diff(dv_time2).value
    5858  end
     
    6767    assert_equal 56, @dv_date_time.second
    6868    assert_equal 0.78, @dv_date_time.fractional_second
    69     dv_date_time2 = DV_Date_Time.new('1970-04-19T13:55:30.12')
     69    dv_date_time2 = DvDateTime.new('1970-04-19T13:55:30.12')
    7070    assert_equal 'P39Y2M1W9DT22H39M26.66S', @dv_date_time.diff(dv_date_time2).value
    7171  end
  • ruby/branches/0.5.0/lib/models/tests/rm/test_common.rb

    r163 r167  
    33require 'rm'
    44
    5 include OpenEHR::RM::Data_Types::Text
    6 include OpenEHR::RM::Common::Resource
    7 include OpenEHR::RM::Common::Archetyped
    8 include OpenEHR::RM::Common::Generic
    9 include OpenEHR::RM::Common::Change_Control
    10 include OpenEHR::RM::Common::Directory
    11 include OpenEHR::RM::Support::Identification
    12 include OpenEHR::RM::Data_Types::Basic
    13 include OpenEHR::RM::Data_Types::Quantity
    14 include OpenEHR::RM::Data_Types::URI
     5include OpenEhr::RM::DataTypes::Text
     6include OpenEhr::RM::Common::Resource
     7include OpenEhr::RM::Common::Archetyped
     8include OpenEhr::RM::Common::Generic
     9include OpenEhr::RM::Common::ChangeControl
     10include OpenEhr::RM::Common::Directory
     11include OpenEhr::RM::Support::Identification
     12include OpenEhr::RM::DataTypes::Basic
     13include OpenEhr::RM::DataTypes::Quantity
     14include OpenEhr::RM::DataTypes::Uri
    1515
    1616class RM_Common_Resource_Test < Test::Unit::TestCase
    1717  def setup
    18     terminology_id = Terminology_ID.new('openehr')
    19     code_phrase = Code_Phrase.new('ja', terminology_id)   
    20     @translation_details = OpenEHR::RM::Common::Resource::Translation_Details.new(:language => code_phrase, :author => {'KOBAYASHI, Shinji', 'Ehime Univ'},
     18    terminology_id = TerminologyId.new('openehr')
     19    code_phrase = CodePhrase.new('ja', terminology_id)
     20    @translation_details = OpenEhr::RM::Common::Resource::TranslationDetails.new(:language => code_phrase, :author => {'KOBAYASHI, Shinji', 'Ehime Univ'},
    2121  :accreditation => 'jp', :other_details => {'ruby', 'test'})
    22     @authored_resource = OpenEHR::RM::Common::Resource::Authored_Resource.new(:original_language => code_phrase, :translations => {'ja', @translation_details}, :description => "test")
    23     @resource_description_item = OpenEHR::RM::Common::Resource::Resource_Description_Item.new(:language => code_phrase,
     22    @authored_resource = OpenEhr::RM::Common::Resource::AuthoredResource.new(:original_language => code_phrase, :translations => {'ja', @translation_details}, :description => "test")
     23    @resource_description_item = OpenEhr::RM::Common::Resource::ResourceDescriptionItem.new(:language => code_phrase,
    2424              :purpose => 'test',
    2525              :keywords => %w[test ruby],
     
    2929              :original_resource_uri => {'issuer', 'http://openehr.jp/'},
    3030              :other_details => {'samos', 'icicth7'})
    31     @resource_description = OpenEHR::RM::Common::Resource::Resource_Description.new(:original_author => {'KOBAYASHI, Shinji' => 'Ehime University'},
     31    @resource_description = OpenEhr::RM::Common::Resource::ResourceDescription.new(:original_author => {'KOBAYASHI, Shinji' => 'Ehime University'},
    3232    :lifecycle_state => 'experimental',
    3333    :details => {'ja', @resource_description_item},
     
    3636    :other_details => {'ja', 'shikoku'},
    3737    :parent_resource => @authored_resource)
    38     @authored_resource = OpenEHR::RM::Common::Resource::Authored_Resource.new(:original_language => code_phrase, :translations => {'ja', @translation_details}, :description => @resource_description)
     38    @authored_resource = OpenEhr::RM::Common::Resource::AuthoredResource.new(:original_language => code_phrase, :translations => {'ja', @translation_details}, :description => @resource_description)
    3939  end
    4040
    4141  def test_init
    42     assert_instance_of OpenEHR::RM::Common::Resource::Authored_Resource, @authored_resource
    43     assert_instance_of OpenEHR::RM::Common::Resource::Translation_Details, @translation_details
    44     assert_instance_of OpenEHR::RM::Common::Resource::Resource_Description_Item, @resource_description_item
    45     assert_instance_of OpenEHR::RM::Common::Resource::Resource_Description, @resource_description
     42    assert_instance_of OpenEhr::RM::Common::Resource::AuthoredResource, @authored_resource
     43    assert_instance_of OpenEhr::RM::Common::Resource::TranslationDetails, @translation_details
     44    assert_instance_of OpenEhr::RM::Common::Resource::ResourceDescriptionItem, @resource_description_item
     45    assert_instance_of OpenEhr::RM::Common::Resource::ResourceDescription, @resource_description
    4646  end
    4747
     
    8686class RM_Common_Archetyped_Test < Test::Unit::TestCase
    8787  def setup
    88     @dv_text = OpenEHR::RM::Data_Types::Text::DV_Text.new('Test')
    89     @uid_based_id = OpenEHR::RM::Support::Identification::UID_Based_ID.new('rrip::0.0.5')
    90     @archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")
    91     @template_id = OpenEHR::RM::Support::Identification::Template_ID.new('1.0.1')
    92     assert_nothing_raised(Exception){@archetyped = OpenEHR::RM::Common::Archetyped::Archetyped.new(@archetype_id, '1.0.1')}
    93     assert_nothing_raised(Exception){@link = OpenEHR::RM::Common::Archetyped::Link.new(OpenEHR::RM::Data_Types::Text::DV_Text.new("generic"), OpenEHR::RM::Data_Types::URI::DV_EHR_URI.new("ehr://test/"),OpenEHR::RM::Data_Types::Text::DV_Text.new("problem"))}
    94     assert_nothing_raised(Exception){
    95       @pathable = OpenEHR::RM::Common::Archetyped::Pathable.new }
    96     name = OpenEHR::RM::Data_Types::Text::DV_Text.new('blood')
     88    @dv_text = OpenEhr::RM::DataTypes::Text::DvText.new('Test')
     89    @uid_based_id = OpenEhr::RM::Support::Identification::UidBasedId.new('rrip::0.0.5')
     90    @archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")
     91    @template_id = OpenEhr::RM::Support::Identification::TemplateId.new('1.0.1')
     92    assert_nothing_raised(Exception){@archetyped = OpenEhr::RM::Common::Archetyped::Archetyped.new(@archetype_id, '1.0.1')}
     93    assert_nothing_raised(Exception){@link = OpenEhr::RM::Common::Archetyped::Link.new(OpenEhr::RM::DataTypes::Text::DvText.new("generic"), OpenEhr::RM::DataTypes::Uri::DvEhrUri.new("ehr://test/"),OpenEhr::RM::DataTypes::Text::DvText.new("problem"))}
     94    assert_nothing_raised(Exception){
     95      @pathable = OpenEhr::RM::Common::Archetyped::Pathable.new }
     96    name = OpenEhr::RM::DataTypes::Text::DvText.new('blood')
    9797    links = Set.new([@uid_based_id])
    9898    assert_nothing_raised(Exception){
     
    100100                                 :name => name,
    101101                                 :links => links)}
    102     provider = Party_Identified.new(:name => 'NERV')
    103     location = Party_Identified.new(:name => 'GEOFRONT')
    104     object_version_id = Object_Version_ID.new('ABC::DEF::1.3.4')
    105     party_ref = Party_Ref.new('local', 'ORGANISATION', object_id)
    106     assert_nothing_raised(Exception){
    107       @feeder_audit_details = Feeder_Audit_Details.new(:system_id => 'MAGI',
     102    provider = PartyIdentified.new(:name => 'NERV')
     103    location = PartyIdentified.new(:name => 'GEOFRONT')
     104    object_version_id = ObjectVersionId.new('ABC::DEF::1.3.4')
     105    party_ref = PartyRef.new('local', 'ORGANISATION', object_id)
     106    assert_nothing_raised(Exception){
     107      @feeder_audit_details = FeederAuditDetails.new(:system_id => 'MAGI',
    108108                                                       :provider => provider,
    109109                                                       :location => location,
    110                                                        :time => DV_Date_Time.new('2009-07-03T12:16:31'),
    111                                                        :subject => Party_Proxy.new(:external_ref => party_ref),
     110                                                       :time => DvDateTime.new('2009-07-03T12:16:31'),
     111                                                       :subject => PartyProxy.new(:external_ref => party_ref),
    112112                                                       :version_id => '0.0.4')}
    113     feeder_audit_details = Feeder_Audit_Details.new(:system_id => 'AKAGI')
    114     dv_identifier = DV_Identifier.new('NERV', 'MELCHIOR', 'RITSUKO', 'COMPUTER')
    115     feeder_audit_details2 = Feeder_Audit_Details.new(:system_id => 'KATSURAGI')
    116     dv_identifier2 = DV_Identifier.new('NERV', 'SHOGOUKI', 'MISATO', 'EVANGELION')
    117     charset = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('UTF-8','character-sets')
    118     language = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('ja', 'languages')
    119 
    120     dv_encapsulated = OpenEHR::RM::Data_Types::Encapsulated::DV_Encapsulated.new(charset, language, 10)
    121     assert_nothing_raised(Exception){
    122       @feeder_audit = Feeder_Audit.new(:originating_system_audit => feeder_audit_details,
     113    feeder_audit_details = FeederAuditDetails.new(:system_id => 'AKAGI')
     114    dv_identifier = DvIdentifier.new('NERV', 'MELCHIOR', 'RITSUKO', 'COMPUTER')
     115    feeder_audit_details2 = FeederAuditDetails.new(:system_id => 'KATSURAGI')
     116    dv_identifier2 = DvIdentifier.new('NERV', 'SHOGOUKI', 'MISATO', 'EVANGELION')
     117    charset = OpenEhr::RM::DataTypes::Text::CodePhrase.new('UTF-8','character-sets')
     118    language = OpenEhr::RM::DataTypes::Text::CodePhrase.new('ja', 'languages')
     119
     120    dv_encapsulated = OpenEhr::RM::DataTypes::Encapsulated::DvEncapsulated.new(charset, language, 10)
     121    assert_nothing_raised(Exception){
     122      @feeder_audit = FeederAudit.new(:originating_system_audit => feeder_audit_details,
    123123                                       :originating_system_item_ids => [dv_identifier],
    124124                                       :feeder_system_audit => feeder_audit_details2,
     
    128128
    129129  def test_init
    130     assert_instance_of OpenEHR::RM::Common::Archetyped::Archetyped, @archetyped
    131     assert_instance_of OpenEHR::RM::Common::Archetyped::Link, @link
    132     assert_instance_of OpenEHR::RM::Common::Archetyped::Pathable, @pathable
    133     assert_instance_of OpenEHR::RM::Common::Archetyped::Locatable, @locatable
    134     assert_instance_of Feeder_Audit_Details, @feeder_audit_details
    135     assert_instance_of Feeder_Audit, @feeder_audit
     130    assert_instance_of OpenEhr::RM::Common::Archetyped::Archetyped, @archetyped
     131    assert_instance_of OpenEhr::RM::Common::Archetyped::Link, @link
     132    assert_instance_of OpenEhr::RM::Common::Archetyped::Pathable, @pathable
     133    assert_instance_of OpenEhr::RM::Common::Archetyped::Locatable, @locatable
     134    assert_instance_of FeederAuditDetails, @feeder_audit_details
     135    assert_instance_of FeederAudit, @feeder_audit
    136136  end
    137137
     
    144144    assert_nothing_raised(Exception){@archetyped.template_id = @template_id}
    145145    assert_equal @template_id, @archetyped.template_id
    146     archetype_id2 = OpenEHR::RM::Support::Identification::Archetype_ID.new("1.0.2", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")
     146    archetype_id2 = OpenEhr::RM::Support::Identification::ArchetypeId.new("1.0.2", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")
    147147    assert_nothing_raised(ArgumentError){@archetyped.archetype_id = archetype_id2}
    148148    assert_equal archetype_id2, @archetyped.archetype_id
     
    157157    assert_equal 'problem', @link.type.value
    158158    # test meaning
    159     assert_nothing_raised(Exception){@link.meaning = OpenEHR::RM::Data_Types::Text::DV_Text.new('clinical')}
     159    assert_nothing_raised(Exception){@link.meaning = OpenEhr::RM::DataTypes::Text::DvText.new('clinical')}
    160160    assert_equal 'clinical', @link.meaning.value
    161161    assert_raise(ArgumentError){@link.meaning = nil}
    162162    # test target
    163     assert_nothing_raised(Exception){@link.target = OpenEHR::RM::Data_Types::URI::DV_EHR_URI.new("ehr://try/")}
     163    assert_nothing_raised(Exception){@link.target = OpenEhr::RM::DataTypes::Uri::DvEhrUri.new("ehr://try/")}
    164164    assert_equal 'ehr://try/', @link.target.value
    165165    assert_raise(ArgumentError){@link.target = nil}
    166166    # test type
    167     assert_nothing_raised(Exception){@link.type = OpenEHR::RM::Data_Types::Text::DV_Text.new("issue")}
     167    assert_nothing_raised(Exception){@link.type = OpenEhr::RM::DataTypes::Text::DvText.new("issue")}
    168168    assert_equal 'issue', @link.type.value
    169169    assert_raise(ArgumentError){@link.type = nil}
     
    190190class RM_Common_Generic_Test < Test::Unit::TestCase
    191191  def setup
    192     assert_nothing_raised(Exception){party_proxy = Party_Proxy.new}
    193     object_id = Object_ID.new('0.0.4')
    194     party_ref = Party_Ref.new('unknown', 'ORGANISATION', object_id)
    195     assert_nothing_raised(Exception){
    196       @party_proxy = Party_Proxy.new(:external_ref => party_ref)}
    197     assert_nothing_raised(Exception){party_self = Party_Self.new}
    198     assert_nothing_raised(Exception){
    199       @party_self = Party_Self.new(:external_ref => party_ref)}
     192    assert_nothing_raised(Exception){party_proxy = PartyProxy.new}
     193    object_id = ObjectId.new('0.0.4')
     194    party_ref = PartyRef.new('unknown', 'ORGANISATION', object_id)
     195    assert_nothing_raised(Exception){
     196      @party_proxy = PartyProxy.new(:external_ref => party_ref)}
     197    assert_nothing_raised(Exception){party_self = PartySelf.new}
     198    assert_nothing_raised(Exception){
     199      @party_self = PartySelf.new(:external_ref => party_ref)}
    200200    assert_raise(ArgumentError){
    201       party_identified = Party_Identified.new}
     201      party_identified = PartyIdentified.new}
    202202
    203203    identifiers = []
    204     identifiers << DV_Identifier.new('NERV', 'MELCHIOR', 'GENDO', 'COMPUTER')
    205     identifiers << DV_Identifier.new('NERV', 'CASPER', 'GENDO', 'COMPUTER')
    206     identifiers << DV_Identifier.new('NERV', 'BALTHAZAR', 'GENDO', 'COMPUTER')
    207     assert_nothing_raised(Exception){
    208       @party_identified = Party_Identified.new(:name => 'NERV',
     204    identifiers << DvIdentifier.new('NERV', 'MELCHIOR', 'GENDO', 'COMPUTER')
     205    identifiers << DvIdentifier.new('NERV', 'CASPER', 'GENDO', 'COMPUTER')
     206    identifiers << DvIdentifier.new('NERV', 'BALTHAZAR', 'GENDO', 'COMPUTER')
     207    assert_nothing_raised(Exception){
     208      @party_identified = PartyIdentified.new(:name => 'NERV',
    209209                                               :external_ref => party_ref,
    210210                                               :identifier => identifiers)}
    211211
    212     terminology_id = Terminology_ID.new('test(0.04)')
    213     code_phrase = Code_Phrase.new('self', terminology_id)
    214     dv_coded_text = DV_Coded_Text.new('Seele',code_phrase)
    215     assert_nothing_raised(Exception){
    216       @party_related = Party_Related.new(:name => 'GEHIRN',
     212    terminology_id = TerminologyId.new('test(0.04)')
     213    code_phrase = CodePhrase.new('self', terminology_id)
     214    dv_coded_text = DvCodedText.new('Seele',code_phrase)
     215    assert_nothing_raised(Exception){
     216      @party_related = PartyRelated.new(:name => 'GEHIRN',
    217217                                         :relationship => dv_coded_text)}
    218     dv_text = DV_Text.new('commiter')
    219     dv_coded_text = DV_Coded_Text.new('present',terminology_id)
    220     dv_date_time1 = DV_Date_Time.new('2009-07-04T16:30:00')
    221     dv_date_time2 = DV_Date_Time.new('2009-07-14T00:00:00')
    222     dv_interval = DV_Interval.new(dv_date_time1, dv_date_time2)
     218    dv_text = DvText.new('commiter')
     219    dv_coded_text = DvCodedText.new('present',terminology_id)
     220    dv_date_time1 = DvDateTime.new('2009-07-04T16:30:00')
     221    dv_date_time2 = DvDateTime.new('2009-07-14T00:00:00')
     222    dv_interval = DvInterval.new(dv_date_time1, dv_date_time2)
    223223    assert_nothing_raised(Exception){
    224224      @participation = Participation.new(:performer => @party_proxy,
     
    226226                                         :mode => dv_coded_text,
    227227                                         :time => dv_interval)}
    228     dv_date_time = DV_Date_Time.new('2009-07-04T18:56:00')
    229     terminology_id = Terminology_ID.new('openehr(1.0.2)')
    230     code_phrase = Code_Phrase.new('249', terminology_id)
    231     dv_coded_text = DV_Coded_Text.new('creation', code_phrase)
    232     dv_text = DV_Text.new('test environment')
    233     assert_nothing_raised(Exception){
    234       @audit_details = Audit_Details.new(:system_id => 'MAGI',
     228    dv_date_time = DvDateTime.new('2009-07-04T18:56:00')
     229    terminology_id = TerminologyId.new('openehr(1.0.2)')
     230    code_phrase = CodePhrase.new('249', terminology_id)
     231    dv_coded_text = DvCodedText.new('creation', code_phrase)
     232    dv_text = DvText.new('test environment')
     233    assert_nothing_raised(Exception){
     234      @audit_details = AuditDetails.new(:system_id => 'MAGI',
    235235                                         :committer => @party_proxy,
    236236                                         :time_committed => dv_date_time,
    237237                                         :change_type => dv_coded_text,
    238238                                         :description => dv_text)}
    239     dv_text = DV_Text.new('authorisation')
    240     dv_ehr_uri = DV_EHR_URI.new('ehr://test/')
     239    dv_text = DvText.new('authorisation')
     240    dv_ehr_uri = DvEhrUri.new('ehr://test/')
    241241    assert_nothing_raised(Exception){
    242242      @attestation = Attestation.new(:system_id => 'NERV',
     
    248248                                     :proof => 'hashedstring',
    249249                                     :items => Set[dv_ehr_uri])}
    250     object_version_id = Object_Version_ID.new('SHOGOUKI::NERV::1.1.1')
    251     audit_details2 = Audit_Details.new(:system_id => 'MAGI',
     250    object_version_id = ObjectVersionId.new('SHOGOUKI::NERV::1.1.1')
     251    audit_details2 = AuditDetails.new(:system_id => 'MAGI',
    252252                                       :committer => @party_proxy,
    253253                                       :time_committed => dv_date_time2,
    254254                                       :change_type => dv_coded_text)
    255255    assert_nothing_raised(Exception){
    256       @revision_history_item = Revision_History_Item.new(:audits => [@audit_details, audit_details2],
     256      @revision_history_item = RevisionHistoryItem.new(:audits => [@audit_details, audit_details2],
    257257                                                         :version_id => object_version_id)}
    258     dv_date_time3 = DV_Date_Time.new('2009-07-14T12:00:00')
    259     dv_date_time4 = DV_Date_Time.new('2009-07-15T00:00:00')
    260     audit_details3 = Audit_Details.new(:system_id => 'MAGI',
     258    dv_date_time3 = DvDateTime.new('2009-07-14T12:00:00')
     259    dv_date_time4 = DvDateTime.new('2009-07-15T00:00:00')
     260    audit_details3 = AuditDetails.new(:system_id => 'MAGI',
    261261                                     :committer => @party_proxy,
    262262                                     :time_committed => dv_date_time3,
    263263                                     :change_type => dv_coded_text)
    264     audit_details4 = Audit_Details.new(:system_id => 'MAGI',
     264    audit_details4 = AuditDetails.new(:system_id => 'MAGI',
    265265                                     :committer => @party_proxy,
    266266                                     :time_committed => dv_date_time4,
    267267                                     :change_type => dv_coded_text)
    268     object_version_id = Object_Version_ID.new('NIGOUKI::NERV::2.2.2')
    269     revision_history_item2 = Revision_History_Item.new(:audits => [audit_details3, audit_details4],
     268    object_version_id = ObjectVersionId.new('NIGOUKI::NERV::2.2.2')
     269    revision_history_item2 = RevisionHistoryItem.new(:audits => [audit_details3, audit_details4],
    270270                                                      :version_id => object_version_id)
    271271    assert_nothing_raised(Exception){
    272       @revision_history = Revision_History.new([@revision_history_item, revision_history_item2])}
     272      @revision_history = RevisionHistory.new([@revision_history_item, revision_history_item2])}
    273273  end
    274274
    275275  def test_init
    276     assert_instance_of Party_Proxy, @party_proxy
    277     assert_instance_of Party_Self, @party_self
    278     assert_instance_of Party_Identified, @party_identified
     276    assert_instance_of PartyProxy, @party_proxy
     277    assert_instance_of PartySelf, @party_self
     278    assert_instance_of PartyIdentified, @party_identified
    279279    assert_instance_of Participation, @participation
    280     assert_instance_of Audit_Details, @audit_details
     280    assert_instance_of AuditDetails, @audit_details
    281281    assert_instance_of Attestation, @attestation
    282     assert_instance_of Revision_History_Item, @revision_history_item
    283     assert_instance_of Revision_History, @revision_history
     282    assert_instance_of RevisionHistoryItem, @revision_history_item
     283    assert_instance_of RevisionHistory, @revision_history
    284284  end
    285285
     
    347347  def setup
    348348    archetype_node_id = 'at0001'
    349     name = DV_Text.new('folder_test')
    350     object_id = Object_ID.new('1.1.1')
    351     object_ref = Object_Ref.new('local', 'PARTY', object_id)
     349    name = DvText.new('folder_test')
     350    object_id = ObjectId.new('1.1.1')
     351    object_ref = ObjectRef.new('local', 'PARTY', object_id)
    352352    assert_nothing_raised(Exception){
    353353      @folder = Folder.new(:archetype_node_id => archetype_node_id,
     
    359359 
    360360  def test_init
    361     assert_instance_of OpenEHR::RM::Common::Directory::Folder, @folder
     361    assert_instance_of OpenEhr::RM::Common::Directory::Folder, @folder
    362362  end
    363363
     
    370370class RM_Common_Change_Control_Test < Test::Unit::TestCase
    371371  def setup
    372     object_version_id1 = Object_Version_ID.new('ABC::DEF::2.2.3')
    373     object_version_id2 = Object_Version_ID.new('GHI::JKL::4.5.6')
    374     object_id = Object_ID.new('ehr://uniqueid1020')
    375     dv_date_time = DV_Date_Time.new('2009-07-06T21:10:12')
    376     party_ref = Party_Ref.new('unknown', 'ORGANISATION', object_id)
    377     party_proxy = Party_Proxy.new(:external_ref => party_ref)
    378     terminology_id = Terminology_ID.new('openehr(1.0.2)')
    379     code_phrase = Code_Phrase.new('249', terminology_id)
    380     dv_coded_text = DV_Coded_Text.new('creation', code_phrase)
    381     audit_details = Audit_Details.new(:system_id => 'MAGI',
     372    object_version_id1 = ObjectVersionId.new('ABC::DEF::2.2.3')
     373    object_version_id2 = ObjectVersionId.new('GHI::JKL::4.5.6')
     374    object_id = ObjectId.new('ehr://uniqueid1020')
     375    dv_date_time = DvDateTime.new('2009-07-06T21:10:12')
     376    party_ref = PartyRef.new('unknown', 'ORGANISATION', object_id)
     377    party_proxy = PartyProxy.new(:external_ref => party_ref)
     378    terminology_id = TerminologyId.new('openehr(1.0.2)')
     379    code_phrase = CodePhrase.new('249', terminology_id)
     380    dv_coded_text = DvCodedText.new('creation', code_phrase)
     381    audit_details = AuditDetails.new(:system_id => 'MAGI',
    382382                                      :committer => party_proxy,
    383383                                      :time_committed => dv_date_time,
    384384                                      :change_type => dv_coded_text)
    385     code_phrase = Code_Phrase.new('532', terminology_id)
    386     dv_coded_text = DV_Coded_Text.new('complete', code_phrase)
    387     object_id = Object_ID.new('ehr://test_location')
    388     object_ref = Object_Ref.new('local', 'PARTY', object_id)
    389     hier_object_id = Hier_Object_ID.new('ABC')
     385    code_phrase = CodePhrase.new('532', terminology_id)
     386    dv_coded_text = DvCodedText.new('complete', code_phrase)
     387    object_id = ObjectId.new('ehr://test_location')
     388    object_ref = ObjectRef.new('local', 'PARTY', object_id)
     389    hier_object_id = HierObjectId.new('ABC')
    390390    assert_nothing_raised(Exception){
    391391      @version = Version.new(:uid => object_version_id1,
     
    396396                             :signature => 'test_version',
    397397                             :data => 'data')}
    398     object_version_id3 = Object_Version_ID.new('MNO::PQR::7.8.9')
    399     object_version_id4 = Object_Version_ID.new('STU::VWX::1.2.3')
    400     code_phrase = Code_Phrase.new('240', terminology_id)
    401     dv_coded_text2 = DV_Coded_Text.new('signed', code_phrase)
     398    object_version_id3 = ObjectVersionId.new('MNO::PQR::7.8.9')
     399    object_version_id4 = ObjectVersionId.new('STU::VWX::1.2.3')
     400    code_phrase = CodePhrase.new('240', terminology_id)
     401    dv_coded_text2 = DvCodedText.new('signed', code_phrase)
    402402    attestation = Attestation.new(:system_id => 'NERV',
    403403                                  :committer => party_proxy,
    404404                                  :time_committed => dv_date_time,
    405405                                  :change_type => dv_coded_text,
    406                                   :reason => DV_Text.new('signed'))
    407     dv_date_time = DV_Date_Time.new('2009-07-07T21:10:12')
    408     audit_details = Audit_Details.new(:system_id => 'MAGI',
     406                                  :reason => DvText.new('signed'))
     407    dv_date_time = DvDateTime.new('2009-07-07T21:10:12')
     408    audit_details = AuditDetails.new(:system_id => 'MAGI',
    409409                                      :committer => party_proxy,
    410410                                      :time_committed => dv_date_time,
    411411                                      :change_type => dv_coded_text)
    412412    assert_nothing_raised(Exception){
    413       @original_version = Original_Version.new(:uid => object_version_id3,
     413      @original_version = OriginalVersion.new(:uid => object_version_id3,
    414414                                               :preceding_version_uid => object_version_id4,
    415415                                               :other_input_version_uids => Set[object_version_id1, object_version_id2],
     
    419419                                               :data => 'data',
    420420                                               :lifecycle_state => dv_coded_text)}
    421     dv_date_time = DV_Date_Time.new('2009-07-08T21:10:12')
    422     audit_details = Audit_Details.new(:system_id => 'CASPER',
     421    dv_date_time = DvDateTime.new('2009-07-08T21:10:12')
     422    audit_details = AuditDetails.new(:system_id => 'CASPER',
    423423                                      :committer => party_proxy,
    424424                                      :time_committed => dv_date_time,
    425425                                      :change_type => dv_coded_text,
    426426                                      :description => 'for contribution')
    427     object_ref = Object_Ref.new('unknown', 'PARTY', object_id)
    428     assert_nothing_raised(Exception){
    429       @imported_version = Imported_Version.new(:item => @original_version,
     427    object_ref = ObjectRef.new('unknown', 'PARTY', object_id)
     428    assert_nothing_raised(Exception){
     429      @imported_version = ImportedVersion.new(:item => @original_version,
    430430                                               :commit_audit => audit_details,
    431431                                               :contribution => object_ref,
     
    435435                                       :versions => Set[object_ref],
    436436                                       :audit => audit_details)}
    437     dv_date_time = DV_Date_Time.new('2009-07-08T18:10:12')
    438     audit_details = Audit_Details.new(:system_id => 'MAGI',
     437    dv_date_time = DvDateTime.new('2009-07-08T18:10:12')
     438    audit_details = AuditDetails.new(:system_id => 'MAGI',
    439439                                      :committer => party_proxy,
    440440                                      :time_committed => dv_date_time,
     
    446446                                :change_type => dv_coded_text)
    447447    assert_nothing_raised(Exception){
    448       @versioned_object = Versioned_Object.new(:uid => hier_object_id,
     448      @versioned_object = VersionedObject.new(:uid => hier_object_id,
    449449                                               :owner_id => object_ref,
    450450                                               :time_created => dv_date_time,
     
    453453
    454454  def test_init
    455     assert_instance_of OpenEHR::RM::Common::Change_Control::Version, @version
    456     assert_instance_of Original_Version, @original_version
    457     assert_instance_of Imported_Version, @imported_version
    458     assert_instance_of OpenEHR::RM::Common::Change_Control::Contribution, @contribution
    459     assert_instance_of Versioned_Object, @versioned_object
     455    assert_instance_of OpenEhr::RM::Common::ChangeControl::Version, @version
     456    assert_instance_of OriginalVersion, @original_version
     457    assert_instance_of ImportedVersion, @imported_version
     458    assert_instance_of OpenEhr::RM::Common::ChangeControl::Contribution, @contribution
     459    assert_instance_of VersionedObject, @versioned_object
    460460  end
    461461
     
    505505    assert !@versioned_object.is_original_version?(@version.uid)
    506506    assert @versioned_object.is_original_version?(@original_version.uid)
    507     assert @versioned_object.has_version_at_time?(DV_Date_Time.new('2009-07-06T21:10:12'))
     507    assert @versioned_object.has_version_at_time?(DvDateTime.new('2009-07-06T21:10:12'))
    508508    assert_equal @version, @versioned_object.version_with_id(@version.uid)
    509509    assert_equal @version, @versioned_object.version_at_time(@version.commit_audit.time_committed)
     
    538538                                                :item => @imported_version.item)}
    539539    assert_equal 7, @versioned_object.version_count
    540     dv_date_time = DV_Date_Time.new('2009-07-07T22:11:31')
     540    dv_date_time = DvDateTime.new('2009-07-07T22:11:31')
    541541    attestation = Attestation.new(:system_id => 'NERV2',
    542542                                  :committer => @version.contribution,
    543543                                  :time_committed => dv_date_time,
    544544                                  :change_type => @original_version.commit_audit.change_type,
    545                                   :reason => DV_Text.new('signed'))
     545                                  :reason => DvText.new('signed'))
    546546    assert_nothing_raised(Exception){
    547547      @versioned_object.commit_attestation(:attestation => attestation,
  • ruby/branches/0.5.0/lib/models/tests/rm/test_data_types.rb

    r158 r167  
    66class RM_Data_Types_Basic_Test < Test::Unit::TestCase
    77  def setup
    8     assert_nothing_raised(Exception){@dv_boolean = OpenEHR::RM::Data_Types::Basic::DV_Boolean.new("TRUE")}
    9     @terminology_id = OpenEHR::RM::Support::Identification::Terminology_ID.new('openEHR(1.0.2)')
    10     @code_phrase = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('PROPOSED', @terminology_id)
    11     @dv_coded_text = OpenEHR::RM::Data_Types::Text::DV_Coded_Text.new("Blood examination", @code_phrase)
    12     assert_nothing_raised(Exception){@dv_state = OpenEHR::RM::Data_Types::Basic::DV_State.new(@dv_coded_text, false)}
    13     assert_nothing_raised(Exception){@dv_identifier = OpenEHR::RM::Data_Types::Basic::DV_Identifier.new("Ruby Hospital","0123456-0", "Information office", "personal id")}
     8    assert_nothing_raised(Exception){@dv_boolean = OpenEhr::RM::DataTypes::Basic::DvBoolean.new("TRUE")}
     9    @terminology_id = OpenEhr::RM::Support::Identification::TerminologyId.new('openEHR(1.0.2)')
     10    @code_phrase = OpenEhr::RM::DataTypes::Text::CodePhrase.new('PROPOSED', @terminology_id)
     11    @dv_coded_text = OpenEhr::RM::DataTypes::Text::DvCodedText.new("Blood examination", @code_phrase)
     12    assert_nothing_raised(Exception){@dv_state = OpenEhr::RM::DataTypes::Basic::DvState.new(@dv_coded_text, false)}
     13    assert_nothing_raised(Exception){@dv_identifier = OpenEhr::RM::DataTypes::Basic::DvIdentifier.new("Ruby Hospital","0123456-0", "Information office", "personal id")}
    1414  end
    1515
    1616  def test_init
    17     assert_instance_of OpenEHR::RM::Data_Types::Basic::DV_Boolean, @dv_boolean
    18     assert_instance_of OpenEHR::RM::Data_Types::Basic::DV_State, @dv_state
    19     assert_instance_of OpenEHR::RM::Data_Types::Basic::DV_Identifier, @dv_identifier
     17    assert_instance_of OpenEhr::RM::DataTypes::Basic::DvBoolean, @dv_boolean
     18    assert_instance_of OpenEhr::RM::DataTypes::Basic::DvState, @dv_state
     19    assert_instance_of OpenEhr::RM::DataTypes::Basic::DvIdentifier, @dv_identifier
    2020  end
    2121
    2222  def test_constant
    23     assert_equal("\r", OpenEHR::RM::Data_Types::Basic::Data_Value::CR)
    24     assert_equal("\n", OpenEHR::RM::Data_Types::Basic::Data_Value::LF)
     23    assert_equal("\r", OpenEhr::RM::DataTypes::Basic::DataValue::CR)
     24    assert_equal("\n", OpenEhr::RM::DataTypes::Basic::DataValue::LF)
    2525  end
    2626
     
    3131    # inv: Value_exists
    3232    assert_raise(ArgumentError){@dv_boolean.value=nil}
    33     assert_raise(ArgumentError){OpenEHR::RM::Data_Types::Basic::DV_Boolean.new(nil)}
     33    assert_raise(ArgumentError){OpenEhr::RM::DataTypes::Basic::DvBoolean.new(nil)}
    3434  end
    3535
     
    4444    assert_equal 'COMPLETED', @dv_state.value.defining_code.code_string
    4545    assert @dv_state.is_terminal?
    46     assert_raise(ArgumentError) {OpenEHR::RM::Data_Types::Basic::DV_State.new(nil,nil)}
     46    assert_raise(ArgumentError) {OpenEhr::RM::DataTypes::Basic::DvState.new(nil,nil)}
    4747    assert_raise(ArgumentError) {@dv_state.value=nil}
    4848    assert_raise(ArgumentError) {@dv_state.is_terminal=nil}
     
    6262    @dv_identifier.type = "test id"
    6363    assert_equal("test id", @dv_identifier.type)
    64     assert_raise(ArgumentError) {OpenEHR::RM::Data_Types::Basic::DV_Identifier.new(nil, nil, nil, nil)}
     64    assert_raise(ArgumentError) {OpenEhr::RM::DataTypes::Basic::DvIdentifier.new(nil, nil, nil, nil)}
    6565  end
    6666end
     
    6969class RM_Data_Types_URI_Test < Test::Unit::TestCase
    7070  def setup
    71     @dv_uri = OpenEHR::RM::Data_Types::URI::DV_URI.new("http://www.openehr.jp/changeset/test?cmd=93#file0")
    72     @dv_ehr_uri = OpenEHR::RM::Data_Types::URI::DV_EHR_URI.new("ehr://1234567/87284370-2D4B-4e3d-A3F3-F303D2F4F34B@2005-08-02T04:30:00")
     71    @dv_uri = OpenEhr::RM::DataTypes::Uri::DvUri.new("http://www.openehr.jp/changeset/test?cmd=93#file0")
     72    @dv_ehr_uri = OpenEhr::RM::DataTypes::Uri::DvEhrUri.new("ehr://1234567/87284370-2D4B-4e3d-A3F3-F303D2F4F34B@2005-08-02T04:30:00")
    7373  end
    7474
    7575  def test_init
    76     assert_instance_of OpenEHR::RM::Data_Types::URI::DV_URI, @dv_uri
    77     assert_instance_of OpenEHR::RM::Data_Types::URI::DV_EHR_URI, @dv_ehr_uri   
     76    assert_instance_of OpenEhr::RM::DataTypes::Uri::DvUri, @dv_uri
     77    assert_instance_of OpenEhr::RM::DataTypes::Uri::DvEhrUri, @dv_ehr_uri
    7878  end
    7979
     
    9898class RM_Data_Types_Text_Test < Test::Unit::TestCase
    9999  def setup
    100     assert_nothing_raised(Exception){@dv_text = OpenEHR::RM::Data_Types::Text::DV_Text.new("valid value")}
    101     @terminology_id = OpenEHR::RM::Support::Identification::Terminology_ID.new('ICD10')
     100    assert_nothing_raised(Exception){@dv_text = OpenEhr::RM::DataTypes::Text::DvText.new("valid value")}
     101    @terminology_id = OpenEhr::RM::Support::Identification::TerminologyId.new('ICD10')
    102102   
    103     assert_nothing_raised(Exception){@code_phrase = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('C92.0', @terminology_id)}
    104     assert_nothing_raised(Exception){@dv_coded_text = OpenEHR::RM::Data_Types::Text::DV_Coded_Text.new("Acute Myeloid Leukemia", @code_phrase)}
    105     @dv_paragraph = OpenEHR::RM::Data_Types::Text::DV_Paragraph.new(Set.new(["test1", "test2"]))
    106     @term_mapping = OpenEHR::RM::Data_Types::Text::Term_Mapping.new('=',@dv_coded_text,"TEST")
     103    assert_nothing_raised(Exception){@code_phrase = OpenEhr::RM::DataTypes::Text::CodePhrase.new('C92.0', @terminology_id)}
     104    assert_nothing_raised(Exception){@dv_coded_text = OpenEhr::RM::DataTypes::Text::DvCodedText.new("Acute Myeloid Leukemia", @code_phrase)}
     105    @dv_paragraph = OpenEhr::RM::DataTypes::Text::DvParagraph.new(Set.new(["test1", "test2"]))
     106    @term_mapping = OpenEhr::RM::DataTypes::Text::TermMapping.new('=',@dv_coded_text,"TEST")
    107107  end
    108108
    109109  def test_init
    110     assert_instance_of OpenEHR::RM::Data_Types::Text::DV_Text, @dv_text
    111     assert_instance_of OpenEHR::RM::Data_Types::Text::Code_Phrase, @code_phrase
    112     assert_instance_of OpenEHR::RM::Data_Types::Text::DV_Coded_Text, @dv_coded_text
    113     assert_instance_of OpenEHR::RM::Data_Types::Text::Term_Mapping, @term_mapping
     110    assert_instance_of OpenEhr::RM::DataTypes::Text::DvText, @dv_text
     111    assert_instance_of OpenEhr::RM::DataTypes::Text::CodePhrase, @code_phrase
     112    assert_instance_of OpenEhr::RM::DataTypes::Text::DvCodedText, @dv_coded_text
     113    assert_instance_of OpenEhr::RM::DataTypes::Text::TermMapping, @term_mapping
    114114  end
    115115
     
    147147  def test_term_mapping
    148148    assert_equal '=', @term_mapping.match
    149     assert OpenEHR::RM::Data_Types::Text::Term_Mapping.is_valid_mach_code?('>')
    150     assert OpenEHR::RM::Data_Types::Text::Term_Mapping.is_valid_mach_code?('=')
    151     assert OpenEHR::RM::Data_Types::Text::Term_Mapping.is_valid_mach_code?('<')
    152     assert OpenEHR::RM::Data_Types::Text::Term_Mapping.is_valid_mach_code?('?')
    153     assert !OpenEHR::RM::Data_Types::Text::Term_Mapping.is_valid_mach_code?('!')
     149    assert OpenEhr::RM::DataTypes::Text::TermMapping.is_valid_mach_code?('>')
     150    assert OpenEhr::RM::DataTypes::Text::TermMapping.is_valid_mach_code?('=')
     151    assert OpenEhr::RM::DataTypes::Text::TermMapping.is_valid_mach_code?('<')
     152    assert OpenEhr::RM::DataTypes::Text::TermMapping.is_valid_mach_code?('?')
     153    assert !OpenEhr::RM::DataTypes::Text::TermMapping.is_valid_mach_code?('!')
    154154    assert_equal @dv_coded_text, @term_mapping.purpose
    155155    assert_equal "TEST", @term_mapping.target
    156     assert_raise(ArgumentError){OpenEHR::RM::Data_Types::Text::Term_Mapping.new}
    157     assert_raise(ArgumentError){OpenEHR::RM::Data_Types::Text::Term_Mapping.new('!',@dv_coded_text, "invalid case")}
    158     assert_raise(ArgumentError){OpenEHR::RM::Data_Types::Text::Term_Mapping.new('=',nil , "invalid case")}
    159     assert_raise(ArgumentError){OpenEHR::RM::Data_Types::Text::Term_Mapping.new('=',@dv_coded_text, nil)}
     156    assert_raise(ArgumentError){OpenEhr::RM::DataTypes::Text::TermMapping.new}
     157    assert_raise(ArgumentError){OpenEhr::RM::DataTypes::Text::TermMapping.new('!',@dv_coded_text, "invalid case")}
     158    assert_raise(ArgumentError){OpenEhr::RM::DataTypes::Text::TermMapping.new('=',nil , "invalid case")}
     159    assert_raise(ArgumentError){OpenEhr::RM::DataTypes::Text::TermMapping.new('=',@dv_coded_text, nil)}
    160160  end
    161161end
     
    164164  def setup
    165165    assert_nothing_raised(Exception){
    166       @dv_ordered = OpenEHR::RM::Data_Types::Quantity::DV_Ordered.new }
    167     assert_nothing_raised(Exception){
    168       terminology = OpenEHR::RM::Support::Identification::Terminology_ID.new('urine')
    169       code_phrase = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('protein',terminology)
    170       urinary_protein = OpenEHR::RM::Data_Types::Text::DV_Coded_Text.new('+', code_phrase)
    171       @dv_ordinal1 = OpenEHR::RM::Data_Types::Quantity::DV_Ordinal.new(1, urinary_protein)
    172       code_phrase = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('protein',terminology)
    173       urinary_protein = OpenEHR::RM::Data_Types::Text::DV_Coded_Text.new('+++', code_phrase)
    174       @dv_ordinal2 = OpenEHR::RM::Data_Types::Quantity::DV_Ordinal.new(3, urinary_protein)}
    175     assert_nothing_raised(Exception){
    176       @dv_interval = OpenEHR::RM::Data_Types::Quantity::DV_Interval.new(@dv_ordinal1, @dv_ordinal2)}
    177     meaning = OpenEHR::RM::Data_Types::Text::DV_Text.new('normal')
    178     assert_nothing_raised(Exception){
    179       @reference_range = OpenEHR::RM::Data_Types::Quantity::Reference_Range.new(meaning, @dv_interval)}
    180     assert_nothing_raised(Exception){
    181       @dv_quantified = OpenEHR::RM::Data_Types::Quantity::DV_Quantified.new(1,'=')}
    182     assert_nothing_raised(Exception){
    183       @dv_amount = OpenEHR::RM::Data_Types::Quantity::DV_Amount.new(2,'<')}
    184     assert_nothing_raised(Exception){
    185       @dv_quantity = OpenEHR::RM::Data_Types::Quantity::DV_Quantity.new(3, 'mg', '~')}
    186     assert_nothing_raised(Exception){
    187       @dv_count = OpenEHR::RM::Data_Types::Quantity::DV_Count.new(1)}
    188     assert_nothing_raised(Exception){
    189       @dv_proportion = OpenEHR::RM::Data_Types::Quantity::DV_Proportion.new(2,3,0)}
    190     assert_nothing_raised(Exception){
    191       @dv_absolute_quantity = OpenEHR::RM::Data_Types::Quantity::DV_Absolute_Quantity.new(7,'=')}
     166      @dv_ordered = OpenEhr::RM::DataTypes::Quantity::DvOrdered.new }
     167    assert_nothing_raised(Exception){
     168      terminology = OpenEhr::RM::Support::Identification::TerminologyId.new('urine')
     169      code_phrase = OpenEhr::RM::DataTypes::Text::CodePhrase.new('protein',terminology)
     170      urinary_protein = OpenEhr::RM::DataTypes::Text::DvCodedText.new('+', code_phrase)
     171      @dv_ordinal1 = OpenEhr::RM::DataTypes::Quantity::DvOrdinal.new(1, urinary_protein)
     172      code_phrase = OpenEhr::RM::DataTypes::Text::CodePhrase.new('protein',terminology)
     173      urinary_protein = OpenEhr::RM::DataTypes::Text::DvCodedText.new('+++', code_phrase)
     174      @dv_ordinal2 = OpenEhr::RM::DataTypes::Quantity::DvOrdinal.new(3, urinary_protein)}
     175    assert_nothing_raised(Exception){
     176      @dv_interval = OpenEhr::RM::DataTypes::Quantity::DvInterval.new(@dv_ordinal1, @dv_ordinal2)}
     177    meaning = OpenEhr::RM::DataTypes::Text::DvText.new('normal')
     178    assert_nothing_raised(Exception){
     179      @reference_range = OpenEhr::RM::DataTypes::Quantity::ReferenceRange.new(meaning, @dv_interval)}
     180    assert_nothing_raised(Exception){
     181      @dv_quantified = OpenEhr::RM::DataTypes::Quantity::DvQuantified.new(1,'=')}
     182    assert_nothing_raised(Exception){
     183      @dv_amount = OpenEhr::RM::DataTypes::Quantity::DvAmount.new(2,'<')}
     184    assert_nothing_raised(Exception){
     185      @dv_quantity = OpenEhr::RM::DataTypes::Quantity::DvQuantity.new(3, 'mg', '~')}
     186    assert_nothing_raised(Exception){
     187      @dv_count = OpenEhr::RM::DataTypes::Quantity::DvCount.new(1)}
     188    assert_nothing_raised(Exception){
     189      @dv_proportion = OpenEhr::RM::DataTypes::Quantity::DvProportion.new(2,3,0)}
     190    assert_nothing_raised(Exception){
     191      @dv_absolute_quantity = OpenEhr::RM::DataTypes::Quantity::DvAbsoluteQuantity.new(7,'=')}
    192192   end
    193193
    194194   def test_init
    195      assert_instance_of OpenEHR::RM::Data_Types::Quantity::DV_Ordered, @dv_ordered
    196      assert_instance_of OpenEHR::RM::Data_Types::Quantity::DV_Quantified, @dv_quantified
    197      assert_instance_of OpenEHR::RM::Data_Types::Quantity::DV_Interval, @dv_interval
    198      assert_instance_of OpenEHR::RM::Data_Types::Quantity::Reference_Range, @reference_range
    199      assert_instance_of OpenEHR::RM::Data_Types::Quantity::DV_Ordinal, @dv_ordinal1
    200      assert_instance_of OpenEHR::RM::Data_Types::Quantity::DV_Ordinal, @dv_ordinal2
    201      assert_instance_of OpenEHR::RM::Data_Types::Quantity::DV_Quantified, @dv_quantified
    202      assert_instance_of OpenEHR::RM::Data_Types::Quantity::DV_Amount, @dv_amount
    203      assert_instance_of OpenEHR::RM::Data_Types::Quantity::DV_Quantity, @dv_quantity
    204      assert_instance_of OpenEHR::RM::Data_Types::Quantity::DV_Count, @dv_count
    205      assert_instance_of OpenEHR::RM::Data_Types::Quantity::DV_Proportion, @dv_proportion
    206      assert_instance_of OpenEHR::RM::Data_Types::Quantity::DV_Absolute_Quantity, @dv_absolute_quantity
     195     assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvOrdered, @dv_ordered
     196     assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvQuantified, @dv_quantified
     197     assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvInterval, @dv_interval
     198     assert_instance_of OpenEhr::RM::DataTypes::Quantity::ReferenceRange, @reference_range
     199     assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvOrdinal, @dv_ordinal1
     200     assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvOrdinal, @dv_ordinal2
     201     assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvQuantified, @dv_quantified
     202     assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvAmount, @dv_amount
     203     assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvQuantity, @dv_quantity
     204     assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvCount, @dv_count
     205     assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvProportion, @dv_proportion
     206     assert_instance_of OpenEhr::RM::DataTypes::Quantity::DvAbsoluteQuantity, @dv_absolute_quantity
    207207  end
    208208
     
    214214    assert @dv_ordered.is_simple?
    215215    assert_raise(NotImplementedError){@dv_ordered<=>1}
    216     openehr_terminology_id = OpenEHR::RM::Support::Identification::Terminology_ID.new('openEHR')
    217     normal_code = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('N', openehr_terminology_id)
     216    openehr_terminology_id = OpenEhr::RM::Support::Identification::TerminologyId.new('openEHR')
     217    normal_code = OpenEhr::RM::DataTypes::Text::CodePhrase.new('N', openehr_terminology_id)
    218218    assert_equal 'N', normal_code.code_string
    219219    assert_nothing_raised(Exception){
    220220      @dv_ordered.normal_status = normal_code }
    221221    assert @dv_ordered.is_normal?
    222     other = OpenEHR::RM::Data_Types::Quantity::DV_Ordered.new
     222    other = OpenEhr::RM::DataTypes::Quantity::DvOrdered.new
    223223    assert_raise(NotImplementedError){
    224224      @dv_ordered.is_strictly_comparable_to?(other)}
     
    232232    assert_equal 'normal', @reference_range.meaning.value
    233233    assert_equal 1, @reference_range.range.lower.value
    234     terminology = OpenEHR::RM::Support::Identification::Terminology_ID.new('urine')
    235     code_phrase = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('protein',terminology)
    236     urinary_protein = OpenEHR::RM::Data_Types::Text::DV_Coded_Text.new('++', code_phrase)
    237     dv_ordinal = OpenEHR::RM::Data_Types::Quantity::DV_Ordinal.new(2, urinary_protein)
     234    terminology = OpenEhr::RM::Support::Identification::TerminologyId.new('urine')
     235    code_phrase = OpenEhr::RM::DataTypes::Text::CodePhrase.new('protein',terminology)
     236    urinary_protein = OpenEhr::RM::DataTypes::Text::DvCodedText.new('++', code_phrase)
     237    dv_ordinal = OpenEhr::RM::DataTypes::Quantity::DvOrdinal.new(2, urinary_protein)
    238238    assert @reference_range.is_in_range?(dv_ordinal)
    239239    dv_ordinal.value = 6
     
    244244    assert_equal 1, @dv_quantified.magnitude
    245245    assert_equal '=', @dv_quantified.magnitude_status
    246     assert !OpenEHR::RM::Data_Types::Quantity::DV_Quantified.valid_magnitude_status?('*')
    247     assert OpenEHR::RM::Data_Types::Quantity::DV_Quantified.valid_magnitude_status?('>')
    248     assert OpenEHR::RM::Data_Types::Quantity::DV_Quantified.valid_magnitude_status?('<')
    249     assert OpenEHR::RM::Data_Types::Quantity::DV_Quantified.valid_magnitude_status?('>=')
    250     assert OpenEHR::RM::Data_Types::Quantity::DV_Quantified.valid_magnitude_status?('<=')
    251     assert OpenEHR::RM::Data_Types::Quantity::DV_Quantified.valid_magnitude_status?('~')
     246    assert !OpenEhr::RM::DataTypes::Quantity::DvQuantified.valid_magnitude_status?('*')
     247    assert OpenEhr::RM::DataTypes::Quantity::DvQuantified.valid_magnitude_status?('>')
     248    assert OpenEhr::RM::DataTypes::Quantity::DvQuantified.valid_magnitude_status?('<')
     249    assert OpenEhr::RM::DataTypes::Quantity::DvQuantified.valid_magnitude_status?('>=')
     250    assert OpenEhr::RM::DataTypes::Quantity::DvQuantified.valid_magnitude_status?('<=')
     251    assert OpenEhr::RM::DataTypes::Quantity::DvQuantified.valid_magnitude_status?('~')
    252252    assert_nothing_raised(Exception){@dv_quantified.magnitude = 0}
    253253    assert_equal 0, @dv_quantified.magnitude
     
    289289    assert @dv_ordinal1 > @dv_ordinal2
    290290    assert_raise(ArgumentError){@dv_ordinal1.limits = @reference_range}
    291     meaning = OpenEHR::RM::Data_Types::Text::DV_Text.new('limits')
    292     limit_reference_range = OpenEHR::RM::Data_Types::Quantity::Reference_Range.new(meaning, @dv_interval)
     291    meaning = OpenEhr::RM::DataTypes::Text::DvText.new('limits')
     292    limit_reference_range = OpenEhr::RM::DataTypes::Quantity::ReferenceRange.new(meaning, @dv_interval)
    293293    assert_nothing_raised(Exception){@dv_ordinal1.limits = limit_reference_range}
    294294    assert_equal 'limits', @dv_ordinal1.limits.meaning.value
     
    299299    assert_equal 'mg', @dv_quantity.units
    300300    assert_equal '~', @dv_quantity.magnitude_status
    301     dv_quantity2 = OpenEHR::RM::Data_Types::Quantity::DV_Quantity.new(4, 'mg', '~')
     301    dv_quantity2 = OpenEhr::RM::DataTypes::Quantity::DvQuantity.new(4, 'mg', '~')
    302302    assert_equal 'mg', dv_quantity2.units
    303303    assert @dv_quantity.is_strictly_comparable_to?(dv_quantity2)
     
    318318  def test_dv_count
    319319    assert_equal 1, @dv_count.magnitude
    320     dv_count2 = OpenEHR::RM::Data_Types::Quantity::DV_Count.new(2)
     320    dv_count2 = OpenEhr::RM::DataTypes::Quantity::DvCount.new(2)
    321321    dv_count3 = @dv_count + dv_count2
    322322    assert 3, dv_count3.magnitude
     
    326326
    327327  def test_proportion_kind
    328     assert_equal 0, OpenEHR::RM::Data_Types::Quantity::Proportion_Kind::PK_RATIO
    329     assert_equal 1, OpenEHR::RM::Data_Types::Quantity::Proportion_Kind::PK_UNITARY
    330     assert_equal 2, OpenEHR::RM::Data_Types::Quantity::Proportion_Kind::PK_PERCENT
    331     assert_equal 3, OpenEHR::RM::Data_Types::Quantity::Proportion_Kind::PK_FRACTION
    332     assert_equal 4, OpenEHR::RM::Data_Types::Quantity::Proportion_Kind::PK_INTEGER_FRACTION
    333     assert OpenEHR::RM::Data_Types::Quantity::Proportion_Kind.valid_proportion_kind?(0)
    334     assert OpenEHR::RM::Data_Types::Quantity::Proportion_Kind.valid_proportion_kind?(4)
    335     assert !OpenEHR::RM::Data_Types::Quantity::Proportion_Kind.valid_proportion_kind?(-1)
    336     assert !OpenEHR::RM::Data_Types::Quantity::Proportion_Kind.valid_proportion_kind?(5)
     328    assert_equal 0, OpenEhr::RM::DataTypes::Quantity::ProportionKind::PK_RATIO
     329    assert_equal 1, OpenEhr::RM::DataTypes::Quantity::ProportionKind::PK_UNITARY
     330    assert_equal 2, OpenEhr::RM::DataTypes::Quantity::ProportionKind::PK_PERCENT
     331    assert_equal 3, OpenEhr::RM::DataTypes::Quantity::ProportionKind::PK_FRACTION
     332    assert_equal 4, OpenEhr::RM::DataTypes::Quantity::ProportionKind::PK_INTEGER_FRACTION
     333    assert OpenEhr::RM::DataTypes::Quantity::ProportionKind.valid_proportion_kind?(0)
     334    assert OpenEhr::RM::DataTypes::Quantity::ProportionKind.valid_proportion_kind?(4)
     335    assert !OpenEhr::RM::DataTypes::Quantity::ProportionKind.valid_proportion_kind?(-1)
     336    assert !OpenEhr::RM::DataTypes::Quantity::ProportionKind.valid_proportion_kind?(5)
    337337  end
    338338
     
    343343    assert_equal 2.0/3.0, @dv_proportion.magnitude
    344344    assert @dv_proportion.is_integral?
    345     dv_proportion2 = OpenEHR::RM::Data_Types::Quantity::DV_Proportion.new(1,3,0)
     345    dv_proportion2 = OpenEhr::RM::DataTypes::Quantity::DvProportion.new(1,3,0)
    346346    assert @dv_proportion.is_strictly_comparable_to?(dv_proportion2)
    347     dv_proportion2 = OpenEHR::RM::Data_Types::Quantity::DV_Proportion.new(1,3,4)
     347    dv_proportion2 = OpenEhr::RM::DataTypes::Quantity::DvProportion.new(1,3,4)
    348348    assert !@dv_proportion.is_strictly_comparable_to?(dv_proportion2)
    349349    assert_raise(ArgumentError){
    350       dv_proportion2 = OpenEHR::RM::Data_Types::Quantity::DV_Proportion.new(1.5,2.3,3)}
    351     assert_raise(ArgumentError){
    352       dv_proportion2 = OpenEHR::RM::Data_Types::Quantity::DV_Proportion.new(10,10,1)}
    353     assert_nothing_raised(Exception){
    354       dv_proportion2 = OpenEHR::RM::Data_Types::Quantity::DV_Proportion.new(10,1,1)}
    355     assert_raise(ArgumentError){
    356       dv_proportion2 = OpenEHR::RM::Data_Types::Quantity::DV_Proportion.new(10,10,2)}
    357     assert_nothing_raised(Exception){
    358       dv_proportion2 = OpenEHR::RM::Data_Types::Quantity::DV_Proportion.new(10,100,2)}
     350      dv_proportion2 = OpenEhr::RM::DataTypes::Quantity::DvProportion.new(1.5,2.3,3)}
     351    assert_raise(ArgumentError){
     352      dv_proportion2 = OpenEhr::RM::DataTypes::Quantity::DvProportion.new(10,10,1)}
     353    assert_nothing_raised(Exception){
     354      dv_proportion2 = OpenEhr::RM::DataTypes::Quantity::DvProportion.new(10,1,1)}
     355    assert_raise(ArgumentError){
     356      dv_proportion2 = OpenEhr::RM::DataTypes::Quantity::DvProportion.new(10,10,2)}
     357    assert_nothing_raised(Exception){
     358      dv_proportion2 = OpenEhr::RM::DataTypes::Quantity::DvProportion.new(10,100,2)}
    359359  end
    360360
     
    363363class EncapsulatedTest < Test::Unit::TestCase
    364364  def setup
    365     charset = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('UTF-8','character-sets')
    366     language = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('ja', 'languages')
    367     assert_nothing_raised(Exception){
    368       @dv_encapsulated = OpenEHR::RM::Data_Types::Encapsulated::DV_Encapsulated.new(charset, language, 10)}
    369     assert_nothing_raised(Exception){
    370       @dv_parsable = OpenEHR::RM::Data_Types::Encapsulated::DV_Parsable.new(charset, language, 10, 'XML','<TEST>test</TEST>')}
    371     media_type = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('text/html', 'media-types')
    372     uri = OpenEHR::RM::Data_Types::URI::DV_URI.new("http://www.openehr.jp/changeset/test?cmd=93#file0")
    373     assert_nothing_raised(Exception){
    374       @dv_multimedia = OpenEHR::RM::Data_Types::Encapsulated::DV_Multimedia.new(charset, language, 10, media_type, uri)}
     365    charset = OpenEhr::RM::DataTypes::Text::CodePhrase.new('UTF-8','character-sets')
     366    language = OpenEhr::RM::DataTypes::Text::CodePhrase.new('ja', 'languages')
     367    assert_nothing_raised(Exception){
     368      @dv_encapsulated = OpenEhr::RM::DataTypes::Encapsulated::DvEncapsulated.new(charset, language, 10)}
     369    assert_nothing_raised(Exception){
     370      @dv_parsable = OpenEhr::RM::DataTypes::Encapsulated::DvParsable.new(charset, language, 10, 'XML','<TEST>test</TEST>')}
     371    media_type = OpenEhr::RM::DataTypes::Text::CodePhrase.new('text/html', 'media-types')
     372    uri = OpenEhr::RM::DataTypes::Uri::DvUri.new("http://www.openehr.jp/changeset/test?cmd=93#file0")
     373    assert_nothing_raised(Exception){
     374      @dv_multimedia = OpenEhr::RM::DataTypes::Encapsulated::DvMultimedia.new(charset, language, 10, media_type, uri)}
    375375  end
    376376
    377377  def test_init
    378     assert_instance_of OpenEHR::RM::Data_Types::Encapsulated::DV_Encapsulated, @dv_encapsulated
    379     assert_instance_of OpenEHR::RM::Data_Types::Encapsulated::DV_Parsable, @dv_parsable
    380     assert_instance_of OpenEHR::RM::Data_Types::Encapsulated::DV_Multimedia, @dv_multimedia
     378    assert_instance_of OpenEhr::RM::DataTypes::Encapsulated::DvEncapsulated, @dv_encapsulated
     379    assert_instance_of OpenEhr::RM::DataTypes::Encapsulated::DvParsable, @dv_parsable
     380    assert_instance_of OpenEhr::RM::DataTypes::Encapsulated::DvMultimedia, @dv_multimedia
    381381  end
    382382
     
    385385    assert_equal 'ja', @dv_encapsulated.language.code_string
    386386    assert_equal 10, @dv_encapsulated.size
    387     wrong_charset = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('USO8000', 'character-sets')
     387    wrong_charset = OpenEhr::RM::DataTypes::Text::CodePhrase.new('USO8000', 'character-sets')
    388388    assert_raise(ArgumentError){@dv_encapsulated.charset = wrong_charset}
    389     charset = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('EUC-JP', 'character-sets')
     389    charset = OpenEhr::RM::DataTypes::Text::CodePhrase.new('EUC-JP', 'character-sets')
    390390    assert_nothing_raised(Exception){@dv_encapsulated.charset = charset}
    391391    assert_equal 'EUC-JP', @dv_encapsulated.charset.code_string
    392     wrong_language = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('jpg', 'language')
     392    wrong_language = OpenEhr::RM::DataTypes::Text::CodePhrase.new('jpg', 'language')
    393393    assert_raise(ArgumentError){@dv_encapsulated.language = wrong_language}
    394     language = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('eng', 'language')
     394    language = OpenEhr::RM::DataTypes::Text::CodePhrase.new('eng', 'language')
    395395    assert_nothing_raised(Exception){@dv_encapsulated.language = language}
    396396    assert_equal 'eng', @dv_encapsulated.language.code_string
     
    429429
    430430class TestDvTimeSpecification < Test::Unit::TestCase
    431   include OpenEHR::RM::Data_Types::Time_Specification
    432   include OpenEHR::RM::Data_Types::Encapsulated
    433   def setup
    434     charset = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('UTF-8','character-sets')
    435     language = OpenEHR::RM::Data_Types::Text::Code_Phrase.new('ja', 'languages')
    436     assert_nothing_raised(Exception){
    437       dv_parsable = DV_Parsable.new(charset, language, 10, 'XML','<TEST>test</TEST>')
    438       @dv_time_specification = DV_Time_Specification.new(dv_parsable)}
     431  include OpenEhr::RM::DataTypes::TimeSpecification
     432  include OpenEhr::RM::DataTypes::Encapsulated
     433  def setup
     434    charset = OpenEhr::RM::DataTypes::Text::CodePhrase.new('UTF-8','character-sets')
     435    language = OpenEhr::RM::DataTypes::Text::CodePhrase.new('ja', 'languages')
     436    assert_nothing_raised(Exception){
     437      dv_parsable = DvParsable.new(charset, language, 10, 'XML','<TEST>test</TEST>')
     438      @dv_time_specification = DvTimeSpecification.new(dv_parsable)}
    439439#    assert_nothing_raised(Exception){
    440440#      @dv_periodic_time_specification = DV_Periodic_Time_Specification.new('[200004181100;200004181110]/(7d)@DWIST', charset, language, 10, 'HL7:PIVL')}
     
    442442
    443443  def test_init
    444     assert_instance_of DV_Time_Specification, @dv_time_specification
     444    assert_instance_of DvTimeSpecification, @dv_time_specification
    445445  end
    446446
  • ruby/branches/0.5.0/lib/models/tests/rm/test_security.rb

    r140 r167  
    55  def setup
    66    assert_nothing_raised(Exception){
    7       @access_control_setting = OpenEHR::RM::Security::Access_Control_Settings.new}
     7      @access_control_setting = OpenEhr::RM::Security::AccessControlSettings.new}
    88  end
    99
    1010  def test_init
    11     assert_instance_of OpenEHR::RM::Security::Access_Control_Settings, @access_control_setting
     11    assert_instance_of OpenEhr::RM::Security::AccessControlSettings, @access_control_setting
    1212  end
    1313end
  • ruby/branches/0.5.0/lib/models/tests/rm/test_support.rb

    r158 r167  
    55class RM_Support_Definition_Test < Test::Unit::TestCase
    66    def test_constant
    7     assert_equal("\r", OpenEHR::RM::Support::Definition::OpenEHR_Definitions::CR)
    8     assert_equal("\n", OpenEHR::RM::Support::Definition::OpenEHR_Definitions::LF)
     7    assert_equal("\r", OpenEhr::RM::Support::Definition::OpenEHRDefinitions::CR)
     8    assert_equal("\n", OpenEhr::RM::Support::Definition::OpenEHRDefinitions::LF)
    99  end
    1010end
     
    1313class RM_Support_Identification_Test < Test::Unit::TestCase
    1414  def setup
    15     assert_nothing_raised(Exception){@object_id = OpenEHR::RM::Support::Identification::Object_ID.new("0.0.3")}
    16     assert_nothing_raised(Exception){@object_ref = OpenEHR::RM::Support::Identification::Object_Ref.new('local', 'ANY', @object_id)}
    17     assert_nothing_raised(Exception){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")}
    18     assert_nothing_raised(Exception){@terminology_id = OpenEHR::RM::Support::Identification::Terminology_ID.new('ICD10(2003)')}
    19     assert_nothing_raised(Exception){@generic_id = OpenEHR::RM::Support::Identification::Generic_ID.new("0.0.3", "openehr")}
    20     assert_nothing_raised(Exception){@uid_based_id = OpenEHR::RM::Support::Identification::UID_Based_ID.new('rrip::0.0.3')}
    21     assert_nothing_raised(Exception){@hier_object_id = OpenEHR::RM::Support::Identification::Hier_Object_ID.new('0.0.4')}
    22     assert_nothing_raised(Exception){@locatable_ref = OpenEHR::RM::Support::Identification::Locatable_Ref.new('unknown', 'PERSON', @uid_based_id, 'data/event[at0001, standing]')}
    23     assert_nothing_raised(Exception){@party_ref = OpenEHR::RM::Support::Identification::Party_Ref.new('unknown', 'ORGANISATION', @object_id)}
    24     assert_nothing_raised(Exception){@access_group_ref = OpenEHR::RM::Support::Identification::Access_Group_Ref.new('unknown', 'ACCESS_GROUP', @object_id)}
    25     assert_nothing_raised(Exception){@version_tree_id = OpenEHR::RM::Support::Identification::Version_Tree_ID.new('1.2.3')}
    26     assert_nothing_raised(Exception){@object_version_id = OpenEHR::RM::Support::Identification::Object_Version_ID.new('ABC::DEF::1.2.3')}
     15    assert_nothing_raised(Exception){@object_id = OpenEhr::RM::Support::Identification::ObjectId.new("0.0.3")}
     16    assert_nothing_raised(Exception){@object_ref = OpenEhr::RM::Support::Identification::ObjectRef.new('local', 'ANY', @object_id)}
     17    assert_nothing_raised(Exception){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")}
     18    assert_nothing_raised(Exception){@terminology_id = OpenEhr::RM::Support::Identification::TerminologyId.new('ICD10(2003)')}
     19    assert_nothing_raised(Exception){@generic_id = OpenEhr::RM::Support::Identification::GenericId.new("0.0.3", "openehr")}
     20    assert_nothing_raised(Exception){@uid_based_id = OpenEhr::RM::Support::Identification::UidBasedId.new('rrip::0.0.3')}
     21    assert_nothing_raised(Exception){@hier_object_id = OpenEhr::RM::Support::Identification::HierObjectId.new('0.0.4')}
     22    assert_nothing_raised(Exception){@locatable_ref = OpenEhr::RM::Support::Identification::LocatableRef.new('unknown', 'PERSON', @uid_based_id, 'data/event[at0001, standing]')}
     23    assert_nothing_raised(Exception){@party_ref = OpenEhr::RM::Support::Identification::PartyRef.new('unknown', 'ORGANISATION', @object_id)}
     24    assert_nothing_raised(Exception){@access_group_ref = OpenEhr::RM::Support::Identification::AccessGroupRef.new('unknown', 'ACCESS_GROUP', @object_id)}
     25    assert_nothing_raised(Exception){@version_tree_id = OpenEhr::RM::Support::Identification::VersionTreeId.new('1.2.3')}
     26    assert_nothing_raised(Exception){@object_version_id = OpenEhr::RM::Support::Identification::ObjectVersionId.new('ABC::DEF::1.2.3')}
    2727  end
    2828 
    2929  def test_init
    30     assert_instance_of OpenEHR::RM::Support::Identification::Object_ID, @object_id
    31     assert_instance_of OpenEHR::RM::Support::Identification::Object_Ref, @object_ref
    32     assert_instance_of OpenEHR::RM::Support::Identification::Archetype_ID, @archetype_id
    33     assert_instance_of OpenEHR::RM::Support::Identification::Terminology_ID, @terminology_id
    34     assert_instance_of OpenEHR::RM::Support::Identification::Object_ID, @object_id
    35     assert_instance_of OpenEHR::RM::Support::Identification::Generic_ID, @generic_id
    36     assert_instance_of OpenEHR::RM::Support::Identification::UID_Based_ID, @uid_based_id
    37     assert_instance_of OpenEHR::RM::Support::Identification::Hier_Object_ID, @hier_object_id
    38     assert_instance_of OpenEHR::RM::Support::Identification::Locatable_Ref, @locatable_ref
    39     assert_instance_of OpenEHR::RM::Support::Identification::Party_Ref, @party_ref
    40     assert_instance_of OpenEHR::RM::Support::Identification::Access_Group_Ref, @access_group_ref
    41     assert_instance_of OpenEHR::RM::Support::Identification::Version_Tree_ID, @version_tree_id
    42     assert_instance_of OpenEHR::RM::Support::Identification::Object_Version_ID, @object_version_id
     30    assert_instance_of OpenEhr::RM::Support::Identification::ObjectId, @object_id
     31    assert_instance_of OpenEhr::RM::Support::Identification::ObjectRef, @object_ref
     32    assert_instance_of OpenEhr::RM::Support::Identification::ArchetypeId, @archetype_id
     33    assert_instance_of OpenEhr::RM::Support::Identification::TerminologyId, @terminology_id
     34    assert_instance_of OpenEhr::RM::Support::Identification::ObjectId, @object_id
     35    assert_instance_of OpenEhr::RM::Support::Identification::GenericId, @generic_id
     36    assert_instance_of OpenEhr::RM::Support::Identification::UidBasedId, @uid_based_id
     37    assert_instance_of OpenEhr::RM::Support::Identification::HierObjectId, @hier_object_id
     38    assert_instance_of OpenEhr::RM::Support::Identification::LocatableRef, @locatable_ref
     39    assert_instance_of OpenEhr::RM::Support::Identification::PartyRef, @party_ref
     40    assert_instance_of OpenEhr::RM::Support::Identification::AccessGroupRef, @access_group_ref
     41    assert_instance_of OpenEhr::RM::Support::Identification::VersionTreeId, @version_tree_id
     42    assert_instance_of OpenEhr::RM::Support::Identification::ObjectVersionId, @object_version_id
    4343  end
    4444
     
    4949    assert_raise(ArgumentError){@object_id.value=nil}
    5050    assert_raise(ArgumentError){@object_id.value=""}
    51     assert_raise(ArgumentError){@object_id = OpenEHR::RM::Support::Identification::Object_ID.new}
    52     assert_raise(ArgumentError){@object_id = OpenEHR::RM::Support::Identification::Object_ID.new(nil)}
    53     assert_raise(ArgumentError){@object_id = OpenEHR::RM::Support::Identification::Object_ID.new("")}
    54     assert_equal @object_id, OpenEHR::RM::Support::Identification::Object_ID.new("0.0.4")
     51    assert_raise(ArgumentError){@object_id = OpenEhr::RM::Support::Identification::ObjectId.new}
     52    assert_raise(ArgumentError){@object_id = OpenEhr::RM::Support::Identification::ObjectId.new(nil)}
     53    assert_raise(ArgumentError){@object_id = OpenEhr::RM::Support::Identification::ObjectId.new("")}
     54    assert_equal @object_id, OpenEhr::RM::Support::Identification::ObjectId.new("0.0.4")
    5555  end
    5656
     
    6060    assert_equal @object_id, @object_ref.id
    6161
    62     assert_raise(ArgumentError){@object_ref = OpenEHR::RM::Support::Identification::Archetype_ID.new}
    63     assert_raise(ArgumentError){@object_ref = OpenEHR::RM::Support::Identification::Archetype_ID.new(nil, 'ANY', @object_id)}
    64     assert_raise(ArgumentError){@object_ref = OpenEHR::RM::Support::Identification::Archetype_ID.new('', 'ANY', @object_id)}
    65     assert_raise(ArgumentError){@object_ref = OpenEHR::RM::Support::Identification::Archetype_ID.new('local', nil, @object_id)}
    66     assert_raise(ArgumentError){@object_ref = OpenEHR::RM::Support::Identification::Archetype_ID.new('local', '', @object_id)}
    67     assert_raise(ArgumentError){@object_ref = OpenEHR::RM::Support::Identification::Archetype_ID.new('local', 'ANY', nil)}
     62    assert_raise(ArgumentError){@object_ref = OpenEhr::RM::Support::Identification::ArchetypeId.new}
     63    assert_raise(ArgumentError){@object_ref = OpenEhr::RM::Support::Identification::ArchetypeId.new(nil, 'ANY', @object_id)}
     64    assert_raise(ArgumentError){@object_ref = OpenEhr::RM::Support::Identification::ArchetypeId.new('', 'ANY', @object_id)}
     65    assert_raise(ArgumentError){@object_ref = OpenEhr::RM::Support::Identification::ArchetypeId.new('local', nil, @object_id)}
     66    assert_raise(ArgumentError){@object_ref = OpenEhr::RM::Support::Identification::ArchetypeId.new('local', '', @object_id)}
     67    assert_raise(ArgumentError){@object_ref = OpenEhr::RM::Support::Identification::ArchetypeId.new('local', 'ANY', nil)}
    6868
    6969    assert_nothing_raised(Exception){@object_ref.namespace = 'terminology'}
     
    7979    assert_raise(ArgumentError){@object_ref.type = ''}
    8080
    81     assert_nothing_raised(Exception){@object_ref.id = OpenEHR::RM::Support::Identification::Object_ID.new("0.0.5")}
    82     assert_equal OpenEHR::RM::Support::Identification::Object_ID.new("0.0.5"), @object_ref.id
     81    assert_nothing_raised(Exception){@object_ref.id = OpenEhr::RM::Support::Identification::ObjectId.new("0.0.5")}
     82    assert_equal OpenEhr::RM::Support::Identification::ObjectId.new("0.0.5"), @object_ref.id
    8383    assert_raise(ArgumentError){@object_ref.id = nil}
    8484  end
     
    9090    assert_raise(ArgumentError){@archetype_id.value=nil}
    9191    assert_raise(ArgumentError){@archetype_id.value=""}
    92     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new}
    93     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new(nil, "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")}
    94     assert_raise(ArgumentError){@object_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")}
    95     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", nil, "entry", "ehr_rm", "openehr","cholesterol","0.0.3")}
    96     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")}
    97     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", nil, "ehr_rm", "openehr","cholesterol","0.0.3")}
    98     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "", "ehr_rm", "openehr","cholesterol","0.0.3")}
    99     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", nil, "openehr","cholesterol","0.0.3")}
    100     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "", "openehr","cholesterol","0.0.3")}
    101     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", nil,"cholesterol","0.0.3")}
    102     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "","cholesterol","0.0.3")}
    103     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr",nil ,"0.0.3")}
    104     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","","0.0.3")}
    105     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol", nil)}
    106     assert_raise(ArgumentError){@archetype_id = OpenEHR::RM::Support::Identification::Archetype_ID.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","")}
     92    assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new}
     93    assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new(nil, "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")}
     94    assert_raise(ArgumentError){@object_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")}
     95    assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", nil, "entry", "ehr_rm", "openehr","cholesterol","0.0.3")}
     96    assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "", "entry", "ehr_rm", "openehr","cholesterol","0.0.3")}
     97    assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", nil, "ehr_rm", "openehr","cholesterol","0.0.3")}
     98    assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "", "ehr_rm", "openehr","cholesterol","0.0.3")}
     99    assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "entry", nil, "openehr","cholesterol","0.0.3")}
     100    assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "entry", "", "openehr","cholesterol","0.0.3")}
     101    assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", nil,"cholesterol","0.0.3")}
     102    assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "","cholesterol","0.0.3")}
     103    assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr",nil ,"0.0.3")}
     104    assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","","0.0.3")}
     105    assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol", nil)}
     106    assert_raise(ArgumentError){@archetype_id = OpenEhr::RM::Support::Identification::ArchetypeId.new("0.0.5", "biochemistry result_cholesterol", "entry", "ehr_rm", "openehr","cholesterol","")}
    107107
    108108    assert_equal "biochemistry result_cholesterol", @archetype_id.domain_concept
     
    151151    assert_raise(ArgumentError){@terminology_id.value = ""}
    152152
    153     assert_raise(ArgumentError){@terminology_id = OpenEHR::RM::Support::Identification::Terminology_ID.new}
    154     assert_raise(ArgumentError){@terminology_id = OpenEHR::RM::Support::Identification::Terminology_ID.new(nil,'2008')}
    155     assert_raise(ArgumentError){@terminology_id = OpenEHR::RM::Support::Identification::Terminology_ID.new('','02008')}
    156     assert_raise(ArgumentError){@terminology_id = OpenEHR::RM::Support::Identification::Terminology_ID.new("SNOMED", nil)}
    157     assert_nothing_raised(Exception){@terminology_id = OpenEHR::RM::Support::Identification::Terminology_ID.new("SNOMED")}
     153    assert_raise(ArgumentError){@terminology_id = OpenEhr::RM::Support::Identification::TerminologyId.new}
     154    assert_raise(ArgumentError){@terminology_id = OpenEhr::RM::Support::Identification::TerminologyId.new(nil,'2008')}
     155    assert_raise(ArgumentError){@terminology_id = OpenEhr::RM::Support::Identification::TerminologyId.new('','02008')}
     156    assert_raise(ArgumentError){@terminology_id = OpenEhr::RM::Support::Identification::TerminologyId.new("SNOMED", nil)}
     157    assert_nothing_raised(Exception){@terminology_id = OpenEhr::RM::Support::Identification::TerminologyId.new("SNOMED")}
    158158
    159159    assert_equal "SNOMED", @terminology_id.name
     
    175175    assert_equal "openehr", @generic_id.scheme
    176176
    177     assert_raise(ArgumentError){@generic_id = OpenEHR::RM::Support::Identification::Generic_ID.new(nil, "openehr")}
    178     assert_raise(ArgumentError){@generic_id = OpenEHR::RM::Support::Identification::Generic_ID.new("", "openehr")}
    179     assert_raise(ArgumentError){@generic_id = OpenEHR::RM::Support::Identification::Generic_ID.new("0.0.3", nil)}
    180     assert_raise(ArgumentError){@generic_id = OpenEHR::RM::Support::Identification::Generic_ID.new("0.0.3", "")}
     177    assert_raise(ArgumentError){@generic_id = OpenEhr::RM::Support::Identification::GenericId.new(nil, "openehr")}
     178    assert_raise(ArgumentError){@generic_id = OpenEhr::RM::Support::Identification::GenericId.new("", "openehr")}
     179    assert_raise(ArgumentError){@generic_id = OpenEhr::RM::Support::Identification::GenericId.new("0.0.3", nil)}
     180    assert_raise(ArgumentError){@generic_id = OpenEhr::RM::Support::Identification::GenericId.new("0.0.3", "")}
    181181
    182182    assert_raise(ArgumentError){@generic_id.value = nil}
     
    197197    assert @uid_based_id.has_extension?
    198198
    199     assert_raise(ArgumentError){@uid_based_id = OpenEHR::RM::Support::Identification::UID_Based_ID.new(nil)}
    200     assert_raise(ArgumentError){@uid_based_id = OpenEHR::RM::Support::Identification::UID_Based_ID.new('')}
     199    assert_raise(ArgumentError){@uid_based_id = OpenEhr::RM::Support::Identification::UidBasedId.new(nil)}
     200    assert_raise(ArgumentError){@uid_based_id = OpenEhr::RM::Support::Identification::UidBasedId.new('')}
    201201    assert_raise(ArgumentError){@uid_based_id.value = nil}
    202202    assert_raise(ArgumentError){@uid_based_id.value = ''}
  • ruby/branches/0.5.0/lib/models/tests/test_archetype_model.rb

    r66 r167  
    55class ArchetypeModelTest < Test::Unit::TestCase
    66  def setup
    7     @archetype = OpenEHR::AM::Archetype::ARCHETYPE.new
    8     @validity_kind = OpenEHR::AM::Archetype::VALIDITY_KIND.new
     7    @archetype = OpenEhr::AM::Archetype::ARCHETYPE.new
     8    @validity_kind = OpenEhr::AM::Archetype::VALIDITY_KIND.new
    99
    10     @archetype_description = OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION.new
    11     @archetype_description_item = OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION_ITEM.new
     10    @archetype_description = OpenEhr::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION.new
     11    @archetype_description_item = OpenEhr::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION_ITEM.new
    1212  end
    1313 
    1414  def test_init
    15     assert_instance_of OpenEHR::AM::Archetype::ARCHETYPE, @archetype
    16     assert_instance_of OpenEHR::AM::Archetype::VALIDITY_KIND, @validity_kind
    17     assert_instance_of OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION, @archetype_description
    18     assert_instance_of OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION_ITEM, @archetype_description_item
    19     assert_instance_of OpenEHR::AM::Archetype::ARCHETYPE, @archetype
     15    assert_instance_of OpenEhr::AM::Archetype::ARCHETYPE, @archetype
     16    assert_instance_of OpenEhr::AM::Archetype::VALIDITY_KIND, @validity_kind
     17    assert_instance_of OpenEhr::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION, @archetype_description
     18    assert_instance_of OpenEhr::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION_ITEM, @archetype_description_item
     19    assert_instance_of OpenEhr::AM::Archetype::ARCHETYPE, @archetype
    2020  end
    2121
    2222  def test_create
    23     archetype_instance = OpenEHR::AM::Archetype::ARCHETYPE.create() do |archetype|
     23    archetype_instance = OpenEhr::AM::Archetype::ARCHETYPE.create() do |archetype|
    2424      archetype.adl_version = '1.4'
    2525    end
    2626
    27     assert_instance_of OpenEHR::AM::Archetype::ARCHETYPE, archetype_instance
     27    assert_instance_of OpenEhr::AM::Archetype::ARCHETYPE, archetype_instance
    2828  end
    2929end
     
    3131class ArchetypeModelConstraintTest < Test::Unit::TestCase
    3232  def setup
    33     @archetype_constraint = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT.new
    34     @cardinality = OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY.new   
     33    @archetype_constraint = OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT.new
     34    @cardinality = OpenEhr::AM::Archetype::Constraint_Model::CARDINALITY.new
    3535   
    36     @archetype_constraint = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT.new
    37     @c_object = OpenEHR::AM::Archetype::Constraint_Model::C_OBJECT.new
    38     @c_defined_object = OpenEHR::AM::Archetype::Constraint_Model::C_DEFINED_OBJECT.new
    39     @c_attribute = OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE.new
    40     @c_single_attribute = OpenEHR::AM::Archetype::Constraint_Model::C_SINGLE_ATTRIBUTE.new
    41     @c_multiple_attribute = OpenEHR::AM::Archetype::Constraint_Model::C_MULTIPLE_ATTRIBUTE.new(:rm_attribute_name => 'attribute_name', :cardinality => @cardinality)
    42     @c_primitive_object = OpenEHR::AM::Archetype::Constraint_Model::C_PRIMITIVE_OBJECT.new
    43     @c_reference_object =  OpenEHR::AM::Archetype::Constraint_Model::C_REFERENCE_OBJECT.new
    44     @archetype_internal_ref =  OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF.new
    45     @archetype_slot = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT.new
    46     @constraint_ref = OpenEHR::AM::Archetype::Constraint_Model::CONSTRAINT_REF.new
    47     @c_domain_type = OpenEHR::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE.new
    48     @c_complex_object = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new(:attributes => [@c_single_attribute])
     36    @archetype_constraint = OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT.new
     37    @c_object = OpenEhr::AM::Archetype::Constraint_Model::C_OBJECT.new
     38    @c_defined_object = OpenEhr::AM::Archetype::Constraint_Model::C_DEFINED_OBJECT.new
     39    @c_attribute = OpenEhr::AM::Archetype::Constraint_Model::C_ATTRIBUTE.new
     40    @c_single_attribute = OpenEhr::AM::Archetype::Constraint_Model::C_SINGLE_ATTRIBUTE.new
     41    @c_multiple_attribute = OpenEhr::AM::Archetype::Constraint_Model::C_MULTIPLE_ATTRIBUTE.new(:rm_attribute_name => 'attribute_name', :cardinality => @cardinality)
     42    @c_primitive_object = OpenEhr::AM::Archetype::Constraint_Model::C_PRIMITIVE_OBJECT.new
     43    @c_reference_object =  OpenEhr::AM::Archetype::Constraint_Model::C_REFERENCE_OBJECT.new
     44    @archetype_internal_ref =  OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF.new
     45    @archetype_slot = OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT.new
     46    @constraint_ref = OpenEhr::AM::Archetype::Constraint_Model::CONSTRAINT_REF.new
     47    @c_domain_type = OpenEhr::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE.new
     48    @c_complex_object = OpenEhr::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new(:attributes => [@c_single_attribute])
    4949  end
    5050
    5151  def test_init
    52     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT, @archetype_constraint
    53     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_OBJECT, @c_object
    54     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_DEFINED_OBJECT, @c_defined_object
    55     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE, @c_attribute
    56     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_SINGLE_ATTRIBUTE, @c_single_attribute
    57     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_MULTIPLE_ATTRIBUTE, @c_multiple_attribute
     52    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT, @archetype_constraint
     53    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_OBJECT, @c_object
     54    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_DEFINED_OBJECT, @c_defined_object
     55    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_ATTRIBUTE, @c_attribute
     56    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_SINGLE_ATTRIBUTE, @c_single_attribute
     57    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_MULTIPLE_ATTRIBUTE, @c_multiple_attribute
    5858    assert_equal 'attribute_name', @c_multiple_attribute.rm_attribute_name
    59     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY, @c_multiple_attribute.cardinality
    60     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_PRIMITIVE_OBJECT, @c_primitive_object
    61     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_REFERENCE_OBJECT, @c_reference_object
    62     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF, @archetype_internal_ref
    63     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT, @archetype_slot
    64     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::CONSTRAINT_REF, @constraint_ref
    65     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE, @c_domain_type
    66     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, @c_complex_object
     59    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::CARDINALITY, @c_multiple_attribute.cardinality
     60    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_PRIMITIVE_OBJECT, @c_primitive_object
     61    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_REFERENCE_OBJECT, @c_reference_object
     62    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF, @archetype_internal_ref
     63    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT, @archetype_slot
     64    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::CONSTRAINT_REF, @constraint_ref
     65    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE, @c_domain_type
     66    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, @c_complex_object
    6767    assert_instance_of Array, @c_complex_object.attributes
    68     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT, @archetype_constraint
    69     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY, @cardinality
     68    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT, @archetype_constraint
     69    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::CARDINALITY, @cardinality
    7070  end
    7171
    7272  def test_create
    73     c_complex_object = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.create(:node_id => 'test_node',
     73    c_complex_object = OpenEhr::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.create(:node_id => 'test_node',
    7474                                                                                         :attributes => [1,2],
    7575                                                                                         :assumed_value => Array
    7676                                                                                         )
    77     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, c_complex_object
     77    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, c_complex_object
    7878    assert_equal 'test_node', c_complex_object.node_id
    7979  end
     
    8383  def setup
    8484    #@c_primitive = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_PRIMITIVE.new
    85     @c_boolean = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true,
     85    @c_boolean = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true,
    8686                                                                                    :false_valid => true,
    8787                                                                                    :assumed_value => true)
    88     @c_string = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_STRING.new
    89     @c_integer = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_INTEGER.new
    90     @c_real = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_REAL.new
    91     @c_time = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_TIME.new
    92     @c_date = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE.new
    93     @c_date_time = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE_TIME.new
    94     @c_duration = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DURATION.new
     88    @c_string = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_STRING.new
     89    @c_integer = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_INTEGER.new
     90    @c_real = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_REAL.new
     91    @c_time = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_TIME.new
     92    @c_date = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_DATE.new
     93    @c_date_time = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_DATE_TIME.new
     94    @c_duration = OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_DURATION.new
    9595  end
    9696
    9797  def test_init
    9898    #assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_PRIMITIVE, @c_primitive
    99     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN, @c_boolean
    100     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_STRING, @c_string
    101     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_INTEGER, @c_integer
    102     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_REAL, @c_real
    103     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_TIME, @c_time
    104     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE, @c_date
    105     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE_TIME, @c_date_time
    106     assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DURATION, @c_duration
     99    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN, @c_boolean
     100    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_STRING, @c_string
     101    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_INTEGER, @c_integer
     102    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_REAL, @c_real
     103    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_TIME, @c_time
     104    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_DATE, @c_date
     105    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_DATE_TIME, @c_date_time
     106    assert_instance_of OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_DURATION, @c_duration
    107107  end
    108108
     
    119119    end
    120120    assert_raise(ArgumentError) do
    121       OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid =>false,
     121      OpenEhr::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid =>false,
    122122                                                                         :false_valid => false,
    123123                                                                         :assumed_value => false)
     
    129129class ArchetypeModelOntologyTest < Test::Unit::TestCase
    130130  def setup
    131     @archetype_ontology = OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY.new
    132     @archetype_term = OpenEHR::AM::Archetype::Ontology::ARCHETYPE_TERM.new(:code => '', :items => '')
     131    @archetype_ontology = OpenEhr::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY.new
     132    @archetype_term = OpenEhr::AM::Archetype::Ontology::ARCHETYPE_TERM.new(:code => '', :items => '')
    133133  end
    134134
    135135  def test_init
    136     assert_instance_of OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY, @archetype_ontology
    137     assert_instance_of OpenEHR::AM::Archetype::Ontology::ARCHETYPE_TERM, @archetype_term
     136    assert_instance_of OpenEhr::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY, @archetype_ontology
     137    assert_instance_of OpenEhr::AM::Archetype::Ontology::ARCHETYPE_TERM, @archetype_term
    138138  end
    139139end
     
    141141class ArchetypeModelAssertionTest < Test::Unit::TestCase
    142142  def setup
    143     @assertion = OpenEHR::AM::Archetype::Assertion::ASSERTION.new
    144     @assertion_variable = OpenEHR::AM::Archetype::Assertion::ASSERTION_VARIABLE.new
    145     @operator_kind = OpenEHR::AM::Archetype::Assertion::OPERATOR_KIND.new
    146     @expr_item = OpenEHR::AM::Archetype::Assertion::EXPR_ITEM.new
    147     @expr_leaf = OpenEHR::AM::Archetype::Assertion::EXPR_LEAF.new
    148     @expr_operator = OpenEHR::AM::Archetype::Assertion::EXPR_OPERATOR.new
    149     @expr_unary_operator = OpenEHR::AM::Archetype::Assertion::EXPR_UNARY_OPERATOR.new
    150     @expr_binary_operator = OpenEHR::AM::Archetype::Assertion::EXPR_BINARY_OPERATOR.new
     143    @assertion = OpenEhr::AM::Archetype::Assertion::ASSERTION.new
     144    @assertion_variable = OpenEhr::AM::Archetype::Assertion::ASSERTION_VARIABLE.new
     145    @operator_kind = OpenEhr::AM::Archetype::Assertion::OPERATOR_KIND.new
     146    @expr_item = OpenEhr::AM::Archetype::Assertion::EXPR_ITEM.new
     147    @expr_leaf = OpenEhr::AM::Archetype::Assertion::EXPR_LEAF.new
     148    @expr_operator = OpenEhr::AM::Archetype::Assertion::EXPR_OPERATOR.new
     149    @expr_unary_operator = OpenEhr::AM::Archetype::Assertion::EXPR_UNARY_OPERATOR.new
     150    @expr_binary_operator = OpenEhr::AM::Archetype::Assertion::EXPR_BINARY_OPERATOR.new
    151151  end
    152152
    153153  def test_init
    154     assert_instance_of OpenEHR::AM::Archetype::Assertion::ASSERTION, @assertion
    155     assert_instance_of OpenEHR::AM::Archetype::Assertion::ASSERTION_VARIABLE, @assertion_variable
    156     assert_instance_of OpenEHR::AM::Archetype::Assertion::OPERATOR_KIND, @operator_kind
    157     assert_instance_of OpenEHR::AM::Archetype::Assertion::EXPR_ITEM, @expr_item
    158     assert_instance_of OpenEHR::AM::Archetype::Assertion::EXPR_LEAF, @expr_leaf
    159     assert_instance_of OpenEHR::AM::Archetype::Assertion::EXPR_OPERATOR, @expr_operator
    160     assert_instance_of OpenEHR::AM::Archetype::Assertion::EXPR_UNARY_OPERATOR, @expr_unary_operator
    161     assert_instance_of OpenEHR::AM::Archetype::Assertion::EXPR_BINARY_OPERATOR, @expr_binary_operator
     154    assert_instance_of OpenEhr::AM::Archetype::Assertion::ASSERTION, @assertion
     155    assert_instance_of OpenEhr::AM::Archetype::Assertion::ASSERTION_VARIABLE, @assertion_variable
     156    assert_instance_of OpenEhr::AM::Archetype::Assertion::OPERATOR_KIND, @operator_kind
     157    assert_instance_of OpenEhr::AM::Archetype::Assertion::EXPR_ITEM, @expr_item
     158    assert_instance_of OpenEhr::AM::Archetype::Assertion::EXPR_LEAF, @expr_leaf
     159    assert_instance_of OpenEhr::AM::Archetype::Assertion::EXPR_OPERATOR, @expr_operator
     160    assert_instance_of OpenEhr::AM::Archetype::Assertion::EXPR_UNARY_OPERATOR, @expr_unary_operator
     161    assert_instance_of OpenEhr::AM::Archetype::Assertion::EXPR_BINARY_OPERATOR, @expr_binary_operator
    162162  end
    163163end
     
    165165class ArchetypeModelProfileTest < Test::Unit::TestCase
    166166  def setup
    167     @c_dv_state = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::C_DV_STATE.new
    168     @state_machine = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::STATE_MACHINE.new
    169     @state = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::STATE.new
    170     @terminal_state = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::TERMINAL_STATE.new
    171     @non_terminal_state = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::NON_TERMINAL_STATE.new
    172     @transition = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::TRANSITION.new
     167    @c_dv_state = OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::C_DV_STATE.new
     168    @state_machine = OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::STATE_MACHINE.new
     169    @state = OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::STATE.new
     170    @terminal_state = OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::TERMINAL_STATE.new
     171    @non_terminal_state = OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::NON_TERMINAL_STATE.new
     172    @transition = OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::TRANSITION.new
    173173
    174     @c_code_phase = OpenEHR::AM::OpenEHR_Profile::Data_Types::Text::C_CODE_PHASE.new
     174    @c_code_phase = OpenEhr::AM::OpenEHR_Profile::DataTypes::Text::C_CODE_PHASE.new
    175175
    176     @c_dv_quantity = OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_DV_QUANTITY.new
    177     @c_dv_ordinal = OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_DV_ORDINAL.new
    178     @c_quantity_item = OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_QUANTITY_ITEM.new
     176    @c_dv_quantity = OpenEhr::AM::OpenEHR_Profile::DataTypes::Quantity::C_DV_QUANTITY.new
     177    @c_dv_ordinal = OpenEhr::AM::OpenEHR_Profile::DataTypes::Quantity::C_DV_ORDINAL.new
     178    @c_quantity_item = OpenEhr::AM::OpenEHR_Profile::DataTypes::Quantity::C_QUANTITY_ITEM.new
    179179  end
    180180
    181181  def test_init
    182     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::C_DV_STATE, @c_dv_state
    183     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::STATE_MACHINE, @state_machine
    184     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::STATE, @state
    185     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::TERMINAL_STATE, @terminal_state
    186     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::NON_TERMINAL_STATE, @non_terminal_state
    187     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::TRANSITION, @transition
    188     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Text::C_CODE_PHASE, @c_code_phase
    189     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_DV_QUANTITY, @c_dv_quantity
    190     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_DV_ORDINAL, @c_dv_ordinal
    191     assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_QUANTITY_ITEM, @c_quantity_item
     182    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::C_DV_STATE, @c_dv_state
     183    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::STATE_MACHINE, @state_machine
     184    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::STATE, @state
     185    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::TERMINAL_STATE, @terminal_state
     186    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::NON_TERMINAL_STATE, @non_terminal_state
     187    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Basic::TRANSITION, @transition
     188    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Text::C_CODE_PHASE, @c_code_phase
     189    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Quantity::C_DV_QUANTITY, @c_dv_quantity
     190    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Quantity::C_DV_ORDINAL, @c_dv_ordinal
     191    assert_instance_of OpenEhr::AM::OpenEHR_Profile::DataTypes::Quantity::C_QUANTITY_ITEM, @c_quantity_item
    192192  end
    193193end
  • ruby/branches/0.5.0/lib/models/tests/test_assumed_library_types.rb

    r151 r167  
    22require 'assumed_library_types.rb'
    33
    4 include OpenEHR::Assumed_Library_Types
     4include OpenEhr::AssumedLibraryTypes
    55
    66class Assumed_Library_Test < Test::Unit::TestCase
    77  def setup
    8     assert_nothing_raised(Exception){@interval = OpenEHR::Assumed_Library_Types::Interval.new(1,2)}
    9     assert_nothing_raised(Exception){@iso8601_date = OpenEHR::Assumed_Library_Types::ISO8601_DATE.new('2009-04-27')}
    10     assert_nothing_raised(Exception){@iso8601_time = OpenEHR::Assumed_Library_Types::ISO8601_TIME.new('15:55:37.32+0900')}
    11     assert_nothing_raised(Exception){@iso8601_date_time = OpenEHR::Assumed_Library_Types::ISO8601_DATE_TIME.new('2009-04-27T15:55:37.32+0900')}
    12     assert_nothing_raised(Exception){@iso8601_duration = OpenEHR::Assumed_Library_Types::ISO8601_DURATION.new('P1Y2M3W4DT5H6M7.8S')}
    13     assert_nothing_raised(Exception){@iso8601_timezone = OpenEHR::Assumed_Library_Types::ISO8601_TIMEZONE.new}
     8    assert_nothing_raised(Exception){@interval = OpenEhr::AssumedLibraryTypes::Interval.new(1,2)}
     9    assert_nothing_raised(Exception){@iso8601_date = OpenEhr::AssumedLibraryTypes::ISO8601_DATE.new('2009-04-27')}
     10    assert_nothing_raised(Exception){@iso8601_time = OpenEhr::AssumedLibraryTypes::ISO8601_TIME.new('15:55:37.32+0900')}
     11    assert_nothing_raised(Exception){@iso8601_date_time = OpenEhr::AssumedLibraryTypes::ISO8601_DATE_TIME.new('2009-04-27T15:55:37.32+0900')}
     12    assert_nothing_raised(Exception){@iso8601_duration = OpenEhr::AssumedLibraryTypes::ISO8601_DURATION.new('P1Y2M3W4DT5H6M7.8S')}
     13    assert_nothing_raised(Exception){@iso8601_timezone = OpenEhr::AssumedLibraryTypes::ISO8601_TIMEZONE.new}
    1414  end
    1515
    1616  def test_initialize
    17     assert_instance_of OpenEHR::Assumed_Library_Types::Interval, @interval
    18     assert_instance_of OpenEHR::Assumed_Library_Types::ISO8601_DATE, @iso8601_date
    19     assert_instance_of OpenEHR::Assumed_Library_Types::ISO8601_TIME, @iso8601_time
    20     assert_instance_of OpenEHR::Assumed_Library_Types::ISO8601_DATE_TIME, @iso8601_date_time
    21     assert_instance_of OpenEHR::Assumed_Library_Types::ISO8601_DURATION, @iso8601_duration
    22     assert_instance_of OpenEHR::Assumed_Library_Types::ISO8601_TIMEZONE, @iso8601_timezone
     17    assert_instance_of OpenEhr::AssumedLibraryTypes::Interval, @interval
     18    assert_instance_of OpenEhr::AssumedLibraryTypes::ISO8601_DATE, @iso8601_date
     19    assert_instance_of OpenEhr::AssumedLibraryTypes::ISO8601_TIME, @iso8601_time
     20    assert_instance_of OpenEhr::AssumedLibraryTypes::ISO8601_DATE_TIME, @iso8601_date_time
     21    assert_instance_of OpenEhr::AssumedLibraryTypes::ISO8601_DURATION, @iso8601_duration
     22    assert_instance_of OpenEhr::AssumedLibraryTypes::ISO8601_TIMEZONE, @iso8601_timezone
    2323  end
    2424
     
    5858
    5959  def test_time_definitions
    60     assert_equal OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS::DAYS_IN_LEAP_YEAR, 366
    61     assert_equal OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS::DAYS_IN_WEEK, 7
    62     assert_equal OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS::DAYS_IN_YEAR, 365
    63     assert_equal OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS::HOURS_IN_DAY, 24
    64     assert_equal OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS::MAX_DAYS_IN_MONTH, 31
    65     assert_equal OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS::MAX_DAYS_IN_YEAR, 366
    66     assert_equal OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS::MINUTES_IN_HOUR, 60
    67     assert_equal OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS::MONTH_IN_YEAR, 12
    68     assert_equal OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS::NOMINAL_DAYS_IN_MONTH, 30.42
    69     assert_equal OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS::NOMINAL_DAYS_IN_YEAR, 365.24
    70     assert_equal OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS::SECONDS_IN_MINUTE, 60
     60    assert_equal OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS::DAYS_IN_LEAP_YEAR, 366
     61    assert_equal OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS::DAYS_IN_WEEK, 7
     62    assert_equal OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS::DAYS_IN_YEAR, 365
     63    assert_equal OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS::HOURS_IN_DAY, 24
     64    assert_equal OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS::MAX_DAYS_IN_MONTH, 31
     65    assert_equal OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS::MAX_DAYS_IN_YEAR, 366
     66    assert_equal OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS::MINUTES_IN_HOUR, 60
     67    assert_equal OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS::MONTH_IN_YEAR, 12
     68    assert_equal OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS::NOMINAL_DAYS_IN_MONTH, 30.42
     69    assert_equal OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS::NOMINAL_DAYS_IN_YEAR, 365.24
     70    assert_equal OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS::SECONDS_IN_MINUTE, 60
    7171  end
    7272
    7373  def test_time_definition_validity
    74     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_year?(2008)
    75     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_year?(-20)
    76     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_year?(0)
     74    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_year?(2008)
     75    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_year?(-20)
     76    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_year?(0)
    7777# today
    78     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,6,19)
     78    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,6,19)
    7979# test valid_day lower limit
    80     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(0,0,0)
    81     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(0,1,1)
    82     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(-1,1,1)
    83     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(0,1,0)
     80    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(0,0,0)
     81    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(0,1,1)
     82    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(-1,1,1)
     83    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(0,1,0)
    8484# test valid_day upper and lowerlimit of each month
    85     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(0,0,1)
    86     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,1,1)
    87     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,1,0)
    88     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,0,1)
    89     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,1,31)
    90     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,1,32)
    91     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,2,1)
    92     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,2,0)
    93     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,2,31)
    94     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,3,1)
    95     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,3,0)
    96     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,3,31)
    97     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,3,32)
    98     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,4,1)
    99     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,4,0)
    100     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,4,30)
    101     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,4,31)
    102     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,5,1)
    103     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,5,0)
    104     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,5,31)
    105     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,5,32)
    106     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,6,1)
    107     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,6,0)
    108     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,6,30)
    109     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,6,31)
    110     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,7,1)
    111     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,7,0)
    112     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,7,31)
    113     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,7,32)
    114     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,8,1)
    115     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,8,0)
    116     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,8,31)
    117     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,8,32)
    118     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,9,1)
    119     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,9,0)
    120     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,9,30)
    121     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,9,31)
    122     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,10,1)
    123     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,10,0)
    124     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,10,31)
    125     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,10,32)
    126     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,11,1)
    127     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,11,0)
    128     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,11,30)
    129     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,11,31)
    130     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,12,1)
    131     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,12,0)
    132     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,12,31)
    133     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,12,32)
     85    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(0,0,1)
     86    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,1,1)
     87    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,1,0)
     88    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,0,1)
     89    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,1,31)
     90    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,1,32)
     91    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,2,1)
     92    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,2,0)
     93    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,2,31)
     94    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,3,1)
     95    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,3,0)
     96    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,3,31)
     97    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,3,32)
     98    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,4,1)
     99    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,4,0)
     100    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,4,30)
     101    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,4,31)
     102    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,5,1)
     103    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,5,0)
     104    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,5,31)
     105    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,5,32)
     106    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,6,1)
     107    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,6,0)
     108    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,6,30)
     109    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,6,31)
     110    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,7,1)
     111    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,7,0)
     112    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,7,31)
     113    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,7,32)
     114    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,8,1)
     115    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,8,0)
     116    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,8,31)
     117    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,8,32)
     118    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,9,1)
     119    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,9,0)
     120    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,9,30)
     121    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,9,31)
     122    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,10,1)
     123    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,10,0)
     124    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,10,31)
     125    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,10,32)
     126    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,11,1)
     127    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,11,0)
     128    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,11,30)
     129    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,11,31)
     130    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,12,1)
     131    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,12,0)
     132    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,12,31)
     133    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,12,32)
    134134# test valid_day leap year
    135     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(1900,2,28)
    136     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(1900,2,29)
    137     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2000,2,29)
    138     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_day?(2008,2,29)
     135    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(1900,2,28)
     136    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(1900,2,29)
     137    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2000,2,29)
     138    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_day?(2008,2,29)
    139139# test valid_hour lower limit
    140     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_hour?(0,0,0)
    141     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_hour?(-1,0,0)
    142     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_hour?(0,-1,0)
    143     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_hour?(0,0,-1)
     140    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_hour?(0,0,0)
     141    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_hour?(-1,0,0)
     142    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_hour?(0,-1,0)
     143    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_hour?(0,0,-1)
    144144# test valid_hour upper limit
    145     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_hour?(0,59,0)
    146     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_hour?(0,60,0)
    147     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_hour?(0,0,59)
    148     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_hour?(0,0,60)
    149     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_hour?(24,0,0)
    150     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_hour?(24,0,1)
    151     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_hour?(24,1,0)
     145    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_hour?(0,59,0)
     146    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_hour?(0,60,0)
     147    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_hour?(0,0,59)
     148    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_hour?(0,0,60)
     149    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_hour?(24,0,0)
     150    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_hour?(24,0,1)
     151    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_hour?(24,1,0)
    152152# test valid_minute method lower limit
    153     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_minute?(0)
    154     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_minute?(-1)
     153    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_minute?(0)
     154    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_minute?(-1)
    155155# test valid_minute method upper limit
    156     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_minute?(59)
    157     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_minute?(60)
     156    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_minute?(59)
     157    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_minute?(60)
    158158# test valid_second method lower limit
    159     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_second?(0)
    160     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_second?(-1)
     159    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_second?(0)
     160    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_second?(-1)
    161161# test valid_second method upper limit
    162     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_second?(59)
    163     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_second?(60)
     162    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_second?(59)
     163    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_second?(60)
    164164# test valid_month method lower limit
    165     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_month?(1)
    166     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_month?(0)
     165    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_month?(1)
     166    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_month?(0)
    167167# test valid_month method upper limit
    168     assert OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_month?(12)
    169     assert !OpenEHR::Assumed_Library_Types::TIME_DEFINITIONS.valid_month?(13)
     168    assert OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_month?(12)
     169    assert !OpenEhr::AssumedLibraryTypes::TIME_DEFINITIONS.valid_month?(13)
    170170  end
    171171  def test_iso8601_date
     
    173173    assert_equal 4,@iso8601_date.month
    174174    assert_equal 27,@iso8601_date.day
    175     assert_nothing_raised(Exception){@iso8601_date = OpenEHR::Assumed_Library_Types::ISO8601_DATE.new('2008')}
     175    assert_nothing_raised(Exception){@iso8601_date = OpenEhr::AssumedLibraryTypes::ISO8601_DATE.new('2008')}
    176176    assert @iso8601_date.day_unknown?
    177177    assert @iso8601_date.month_unknown?
     
    194194    assert !@iso8601_date.is_partial?
    195195    assert_equal "2008-06-14", @iso8601_date.as_string
    196     assert OpenEHR::Assumed_Library_Types::ISO8601_DATE.valid_iso8601_date?("2006-06-14")
    197     assert !OpenEHR::Assumed_Library_Types::ISO8601_DATE.valid_iso8601_date?("ABCDEFG")
     196    assert OpenEhr::AssumedLibraryTypes::ISO8601_DATE.valid_iso8601_date?("2006-06-14")
     197    assert !OpenEhr::AssumedLibraryTypes::ISO8601_DATE.valid_iso8601_date?("ABCDEFG")
    198198  end
    199199
     
    207207#    assert_nothing_raised(Exception){@iso8601_time = OpenEHR::Assumed_Library_Types::ISO8601_TIME.new('15:55:37.32+0900')}
    208208
    209     assert_nothing_raised(Exception){@iso8601_time = OpenEHR::Assumed_Library_Types::ISO8601_TIME.new('01')}
     209    assert_nothing_raised(Exception){@iso8601_time = OpenEhr::AssumedLibraryTypes::ISO8601_TIME.new('01')}
    210210    assert_equal 1, @iso8601_time.hour
    211211    assert @iso8601_time.is_partial?
     
    253253    assert @iso8601_time.is_extended?
    254254    assert !@iso8601_time.is_decimal_sign_comma?
    255     assert OpenEHR::Assumed_Library_Types::ISO8601_TIME.valid_iso8601_time?("012345Z")
    256     assert OpenEHR::Assumed_Library_Types::ISO8601_TIME.valid_iso8601_time?("012345.67+0900")
    257     assert !OpenEHR::Assumed_Library_Types::ISO8601_TIME.valid_iso8601_time?("242345.67+0900")
    258     assert !OpenEHR::Assumed_Library_Types::ISO8601_TIME.valid_iso8601_time?("242345.67+0900")
    259     assert OpenEHR::Assumed_Library_Types::ISO8601_TIME.valid_iso8601_time?("240000")
    260     assert OpenEHR::Assumed_Library_Types::ISO8601_TIME.valid_iso8601_time?("240000Z")
    261     assert !OpenEHR::Assumed_Library_Types::ISO8601_TIME.valid_iso8601_time?("240000.011Z")
     255    assert OpenEhr::AssumedLibraryTypes::ISO8601_TIME.valid_iso8601_time?("012345Z")
     256    assert OpenEhr::AssumedLibraryTypes::ISO8601_TIME.valid_iso8601_time?("012345.67+0900")
     257    assert !OpenEhr::AssumedLibraryTypes::ISO8601_TIME.valid_iso8601_time?("242345.67+0900")
     258    assert !OpenEhr::AssumedLibraryTypes::ISO8601_TIME.valid_iso8601_time?("242345.67+0900")
     259    assert OpenEhr::AssumedLibraryTypes::ISO8601_TIME.valid_iso8601_time?("240000")
     260    assert OpenEhr::AssumedLibraryTypes::ISO8601_TIME.valid_iso8601_time?("240000Z")
     261    assert !OpenEhr::AssumedLibraryTypes::ISO8601_TIME.valid_iso8601_time?("240000.011Z")
    262262  end
    263263
  • ruby/branches/0.5.0/lib/open_ehr/am.rb

    r165 r167  
    1414require 'rm/common/resource.rb'
    1515#require 'rm/support/terminology/openehr_code_set_identifier.rb'
    16 module OpenEHR
     16module OpenEhr
    1717  module AM
    1818    module Archetype
     
    3838
    3939    module OpenEHR_Profile
    40       module Data_Types
     40      module DataTypes
    4141        module Basic
    4242          autoload :C_DV_STATE, "am/openehr_profile/data_types/basic.rb"
  • ruby/branches/0.5.0/lib/open_ehr/am/archetype/archetype.rb

    r163 r167  
    11require 'rm/support/terminology.rb'
    22
    3 module OpenEHR
     3module OpenEhr
    44  module AM
    55    module Archetype
    66      module ADL_Definition
    77#        include OpenEHR::RM::Support::Terminology::OpenEHR_Code_Set_Identifier
    8         include OpenEHR::RM::Support::Terminology
     8        include OpenEhr::RM::Support::Terminology
    99        CURRENT_ADL_VERSION = "1.4"
    1010      end
    1111
    12       class ARCHETYPE < OpenEHR::RM::Common::Resource::Authored_Resource
     12      class ARCHETYPE < OpenEhr::RM::Common::Resource::AuthoredResource
    1313        include ADL_Definition
    1414        attr_accessor :archetype_id, :concept_code, :is_controlled, :original_language, :parent_archtype_id, :uid
  • ruby/branches/0.5.0/lib/open_ehr/am/archetype/archetype_description/archetype_description.rb

    r23 r167  
    11
    2 module OpenEHR
     2module OpenEhr
    33  module AM
    44    module Archetype
  • ruby/branches/0.5.0/lib/open_ehr/am/archetype/constraint_model/archetype_constraint.rb

    r35 r167  
    11
    2 module OpenEHR
     2module OpenEhr
    33  module AM
    44    module Archetype
  • ruby/branches/0.5.0/lib/open_ehr/am/archetype/constraint_model/assertion.rb

    r23 r167  
    1 module OpenEHR
     1module OpenEhr
    22  module AM
    33    module Archetype
  • ruby/branches/0.5.0/lib/open_ehr/am/archetype/constraint_model/primitive.rb

    r32 r167  
    1 module OpenEHR
     1module OpenEhr
    22  module AM
    33    module Archetype
  • ruby/branches/0.5.0/lib/open_ehr/am/archetype/ontology.rb

    r23 r167  
    1 module OpenEHR
     1module OpenEhr
    22  module AM
    33    module Archetype
  • ruby/branches/0.5.0/lib/open_ehr/am/archetype/validity_kind.rb

    r47 r167  
    1 module OpenEHR
     1module OpenEhr
    22  module AM
    33    module Archetype
  • ruby/branches/0.5.0/lib/open_ehr/assumed_library_types.rb

    r165 r167  
    33require 'time'
    44
    5 module OpenEHR
    6   module Assumed_Library_Types
     5module OpenEhr
     6  module AssumedLibraryTypes
    77    class Any < Object
    88     
  • ruby/branches/0.5.0/lib/open_ehr/rm.rb

    r165 r167  
    99
    1010# OpenEHR::RM
    11 module OpenEHR
     11module OpenEhr
    1212
    1313  autoload :Assumed_Library_Types, "assumed_library_types.rb"
     
    3131    end
    3232
    33     module Data_Types
     33    module DataTypes
    3434      autoload :Basic, "rm/data_types/basic.rb"
    3535      autoload :Text, "rm/data_types/text.rb"
     
    4040    end
    4141
    42     module Data_Structures
     42    module DataStructures
    4343      autoload :Data_Structure, "rm/data_structure.rb"
    4444      autoload :History, 'rm/data_structures/history.rb'
  • ruby/branches/0.5.0/lib/open_ehr/rm/common/archetyped.rb

    r162 r167  
    22# http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109318114715_211173_0Report.html
    33# Ticket refs #65
    4 module OpenEHR
     4module OpenEhr
    55  module RM
    66    module Common
    77      module Archetyped
    8         module Locater_Constants
     8        module LocaterConstants
    99          CURRENT_TRANSACTION_ID = "current"
    1010          FRAGMENT_SEPARATOR = "#"
     
    4343
    4444        class Locatable < Pathable
    45           include Locater_Constants
     45          include LocaterConstants
    4646          attr_reader :archetype_node_id, :name, :links
    4747          attr_accessor :uid, :archetype_details, :feeder_audit
     
    138138        end # of Link
    139139
    140         class Feeder_Audit
     140        class FeederAudit
    141141          attr_reader :originating_system_audit
    142142          attr_accessor :originating_system_item_ids, :feeder_system_audit,
     
    157157            @originating_system_audit = originating_system_audit
    158158          end
    159         end # of Feeder_Audit
     159        end # of FeederAudit
    160160
    161         class Feeder_Audit_Details
     161        class FeederAuditDetails
    162162          attr_reader :system_id
    163163          attr_accessor :provider, :location, :time, :subject, :version_id
     
    176176            @system_id = system_id
    177177          end
    178         end # of Feeder_Audit_Details
     178        end # of FeederAudit_Details
    179179      end # of Archetyped
    180180    end # of Common
  • ruby/branches/0.5.0/lib/open_ehr/rm/common/change_control.rb

    r161 r167  
    33# Ticket refs #64
    44
    5 module OpenEHR
     5module OpenEhr
    66  module RM
    77    module Common
    8       module Change_Control
     8      module ChangeControl
    99        class Contribution
    1010          attr_reader :uid, :versions, :audit
     
    9393
    9494          def owner_id
    95             return Hier_Object_ID.new(@uid.object_id.value)
     95            return HierObjectId.new(@uid.object_id.value)
    9696          end
    9797
     
    105105        end
    106106
    107         class Imported_Version < Version
     107        class ImportedVersion < Version
    108108          attr_reader :item
    109109
     
    126126        end
    127127
    128         class Original_Version < Version
     128        class OriginalVersion < Version
    129129          attr_reader :attestations, :other_input_version_uids
    130130
     
    155155        end
    156156
    157         class Versioned_Object
     157        class VersionedObject
    158158          attr_reader :uid, :owner_id, :time_created, :all_versions
    159159
     
    208208              raise ArgumentError, 'invalid a_ver_id'
    209209            end
    210             return @all_versions[self.all_version_ids.index(a_ver_id)].instance_of? Original_Version
     210            return @all_versions[self.all_version_ids.index(a_ver_id)].instance_of? OriginalVersion
    211211          end
    212212
     
    267267            @all_versions.each do |ver|
    268268              audits = [ ]
    269               if ver.instance_of? Original_Version
     269              if ver.instance_of? OriginalVersion
    270270                audits << ver.attestations
    271271              end
    272272              audits << ver.commit_audit
    273               revision_history_items << Revision_History_Item.new(
     273              revision_history_items << RevisionHistoryItem.new(
    274274                                          :audits => audits,
    275275                                          :version_id => ver.uid)
    276276            end
    277             return Revision_History.new(revision_history_items)
     277            return RevisionHistory.new(revision_history_items)
    278278          end
    279279
    280280          def commit_original_version(args={ })
    281             @all_versions << Original_Version.new(:uid => args[:uid],
     281            @all_versions << OriginalVersion.new(:uid => args[:uid],
    282282                                                  :preceding_version_uid => args[:preceding_version_uid],
    283283                                                  :contribution => args[:contribution],
     
    290290
    291291          def commit_original_merged_version(args = { })
    292             @all_versions << Original_Version.new(:uid => args[:uid],
     292            @all_versions << OriginalVersion.new(:uid => args[:uid],
    293293                                                  :contribution => args[:contribution],
    294294                                              :preceding_version_uid => args[:preceding_version_uid],
     
    302302
    303303          def commit_imported_version(args = { })
    304             @all_versions << Imported_Version.new(:item => args[:item],
     304            @all_versions << ImportedVersion.new(:item => args[:item],
    305305                                                  :contribution => args[:contribution],
    306306                                                  :commit_audit => args[:commit_audit])
     
    319319          end
    320320        end
    321       end # of Change_Control
     321      end # of ChangeControl
    322322    end # of Common
    323323  end # of RM
  • ruby/branches/0.5.0/lib/open_ehr/rm/common/directory.rb

    r162 r167  
    22# http://www.openehr.org/uml/release-1.0.1/Browsable/_9_5_1_76d0249_1140536622627_218703_7149Report.html
    33# Ticket refs #63
    4 include OpenEHR::RM::Data_Types::Text
    5 module OpenEHR
     4include OpenEhr::RM::DataTypes::Text
     5module OpenEhr
    66  module RM
    77    module Common
    88      module Directory
    9         class Folder < OpenEHR::RM::Common::Archetyped::Locatable
     9        class Folder < OpenEhr::RM::Common::Archetyped::Locatable
    1010          attr_accessor :items
    1111          attr_reader :folders
     
    2222          end
    2323        end       
    24         class Versioned_Folder < OpenEHR::RM::Common::Change_Control::Versioned_Object
     24        class VersionedFolder < OpenEhr::RM::Common::ChangeControl::VersionedObject
    2525        end
    2626      end # of Directory
  • ruby/branches/0.5.0/lib/open_ehr/rm/common/generic.rb

    r157 r167  
    22# http://www.openehr.org/uml/release-1.0.1/Browsable/_9_5_1_76d0249_1140169202660_257304_813Report.html
    33# Related to the ticket #62
    4 include OpenEHR::RM::Support::Identification
    5 include OpenEHR::RM::Data_Types::Basic
    6 module OpenEHR
     4include OpenEhr::RM::Support::Identification
     5include OpenEhr::RM::DataTypes::Basic
     6module OpenEhr
    77  module RM
    88    module Common
    99      module Generic
    10         class Audit_Details
     10        class AuditDetails
    1111          attr_reader :system_id, :committer, :time_committed, :change_type
    1212          attr_accessor :description
     
    4545        end
    4646
    47         class Revision_History
     47        class RevisionHistory
    4848          attr_reader :items
    4949
     
    6666            return @items.last.audits.first.time_committed.value
    6767          end
    68         end # of Revision_History
     68        end # of RevisionHistory
    6969
    70         class Revision_History_Item
     70        class RevisionHistoryItem
    7171          attr_reader :version_id, :audits
    7272
     
    8787            @version_id = version_id
    8888          end
    89         end # of Revision_History_Item
     89        end # of RevisionHistory_Item
    9090
    91         class Party_Proxy
     91        class PartyProxy
    9292          attr_accessor :external_ref
    9393
     
    9797        end
    9898
    99         class Party_Self < Party_Proxy
     99        class PartySelf < PartyProxy
    100100
    101101        end
    102102
    103         class Party_Identified < Party_Proxy
     103        class PartyIdentified < PartyProxy
    104104          attr_reader :name, :identifier
    105105          def initialize(args = { })
     
    132132        end
    133133
    134         class Party_Related < Party_Identified
     134        class PartyRelated < PartyIdentified
    135135          attr_reader :relationship
    136136          def initialize(args = { })
     
    174174        end
    175175
    176         class Attestation < Audit_Details
     176        class Attestation < AuditDetails
    177177          attr_reader :reason
    178178          attr_accessor :proof, :items
  • ruby/branches/0.5.0/lib/open_ehr/rm/common/resource.rb

    r163 r167  
    11require 'set'
    2 module OpenEHR
     2module OpenEhr
    33  module RM
    44    module Common
    55      module Resource
    6         class Authored_Resource
     6        class AuthoredResource
    77          attr_reader  :original_language, :translations
    88          attr_accessor :description, :revision_history
     
    4242        end
    4343
    44         class Translation_Details
     44        class TranslationDetails
    4545          attr_reader :language, :author
    4646          attr_accessor :accreditation, :other_details
     
    6464        end
    6565
    66         class Resource_Description
     66        class ResourceDescription
    6767          attr_reader :original_author, :lifecycle_state, :details
    6868          attr_accessor :other_contributors, :resource_package_uri,
     
    101101        end
    102102
    103         class Resource_Description_Item
     103        class ResourceDescriptionItem
    104104          attr_reader :language, :purpose, :use, :misuse, :copyright
    105105          attr_accessor :keywords, :original_resource_uri, :other_details
  • ruby/branches/0.5.0/lib/open_ehr/rm/composition/content/entry.rb

    r4 r167  
    1 module OpenEHR
     1module OpenEhr
    22  module RM
    33    module Content
     
    55        class Entry < Content_Item
    66        end
    7         class Care_Entry < Entry
     7        class CareEntry < Entry
    88        end
    9         class Action < Care_Entry
     9        class Action < CareEntry
    1010          attr_accessor :description, :time
    1111          attr_accessor :ism_transition, :instruction_details
  • ruby/branches/0.5.0/lib/open_ehr/rm/data_structure.rb

    r164 r167  
    44# refs #59
    55
    6 module OpenEHR
     6module OpenEhr
    77  module RM
    8     module Data_Structures
    9       class Data_Structure < OpenEHR::RM::Common::Archetyped::Locatable       
     8    module DataStructures
     9      class DataStructure < OpenEhr::RM::Common::Archetyped::Locatable
    1010        def initialize(args = { })
    1111          super(args)
  • ruby/branches/0.5.0/lib/open_ehr/rm/data_types/basic.rb

    r109 r167  
    22# http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109067591791_562382_3151Report.html
    33# Ticket refs #52
    4 module OpenEHR
     4module OpenEhr
    55  module RM
    6     module Data_Types
     6    module DataTypes
    77      module Basic
    8         module Canonical_Fragment
     8        module CanonicalFragment
    99        end
    1010
    11         class Data_Value
    12           include OpenEHR::RM::Support::Definition::Basic_Definition
     11        class DataValue
     12          include OpenEhr::RM::Support::Definition::BasicDefinition
    1313        end
    1414
    15         class DV_Boolean < Data_Value
     15        class DvBoolean < DataValue
    1616          def initialize(value)
    1717            self.value = value
     
    2828            @value == true
    2929          end
    30         end  # end of DV_Boolean
     30        end  # end of DvBoolean
    3131
    32         class DV_State < Data_Value
     32        class DvState < DataValue
    3333          attr_reader :value
    3434
     
    4848            @is_terminal = s
    4949          end
    50         end # end of DV_State
     50        end # end of DvState
    5151
    52         class DV_Identifier
     52        class DvIdentifier
    5353          attr_accessor :issuer, :assigner, :id, :type
    5454          def initialize(assigner, id, issuer, type)
     
    6363            @type = type
    6464          end
    65         end #end of DV_Identifier
     65        end #end of DvIdentifier
    6666      end # end of Basic
    67     end # end of Data_types
     67    end # end of DataTypes
    6868  end # end of RM
    6969end # end of OpenEHR
  • ruby/branches/0.5.0/lib/open_ehr/rm/data_types/encapsulated.rb

    r134 r167  
    55require 'locale/info'
    66
    7 module OpenEHR
     7module OpenEhr
    88  module RM
    9     module Data_Types
     9    module DataTypes
    1010      module Encapsulated
    11         class DV_Encapsulated  < OpenEHR::RM::Data_Types::Basic::Data_Value
     11        class DvEncapsulated  < OpenEhr::RM::DataTypes::Basic::DataValue
    1212          attr_reader :language, :charset, :size
    1313          def initialize(charset, language, size)
     
    5959
    6060# media type http://www.iana.org/assignments/media-types/text/
    61         class DV_Multimedia < DV_Encapsulated
     61        class DvMultimedia < DvEncapsulated
    6262          attr_reader :media_type
    6363          attr_accessor :uri, :data, :compression_algorithm,
     
    8484        end
    8585
    86         class DV_Parsable < DV_Encapsulated
     86        class DvParsable < DvEncapsulated
    8787          attr_reader :value, :formalism
    8888          def initialize(charset, language, size, formalism, value)
     
    107107        end
    108108      end # of Encapsulated
    109     end # of Data_Types
     109    end # of DataTypes
    110110  end # of RM
    111111end # of OpenEHR
  • ruby/branches/0.5.0/lib/open_ehr/rm/data_types/quantity.rb

    r149 r167  
    33# Ticket refs #50
    44require 'assumed_library_types'
    5 module OpenEHR
     5module OpenEhr
    66  module RM
    7     module Data_Types
     7    module DataTypes
    88      module Quantity
    99
    1010        autoload :Date_Time, "rm/data_types/quantity/date_time.rb"
    1111
    12         class DV_Ordered < OpenEHR::RM::Data_Types::Basic::Data_Value
     12        class DvOrdered < OpenEhr::RM::DataTypes::Basic::DataValue
    1313          include Comparable
    1414          attr_accessor :normal_range, :other_refference_ranges, :normal_status
     
    5151        end
    5252
    53         class DV_Interval < OpenEHR::Assumed_Library_Types::Interval
    54 
    55         end
    56 
    57         class DV_Quantified < DV_Ordered
     53        class DvInterval < OpenEhr::AssumedLibraryTypes::Interval
     54
     55        end
     56
     57        class DvQuantified < DvOrdered
    5858          attr_reader :magnitude, :magnitude_status
    5959
     
    7878            if magnitude_status.nil?
    7979              @magnitude_status = '='
    80             elsif DV_Quantified.valid_magnitude_status?(magnitude_status)
     80            elsif DvQuantified.valid_magnitude_status?(magnitude_status)
    8181              @magnitude_status = magnitude_status
    8282            else
     
    9999        end
    100100
    101         class DV_Ordinal < DV_Ordered
     101        class DvOrdinal < DvOrdered
    102102          attr_reader :value, :symbol, :limits
    103103
     
    121121
    122122          def is_strictly_comparable_to?(others)
    123             unless others.instance_of? OpenEHR::RM::Data_Types::Quantity::DV_Ordinal
     123            unless others.instance_of? OpenEhr::RM::DataTypes::Quantity::DvOrdinal
    124124              return false
    125125            end
     
    144144        end
    145145
    146         class DV_Absolute_Quantity < DV_Quantified
     146        class DvAbsoluteQuantity < DvQuantified
    147147          attr_accessor :accuracy
    148148
     
    168168        end
    169169
    170         class DV_Amount < DV_Quantified
     170        class DvAmount < DvQuantified
    171171          attr_reader :accuracy, :accuracy_percent
    172172          def initialize(magnitude, magnitude_status=nil, accuracy=nil,
     
    186186              raise ArgumentError, 'type mismatch'
    187187            end
    188             return DV_Amount.new(@magnitude+other.magnitude, @magnitude_status,
     188            return DvAmount.new(@magnitude+other.magnitude, @magnitude_status,
    189189                                 @accuracy, @accuracy_percent, @normal_range,
    190190                                 @normal_status, @other_reference_ranges)
     
    210210        end
    211211
    212         class DV_Quantity < DV_Amount
     212        class DvQuantity < DvAmount
    213213          attr_reader :units, :precision
    214214          def initialize(magnitude, units, magnitude_status=nil, precision=nil,
     
    235235          def is_strictly_comparable_to?(others)
    236236            return false if others.nil?
    237             if others.instance_of?(DV_Quantity) && others.units == @units
     237            if others.instance_of?(DvQuantity) && others.units == @units
    238238              return true
    239239            else
     
    252252          def +(other)
    253253            dv_amount = super(other)
    254             return DV_Quantity.new(dv_amount.magnitude, @units,
     254            return DvQuantity.new(dv_amount.magnitude, @units,
    255255                                   @magnitude_status, @precision,
    256256                                   @accuracy, @accuracy_percent, @normal_range,
     
    259259        end
    260260
    261         class DV_Count < DV_Amount
     261        class DvCount < DvAmount
    262262          def is_strictly_comparable_to?(others)
    263263            return false if others.nil?
    264             if others.instance_of?(DV_Count)
     264            if others.instance_of?(DvCount)
    265265              return true
    266266            else
     
    270270        end
    271271
    272         class Reference_Range
     272        class ReferenceRange
    273273          attr_reader :meaning, :range
    274274
     
    297297        end
    298298
    299         module Proportion_Kind
     299        module ProportionKind
    300300          PK_RATIO = 0
    301301          PK_UNITARY = 1
     
    304304          PK_INTEGER_FRACTION = 4
    305305
    306           def Proportion_Kind.valid_proportion_kind?(kind)
     306          def ProportionKind.valid_proportion_kind?(kind)
    307307            return true if kind >= 0 && kind <= 4
    308308            return false
    309309          end
    310         end # end of Proportion_Kind
    311 
    312         class DV_Proportion < DV_Amount
    313           include Proportion_Kind
     310        end # end of ProportionKind
     311
     312        class DvProportion < DvAmount
     313          include ProportionKind
    314314          attr_reader :numerator, :denominator, :type, :precision
    315315
     
    360360
    361361          def type=(type)
    362             if Proportion_Kind.valid_proportion_kind?(type)
     362            if ProportionKind.valid_proportion_kind?(type)
    363363              @type = type
    364364            else
     
    386386
    387387          def is_strictly_comparable_to?(other)
    388             unless other.instance_of?(DV_Proportion)
     388            unless other.instance_of?(DvProportion)
    389389              return false
    390390            end
     
    395395            end
    396396          end
    397         end # end of DV_Proportion
    398 
     397        end # end of DvProportion
    399398      end # of Quantity
    400399    end # of Data_Types
  • ruby/branches/0.5.0/lib/open_ehr/rm/data_types/quantity/date_time.rb

    r157 r167  
    55require 'date'
    66
    7 module OpenEHR
     7module OpenEhr
    88  module RM
    9     module Data_Types
     9    module DataTypes
    1010      module Quantity
    11         module Date_Time
    12           class DV_Temporal < OpenEHR::RM::Data_Types::Quantity::DV_Absolute_Quantity
     11        module DateTime
     12          class DvTemporal < OpenEhr::RM::DataTypes::Quantity::DvAbsoluteQuantity
    1313            include Comparable
    1414            attr_reader :value
     
    3737          end
    3838
    39           class DV_Date < DV_Temporal
    40             include OpenEHR::Assumed_Library_Types::ISO8601_DATE_MODULE
     39          class DvDate < DvTemporal
     40            include OpenEhr::AssumedLibraryTypes::ISO8601_DATE_MODULE
    4141
    4242            DAYS_IN_MONTH = [0,31,28,31,30,31,30,31,31,30,31,30,31]
     
    5151            def value=(value)
    5252              super(value)
    53               iso8601_date = Assumed_Library_Types::ISO8601_DATE.new(value)
     53              iso8601_date = AssumedLibraryTypes::ISO8601_DATE.new(value)
    5454              @year = iso8601_date.year
    5555              @month = iso8601_date.month
     
    9191              end
    9292              year += future.year - past.year
    93               return DV_Duration.new(
     93              return DvDuration.new(
    9494                   'P' + year.to_s + 'Y' + month.to_s + 'M' +
    9595                         week.to_s + 'W' + day.to_s + 'D')
     
    9797          end
    9898         
    99           class DV_Time < DV_Temporal
    100             include OpenEHR::Assumed_Library_Types::ISO8601_TIME_MODULE
     99          class DvTime < DvTemporal
     100            include OpenEhr::AssumedLibraryTypes::ISO8601_TIME_MODULE
    101101            def initialize(value, magnitude_status=nil, accuracy=nil,
    102102                           normal_range=nil, normal_status=nil,
     
    108108            def value=(value)
    109109              super(value)
    110               iso8601_time = Assumed_Library_Types::ISO8601_TIME.new(value)
     110              iso8601_time = AssumedLibraryTypes::ISO8601_TIME.new(value)
    111111              @hour = iso8601_time.hour
    112112              @minute = iso8601_time.minute
     
    125125              second = (diff - hour * 60 *60 - minute * 60).to_i
    126126              fractional_second = ((diff - diff.to_i)*1000000.0).to_i/1000000.0
    127               return DV_Duration.new('P0Y0M0W0DT' + hour.to_s + 'H' +
     127              return DvDuration.new('P0Y0M0W0DT' + hour.to_s + 'H' +
    128128                        minute.to_s + 'M' +
    129129                        second.to_s + fractional_second.to_s[1..-1] + 'S')
     
    131131          end
    132132
    133           class DV_Date_Time < DV_Temporal
    134             include OpenEHR::Assumed_Library_Types::ISO8601_DATE_TIME_MODULE
     133          class DvDateTime < DvTemporal
     134            include OpenEhr::AssumedLibraryTypes::ISO8601_DATE_TIME_MODULE
    135135            attr_reader :value
    136136
     
    144144            def value=(value)             
    145145              super(value)
    146               iso8601date_time = Assumed_Library_Types::ISO8601_DATE_TIME.new(value)
     146              iso8601date_time = AssumedLibraryTypes::ISO8601_DATE_TIME.new(value)
    147147              self.year = iso8601date_time.year
    148148              self.month = iso8601date_time.month
     
    186186              fractional_second = ((time_diff - time_diff.to_i)*1000000.0).to_i/1000000.0
    187187
    188               return DV_Duration.new(date_duration.value + 'T' +
     188              return DvDuration.new(date_duration.value + 'T' +
    189189                        hour.to_s + 'H' +
    190190                        minute.to_s + 'M' +
     
    197197            def split_date_time(date_time)
    198198              /^(.*)T(.*)$/ =~ date_time.as_string
    199               return DV_Date.new($1), DV_Time.new($2)             
    200             end
    201           end
    202 
    203           class DV_Duration < DV_Amount
    204             include Assumed_Library_Types::ISO8601_DURATION_MODULE
     199              return DvDate.new($1), DvTime.new($2)
     200            end
     201          end
     202
     203          class DvDuration < DvAmount
     204            include AssumedLibraryTypes::ISO8601_DURATION_MODULE
    205205            attr_reader :value
    206206           
     
    214214              raise ArgumentError, 'value must be not nil' if value.nil?
    215215              @value = value
    216               iso8601_duration = Assumed_Library_Types::ISO8601_DURATION.new(value)
     216              iso8601_duration = AssumedLibraryTypes::ISO8601_DURATION.new(value)
    217217              self.years = iso8601_duration.years
    218218              self.months = iso8601_duration.months
     
    234234
    235235          end
    236         end # of Date_Time
     236        end # of DateTime
    237237      end # of Quantity
    238238    end # of Data_Types
  • ruby/branches/0.5.0/lib/open_ehr/rm/data_types/text.rb

    r124 r167  
    22# http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109067605961_209522_3179Report.html
    33# Ticket refs #48
    4 module OpenEHR
     4module OpenEhr
    55  module RM
    6     module Data_Types
     6    module DataTypes
    77      module Text
    8         class Term_Mapping
     8        class TermMapping
    99          attr_reader :match, :purpose, :target
    1010          def initialize(match, purpose, target)
     
    2626            match == '?'
    2727          end
    28           def Term_Mapping.is_valid_mach_code?(c)
     28          def TermMapping.is_valid_mach_code?(c)
    2929            c == '>' or c == '=' or c == '<' or c == '?'
    3030          end
    3131          private
    3232          def match_valid(match)
    33             raise ArgumentError, "match is not valid" if !Term_Mapping.is_valid_mach_code? match
     33            raise ArgumentError, "match is not valid" if !TermMapping.is_valid_mach_code? match
    3434          end
    3535          def purpose_valid(purpose)
    36             if purpose.nil? or !purpose.instance_of? DV_Coded_Text
     36            if purpose.nil? or !purpose.instance_of? DvCodedText
    3737              raise ArgumentError, "purpose is not valid"
    3838            end
     
    4444        end
    4545
    46         class Code_Phrase
     46        class CodePhrase
    4747          attr_reader :terminology_id, :code_string
    4848          def initialize(code_string, terminology_id)
     
    6060            @code_string = code_string
    6161          end
    62         end # of Code_Phrase
     62        end # of CodePhrase
    6363
    64         class DV_Text < OpenEHR::RM::Data_Types::Basic::Data_Value
     64        class DvText < OpenEhr::RM::DataTypes::Basic::DataValue
    6565          attr_reader :value, :formatting, :hyperlink, :mappings
    6666          attr_reader :language, :encoding
     
    6868                         mappings = nil, language = nil, encoding = nil)
    6969            value_valid(value)
    70             DV_Text.formatting_valid(formatting)
    71             DV_Text.encoding_valid(encoding)
    72             DV_Text.mapping_valid(mappings)
    73             DV_Text.language_valid(language)
     70            DvText.formatting_valid(formatting)
     71            DvText.encoding_valid(encoding)
     72            DvText.mapping_valid(mappings)
     73            DvText.language_valid(language)
    7474            @value, @formatting, @encoding = value, formatting, encoding
    7575            @mappings, @language = mappings, language
     
    8080          end
    8181          def formatting=(formatting)
    82             DV_Text.formatting_valid(formatting)
     82            DvText.formatting_valid(formatting)
    8383            @formatting = formatting
    8484          end
    8585          def encoding=(encoding)
    86             DV_Text.encoding_valid(encoding)
     86            DvText.encoding_valid(encoding)
    8787            @encoding = encoding
    8888          end
    8989          def mappings=(mappings)
    90             DV_Text.mapping_valid(mappings)
     90            DvText.mapping_valid(mappings)
    9191            @mappings = mappings
    9292          end
    9393          def language=(language)
    94             DV_Text.language_valid(language)
     94            DvText.language_valid(language)
    9595            @language = language
    9696          end
     
    9999            if value.nil? or value.empty? or value.include? CR or value.include? LF
    100100              raise ArgumentError, "value is not valid"
    101               # CR and LF are defined in Basic_Definition inherited Data_Value.
     101              # CR and LF are defined in Basic_Definition inherited DataValue.
    102102            end
    103103          end
     
    128128        end
    129129
    130         class DV_Coded_Text < DV_Text
     130        class DvCodedText < DvText