Index: /haskell/trunk/ADLParser.hs
===================================================================
--- /haskell/trunk/ADLParser.hs	(revision 30)
+++ /haskell/trunk/ADLParser.hs	(revision 20)
@@ -24,5 +24,6 @@
                  return ontology
 
-adlVersion :: Parser Version
+
+adlVersion :: Parser String
 adlVersion = do dec1 <- string "archetype (adl_version="
                 ver <- many anyChar
@@ -51,34 +52,3 @@
 
 adlLanguage :: Parser Language
-adlLanguage = do spaces
-                 head <- string "language"
-                 
 
-
-parseAtoms :: Parser [Atom]
-parseAtoms = many atom
-    where
-      atom :: Parser Atom
-      atom = do spaces
-                name <- string
-                spaces
-                equal <- char '='
-                spaces
-      <|> return []
-
-
-data Language = Original_Laguage String
-              | Translaions [Transpation]
-                deriving Show
-
-data Translation = Symbol String
-                 | Language String
-                 | Author Author
-
-data Author = Name String
-            | Organisation String
-
-data Atom = Name String
-          | Description String
-
-type Version :: String
Index: by/trunk/README
===================================================================
--- /ruby/trunk/README	(revision 30)
+++ 	(revision )
@@ -1,57 +1,0 @@
-= Synopsis
-
-Ruby openEHR implementation project
-
-= Version
-
-Release-0.0.1
-
-= Requirements
-
-* Ruby 1.8.6 or higher
-* Yaparc Library 0.2.0 or higer
-* Tested with Ruby 1.8.6 on Linux and FreeBSD.
-* If you use Ruby 1.6, you should prepare racc 
-  runtime environment and some adjustment
-* It should work on other platforms with Ruby
-  support as well.
-
-= Status
-
-This is the memorable first release of Ruby openEHR
-implementation project. This release is experimental
-preview of our work based on openEHR specification 
-release 1.0.1. We implemented ADL Parser and some 
-archetype models and reference models. This parser 
-successfully parses 27 ADLs and generates archetype 
-instances.  The work is still in progress. The 
-intention is to have complete implementation of openEHR
-Reference Model and Archetype Object Model, with 
-support for archetype based object creation and validation.
-
-= Authors
-Akimihci Tatsukawa, Shinji Kobayashi
-openEHR.jp, <http://openehr.jp>
-
-= Copyright
-The software, including all files in this directory 
-and subdirectories is copyrighted to the original 
-authors and contributors, 2008
-All Rights Reserved.
-
-= License
-
-This product is under openEHR Open Source Software License
-
-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 General 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.
-
-
Index: /ruby/trunk/adl_parser/Rakefile
===================================================================
--- /ruby/trunk/adl_parser/Rakefile	(revision 30)
+++ /ruby/trunk/adl_parser/Rakefile	(revision 20)
@@ -83,14 +83,13 @@
   s.email = 'akimichi_tatsukawa@nifty.com'
   s.test_files = FileList['tests/*_test.rb', '*.adl']
-  candidates = Dir.glob("{bin,docs,lib,tests,ext}/**/*")
+  candidates = Dir.glob("{bin, docs, lib, tests, ext}/**/*")
   s.files = candidates.delete_if do |item|
     item.include?(".svn") || item.include?("rdoc")
   end
-  s.files = FileList['README', 'COPYING', 'Rakefile']
+  FileList['README', 'COPYING', 'Rakefile']
   s.require_path = "lib"
   s.has_rdoc = true
   s.extra_rdoc_files = ["README"]
   s.add_dependency("yaparc", ">= 0.2.0")
-  s.add_dependency("openehr_models", ">= 0.0.1")
 end
 
Index: /ruby/trunk/adl_parser/lib/parser.rb
===================================================================
--- /ruby/trunk/adl_parser/lib/parser.rb	(revision 30)
+++ /ruby/trunk/adl_parser/lib/parser.rb	(revision 20)
@@ -13,6 +13,5 @@
 require 'lib/util.rb'
 require 'lib/scanner.rb'
-require 'rubygems'
-require 'am.rb'
+require 'lib/model.rb'
 $DEBUG = true
 
@@ -26,11 +25,5 @@
     class Parser < Racc::Parser
 
-module_eval <<'..end lib/parser.y modeval..id3b9eed63e6', 'lib/parser.y', 1127
-
-def assert_at(file,line, message = "")
-  unless yield
-    raise "Assertion failed !: #{file}, #{line}: #{message}"
-  end
-end
+module_eval <<'..end lib/parser.y modeval..id134a7f5a66', 'lib/parser.y', 739
 
 @@log = Logger.new('log/parser.log','daily')
@@ -819,5 +812,5 @@
 
 
-..end lib/parser.y modeval..id3b9eed63e6
+..end lib/parser.y modeval..id134a7f5a66
 
 ##### racc 1.4.5 generates ###
@@ -825,49 +818,49 @@
 racc_reduce_table = [
  0, 0, :racc_error,
- 2, 95, :_reduce_1,
+ 2, 95, :_reduce_none,
  1, 95, :_reduce_none,
- 8, 96, :_reduce_3,
- 2, 97, :_reduce_4,
- 2, 97, :_reduce_5,
- 1, 105, :_reduce_6,
- 2, 105, :_reduce_7,
- 3, 106, :_reduce_8,
- 1, 107, :_reduce_9,
- 3, 107, :_reduce_10,
- 3, 108, :_reduce_11,
- 1, 108, :_reduce_12,
+ 8, 96, :_reduce_none,
+ 2, 97, :_reduce_none,
+ 2, 97, :_reduce_none,
+ 1, 105, :_reduce_none,
+ 2, 105, :_reduce_none,
+ 3, 106, :_reduce_none,
+ 1, 107, :_reduce_none,
+ 3, 107, :_reduce_none,
+ 3, 108, :_reduce_none,
+ 1, 108, :_reduce_none,
  0, 98, :_reduce_none,
  2, 98, :_reduce_none,
  2, 98, :_reduce_none,
- 2, 99, :_reduce_16,
  2, 99, :_reduce_none,
- 0, 100, :_reduce_18,
+ 2, 99, :_reduce_none,
+ 0, 100, :_reduce_none,
  2, 100, :_reduce_19,
  2, 100, :_reduce_none,
  0, 101, :_reduce_none,
- 2, 101, :_reduce_22,
  2, 101, :_reduce_none,
- 2, 102, :_reduce_24,
+ 2, 101, :_reduce_none,
  2, 102, :_reduce_none,
- 1, 110, :_reduce_26,
- 1, 110, :_reduce_27,
- 5, 111, :_reduce_28,
- 5, 111, :_reduce_29,
- 2, 113, :_reduce_30,
+ 2, 102, :_reduce_none,
+ 1, 110, :_reduce_none,
+ 1, 110, :_reduce_none,
+ 5, 111, :_reduce_none,
+ 5, 111, :_reduce_none,
+ 2, 113, :_reduce_none,
  1, 115, :_reduce_31,
  2, 115, :_reduce_32,
  1, 114, :_reduce_none,
- 1, 114, :_reduce_34,
- 1, 120, :_reduce_35,
- 1, 120, :_reduce_36,
- 1, 120, :_reduce_37,
- 1, 120, :_reduce_38,
- 1, 120, :_reduce_39,
- 1, 120, :_reduce_40,
- 1, 120, :_reduce_41,
- 1, 120, :_reduce_42,
+ 1, 114, :_reduce_none,
  1, 120, :_reduce_none,
  1, 120, :_reduce_none,
- 3, 121, :_reduce_45,
+ 1, 120, :_reduce_none,
+ 1, 120, :_reduce_none,
+ 1, 120, :_reduce_none,
+ 1, 120, :_reduce_none,
+ 1, 120, :_reduce_none,
+ 1, 120, :_reduce_none,
+ 1, 120, :_reduce_none,
+ 1, 120, :_reduce_none,
+ 3, 121, :_reduce_none,
  4, 122, :_reduce_none,
  3, 122, :_reduce_none,
@@ -877,24 +870,24 @@
  3, 132, :_reduce_none,
  2, 132, :_reduce_none,
- 1, 127, :_reduce_53,
- 1, 133, :_reduce_54,
- 1, 133, :_reduce_55,
- 1, 133, :_reduce_56,
- 1, 133, :_reduce_57,
- 1, 133, :_reduce_58,
- 1, 133, :_reduce_59,
- 1, 133, :_reduce_60,
- 1, 133, :_reduce_61,
+ 1, 127, :_reduce_none,
+ 1, 133, :_reduce_none,
+ 1, 133, :_reduce_none,
+ 1, 133, :_reduce_none,
+ 1, 133, :_reduce_none,
+ 1, 133, :_reduce_none,
+ 1, 133, :_reduce_none,
+ 1, 133, :_reduce_none,
+ 1, 133, :_reduce_none,
  1, 118, :_reduce_none,
- 1, 119, :_reduce_63,
- 2, 119, :_reduce_64,
- 5, 142, :_reduce_65,
- 5, 142, :_reduce_66,
- 5, 142, :_reduce_67,
+ 1, 119, :_reduce_none,
+ 2, 119, :_reduce_none,
+ 5, 142, :_reduce_none,
+ 5, 142, :_reduce_none,
+ 5, 142, :_reduce_none,
  2, 143, :_reduce_68,
  3, 143, :_reduce_69,
- 1, 144, :_reduce_70,
- 2, 144, :_reduce_71,
- 1, 144, :_reduce_72,
+ 1, 144, :_reduce_none,
+ 2, 144, :_reduce_none,
+ 1, 144, :_reduce_none,
  0, 130, :_reduce_none,
  2, 130, :_reduce_none,
@@ -909,40 +902,40 @@
  2, 103, :_reduce_none,
  2, 103, :_reduce_none,
- 2, 104, :_reduce_85,
+ 2, 104, :_reduce_none,
  2, 104, :_reduce_none,
  1, 109, :_reduce_none,
  1, 151, :_reduce_none,
  1, 151, :_reduce_none,
- 1, 152, :_reduce_90,
- 2, 152, :_reduce_91,
- 3, 152, :_reduce_92,
+ 1, 152, :_reduce_none,
+ 2, 152, :_reduce_none,
+ 3, 152, :_reduce_none,
  3, 154, :_reduce_93,
  1, 155, :_reduce_94,
  2, 155, :_reduce_none,
- 1, 156, :_reduce_96,
- 1, 156, :_reduce_97,
- 1, 153, :_reduce_98,
- 1, 153, :_reduce_99,
- 1, 159, :_reduce_100,
- 2, 159, :_reduce_101,
- 3, 160, :_reduce_102,
+ 1, 156, :_reduce_none,
+ 1, 156, :_reduce_none,
+ 1, 153, :_reduce_none,
+ 1, 153, :_reduce_none,
+ 1, 159, :_reduce_none,
+ 2, 159, :_reduce_none,
+ 3, 160, :_reduce_none,
  1, 161, :_reduce_103,
- 1, 162, :_reduce_104,
- 2, 162, :_reduce_105,
+ 1, 162, :_reduce_none,
+ 2, 162, :_reduce_none,
  3, 163, :_reduce_106,
  3, 164, :_reduce_107,
- 1, 158, :_reduce_108,
- 2, 158, :_reduce_109,
- 2, 166, :_reduce_110,
- 3, 166, :_reduce_111,
+ 1, 158, :_reduce_none,
+ 2, 158, :_reduce_none,
+ 2, 166, :_reduce_none,
+ 3, 166, :_reduce_none,
  1, 167, :_reduce_none,
- 1, 157, :_reduce_113,
- 2, 157, :_reduce_114,
+ 1, 157, :_reduce_none,
+ 2, 157, :_reduce_none,
  3, 168, :_reduce_115,
- 1, 169, :_reduce_116,
- 1, 169, :_reduce_117,
- 1, 169, :_reduce_118,
- 1, 169, :_reduce_119,
- 1, 169, :_reduce_120,
+ 1, 169, :_reduce_none,
+ 1, 169, :_reduce_none,
+ 1, 169, :_reduce_none,
+ 1, 169, :_reduce_none,
+ 1, 169, :_reduce_none,
  1, 165, :_reduce_121,
  1, 165, :_reduce_122,
@@ -976,7 +969,7 @@
  3, 184, :_reduce_none,
  3, 184, :_reduce_none,
- 1, 175, :_reduce_152,
- 2, 175, :_reduce_153,
- 2, 175, :_reduce_154,
+ 1, 175, :_reduce_none,
+ 2, 175, :_reduce_none,
+ 2, 175, :_reduce_none,
  3, 185, :_reduce_none,
  3, 185, :_reduce_none,
@@ -991,7 +984,7 @@
  4, 193, :_reduce_none,
  3, 193, :_reduce_none,
- 1, 176, :_reduce_167,
- 2, 176, :_reduce_168,
- 2, 176, :_reduce_169,
+ 1, 176, :_reduce_none,
+ 2, 176, :_reduce_none,
+ 2, 176, :_reduce_none,
  3, 186, :_reduce_none,
  3, 186, :_reduce_none,
@@ -1006,6 +999,6 @@
  4, 194, :_reduce_none,
  3, 194, :_reduce_none,
- 1, 177, :_reduce_182,
- 1, 177, :_reduce_183,
+ 1, 177, :_reduce_none,
+ 1, 177, :_reduce_none,
  3, 187, :_reduce_none,
  3, 187, :_reduce_none,
@@ -1114,9 +1107,9 @@
  2, 206, :_reduce_288,
  1, 206, :_reduce_289,
- 0, 145, :_reduce_290,
- 5, 145, :_reduce_291,
- 1, 207, :_reduce_292,
- 3, 207, :_reduce_293,
- 5, 146, :_reduce_294,
+ 0, 145, :_reduce_none,
+ 5, 145, :_reduce_none,
+ 1, 207, :_reduce_none,
+ 3, 207, :_reduce_none,
+ 5, 146, :_reduce_none,
  1, 208, :_reduce_none,
  3, 208, :_reduce_none,
@@ -1130,5 +1123,5 @@
  1, 210, :_reduce_none,
  0, 116, :_reduce_none,
- 5, 116, :_reduce_306,
+ 5, 116, :_reduce_none,
  2, 116, :_reduce_none,
  1, 209, :_reduce_none,
@@ -1177,11 +1170,11 @@
  3, 140, :_reduce_none,
  3, 140, :_reduce_none,
- 1, 219, :_reduce_353,
- 1, 219, :_reduce_354,
- 3, 219, :_reduce_355,
- 3, 219, :_reduce_356,
- 1, 141, :_reduce_357,
- 3, 141, :_reduce_358,
- 3, 141, :_reduce_359,
+ 1, 219, :_reduce_none,
+ 1, 219, :_reduce_none,
+ 3, 219, :_reduce_none,
+ 3, 219, :_reduce_none,
+ 1, 141, :_reduce_none,
+ 3, 141, :_reduce_none,
+ 3, 141, :_reduce_none,
  1, 126, :_reduce_none,
  3, 126, :_reduce_none,
@@ -1199,5 +1192,5 @@
  1, 149, :_reduce_none,
  1, 149, :_reduce_374,
- 1, 217, :_reduce_375 ]
+ 1, 217, :_reduce_none ]
 
 racc_reduce_n = 376
@@ -2019,101 +2012,27 @@
  # reduce 0 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 32
-  def _reduce_1( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
+ # reduce 1 omitted
 
  # reduce 2 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 57
-  def _reduce_3( val, _values, result )
-    assert_at(__FILE__,__LINE__) do
-      val[4].instance_of?(OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION) and val[5].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT) and val[7].instance_of?(OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY) 
-    end
-    
-    archetype_id = val[0][:archetype_id]
-    adl_version = val[0][:arch_head][:arch_meta_data][:adl_version]
-    concept = val[2]
-    language = val[3][:arch_language]
-    archetype = OpenEHR::AM::Archetype::ARCHETYPE.create(
-                                                         :archetype_id => archetype_id,
-                                                         :adl_version => adl_version,
-                                                         :concept => concept,
-                                                         :description => val[4],
-                                                         :definition => val[5],
-                                                         :ontology => val[7]
-                                                         ) do |archetype|
-      archetype.original_language = language
-    end
-    @@log.info("#{__FILE__}:#{__LINE__}: archetype = #{archetype} at #{@filename}:#{@lineno}")
-    result = archetype
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 63
-  def _reduce_4( val, _values, result )
-    result = {:arch_head => val[0], :archetype_id => val[1] }
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 67
-  def _reduce_5( val, _values, result )
-    raise
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 72
-  def _reduce_6( val, _values, result )
-    result = {:arch_meta_data => nil }
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 76
-  def _reduce_7( val, _values, result )
-    result = val[1]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 81
-  def _reduce_8( val, _values, result )
-    result = {:arch_meta_data => val[1] }
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 86
-  def _reduce_9( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 90
-  def _reduce_10( val, _values, result )
-    result = val[0].merge(val[2])
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 96
-  def _reduce_11( val, _values, result )
-    result = {:adl_version => val[2], :is_controlled => false }
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 100
-  def _reduce_12( val, _values, result )
-    result = {:is_controlled => true }
-   result
-  end
-.,.,
+ # reduce 3 omitted
+
+ # reduce 4 omitted
+
+ # reduce 5 omitted
+
+ # reduce 6 omitted
+
+ # reduce 7 omitted
+
+ # reduce 8 omitted
+
+ # reduce 9 omitted
+
+ # reduce 10 omitted
+
+ # reduce 11 omitted
+
+ # reduce 12 omitted
 
  # reduce 13 omitted
@@ -2123,104 +2042,49 @@
  # reduce 15 omitted
 
+ # reduce 16 omitted
+
+ # reduce 17 omitted
+
+ # reduce 18 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 74
+  def _reduce_19( val, _values, result )
+    result = {:language => val[1]}
+   result
+  end
+.,.,
+
+ # reduce 20 omitted
+
+ # reduce 21 omitted
+
+ # reduce 22 omitted
+
+ # reduce 23 omitted
+
+ # reduce 24 omitted
+
+ # reduce 25 omitted
+
+ # reduce 26 omitted
+
+ # reduce 27 omitted
+
+ # reduce 28 omitted
+
+ # reduce 29 omitted
+
+ # reduce 30 omitted
+
 module_eval <<'.,.,', 'lib/parser.y', 111
-  def _reduce_16( val, _values, result )
-    result = {:arch_concept => val[1] }
-   result
-  end
-.,.,
-
- # reduce 17 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 121
-  def _reduce_18( val, _values, result )
-    result = {:arch_language => nil}
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 125
-  def _reduce_19( val, _values, result )
-    result = {:arch_language => val[1]}
-   result
-  end
-.,.,
-
- # reduce 20 omitted
-
- # reduce 21 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 136
-  def _reduce_22( val, _values, result )
-    result = OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION.new(:details => val[1])
-   result
-  end
-.,.,
-
- # reduce 23 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 144
-  def _reduce_24( val, _values, result )
-    result = val[1]
-   result
-  end
-.,.,
-
- # reduce 25 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 154
-  def _reduce_26( val, _values, result )
-    assert_at(__FILE__,__LINE__){val[0].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT)}
-    @@log.info("#{__FILE__}:#{__LINE__}: c_complex_object = #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 158
-  def _reduce_27( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 169
-  def _reduce_28( val, _values, result )
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.create(:attributes => val[3]) do |c_complex_object|
-      c_complex_object.node_id = val[0][:c_complex_object_id][:local_term_code_ref]
-      c_complex_object.rm_type_name = val[0][:c_complex_object_id][:type_identifier]
-      c_complex_object.occurrences = val[0][:c_occurrences]
-    end
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 177
-  def _reduce_29( val, _values, result )
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.create(:attributes => val[3]) do |c_complex_object|
-      c_complex_object.node_id = val[0][:c_complex_object_id][:local_term_code_ref]
-      c_complex_object.rm_type_name = val[0][:c_complex_object_id][:type_identifier]
-      c_complex_object.occurrences = val[0][:c_occurrences]
-    end
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 184
-  def _reduce_30( val, _values, result )
-    result = {:c_complex_object_id => val[0], :c_occurrences => val[1]}
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 189
   def _reduce_31( val, _values, result )
-    result = {:type_identifier => val[0]}
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 193
+    result = {:c_complex_object_id => {:type_identifier => val[0]}}
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 115
   def _reduce_32( val, _values, result )
-    result = {:type_identifier => val[0], :local_term_code_ref => val[1]}
+    result = {:c_complex_object_id => {:type_identifier => val[0], :V_LOCAL_TERM_CODE_REF => val[1]}}
    result
   end
@@ -2229,66 +2093,21 @@
  # reduce 33 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 199
-  def _reduce_34( val, _values, result )
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new(:attributes => val[0])
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 207
-  def _reduce_35( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 211
-  def _reduce_36( val, _values, result )
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 215
-  def _reduce_37( val, _values, result )
-    result = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF.new
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 219
-  def _reduce_38( val, _values, result )
-    result = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT.new
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 223
-  def _reduce_39( val, _values, result )
-    result = OpenEHR::AM::Archetype::Constraint_Model::CONSTRAINT_REF.new
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 227
-  def _reduce_40( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 231
-  def _reduce_41( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 235
-  def _reduce_42( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
+ # reduce 34 omitted
+
+ # reduce 35 omitted
+
+ # reduce 36 omitted
+
+ # reduce 37 omitted
+
+ # reduce 38 omitted
+
+ # reduce 39 omitted
+
+ # reduce 40 omitted
+
+ # reduce 41 omitted
+
+ # reduce 42 omitted
 
  # reduce 43 omitted
@@ -2296,10 +2115,5 @@
  # reduce 44 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 250
-  def _reduce_45( val, _values, result )
-    result = val[1]
-   result
-  end
-.,.,
+ # reduce 45 omitted
 
  # reduce 46 omitted
@@ -2317,163 +2131,53 @@
  # reduce 52 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 270
-  def _reduce_53( val, _values, result )
-    assert_at(__FILE__,__LINE__){val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_PRIMITIVE)}
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_PRIMITIVE_OBJECT.new(:item => val[0])
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 276
-  def _reduce_54( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: c_integer = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_INTEGER.new
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 281
-  def _reduce_55( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: c_real = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_REAL.new
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 286
-  def _reduce_56( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: c_date = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE.new
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 291
-  def _reduce_57( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: c_time = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_TIME.new
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 296
-  def _reduce_58( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: c_date_time = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE_TIME.new
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 301
-  def _reduce_59( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: c_duration = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DURATION.new
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 306
-  def _reduce_60( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: c_string = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_STRING.new
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 312
-  def _reduce_61( val, _values, result )
-    assert_at(__FILE__,__LINE__){val[0].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN)}
-    @@log.info("#{__FILE__}:#{__LINE__}: c_boolean = #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
+ # reduce 53 omitted
+
+ # reduce 54 omitted
+
+ # reduce 55 omitted
+
+ # reduce 56 omitted
+
+ # reduce 57 omitted
+
+ # reduce 58 omitted
+
+ # reduce 59 omitted
+
+ # reduce 60 omitted
+
+ # reduce 61 omitted
 
  # reduce 62 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 322
-  def _reduce_63( val, _values, result )
-    result = [val[0]]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 326
-  def _reduce_64( val, _values, result )
-    result = (val[0] << val[1])
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 335
-  def _reduce_65( val, _values, result )
-    assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE)}
-    c_attribute = val[0]
-    c_attribute.children = val[3]
-    result = c_attribute
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 340
-  def _reduce_66( val, _values, result )
-    assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE)}
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 345
-  def _reduce_67( val, _values, result )
-    assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE)}
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 356
+ # reduce 63 omitted
+
+ # reduce 64 omitted
+
+ # reduce 65 omitted
+
+ # reduce 66 omitted
+
+ # reduce 67 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 186
   def _reduce_68( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER = #{val[0]}, c_existence = #{val[1]} at #{@filename}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_SINGLE_ATTRIBUTE.new(
-                                                                              :rm_attribute_name => val[0],
-                                                                              :existence => val[1]
-                                                                              )
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 366
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 190
   def _reduce_69( val, _values, result )
-    assert_at(__FILE__,__LINE__){ val[2].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY) }
-    @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER: #{val[0]}, c_existence = #{val[1]}, c_cardinality = #{val[2]} at #{@filename}") 
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_MULTIPLE_ATTRIBUTE.new(
-                                                                                :rm_attribute_name => val[0],
-                                                                                :existence => val[1],
-                                                                                :cardinality => val[2]
-                                                                                )
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 371
-  def _reduce_70( val, _values, result )
-    result = Array[val[0]]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 375
-  def _reduce_71( val, _values, result )
-    result = (val[0] << val[1])
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 379
-  def _reduce_72( val, _values, result )
-    result = Array[val[0]]
-   result
-  end
-.,.,
+    @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER: #{val[0]}, c_existence = #{val[1]}, c_cardinality = #{val[2]} at #{@filename}")
+   result
+  end
+.,.,
+
+ # reduce 70 omitted
+
+ # reduce 71 omitted
+
+ # reduce 72 omitted
 
  # reduce 73 omitted
@@ -2501,11 +2205,5 @@
  # reduce 84 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 410
-  def _reduce_85( val, _values, result )
-    dadl_section = val[1]
-    result = OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY.new
-   result
-  end
-.,.,
+ # reduce 85 omitted
 
  # reduce 86 omitted
@@ -2517,37 +2215,20 @@
  # reduce 89 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 424
-  def _reduce_90( val, _values, result )
-    result = Array[val[0]]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 428
-  def _reduce_91( val, _values, result )
-    result = (val[0] << val[1])
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 432
-  def _reduce_92( val, _values, result )
-    result = (val[0] << val[2])
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 438
+ # reduce 90 omitted
+
+ # reduce 91 omitted
+
+ # reduce 92 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 240
   def _reduce_93( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: attr_id = #{val[0]}, object_block = #{val[2]} at #{@filename}:#{@lineno}")
-    result = {:attr_id => val[0], :object_block => val[2]}
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 444
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 245
   def _reduce_94( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
    result
   end
@@ -2556,258 +2237,140 @@
  # reduce 95 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 450
-  def _reduce_96( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 454
-  def _reduce_97( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 459
-  def _reduce_98( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 463
-  def _reduce_99( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 468
-  def _reduce_100( val, _values, result )
-    result = {:untyped_multiple_attr_object_block => val[0]}
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 472
-  def _reduce_101( val, _values, result )
-    result = {:type_identifier => val[0], :untyped_multiple_attr_object_block => val[1]}
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 477
-  def _reduce_102( val, _values, result )
-    result = {:multiple_attr_object_block_head => val[0], :keyed_objects => val[1]}
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 483
+ # reduce 96 omitted
+
+ # reduce 97 omitted
+
+ # reduce 98 omitted
+
+ # reduce 99 omitted
+
+ # reduce 100 omitted
+
+ # reduce 101 omitted
+
+ # reduce 102 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 262
   def _reduce_103( val, _values, result )
     @@log.info("SYM_START_DBLOCK: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 488
-  def _reduce_104( val, _values, result )
-    result = Array[val[0]]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 492
-  def _reduce_105( val, _values, result )
-    result = (val[0] << val[1])
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 498
+   result
+  end
+.,.,
+
+ # reduce 104 omitted
+
+ # reduce 105 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 270
   def _reduce_106( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: keyed_object = #{val[0]}, object_block = #{val[2]} at #{@filename}:#{@lineno}")
-    result = {:object_key => val[0], :object_block => val[1]}
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 504
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 275
   def _reduce_107( val, _values, result )
     @@log.info("object_key: [#{val[1]}] at #{@filename}:#{@lineno}")
-    result = val[1]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 509
-  def _reduce_108( val, _values, result )
-    result = {:untyped_single_attr_object_block => val[0]}
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 513
-  def _reduce_109( val, _values, result )
-    result = {:type_identifier => val[0], :untyped_single_attr_object_block => val[1]}
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 519
-  def _reduce_110( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: single_attr_object_complex_head = #{val[0]} at #{@filename}:#{@lineno}")
-    result = {:single_attr_object_complex_head => val[0]}
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 524
-  def _reduce_111( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: single_attr_object_complex_head = #{val[0]}, attr_vals = #{val[1]} at #{@filename}:#{@lineno}")
-    result = {:single_attr_object_complex_head => val[0], :attr_vals => val[1]}
-   result
-  end
-.,.,
+   result
+  end
+.,.,
+
+ # reduce 108 omitted
+
+ # reduce 109 omitted
+
+ # reduce 110 omitted
+
+ # reduce 111 omitted
 
  # reduce 112 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 530
-  def _reduce_113( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: untyped_primitive_object_block = #{val[0]} at #{@filename}:#{@lineno}")
-    result = {:untyped_primitive_object_block => val[0]}
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 535
-  def _reduce_114( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: type_identifier = #{val[0]}, untyped_primitive_object_block = #{val[1]} at #{@filename}:#{@lineno}")
-    result = {:type_identifier => val[0], :untyped_primitive_object_block => val[1]}
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 540
+ # reduce 113 omitted
+
+ # reduce 114 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 287
   def _reduce_115( val, _values, result )
-    @@log.info("#{__FILE__}:#{__LINE__}: primitive_object_block = <#{val[1]}> at #{@filename}:#{@lineno}")
-    result = val[1]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 544
-  def _reduce_116( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 548
-  def _reduce_117( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 552
-  def _reduce_118( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 556
-  def _reduce_119( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 560
-  def _reduce_120( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 565
+    @@log.info("#{__FILE__}:#{__LINE__}: primitive_object_block = <#{val[2]}> at #{@filename}:#{@lineno}")
+   result
+  end
+.,.,
+
+ # reduce 116 omitted
+
+ # reduce 117 omitted
+
+ # reduce 118 omitted
+
+ # reduce 119 omitted
+
+ # reduce 120 omitted
+
+module_eval <<'.,.,', 'lib/parser.y', 296
   def _reduce_121( val, _values, result )
     @@log.info("string_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 570
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 300
   def _reduce_122( val, _values, result )
     @@log.info("integer_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 575
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 304
   def _reduce_123( val, _values, result )
     @@log.info("real_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 580
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 308
   def _reduce_124( val, _values, result )
     @@log.info("boolean_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 585
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 312
   def _reduce_125( val, _values, result )
     @@log.info("character_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 590
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 316
   def _reduce_126( val, _values, result )
     @@log.info("date_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 595
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 320
   def _reduce_127( val, _values, result )
     @@log.info("time_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 600
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 324
   def _reduce_128( val, _values, result )
     @@log.info("date_time_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 605
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 328
   def _reduce_129( val, _values, result )
     @@log.info("duration_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 610
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 332
   def _reduce_130( val, _values, result )
     @@log.info("uri_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
    result
   end
@@ -2844,24 +2407,21 @@
  # reduce 145 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 633
+module_eval <<'.,.,', 'lib/parser.y', 353
   def _reduce_146( val, _values, result )
     @@log.info("V_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 638
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 357
   def _reduce_147( val, _values, result )
     @@log.info("V_GENERIC_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 644
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 362
   def _reduce_148( val, _values, result )
     @@log.info("V_STRING: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
    result
   end
@@ -2874,39 +2434,9 @@
  # reduce 151 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 658
-  def _reduce_152( val, _values, result )
-    begin
-      integer = Integer(val[0])
-    rescue
-      raise
-    end
-    result = integer
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 667
-  def _reduce_153( val, _values, result )
-    begin
-      integer = Integer(val[0])
-    rescue
-      raise
-    end
-    result = integer
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 676
-  def _reduce_154( val, _values, result )
-    begin
-      integer = Integer(val[0])
-    rescue
-      raise
-    end
-    result = - integer
-   result
-  end
-.,.,
+ # reduce 152 omitted
+
+ # reduce 153 omitted
+
+ # reduce 154 omitted
 
  # reduce 155 omitted
@@ -2934,39 +2464,9 @@
  # reduce 166 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 702
-  def _reduce_167( val, _values, result )
-    begin
-      real = Float(val[0])
-    rescue
-      raise
-    end
-    result = real
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 711
-  def _reduce_168( val, _values, result )
-    begin
-      real = Float(val[1])
-    rescue
-      raise
-    end
-    result = real
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 720
-  def _reduce_169( val, _values, result )
-    begin
-      real = Float(val[1])
-    rescue
-      raise
-    end
-    result = - real
-   result
-  end
-.,.,
+ # reduce 167 omitted
+
+ # reduce 168 omitted
+
+ # reduce 169 omitted
 
  # reduce 170 omitted
@@ -2994,17 +2494,7 @@
  # reduce 181 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 740
-  def _reduce_182( val, _values, result )
-    result = true
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 744
-  def _reduce_183( val, _values, result )
-    result = false
-   result
-  end
-.,.,
+ # reduce 182 omitted
+
+ # reduce 183 omitted
 
  # reduce 184 omitted
@@ -3100,8 +2590,7 @@
  # reduce 229 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 808
+module_eval <<'.,.,', 'lib/parser.y', 473
   def _reduce_230( val, _values, result )
     @@log.info("V_ISO8601_DURATION: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
    result
   end
@@ -3132,8 +2621,7 @@
  # reduce 242 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 828
+module_eval <<'.,.,', 'lib/parser.y', 492
   def _reduce_243( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: V_QUALIFIED_TERM_CODE_REF = #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
    result
   end
@@ -3146,8 +2634,7 @@
  # reduce 246 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 838
+module_eval <<'.,.,', 'lib/parser.y', 501
   def _reduce_247( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: V_URI = #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
    result
   end
@@ -3234,5 +2721,5 @@
  # reduce 287 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 907
+module_eval <<'.,.,', 'lib/parser.y', 570
   def _reduce_288( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}")
@@ -3241,5 +2728,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 911
+module_eval <<'.,.,', 'lib/parser.y', 574
   def _reduce_289( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}")
@@ -3248,49 +2735,13 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 922
-  def _reduce_290( val, _values, result )
-    result = Range.new(1,1)
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 926
-  def _reduce_291( val, _values, result )
-    result = val[3]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 936
-  def _reduce_292( val, _values, result )
-    begin
-      integer = Integer(val[0])
-    rescue
-      raise
-    end
-    result = integer
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 946
-  def _reduce_293( val, _values, result )
-    begin
-      from_integer = Integer(val[0])
-      to_integer = Integer(val[2])
-    rescue
-      raise
-    end
-    result = Range.new(from_integer,to_integer)
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 951
-  def _reduce_294( val, _values, result )
-    result = OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY.new
-   result
-  end
-.,.,
+ # reduce 290 omitted
+
+ # reduce 291 omitted
+
+ # reduce 292 omitted
+
+ # reduce 293 omitted
+
+ # reduce 294 omitted
 
  # reduce 295 omitted
@@ -3316,10 +2767,5 @@
  # reduce 305 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 970
-  def _reduce_306( val, _values, result )
-    result = val[3]
-   result
-  end
-.,.,
+ # reduce 306 omitted
 
  # reduce 307 omitted
@@ -3415,52 +2861,17 @@
  # reduce 352 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 1040
-  def _reduce_353( val, _values, result )
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true)
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 1044
-  def _reduce_354( val, _values, result )
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => false)
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 1048
-  def _reduce_355( val, _values, result )
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true,:false_valid => false)
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 1052
-  def _reduce_356( val, _values, result )
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => false,:false_valid => true)
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 1057
-  def _reduce_357( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 1061
-  def _reduce_358( val, _values, result )
-    raise 'Not implemented yet'
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 1065
-  def _reduce_359( val, _values, result )
-    raise 'Not implemented yet'
-   result
-  end
-.,.,
+ # reduce 353 omitted
+
+ # reduce 354 omitted
+
+ # reduce 355 omitted
+
+ # reduce 356 omitted
+
+ # reduce 357 omitted
+
+ # reduce 358 omitted
+
+ # reduce 359 omitted
 
  # reduce 360 omitted
@@ -3474,5 +2885,5 @@
  # reduce 364 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 1078
+module_eval <<'.,.,', 'lib/parser.y', 694
   def _reduce_365( val, _values, result )
     @in_interval = false
@@ -3498,5 +2909,5 @@
  # reduce 373 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 1100
+module_eval <<'.,.,', 'lib/parser.y', 716
   def _reduce_374( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{word} at #{@filename}")
@@ -3505,10 +2916,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 1110
-  def _reduce_375( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
+ # reduce 375 omitted
 
  def _reduce_none( val, _values, result )
Index: /ruby/trunk/adl_parser/lib/parser.y
===================================================================
--- /ruby/trunk/adl_parser/lib/parser.y	(revision 30)
+++ /ruby/trunk/adl_parser/lib/parser.y	(revision 20)
@@ -28,75 +28,30 @@
 
 input: archetype EOF
-  { 
-    result = val[0]
-  }
   | error
 
-archetype: arch_identification arch_specialisation arch_concept arch_language arch_description arch_definition arch_invariant arch_ontology
-  { 
-    assert_at(__FILE__,__LINE__) do
-      val[4].instance_of?(OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION) and val[5].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT) and val[7].instance_of?(OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY) 
-    end
-    
-    archetype_id = val[0][:archetype_id]
-    adl_version = val[0][:arch_head][:arch_meta_data][:adl_version]
-    concept = val[2]
-    language = val[3][:arch_language]
-    archetype = OpenEHR::AM::Archetype::ARCHETYPE.create(
-                                                         :archetype_id => archetype_id,
-                                                         :adl_version => adl_version,
-                                                         :concept => concept,
-                                                         :description => val[4],
-                                                         :definition => val[5],
-                                                         :ontology => val[7]
-                                                         ) do |archetype|
-      archetype.original_language = language
-    end
-    @@log.info("#{__FILE__}:#{__LINE__}: archetype = #{archetype} at #{@filename}:#{@lineno}")
-    result = archetype
-  }
+archetype: arch_identification
+  arch_specialisation
+  arch_concept
+  arch_language
+  arch_description
+  arch_definition
+  arch_invariant
+  arch_ontology
 
 
 arch_identification: arch_head V_ARCHETYPE_ID
-  { 
-    result = {:arch_head => val[0], :archetype_id => val[1] }
-  }
   | SYM_ARCHETYPE error
-  { 
-    raise
-  }
 
 arch_head: SYM_ARCHETYPE
-  { 
-    result = {:arch_meta_data => nil }
-  }
   | SYM_ARCHETYPE arch_meta_data
-  { 
-    result = val[1]
-  }
 
 arch_meta_data: Left_parenthesis_code arch_meta_data_items Right_parenthesis_code
-  { 
-    result = {:arch_meta_data => val[1] }
-  }
 
 arch_meta_data_items: arch_meta_data_item
-  { 
-    result = val[0]
-  }
   | arch_meta_data_items Semicolon_code arch_meta_data_item
-  { 
-    result = val[0].merge(val[2])
-  }
-
+#  | arch_meta_data_items ';' arch_meta_data_item
 
 arch_meta_data_item: SYM_ADL_VERSION SYM_EQ V_VERSION_STRING
-  { 
-    result = {:adl_version => val[2], :is_controlled => false }
-  }
   | SYM_IS_CONTROLLED
-  { 
-    result = {:is_controlled => true }
-  }
 
 # Define specialization in which its constraints are narrower than those of the parent.
@@ -107,7 +62,4 @@
 
 arch_concept: SYM_CONCEPT V_LOCAL_TERM_CODE_REF
-  { 
-    result = {:arch_concept => val[1] }
-  }
   | SYM_CONCEPT error
 
@@ -117,10 +69,7 @@
 
 arch_language: #-- empty is ok for ADL 1.4 tools
-  {
-    result = {:arch_language => nil}
-  }
     | SYM_LANGUAGE dadl_section
   {
-    result = {:arch_language => val[1]}
+    result = {:language => val[1]}
   }
   | SYM_LANGUAGE error
@@ -132,15 +81,9 @@
 arch_description: #-- no meta-data ok
     | SYM_DESCRIPTION dadl_section
-  { 
-    result = OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION.new(:details => val[1])
-  }
-  | SYM_DESCRIPTION error
-  
+    | SYM_DESCRIPTION error
+
 #arch_definition: SYM_DEFINITION V_CADL_TEXT
 #  | SYM_DEFINITION error
 arch_definition: SYM_DEFINITION cadl_section
-  { 
-    result = val[1]
-  }
   | SYM_DEFINITION error
 
@@ -148,54 +91,30 @@
 ### cADL section
 cadl_section: c_complex_object
-  { 
-    assert_at(__FILE__,__LINE__){val[0].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT)}
-    @@log.info("#{__FILE__}:#{__LINE__}: c_complex_object = #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-  }
   | assertions
-  { 
-    result = val[0]
-  }
 #  | error
 
 #c_complex_object: c_complex_object_head SYM_MATCHES SYM_START_CBLOCK c_complex_object_body SYM_END_CBLOCK
 c_complex_object: c_complex_object_head SYM_MATCHES START_REGEXP_BLOCK REGEXP_BODY END_REGEXP_BLOCK # added by akimichi
-  { 
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.create(:attributes => val[3]) do |c_complex_object|
-      c_complex_object.node_id = val[0][:c_complex_object_id][:local_term_code_ref]
-      c_complex_object.rm_type_name = val[0][:c_complex_object_id][:type_identifier]
-      c_complex_object.occurrences = val[0][:c_occurrences]
-    end
-  }
     | c_complex_object_head SYM_MATCHES SYM_START_CBLOCK c_complex_object_body SYM_END_CBLOCK
-  { 
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.create(:attributes => val[3]) do |c_complex_object|
-      c_complex_object.node_id = val[0][:c_complex_object_id][:local_term_code_ref]
-      c_complex_object.rm_type_name = val[0][:c_complex_object_id][:type_identifier]
-      c_complex_object.occurrences = val[0][:c_occurrences]
-    end
-  }
-#    | c_complex_object_head error SYM_END_CBLOCK
+#     | c_complex_object_head error SYM_END_CBLOCK
+#   {
+#     @adl_type.push(:cadl)
+#     yyerror
+#   }
 #    | c_complex_object_head SYM_MATCHES SYM_START_CBLOCK c_complex_object_body c_invariants SYM_END_CBLOCK
 
 c_complex_object_head: c_complex_object_id c_occurrences
-  {
-    result = {:c_complex_object_id => val[0], :c_occurrences => val[1]}
-  }
 
 c_complex_object_id: type_identifier
   {
-    result = {:type_identifier => val[0]}
+    result = {:c_complex_object_id => {:type_identifier => val[0]}}
   }
   | type_identifier V_LOCAL_TERM_CODE_REF
   {
-    result = {:type_identifier => val[0], :local_term_code_ref => val[1]}
+    result = {:c_complex_object_id => {:type_identifier => val[0], :V_LOCAL_TERM_CODE_REF => val[1]}}
   }
 
 c_complex_object_body: c_any #-- used to indicate that any value of a type is ok
   | c_attributes
-  { 
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new(:attributes => val[0])
-  }
 
 
@@ -203,35 +122,11 @@
 
 c_object: v_c_domain_type
-  { 
-    result = val[0]
-  }
   | c_complex_object
-  { 
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new
-  }
   | archetype_internal_ref
-  { 
-    result = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF.new
-  }
   | archetype_slot
-  { 
-    result = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT.new
-  }
   | constraint_ref
-  { 
-    result = OpenEHR::AM::Archetype::Constraint_Model::CONSTRAINT_REF.new
-  }
   | c_code_phrase
-  { 
-    result = val[0]
-  }
   | c_ordinal
-  { 
-    result = val[0]
-  }
   | c_primitive_object
-  { 
-    result = val[0]
-  }
 #  | v_c_domain_type
 #  | V_C_DOMAIN_TYPE
@@ -246,7 +141,4 @@
 
 v_c_domain_type: START_V_C_DOMAIN_TYPE_BLOCK dadl_section END_V_C_DOMAIN_TYPE_BLOCK
-  { 
-    result = val[1]
-  }
 
 # 'archetype_internal_ref' is a node that refers to a previously defined object node in the same archetype.
@@ -265,50 +157,13 @@
 # 'c_primitive_object' is an node representing a constraint on a primitive object type.
 c_primitive_object: c_primitive
-  {
-    assert_at(__FILE__,__LINE__){val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_PRIMITIVE)}
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_PRIMITIVE_OBJECT.new(:item => val[0])
-  }
 
 c_primitive: c_integer
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: c_integer = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_INTEGER.new
-  }
   | c_real
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: c_real = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_REAL.new
-  }
   | c_date
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: c_date = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE.new
-  }
   | c_time
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: c_time = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_TIME.new
-  }
   | c_date_time
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: c_date_time = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE_TIME.new
-  }
   | c_duration
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: c_duration = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DURATION.new
-  }
   | c_string
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: c_string = #{val[0]} at #{@filename}:#{@lineno}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_STRING.new
-  }
   | c_boolean
-  {
-    assert_at(__FILE__,__LINE__){val[0].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN)}
-    @@log.info("#{__FILE__}:#{__LINE__}: c_boolean = #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-  }
 
 c_any: Star_code
@@ -318,30 +173,10 @@
 
 c_attributes: c_attribute
-  { 
-    result = [val[0]]
-  }
   | c_attributes c_attribute
-  { 
-    result = (val[0] << val[1])
-  }
 
 # 'c_attribute' is a node representing a constraint on an attribute in an object model.
 c_attribute: c_attr_head SYM_MATCHES SYM_START_CBLOCK c_attr_values SYM_END_CBLOCK
-  { 
-    assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE)}
-    c_attribute = val[0]
-    c_attribute.children = val[3]
-    result = c_attribute
-  }
   | c_attr_head SYM_MATCHES START_REGEXP_BLOCK REGEXP_BODY END_REGEXP_BLOCK # added by akimichi
-  { 
-    assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE)}
-    result = val[0]
-  }
   | c_attr_head SYM_MATCHES SYM_START_CBLOCK error SYM_END_CBLOCK
-  { 
-    assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE)}
-    result = val[0]
-  }
 
 
@@ -349,33 +184,13 @@
   {
     @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER = #{val[0]}, c_existence = #{val[1]} at #{@filename}")
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_SINGLE_ATTRIBUTE.new(
-                                                                              :rm_attribute_name => val[0],
-                                                                              :existence => val[1]
-                                                                              )
-
   }
   | V_ATTRIBUTE_IDENTIFIER c_existence c_cardinality
   {
-    assert_at(__FILE__,__LINE__){ val[2].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY) }
     @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER: #{val[0]}, c_existence = #{val[1]}, c_cardinality = #{val[2]} at #{@filename}") 
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_MULTIPLE_ATTRIBUTE.new(
-                                                                                :rm_attribute_name => val[0],
-                                                                                :existence => val[1],
-                                                                                :cardinality => val[2]
-                                                                                )
   }
 
 c_attr_values: c_object
-  { 
-    result = Array[val[0]]
-  }
   | c_attr_values c_object
-  { 
-    result = (val[0] << val[1])
-  }
   | c_any #	-- to allow a property to have any value
-  { 
-    result = Array[val[0]]
-  }
 
 ### c_includes: #-- Empty
@@ -405,8 +220,4 @@
 
 arch_ontology: SYM_ONTOLOGY dadl_section
-  { 
-    dadl_section = val[1]
-    result = OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY.new
-  }
   | SYM_ONTOLOGY error
 
@@ -420,20 +231,11 @@
 
 attr_vals: attr_val
-  {
-    result = Array[val[0]]
-  }
   | attr_vals attr_val
-  {
-    result = (val[0] << val[1])
-  }
   | attr_vals Semicolon_code attr_val
-  {
-    result = (val[0] << val[2])
-  }
+#  | attr_vals ';' attr_val
 
 attr_val: attr_id SYM_EQ object_block
   {
     @@log.info("#{__FILE__}:#{__LINE__}: attr_id = #{val[0]}, object_block = #{val[2]} at #{@filename}:#{@lineno}")
-    result = {:attr_id => val[0], :object_block => val[2]}
   }
 
@@ -441,59 +243,29 @@
   {
     @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
   }
   | V_ATTRIBUTE_IDENTIFIER error
 
 object_block: complex_object_block
-  { 
-    result = val[0]
-  }
   | primitive_object_block
-  { 
-    result = val[0]
-  }
 
 complex_object_block: single_attr_object_block
-  { 
-    result = val[0]
-  }
   | multiple_attr_object_block
-  { 
-    result = val[0]
-  }
 
 multiple_attr_object_block: untyped_multiple_attr_object_block
-  { 
-    result = {:untyped_multiple_attr_object_block => val[0]}
-  }
   | type_identifier untyped_multiple_attr_object_block
-  { 
-    result = {:type_identifier => val[0], :untyped_multiple_attr_object_block => val[1]}
-  }
 
 untyped_multiple_attr_object_block: multiple_attr_object_block_head keyed_objects SYM_END_DBLOCK
-  { 
-    result = {:multiple_attr_object_block_head => val[0], :keyed_objects => val[1]}
-  }
 
 multiple_attr_object_block_head: SYM_START_DBLOCK
-  { 
+  {
     @@log.info("SYM_START_DBLOCK: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
   }
 
 keyed_objects: keyed_object
-  { 
-    result = Array[val[0]]
-  }
   | keyed_objects keyed_object
-  { 
-    result = (val[0] << val[1])
-  }
 
 keyed_object: object_key SYM_EQ object_block
   {
     @@log.info("#{__FILE__}:#{__LINE__}: keyed_object = #{val[0]}, object_block = #{val[2]} at #{@filename}:#{@lineno}")
-    result = {:object_key => val[0], :object_block => val[1]}
   }
 
@@ -501,113 +273,62 @@
   {
     @@log.info("object_key: [#{val[1]}] at #{@filename}:#{@lineno}")
-    result = val[1]
   }
 
 single_attr_object_block: untyped_single_attr_object_block
-  {
-    result = {:untyped_single_attr_object_block => val[0]}
-  }
   | type_identifier untyped_single_attr_object_block
-  {
-    result = {:type_identifier => val[0], :untyped_single_attr_object_block => val[1]}
-  }
-
 untyped_single_attr_object_block: single_attr_object_complex_head SYM_END_DBLOCK # <>
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: single_attr_object_complex_head = #{val[0]} at #{@filename}:#{@lineno}")
-    result = {:single_attr_object_complex_head => val[0]}
-  }
   | single_attr_object_complex_head attr_vals SYM_END_DBLOCK
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: single_attr_object_complex_head = #{val[0]}, attr_vals = #{val[1]} at #{@filename}:#{@lineno}")
-    result = {:single_attr_object_complex_head => val[0], :attr_vals => val[1]}
-  }
 single_attr_object_complex_head: SYM_START_DBLOCK
 primitive_object_block: untyped_primitive_object_block
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: untyped_primitive_object_block = #{val[0]} at #{@filename}:#{@lineno}")
-    result = {:untyped_primitive_object_block => val[0]}
-  }
   | type_identifier untyped_primitive_object_block
-  {
-    @@log.info("#{__FILE__}:#{__LINE__}: type_identifier = #{val[0]}, untyped_primitive_object_block = #{val[1]} at #{@filename}:#{@lineno}")
-    result = {:type_identifier => val[0], :untyped_primitive_object_block => val[1]}
-  }
 untyped_primitive_object_block: SYM_START_DBLOCK primitive_object_value SYM_END_DBLOCK
   {
-    @@log.info("#{__FILE__}:#{__LINE__}: primitive_object_block = <#{val[1]}> at #{@filename}:#{@lineno}")
-    result = val[1]
+    @@log.info("#{__FILE__}:#{__LINE__}: primitive_object_block = <#{val[2]}> at #{@filename}:#{@lineno}")
   }
 primitive_object_value: simple_value
-  {
-    result = val[0]
-  }
   | simple_list_value
-  {
-    result = val[0]
-  }
   | simple_interval_value
-  {
-    result = val[0]
-  }
   | term_code
-  {
-    result = val[0]
-  }
   | term_code_list_value
-  {
-    result = val[0]
-  }
 simple_value: string_value
   {
     @@log.info("string_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
   }
   | integer_value
   {
     @@log.info("integer_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
   }
   | real_value
   {
     @@log.info("real_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
   }
   | boolean_value
   {
     @@log.info("boolean_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
   }
   | character_value
   {
     @@log.info("character_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
   }
   | date_value
   {
     @@log.info("date_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
   }
   | time_value
   {
     @@log.info("time_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
   }
   | date_time_value
   {
     @@log.info("date_time_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
   }
   | duration_value
   {
     @@log.info("duration_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
   }
   | uri_value
   {
     @@log.info("uri_value: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-  }
-
+  }
 simple_list_value: string_list_value
   | integer_list_value
@@ -630,10 +351,8 @@
   {
     @@log.info("V_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
   }
   | V_GENERIC_TYPE_IDENTIFIER
   {
     @@log.info("V_GENERIC_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
   }
 
@@ -641,5 +360,4 @@
   {
     @@log.info("V_STRING: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
   }
 
@@ -649,30 +367,6 @@
 
 integer_value: V_INTEGER
-  { 
-    begin
-      integer = Integer(val[0])
-    rescue
-      raise
-    end
-    result = integer
-  }
   | Plus_code V_INTEGER
-  {
-    begin
-      integer = Integer(val[0])
-    rescue
-      raise
-    end
-    result = integer
-  }
   | Minus_code V_INTEGER
-  {
-    begin
-      integer = Integer(val[0])
-    rescue
-      raise
-    end
-    result = - integer
-  }
 ###   | '+' V_INTEGER
 ###   | '-' V_INTEGER
@@ -693,30 +387,8 @@
 
 real_value: V_REAL
-  {
-    begin
-      real = Float(val[0])
-    rescue
-      raise
-    end
-    result = real
-  }
   | Plus_code V_REAL
-  {
-    begin
-      real = Float(val[1])
-    rescue
-      raise
-    end
-    result = real
-  }
   | Minus_code V_REAL
-  {
-    begin
-      real = Float(val[1])
-    rescue
-      raise
-    end
-    result = - real
-  }
+#  | '+' V_REAL
+#  | '-' V_REAL
 
 real_list_value: real_value Comma_code real_value
@@ -736,11 +408,5 @@
 
 boolean_value: SYM_TRUE
-  { 
-    result = true
-  }
   | SYM_FALSE
-  { 
-    result = false
-  }
 
 boolean_list_value: boolean_value Comma_code boolean_value
@@ -805,5 +471,4 @@
   {
     @@log.info("V_ISO8601_DURATION: #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
   }
 
@@ -825,5 +490,4 @@
   {
     @@log.info("#{__FILE__}:#{__LINE__}: V_QUALIFIED_TERM_CODE_REF = #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
   }
 
@@ -835,5 +499,4 @@
   {
     @@log.info("#{__FILE__}:#{__LINE__}: V_URI = #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
   }
 
@@ -918,36 +581,10 @@
 
 c_existence: #-- default to 1..1
-    { 
-    result = Range.new(1,1)
-  }
-  | SYM_EXISTENCE SYM_MATCHES SYM_START_CBLOCK existence_spec SYM_END_CBLOCK
-  { 
-    result = val[3]
-  }
+    | SYM_EXISTENCE SYM_MATCHES SYM_START_CBLOCK existence_spec SYM_END_CBLOCK
 
 existence_spec:  V_INTEGER #-- can only be 0 or 1
-  { 
-    begin
-      integer = Integer(val[0])
-    rescue
-      raise
-    end
-    result = integer
-  }
   | V_INTEGER SYM_ELLIPSIS V_INTEGER #-- can only be 0..0, 0..1, 1..1
-  { 
-    begin
-      from_integer = Integer(val[0])
-      to_integer = Integer(val[2])
-    rescue
-      raise
-    end
-    result = Range.new(from_integer,to_integer)
-  }
 
 c_cardinality: SYM_CARDINALITY SYM_MATCHES SYM_START_CBLOCK cardinality_spec SYM_END_CBLOCK
-  { 
-    result = OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY.new
-  }
 
 cardinality_spec: occurrence_spec
@@ -966,7 +603,4 @@
 c_occurrences:  #-- default to 1..1
   | SYM_OCCURRENCES SYM_MATCHES SYM_START_CBLOCK occurrence_spec SYM_END_CBLOCK
-  { 
-    result = val[3]
-  }
   | SYM_OCCURRENCES error
 
@@ -1036,39 +670,21 @@
 
 c_boolean_spec: SYM_TRUE
-  { 
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true)
-  }
   | SYM_FALSE
-  { 
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => false)
-  }
   | SYM_TRUE Comma_code SYM_FALSE
-  { 
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true,:false_valid => false)
-  }
   | SYM_FALSE Comma_code SYM_TRUE
-  { 
-    result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => false,:false_valid => true)
-  }
 
 c_boolean: c_boolean_spec
-  { 
-    result = val[0]
-  }
   | c_boolean_spec Semicolon_code boolean_value
-  {
-    raise 'Not implemented yet'
-  }
   | c_boolean_spec Semicolon_code error
-  {
-    raise 'Not implemented yet'
-  }
+#  | c_boolean_spec ';' error
 
 c_ordinal: c_ordinal_spec
   | c_ordinal_spec Semicolon_code integer_value
   | c_ordinal_spec Semicolon_code error
+#  | c_ordinal_spec ';' error
 
 c_ordinal_spec: ordinal
   | c_ordinal_spec Comma_code ordinal
+#  | c_ordinal_spec ',' ordinal
 
 ordinal: integer_value SYM_INTERVAL_DELIM V_QUALIFIED_TERM_CODE_REF
@@ -1106,7 +722,4 @@
 
 duration_pattern: V_ISO8601_DURATION_CONSTRAINT_PATTERN
-  { 
-    result = val[0]
-  }
 
 
@@ -1118,6 +731,5 @@
 require 'lib/util.rb'
 require 'lib/scanner.rb'
-require 'rubygems'
-require 'am.rb'
+require 'lib/model.rb'
 $DEBUG = true
 
@@ -1125,10 +737,4 @@
 
 ---- inner
-
-def assert_at(file,line, message = "")
-  unless yield
-    raise "Assertion failed !: #{file}, #{line}: #{message}"
-  end
-end
 
 @@log = Logger.new('log/parser.log','daily')
Index: /ruby/trunk/adl_parser/lib/scanner.rb
===================================================================
--- /ruby/trunk/adl_parser/lib/scanner.rb	(revision 30)
+++ /ruby/trunk/adl_parser/lib/scanner.rb	(revision 20)
@@ -115,5 +115,7 @@
               Yaparc::Apply.new(
                                 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])?/),
-                                                Yaparc::Regex.new(/\AP([0-9]+|[yY])?([0-9]+|[mM])?([0-9]+|[wW])?([0-9]+|[dD])?/))) do |match|
+                                                Yaparc::Regex.new(/AP([0-9]+|[yY])?([0-9]+|[mM])?([0-9]+|[wW])?([0-9]+|[dD])?/))) do |match|
+#                                 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])?/),
+#                                                 Yaparc::Regex.new(/AP([0-9]+[yY])?([0-9]+[mM])?([0-9]+[wW])?([0-9]+[dD])?/))) do |match|
                 LOG.info("V_ISO8601_DURATION: #{match}")
                 [:V_ISO8601_DURATION, match]
@@ -158,7 +160,5 @@
             @parser = lambda do |input|
               reserved_parsers = OpenEHR::ADL::Scanner::DADL::RESERVED.map do |keyword| 
-                Yaparc::Tokenize.new(
-                                     Yaparc::Literal.new(keyword[0], false)
-                                     )
+                Yaparc::Tokenize.new(Yaparc::Literal.new(keyword[0], false))
               end
               Yaparc::Alt.new(Yaparc::Apply.new(Yaparc::Alt.new(*reserved_parsers)) do |match|
@@ -248,18 +248,4 @@
         end
 
-        #V_ISO8601_DURATION_CONSTRAINT_PATTERN 
-        class V_ISO8601_DURATION_CONSTRAINT_PATTERN
-          include Yaparc::Parsable
-          def initialize
-            @parser = lambda do |input|
-              Yaparc::Apply.new(Yaparc::Alt.new(Yaparc::Regex.new(/\AP[yY]?[mM]?[wW]?[dD]?T[hH]?[mM]?[sS]?/),
-                                                Yaparc::Regex.new(/\AP[yY]?[mM]?[wW]?[dD]?/))) do |match|
-                OpenEHR::ADL::Scanner::Common::LOG.info("V_ISO8601_DURATION_CONSTRAINT_PATTERN: #{match}")
-                [:V_ISO8601_DURATION_CONSTRAINT_PATTERN, match]
-              end
-            end
-          end
-        end
-
         #V_C_DOMAIN_TYPE /\A[A-Z][a-zA-Z0-9_]*[ \n]*\</
         class V_C_DOMAIN_TYPE
@@ -284,5 +270,4 @@
                               OpenEHR::ADL::Scanner::Common::V_ISO8601_DURATION.new,
                               V_C_DOMAIN_TYPE.new,
-                              V_ISO8601_DURATION_CONSTRAINT_PATTERN.new,
                               Reserved.new,
                               OpenEHR::ADL::Scanner::Common::V_QUALIFIED_TERM_CODE_REF.new,
Index: /ruby/trunk/adl_parser/tests/cparser_test.rb
===================================================================
--- /ruby/trunk/adl_parser/tests/cparser_test.rb	(revision 20)
+++ /ruby/trunk/adl_parser/tests/cparser_test.rb	(revision 20)
@@ -0,0 +1,22 @@
+#$:.unshift File.join(File.dirname(__FILE__))
+
+require 'lib/cparser.rb'
+require 'test/unit'
+
+class CADLParserTest < Test::Unit::TestCase
+  def setup
+    @parser = ::OpenEHR::CADLParser.new
+  end
+
+  def test_init
+    assert_instance_of ::OpenEHR::CADLParser,@parser
+  end
+
+  def test_parse
+    vital_signs = File.read('tests/vital_signs.cadl')
+    assert_nothing_raised do
+      @parser.parse(vital_signs, 'vital_signs')
+    end
+  end
+
+end
Index: /ruby/trunk/adl_parser/tests/parser_test.rb
===================================================================
--- /ruby/trunk/adl_parser/tests/parser_test.rb	(revision 30)
+++ /ruby/trunk/adl_parser/tests/parser_test.rb	(revision 20)
@@ -1,2 +1,4 @@
+#$:.unshift File.join(File.dirname(__FILE__))
+
 require 'lib/parser.rb'
 require 'test/unit'
@@ -14,9 +16,5 @@
     laboratory_request = File.read('tests/openEHR-EHR-ITEM_TREE.Laboratory_request.v1.adl')
     assert_nothing_raised do
-      result = @parser.parse(laboratory_request, 'openEHR-EHR-ITEM_TREE.Laboratory_request.v1.adl')
-      assert_instance_of OpenEHR::AM::Archetype::ARCHETYPE, result
-      assert_instance_of OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION, result.description
-      assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, result.definition
-#      assert_equal '', result.definition
+      @parser.parse(laboratory_request, 'openEHR-EHR-ITEM_TREE.Laboratory_request.v1.adl')
     end
 
@@ -24,7 +22,5 @@
     assert_nothing_raised do
       result = @parser.parse(apgar, 'openEHR-EHR-OBSERVATION.apgar.v1.adl')
-      assert_instance_of OpenEHR::AM::Archetype::ARCHETYPE, result
-      assert_instance_of OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION, result.description
-      assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, result.definition
+      #       assert_equal "", result
     end
 
@@ -35,4 +31,8 @@
 
 
+#     medication = File.read('tests/openEHR-EHR-ITEM_TREE.medication.v1.adl')
+#     assert_nothing_raised do
+#       @parser.parse(medication, 'openEHR-EHR-ITEM_TREE.medication.v1.adl')
+#     end
 
     referral = File.read('tests/openEHR-EHR-ITEM_TREE.referral.v1.adl')
@@ -144,8 +144,4 @@
 
 
-#     medication = File.read('tests/openEHR-EHR-ITEM_TREE.medication.v1.adl')
-#     assert_nothing_raised do
-#       @parser.parse(medication, 'openEHR-EHR-ITEM_TREE.medication.v1.adl')
-#     end
   end
 end
Index: by/trunk/adl_parser/tests/semantic_test.rb
===================================================================
--- /ruby/trunk/adl_parser/tests/semantic_test.rb	(revision 30)
+++ 	(revision )
@@ -1,12 +1,0 @@
-require 'lib/parser.rb'
-require 'test/unit'
-
-class ADLSemanticTest < Test::Unit::TestCase
-  def setup
-    @parser = ::OpenEHR::ADL::Parser.new
-  end
-
-  def test_init
-    assert_instance_of ::OpenEHR::ADL::Parser,@parser
-  end
-end
Index: /ruby/trunk/adl_parser/tests/test_parser.rb
===================================================================
--- /ruby/trunk/adl_parser/tests/test_parser.rb	(revision 20)
+++ /ruby/trunk/adl_parser/tests/test_parser.rb	(revision 20)
@@ -0,0 +1,21 @@
+#$:.unshift File.join(File.dirname(__FILE__))
+
+require 'lib/parser.rb'
+require 'test/unit'
+
+class ADLParserTest < Test::Unit::TestCase
+  def setup
+    @parser = ::OpenEHR::ADL::Parser.new
+  end
+
+  def test_init
+    assert_instance_of ::OpenEHR::ADL::Parser,@parser
+  end
+
+  def test_parse
+    exam_uterine_cervix = File.read('tests/openEHR-EHR-CLUSTER.exam-uterine_cervix.v1.adl')
+    assert_nothing_raised do
+      @parser.parse(exam_uterine_cervix, 'openEHR-EHR-CLUSTER.exam-uterine_cervix.v1.adl')
+    end
+  end
+end
Index: by/trunk/models/COPYING
===================================================================
--- /ruby/trunk/models/COPYING	(revision 30)
+++ 	(revision )
@@ -1,3 +1,0 @@
-openEHR Open Source Software License
-
-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. 
Index: /ruby/trunk/models/Rakefile
===================================================================
--- /ruby/trunk/models/Rakefile	(revision 30)
+++ /ruby/trunk/models/Rakefile	(revision 20)
@@ -34,32 +34,4 @@
 
 
-gem_spec = Gem::Specification.new do |s|
-  s.name = 'openehr_models'
-  s.author = 'Shinji KOBAYASHI, Akimichi TATSUKAWA'
-  s.version = '0.0.1'
-  s.summary = 'OpenEHR models'
-  s.email = 'openehr-jp@openehr.jp'
-  s.test_files = FileList['tests/test_*.rb', '*.adl']
-  candidates = Dir.glob("{am,rm,docs,tests}/**/*") + FileList['COPYING', 'Rakefile','am.rb','assumed_library_types.rb','rm.rb']
-  s.files = candidates.delete_if do |item|
-    item.include?(".svn") || item.include?("rdoc")
-  end
-#  s.files << FileList['COPYING', 'Rakefile','am.rb','assumed_library_types.rb','rm.rb']
-#  s.require_paths += [".","am","rm"]
-  s.require_path = "."
-  s.has_rdoc = true
-#  s.extra_rdoc_files = ["README"]
-end
-
-
-Rake::GemPackageTask.new(gem_spec) do |pkg|
-  pkg.need_zip = false
-  pkg.need_tar = false
-end
-
-#CLOBBER.include('rdoc')
-#CLEAN.include('lib/*.output', 'log/*.log')
-
-
 
 
Index: /ruby/trunk/models/am.rb
===================================================================
--- /ruby/trunk/models/am.rb	(revision 30)
+++ /ruby/trunk/models/am.rb	(revision 20)
@@ -17,40 +17,13 @@
   module AM
     module Archetype
-      autoload :ARCHETYPE, "am/archetype/archetype.rb"
+      autoload :Archetype, "am/archetype/archetype.rb"
       autoload :Constraint_Model, "am/archetype/constraint_model/archetype_constraint.rb"
       autoload :Ontology, "am/archetype/ontology.rb"
-      
-      module Archetype_Description
-        autoload :ARCHETYPE_DESCRIPTION, "am/archetype/archetype_description/archetype_description.rb"
-      end
-
+      autoload :Archetype_Description, "am/archetype/archetype_description/archetype_description.rb"
       module Constraint_Model
-        autoload :ARCHETYPE_CONSTRAINT, "am/archetype/constraint_model/archetype_constraint.rb"
+        autoload :Assertion, "am/archetype/constraint_model/assertion.rb"
         autoload :Primitive, "am/archetype/constraint_model/primitive.rb"
       end #end of ConstraintModel
-
-      module Assertion
-        autoload :ASSERTION, "am/archetype/constraint_model/assertion.rb"
-      end
-
     end # of Archetype
-
-    module OpenEHR_Profile
-      module Data_Types
-        module Basic
-          autoload :C_DV_STATE, "am/openehr_profile/data_types/basic.rb"
-        end
-
-        module Text
-          autoload :C_CODE_PHASE, "am/openehr_profile/data_types/text.rb"
-        end
-
-        module Quantity
-          autoload :C_DV_QUANTITY, "am/openehr_profile/data_types/quantity.rb"
-          autoload :C_DV_ORDINAL, "am/openehr_profile/data_types/quantity.rb"
-          autoload :C_QUANTITY_ITEM, "am/openehr_profile/data_types/quantity.rb"
-        end
-      end
-    end
   end # of AM
 end # of OpenEHR
Index: /ruby/trunk/models/am/archetype/archetype.rb
===================================================================
--- /ruby/trunk/models/am/archetype/archetype.rb	(revision 30)
+++ /ruby/trunk/models/am/archetype/archetype.rb	(revision 20)
@@ -7,33 +7,35 @@
 #        include OpenEHR::RM::Support::Terminology::OpenEHR_Code_Set_Identifier
         include OpenEHR::RM::Support::Terminology
-        CURRENT_ADL_VERSION = "1.4"
+        CURRENT_ADL_VERSION = "2.0"
       end
-
-      class ARCHETYPE < OpenEHR::RM::Common::Resource::AUTHORED_RESOURCE
+      class Archetype < OpenEHR::RM::Common::Resource::Authored_Resource
         include ADL_Definition
         attr_accessor :archetype_id, :concept_code, :is_controlled, :original_language, :parent_archtype_id, :uid
 
-        attr_reader :parent_id,:concept, :definition, :ontology
-        attr_accessor :adl_version,:description,:original_language
+        attr_reader :adl_version, :id, :parent_id
+        attr_reader :concept, :definition, :ontology
+        attr_accessor :description,:original_language
         attr_accessor :revision_history, :translation
 
-        def initialize(args = {})
-          @adl_version = args[:adl_version] if args[:adl_version]
-          @archetype_id = args[:archetype_id] ? args[:archetype_id] : nil
-          @parent_id = args[:parent_id] if args[:parent_id]
-          @concept = args[:concept] if args[:concept]
-          @is_controled = args[:is_controled] if args[:is_controled]
-          @definition = args[:definition] if args[:definition]
-          @ontology = args[:ontology] if args[:ontology]
+        def initialize(parent_id, concept,
+                       description, revision_history, is_controled,
+                       definition, ontology, adl_version,
+                       id = nil , original_language = nil, translation = nil)
+#          raise Exception.new("illegal argument error, id == nil") unless id
+#          raise Exception.new("illegal argument error, originalLanguage == nil") unless origina_language
+
+#          raise Exception.new("illegal argument error, translation == nil") unless translation
+          @adl_version = adl_version
+          @id = id
+          @parent_id = parent_id
+          @concept = concept
+          @original_language = original_language
+          @translation = translation
+          @description = description
+          @revision_history = revision_history
+          @is_controled = is_controled
+          @definition = definition
+          @ontology = ontology
  #         loadMaps(definition)
-          super
-        end
-
-        def self.create(args ={}, &block)
-          archetype = new(args)
-          if block_given?
-            yield archetype
-          end
-          return archetype
         end
 
@@ -73,13 +75,8 @@
         def version
         end
-      end # end of ARCHETYPE
+      end
       # original file:
       # ref_imple_eiffel/components/adl_parser/src/interface/adl_definition.e
-
-      class VALIDITY_KIND
-      end
-    end
-
-
+    end # end of Archetype
   end # end of AM
 end # end of OpenEHR
Index: /ruby/trunk/models/am/archetype/archetype_description/archetype_description.rb
===================================================================
--- /ruby/trunk/models/am/archetype/archetype_description/archetype_description.rb	(revision 30)
+++ /ruby/trunk/models/am/archetype/archetype_description/archetype_description.rb	(revision 20)
@@ -4,12 +4,9 @@
     module Archetype
       module Archetype_Description
-        class ARCHETYPE_DESCRIPTION
-          attr_accessor :archetype_package_uri, :lifecycle_state, :original_author, :other_contributors, :other_details, :details
-          def initialize(args ={ })
-            @details = args[:details] ? args[:details] : []
-          end
+        class Archetype_Description
+          attr_accessor :archetype_package_uri, :lifecycle_state, :original_author, :other_contributors, :other_details
         end
 
-        class ARCHETYPE_DESCRIPTION_ITEM
+        class Archetype_Description_Item
           attr_accessor :archetype_package_uri, :lifecycle_state, :original_author, :other_contributors, :other_details
         end
Index: /ruby/trunk/models/am/archetype/constraint_model/archetype_constraint.rb
===================================================================
--- /ruby/trunk/models/am/archetype/constraint_model/archetype_constraint.rb	(revision 30)
+++ /ruby/trunk/models/am/archetype/constraint_model/archetype_constraint.rb	(revision 20)
@@ -4,105 +4,6 @@
     module Archetype
       module Constraint_Model
-        class ARCHETYPE_CONSTRAINT
+        class Archetype_Constraint
           
-        end
-
-        class CARDINALITY
-          
-        end
-
-        class C_OBJECT < ARCHETYPE_CONSTRAINT
-          attr_accessor :node_id, :occurrences, :rm_type_name
-
-          def initialize(args = { })
-            @node_id = args[:node_id] if args[:node_id]
-            @occurrences = args[:occurrences] if args[:occurrences]
-            @rm_type_name = args[:rm_type_name] if args[:rm_type_name]
-          end
-        end
-
-        class C_ATTRIBUTE < ARCHETYPE_CONSTRAINT
-          attr_accessor :rm_attribute_name, :existence, :children
-
-          def initialize(args = { })
-            @rm_attribute_name = args[:rm_attribute_name] if args[:rm_attribute_name]
-            @existence = args[:existence] if args[:existence]
-            @children = args[:children] ? args[:children] : []
-            
-          end
-        end
-
-        class C_DEFINED_OBJECT < C_OBJECT
-          attr_accessor :assumed_value
-          
-          def initialize(args = { })
-            @assumed_value = args[:assumed_value] if args[:assumed_value]
-            super
-          end
-        end
-
-        class C_PRIMITIVE_OBJECT < C_DEFINED_OBJECT
-          attr_accessor :item
-          
-          def initialize(args = { })
-            @attributes = args[:item] if args[:item]
-            super
-          end
-        end
-
-        class C_COMPLEX_OBJECT < C_DEFINED_OBJECT
-          attr_accessor :attributes, :attributes_valid
-          
-          def initialize(args = { })
-            @attributes = args[:attributes] ? args[:attributes] : []
-            super
-          end
-
-          def self.create(args = { }, &block)
-            c_complex_object = new(args)
-            if block_given?
-              yield c_complex_object
-            end
-            return c_complex_object
-          end
-        end
-
-        class C_DOMAIN_TYPE < C_DEFINED_OBJECT
-          
-        end
-
-        class C_REFERENCE_OBJECT < C_OBJECT
-          
-        end
-
-        class ARCHETYPE_INTERNAL_REF < C_REFERENCE_OBJECT
-          
-        end
-
-        class ARCHETYPE_SLOT < C_REFERENCE_OBJECT
-          
-        end
-
-        class CONSTRAINT_REF < C_REFERENCE_OBJECT
-          
-        end
-
-        class C_SINGLE_ATTRIBUTE < C_ATTRIBUTE
-          attr_accessor :alternatives
-
-          def initialize(args = { })
-            @alternatives = args[:alternatives] ? args[:alternatives] : []
-            super
-          end
-        end
-
-        class C_MULTIPLE_ATTRIBUTE < C_ATTRIBUTE
-          attr_accessor :members, :cardinality
-          
-          def initialize(args = { })
-            @members = args[:members] ? args[:members] : []
-            @cardinality = args[:cardinality] if args[:cardinality]
-            super
-          end
         end
       end
Index: /ruby/trunk/models/am/archetype/constraint_model/assertion.rb
===================================================================
--- /ruby/trunk/models/am/archetype/constraint_model/assertion.rb	(revision 30)
+++ /ruby/trunk/models/am/archetype/constraint_model/assertion.rb	(revision 20)
@@ -2,27 +2,8 @@
   module AM
     module Archetype
-      module Assertion
-        class ASSERTION
-        end
-
-        class ASSERTION_VARIABLE
-        end
-
-        class OPERATOR_KIND
-        end
-
-        class EXPR_ITEM
-        end
-
-        class EXPR_LEAF < EXPR_ITEM
-        end
-
-        class EXPR_OPERATOR < EXPR_ITEM
-        end
-
-        class EXPR_UNARY_OPERATOR < EXPR_OPERATOR
-        end
-
-        class EXPR_BINARY_OPERATOR < EXPR_OPERATOR
+      module Constraint_Model
+        module Assertion
+          class Assertion
+          end
         end
       end
Index: /ruby/trunk/models/am/archetype/constraint_model/primitive.rb
===================================================================
--- /ruby/trunk/models/am/archetype/constraint_model/primitive.rb	(revision 30)
+++ /ruby/trunk/models/am/archetype/constraint_model/primitive.rb	(revision 20)
@@ -3,8 +3,6 @@
     module Archetype
       module Constraint_Model
-
         module Primitive
-
-          class C_PRIMITIVE
+          class C_Primitive
             def assumed_value
               raise NotImplementedError, "assumed_value should be implemented"
@@ -20,30 +18,30 @@
             end
           end
-
-          class C_BOOLEAN < C_PRIMITIVE
-            attr_reader :true_valid, :false_valid, :assumed_value
-
-            def initialize(args = { })
-              @true_valid = args[:true_valid] ? args[:true_valid] : false
-              @false_valid = args[:false_valid] ? args[:false_valid] : false
-              @assumed_value = args[:assumed_value] ? args[:assumed_value] : false
-              binary_consistency(@true_valid, @false_valid)
+          class C_Boolean < C_Primitive
+            attr_accessor :assumed_value
+            def initialize(true_valid, false_valid, assumed_value)
+              binary_consistency(true_valid, false_valid)
+              @true_valid = true_valid
+              @false_valid = false_valid
+              @assumed_value = assumed_value
             end
-
-            def true_valid=(true_valid)
+            def set_true_valid(true_valid)
               binary_consistency(true_valid, @false_valid)
               @true_valid = true_valid
             end
-
-            def false_valid=(false_valid)
+            def set_false_valid(false_valid)
               binary_consistency(@true_valid,false_valid)
               @false_valid = false_valid 
             end
-
+            def true_valid?
+              @true_valid
+            end
+            def false_valid?
+              @false_valid
+            end
             def valid_value?
               
             end
-
-            def default_value(a_value = nil)
+            def default_value(a_value=nil)
               if a_value == nil
                 @true_valid
@@ -52,7 +50,5 @@
               end              
             end
-
             private 
-
             def binary_consistency(true_valid, false_valid)
               if !true_valid && !false_valid
@@ -61,35 +57,7 @@
             end
           end # of C_Boolean
-
-          class C_STRING < C_PRIMITIVE
+          class C_Integer < C_Primitive
             
           end
-
-          class C_INTEGER < C_PRIMITIVE
-            
-          end
-
-          class C_REAL < C_PRIMITIVE
-            
-          end
-
-          class C_TIME < C_PRIMITIVE
-            
-          end
-
-          class C_DATE < C_PRIMITIVE
-            
-          end
-
-          class C_DATE_TIME < C_PRIMITIVE
-            
-          end
-
-          class C_DURATION < C_PRIMITIVE
-            attr_accessor :years_allowed, :months_allowed, :weeks_allowed, :days_allowed, :hours_allowed, :minutes_allowed, :seconds_allowed, :fractional_seconds_allowed, :range, :assumed_value
-          end
-
-
-
         end # of Primitive
       end # of Constraint_Model
Index: /ruby/trunk/models/am/archetype/ontology.rb
===================================================================
--- /ruby/trunk/models/am/archetype/ontology.rb	(revision 30)
+++ /ruby/trunk/models/am/archetype/ontology.rb	(revision 20)
@@ -3,47 +3,35 @@
     module Archetype
       module Ontology
-        class ARCHETYPE_ONTOLOGY
+        class Archetype_Ontology
           attr_accessor :constraint_codes, :specialisation_depth
           attr_accessor :term_attribute_names, :term_codes
           attr_accessor :terminologies_available
-
           def constraint_binding(a_terminology, a_code)
           end
-
           def constraint_definition(a_lang, a_code)
           end
-
           def has_language?(a_lang)
           end
-
           def has_terminology?(a_terminology)
           end
-
           def term_binding(a_terminology, a_code)
           end
-
           def term_definition(a_lang, a_code)
           end
         end
-
-        class ARCHETYPE_TERM
+        class Archetype_Term
           attr_accessor :code, :items
-
-          def initialize(args = { })
-                         
-            @code = if args[:code]
-                      args[:code]
-                    else
-                      raise ArgumentError, "Code is empty"
-                    end
-            @items = if args[:items]
-                       args[:items]
-                     else
-                       raise ArgumentError, "Items is empty"
-                     end
+          def initialize(code, items)
+            if code == nil
+              raise ArgumentError, "Code is empty"
+            end
+            if items.keys == nil
+              raise ArgumentError, "Items is empty"
+            end
+            @code = code
+            @items = items
           end
-
           def keys
-            @items.keys
+            items.keys
           end
         end
Index: /ruby/trunk/models/am/openehr_profile/data_types/basic.rb
===================================================================
--- /ruby/trunk/models/am/openehr_profile/data_types/basic.rb	(revision 30)
+++ /ruby/trunk/models/am/openehr_profile/data_types/basic.rb	(revision 20)
@@ -1,27 +1,6 @@
 module OpenEHR
-  module AM
+  module RM
     module OpenEHR_Profile
       module Data_Types
-        module Basic
-          class C_DV_STATE
-          end
-
-          class STATE_MACHINE
-          end
-
-          class STATE
-          end
-
-          class TERMINAL_STATE < STATE
-          end
-
-          class NON_TERMINAL_STATE < STATE
-          end
-
-          class TRANSITION
-          end
-        end
-
-        
       end # of Data_Types
     end # of OpenEHR Profile
Index: by/trunk/models/am/openehr_profile/data_types/quantity.rb
===================================================================
--- /ruby/trunk/models/am/openehr_profile/data_types/quantity.rb	(revision 30)
+++ 	(revision )
@@ -1,19 +1,0 @@
-module OpenEHR
-  module AM
-    module OpenEHR_Profile
-      module Data_Types
-
-        module Quantity
-          class C_DV_QUANTITY < OpenEHR::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE
-          end
-          
-          class C_DV_ORDINAL < OpenEHR::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE
-          end
-
-          class C_QUANTITY_ITEM
-          end
-        end
-      end # of Data_Types
-    end # of OpenEHR Profile
-  end # of RM
-end # of OpenEHR
Index: by/trunk/models/am/openehr_profile/data_types/text.rb
===================================================================
--- /ruby/trunk/models/am/openehr_profile/data_types/text.rb	(revision 30)
+++ 	(revision )
@@ -1,12 +1,0 @@
-module OpenEHR
-  module AM
-    module OpenEHR_Profile
-      module Data_Types
-        module Text
-          class C_CODE_PHASE < OpenEHR::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE
-          end
-        end
-      end # of Data_Types
-    end # of OpenEHR Profile
-  end # of RM
-end # of OpenEHR
Index: /ruby/trunk/models/assumed_library_types.rb
===================================================================
--- /ruby/trunk/models/assumed_library_types.rb	(revision 30)
+++ /ruby/trunk/models/assumed_library_types.rb	(revision 20)
@@ -10,13 +10,10 @@
         set_upper_included(upper_included)
       end
-
       def set_lower(lower)
         check_lower_upper(lower, @upper)
       end
-
       def set_upper(upper)
         check_lower_upper(@lower, upper)
       end
-
       def set_lower_included(lower_included)
         if (lower == nil) && (lower_included != nil)
@@ -25,5 +22,4 @@
         @lower_included = lower_included
       end
-
       def set_upper_included(upper_included)
         @upper_included = upper_included
@@ -32,5 +28,4 @@
         end
       end
-
       def has?(value)
         if ((@lower < value) && (value < @upper) ||
@@ -42,7 +37,5 @@
         end
       end
-
       private
-
       def check_lower_upper(lower, upper)
         if (lower == nil) && (upper == nil)
Index: /ruby/trunk/models/rm.rb
===================================================================
--- /ruby/trunk/models/rm.rb	(revision 30)
+++ /ruby/trunk/models/rm.rb	(revision 20)
@@ -13,21 +13,13 @@
   module RM
     autoload :Demographic, "rm/demographic.rb"
-
     module Common
       autoload :Resource, "rm/common/resource.rb"
     end
-
     module Support
       autoload :Definition, "rm/support/definition.rb"
-
-      module Identification
-        autoload :OBJECT_ID, "rm/support/identification.rb"
-      end
-
       module Terminology
         autoload :Terminology, "rm/support/terminology.rb"
       end
     end
-
     module Data_Types
       autoload :Basic, "rm/data_types/basic.rb"
Index: /ruby/trunk/models/rm/common/resource.rb
===================================================================
--- /ruby/trunk/models/rm/common/resource.rb	(revision 30)
+++ /ruby/trunk/models/rm/common/resource.rb	(revision 20)
@@ -4,41 +4,40 @@
     module Common
       module Resource
-        class AUTHORED_RESOURCE
-          attr_reader :is_controled,:revision_history, :translations
+        class Authored_Resource
+          attr_reader :is_controled
+          attr_reader :revision_history, :translations
           attr_accessor :description, :original_language
-
-          def initialize(args = { })
-            @original_language = args[:original_language] if args[:original_language]
-            @translations = args[:translations] if args[:translations]
-            @revision_history = args[:revision_history] ? args[:revision_history] : nil
-
-            unless @revision_history
-              @is_controled = false
+          def initialize(original_language, translations,
+                         description, revision_history = nil)
+            if original_language == nil
+              raise Exception.new("original language nil")
+            end
+            if translations == nil
+              raise Exception.new("translation empty")
+            end
+            if revision_history == nil
+              is_controled = false
             else
-              @is_controled = true
+              is_controled = true
             end
-
-            @original_language = args[:original_language] if args[:original_language]
-            @translations = args[:translations] if args[:translations]
-            @description = args[:description] if args[:description]
+            @original_language = original_language
+            @translations = translations
+            @description = description
+            @revision_history = revision_history
           end
-
           def current_version
             @revision_history.most_recent_revision
           end
-
           def language_available
             languages = Set.new
-            if @translations != nil
-              languages << @translations.keys
+            if translations != nil
+              languages << translations.keys
             end
-            languages << @original_language.code_string
+            languages << original_language.code_string
           end
         end
-
-        class TRANSLATION_DETAILS
+        class Translation_Details
           attr_accessor :language, :author, :accreditation
           attr_accessor :other_details, :terminology_service
-
           def initialize(language, author, accreditation, other_details,
                          terminology_service)
Index: /ruby/trunk/models/rm/support/identification.rb
===================================================================
--- /ruby/trunk/models/rm/support/identification.rb	(revision 30)
+++ /ruby/trunk/models/rm/support/identification.rb	(revision 20)
@@ -2,46 +2,36 @@
   module RM
     module Support
-      module Identification
-
-        class OBJECT_ID
+      module Definition
+        class Object_ID
           attr_accessor :value
-
           def initiallize(value)
-            raise "empty value" unless value
+            if value == nil
+              raise Exception.new("empty value")
+            end
             @value = value
           end
         end # of ObjectID
-
-        class ARCHETYPE_ID < OBJECT_ID
-        end
-
-        class TERMINOLOGY_ID < OBJECT_ID
+        class Terminology_ID < Object_ID
           attr_reader :name
-
-          def initialize(name , version_id)
-            @name , @version_id = name , version_id
-#             if arg1 == nil
-#               super(arg0)
-#             else
-#               super(toValue(arg0, arg1))
-#               @name = arg0
-#               @version = arg1      
-#             end
+          def initialize(arg0, arg1=nil)
+            if arg1 == nil
+              super(arg0)
+            else
+              super(toValue(arg0, arg1))
+              @name = arg0
+              @version = arg1      
+            end
           end
-
           def setValue(value)
             loadValue(value)
             super.value = value
           end
-
           def version_id
             @version
           end
-
           private
-
           def loadValue(value)
             if /\(.*\)$/ =~ value
-#              @name, @version = value.split(\())
+              @name, @version = value.split(\())
               @version.chop!
             else
@@ -50,5 +40,4 @@
             end
           end
-
           def toValue(name, version)
             if name == ""
Index: /ruby/trunk/models/tests/test_archetype_model.rb
===================================================================
--- /ruby/trunk/models/tests/test_archetype_model.rb	(revision 30)
+++ /ruby/trunk/models/tests/test_archetype_model.rb	(revision 20)
@@ -5,189 +5,33 @@
 class ArchetypeModelTest < Test::Unit::TestCase
   def setup
-    @archetype = OpenEHR::AM::Archetype::ARCHETYPE.new
-    @validity_kind = OpenEHR::AM::Archetype::VALIDITY_KIND.new
-
-    @archetype_description = OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION.new
-    @archetype_description_item = OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION_ITEM.new
+    @archetype = OpenEHR::AM::Archetype::Archetype.new(nil,nil,nil,nil,nil,nil,nil,nil)
+    @archetype_description = OpenEHR::AM::Archetype::Archetype_Description::Archetype_Description.new
+    @archetype_constraint = OpenEHR::AM::Archetype::Constraint_Model::Archetype_Constraint.new
+    @assertion = OpenEHR::AM::Archetype::Constraint_Model::Assertion::Assertion.new
+    @c_primitive = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_Primitive.new
+    @c_boolean = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_Boolean.new(true, true, true)
+    @c_integer = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_Integer.new
+    @archetype_ontology = OpenEHR::AM::Archetype::Ontology::Archetype_Ontology.new
   end
   
   def test_init
-    assert_instance_of OpenEHR::AM::Archetype::ARCHETYPE, @archetype
-    assert_instance_of OpenEHR::AM::Archetype::VALIDITY_KIND, @validity_kind
-    assert_instance_of OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION, @archetype_description
-    assert_instance_of OpenEHR::AM::Archetype::Archetype_Description::ARCHETYPE_DESCRIPTION_ITEM, @archetype_description_item
-    assert_instance_of OpenEHR::AM::Archetype::ARCHETYPE, @archetype
+    assert_instance_of OpenEHR::AM::Archetype::Ontology::Archetype_Ontology, @archetype_ontology
+    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Archetype_Constraint, @archetype_constraint
+    assert_instance_of OpenEHR::AM::Archetype::Archetype_Description::Archetype_Description, @archetype_description
+    assert_instance_of OpenEHR::AM::Archetype::Archetype, @archetype
+    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Assertion::Assertion, @assertion
+    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_Primitive, @c_primitive
+    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_Boolean, @c_boolean
   end
-
-  def test_create
-    archetype_instance = OpenEHR::AM::Archetype::ARCHETYPE.create() do |archetype|
-      archetype.adl_version = '1.4'
-    end
-
-    assert_instance_of OpenEHR::AM::Archetype::ARCHETYPE, archetype_instance
-  end
-end
-
-class ArchetypeModelConstraintTest < Test::Unit::TestCase
-  def setup
-    @archetype_constraint = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT.new
-    @cardinality = OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY.new    
-    
-    @archetype_constraint = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT.new
-    @c_object = OpenEHR::AM::Archetype::Constraint_Model::C_OBJECT.new
-    @c_defined_object = OpenEHR::AM::Archetype::Constraint_Model::C_DEFINED_OBJECT.new
-    @c_attribute = OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE.new
-    @c_single_attribute = OpenEHR::AM::Archetype::Constraint_Model::C_SINGLE_ATTRIBUTE.new
-    @c_multiple_attribute = OpenEHR::AM::Archetype::Constraint_Model::C_MULTIPLE_ATTRIBUTE.new(:rm_attribute_name => 'attribute_name', :cardinality => @cardinality)
-    @c_primitive_object = OpenEHR::AM::Archetype::Constraint_Model::C_PRIMITIVE_OBJECT.new
-    @c_reference_object =  OpenEHR::AM::Archetype::Constraint_Model::C_REFERENCE_OBJECT.new
-    @archetype_internal_ref =  OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF.new
-    @archetype_slot = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT.new
-    @constraint_ref = OpenEHR::AM::Archetype::Constraint_Model::CONSTRAINT_REF.new
-    @c_domain_type = OpenEHR::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE.new
-    @c_complex_object = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new(:attributes => [@c_single_attribute])
-  end
-
-  def test_init
-    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT, @archetype_constraint
-    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_OBJECT, @c_object
-    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_DEFINED_OBJECT, @c_defined_object
-    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE, @c_attribute
-    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_SINGLE_ATTRIBUTE, @c_single_attribute
-    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_MULTIPLE_ATTRIBUTE, @c_multiple_attribute
-    assert_equal 'attribute_name', @c_multiple_attribute.rm_attribute_name
-    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY, @c_multiple_attribute.cardinality
-    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_PRIMITIVE_OBJECT, @c_primitive_object
-    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_REFERENCE_OBJECT, @c_reference_object
-    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF, @archetype_internal_ref
-    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT, @archetype_slot
-    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::CONSTRAINT_REF, @constraint_ref
-    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE, @c_domain_type
-    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, @c_complex_object
-    assert_instance_of Array, @c_complex_object.attributes
-    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_CONSTRAINT, @archetype_constraint
-    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY, @cardinality
-  end
-
-  def test_create
-    c_complex_object = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.create(:node_id => 'test_node',
-                                                                                         :attributes => [1,2],
-                                                                                         :assumed_value => Array
-                                                                                         )
-    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT, c_complex_object
-    assert_equal 'test_node', c_complex_object.node_id
-  end
-end
-
-class ArchetypeModelPrimitiveTest < Test::Unit::TestCase
-  def setup
-    @c_primitive = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_PRIMITIVE.new
-    @c_boolean = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true,
-                                                                                    :false_valid => true,
-                                                                                    :assumed_value => true)
-    @c_string = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_STRING.new
-    @c_integer = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_INTEGER.new
-    @c_real = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_REAL.new
-    @c_time = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_TIME.new
-    @c_date = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE.new
-    @c_date_time = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE_TIME.new
-    @c_duration = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DURATION.new
-  end
-
-  def test_init
-    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_PRIMITIVE, @c_primitive
-    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN, @c_boolean
-    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_STRING, @c_string
-    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_INTEGER, @c_integer
-    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_REAL, @c_real
-    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_TIME, @c_time
-    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE, @c_date
-    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DATE_TIME, @c_date_time
-    assert_instance_of OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_DURATION, @c_duration
-  end
-
   def test_primitive
-    assert @c_boolean.true_valid
-    assert @c_boolean.false_valid
+    assert @c_boolean.true_valid?
+    assert @c_boolean.false_valid?
     assert @c_boolean.assumed_value
     assert @c_boolean.has_assumed_value?
     assert @c_boolean.default_value
     assert @c_boolean.default_value(true)
-    assert_raise(ArgumentError) do
-      @c_boolean.true_valid = false
-      @c_boolean.false_valid = false
-    end
-    assert_raise(ArgumentError) do 
-      OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid =>false,
-                                                                         :false_valid => false,
-                                                                         :assumed_value => false)
-    end
-  end
-  
-end
-
-class ArchetypeModelOntologyTest < Test::Unit::TestCase
-  def setup
-    @archetype_ontology = OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY.new
-    @archetype_term = OpenEHR::AM::Archetype::Ontology::ARCHETYPE_TERM.new(:code => '', :items => '')
-  end
-
-  def test_init
-    assert_instance_of OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY, @archetype_ontology
-    assert_instance_of OpenEHR::AM::Archetype::Ontology::ARCHETYPE_TERM, @archetype_term
-  end
-end
-    
-class ArchetypeModelAssertionTest < Test::Unit::TestCase
-  def setup
-    @assertion = OpenEHR::AM::Archetype::Assertion::ASSERTION.new
-    @assertion_variable = OpenEHR::AM::Archetype::Assertion::ASSERTION_VARIABLE.new
-    @operator_kind = OpenEHR::AM::Archetype::Assertion::OPERATOR_KIND.new
-    @expr_item = OpenEHR::AM::Archetype::Assertion::EXPR_ITEM.new
-    @expr_leaf = OpenEHR::AM::Archetype::Assertion::EXPR_LEAF.new
-    @expr_operator = OpenEHR::AM::Archetype::Assertion::EXPR_OPERATOR.new
-    @expr_unary_operator = OpenEHR::AM::Archetype::Assertion::EXPR_UNARY_OPERATOR.new
-    @expr_binary_operator = OpenEHR::AM::Archetype::Assertion::EXPR_BINARY_OPERATOR.new
-  end
-
-  def test_init
-    assert_instance_of OpenEHR::AM::Archetype::Assertion::ASSERTION, @assertion
-    assert_instance_of OpenEHR::AM::Archetype::Assertion::ASSERTION_VARIABLE, @assertion_variable
-    assert_instance_of OpenEHR::AM::Archetype::Assertion::OPERATOR_KIND, @operator_kind
-    assert_instance_of OpenEHR::AM::Archetype::Assertion::EXPR_ITEM, @expr_item
-    assert_instance_of OpenEHR::AM::Archetype::Assertion::EXPR_LEAF, @expr_leaf
-    assert_instance_of OpenEHR::AM::Archetype::Assertion::EXPR_OPERATOR, @expr_operator
-    assert_instance_of OpenEHR::AM::Archetype::Assertion::EXPR_UNARY_OPERATOR, @expr_unary_operator
-    assert_instance_of OpenEHR::AM::Archetype::Assertion::EXPR_BINARY_OPERATOR, @expr_binary_operator
+    assert_raise(ArgumentError) {@c_boolean.set_true_valid(false); @c_boolean.set_false_valid(false)}
+    assert_raise(ArgumentError) {OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_Boolean.new(false,false,false)}
   end
 end
 
-class ArchetypeModelProfileTest < Test::Unit::TestCase
-  def setup
-    @c_dv_state = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::C_DV_STATE.new
-    @state_machine = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::STATE_MACHINE.new
-    @state = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::STATE.new
-    @terminal_state = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::TERMINAL_STATE.new
-    @non_terminal_state = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::NON_TERMINAL_STATE.new
-    @transition = OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::TRANSITION.new
-
-    @c_code_phase = OpenEHR::AM::OpenEHR_Profile::Data_Types::Text::C_CODE_PHASE.new
-
-    @c_dv_quantity = OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_DV_QUANTITY.new
-    @c_dv_ordinal = OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_DV_ORDINAL.new
-    @c_quantity_item = OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_QUANTITY_ITEM.new
-  end
-
-  def test_init
-    assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::C_DV_STATE, @c_dv_state
-    assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::STATE_MACHINE, @state_machine
-    assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::STATE, @state
-    assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::TERMINAL_STATE, @terminal_state
-    assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::NON_TERMINAL_STATE, @non_terminal_state
-    assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Basic::TRANSITION, @transition
-    assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Text::C_CODE_PHASE, @c_code_phase
-    assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_DV_QUANTITY, @c_dv_quantity
-    assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_DV_ORDINAL, @c_dv_ordinal
-    assert_instance_of OpenEHR::AM::OpenEHR_Profile::Data_Types::Quantity::C_QUANTITY_ITEM, @c_quantity_item
-  end
-end
Index: /ruby/trunk/models/tests/test_reference_model.rb
===================================================================
--- /ruby/trunk/models/tests/test_reference_model.rb	(revision 30)
+++ /ruby/trunk/models/tests/test_reference_model.rb	(revision 20)
@@ -5,8 +5,6 @@
 class ReferenceModelTest < Test::Unit::TestCase
   def setup
-    @authored_resource = OpenEHR::RM::Common::Resource::AUTHORED_RESOURCE.new(:original_language => "ja",
-                                                                              :translations => "en",
-                                                                              :description => "test")
-    @translation_details = OpenEHR::RM::Common::Resource::TRANSLATION_DETAILS.new(nil,nil,nil,nil,nil)
+    @authored_resource = OpenEHR::RM::Common::Resource::Authored_Resource.new("ja","en","test")
+    @translation_details = OpenEHR::RM::Common::Resource::Translation_Details.new(nil,nil,nil,nil,nil)
 #    @openehr_definitions = OpenEHR::RM::Support::Definition::OpenEHR_Definitions.new
     @dv_boolean = OpenEHR::RM::Data_Types::Basic::DV_Boolean.new("TRUE")
@@ -21,6 +19,6 @@
   
   def test_init
-    assert_instance_of OpenEHR::RM::Common::Resource::AUTHORED_RESOURCE, @authored_resource
-    assert_instance_of OpenEHR::RM::Common::Resource::TRANSLATION_DETAILS, @translation_details
+    assert_instance_of OpenEHR::RM::Common::Resource::Authored_Resource, @authored_resource
+    assert_instance_of OpenEHR::RM::Common::Resource::Translation_Details, @translation_details
     assert_instance_of OpenEHR::RM::Data_Types::Basic::DV_Boolean, @dv_boolean
     assert_instance_of OpenEHR::RM::Data_Types::Basic::DV_State, @dv_state
@@ -31,5 +29,4 @@
     assert_instance_of OpenEHR::RM::Data_Types::Text::DV_Coded_Text, @dv_coded_text
   end
-
   def test_constant
     assert_equal("\r", OpenEHR::RM::Support::Definition::OpenEHR_Definitions::CR)
@@ -38,5 +35,4 @@
     assert_equal("\n", OpenEHR::RM::Data_Types::Basic::Data_Value::LF)
   end
-
   def test_dv_boolean
     assert @dv_boolean.value?
@@ -47,5 +43,4 @@
     assert_raise(ArgumentError){OpenEHR::RM::Data_Types::Basic::DV_Boolean.new(nil)}
   end
-
   def test_dv_state
     assert_equal("code1", @dv_state.value)
@@ -57,5 +52,4 @@
     assert_raise(ArgumentError) {OpenEHR::RM::Data_Types::Basic::DV_State.new(nil,nil)}
   end
-
   def test_dv_identifier
     assert_equal("Ruby Hospital", @dv_identifier.assigner)
@@ -73,5 +67,4 @@
     assert_raise(ArgumentError) {OpenEHR::RM::Data_Types::Basic::DV_Identifier.new(nil, nil, nil, nil)}
   end
-
   def test_dv_uri
     assert_equal("file0", @dv_uri.fragment_id)
@@ -84,5 +77,4 @@
     assert_equal("/openehr-jp/", @dv_uri.path)
   end
-
   def test_dv_ehr_uri
     assert_equal("ehr", @dv_ehr_uri.scheme)
@@ -90,29 +82,36 @@
       @dv_ehr_uri.value="svn://www.openehr.jp/openehr-jp/" }
   end
-
   def test_dv_text
     assert_equal("valid value", @dv_text.value)
-    assert_raise(ArgumentError){@dv_text.value = "not valid value\n"}
-    assert_raise(ArgumentError){@dv_text.value = nil }
-    assert_raise(ArgumentError){@dv_text.value = "" }
-    assert_raise(ArgumentError){@dv_text.formatting = "" }
-    assert_raise(ArgumentError){@dv_text.encoding = ""}
-    assert_raise(ArgumentError){@dv_text.language = ""}
-    assert_raise(ArgumentError){@dv_text.mappings = Set.new}
-    assert_raise(ArgumentError){@dv_text.mappings = ""}
-    assert_raise(ArgumentError){@dv_text.language = ""}
+    assert_raise(ArgumentError){
+      @dv_text.value = "not valid value\n"}
+    assert_raise(ArgumentError){
+      @dv_text.value = nil }
+    assert_raise(ArgumentError){
+      @dv_text.value = "" }
+    assert_raise(ArgumentError){
+      @dv_text.formatting = "" }
+    assert_raise(ArgumentError){
+      @dv_text.encoding = ""}
+    assert_raise(ArgumentError){
+      @dv_text.language = ""}
+    assert_raise(ArgumentError){
+      @dv_text.mappings = Set.new}
+    assert_raise(ArgumentError){
+      @dv_text.mappings = ""}
+    assert_raise(ArgumentError){
+      @dv_text.language = ""}
   end
-
   def test_dv_coded_text
     assert_equal("valid value", @dv_coded_text.value)
     assert_equal("AT1000", @dv_coded_text.defining_code)
-    assert_raise(ArgumentError){@dv_coded_text.defining_code=nil}
+    assert_raise(ArgumentError){
+      @dv_coded_text.defining_code=nil}
   end
-
   def test_dv_paragraph
     assert_equal((Set.new ["test1", "test2"]), @dv_paragraph.items)
-    assert_raise(ArgumentError){@dv_paragraph.items=Set.new}
+    assert_raise(ArgumentError){
+      @dv_paragraph.items=Set.new}
   end
-
   def test_terminology_mapping
     
@@ -120,17 +119,2 @@
 end
 
-
-class ReferenceModelSupportIdentificationTest < Test::Unit::TestCase
-  def setup
-    @object_id = OpenEHR::RM::Support::Identification::OBJECT_ID.new
-    @terminology_id = OpenEHR::RM::Support::Identification::TERMINOLOGY_ID.new('terminology','version')
-    @archetype_id = OpenEHR::RM::Support::Identification::ARCHETYPE_ID.new
-  end
-  
-  def test_init
-    assert_instance_of OpenEHR::RM::Support::Identification::OBJECT_ID, @object_id
-    assert_instance_of OpenEHR::RM::Support::Identification::TERMINOLOGY_ID, @terminology_id
-    assert_instance_of OpenEHR::RM::Support::Identification::ARCHETYPE_ID, @archetype_id
-
-  end
-end
