Index: /ruby/trunk/adl_parser/lib/parser.rb
===================================================================
--- /ruby/trunk/adl_parser/lib/parser.rb	(revision 22)
+++ /ruby/trunk/adl_parser/lib/parser.rb	(revision 23)
@@ -27,5 +27,5 @@
     class Parser < Racc::Parser
 
-module_eval <<'..end lib/parser.y modeval..idc7c14292e8', 'lib/parser.y', 1010
+module_eval <<'..end lib/parser.y modeval..id4cf2f1104b', 'lib/parser.y', 1079
 
 def assert_at(file,line, message = "")
@@ -820,5 +820,5 @@
 
 
-..end lib/parser.y modeval..idc7c14292e8
+..end lib/parser.y modeval..id4cf2f1104b
 
 ##### racc 1.4.5 generates ###
@@ -852,8 +852,8 @@
  2, 102, :_reduce_none,
  1, 110, :_reduce_26,
- 1, 110, :_reduce_none,
+ 1, 110, :_reduce_27,
  5, 111, :_reduce_28,
  5, 111, :_reduce_29,
- 2, 113, :_reduce_none,
+ 2, 113, :_reduce_30,
  1, 115, :_reduce_31,
  2, 115, :_reduce_32,
@@ -870,5 +870,5 @@
  1, 120, :_reduce_none,
  1, 120, :_reduce_none,
- 3, 121, :_reduce_none,
+ 3, 121, :_reduce_45,
  4, 122, :_reduce_none,
  3, 122, :_reduce_none,
@@ -915,7 +915,7 @@
  1, 151, :_reduce_none,
  1, 151, :_reduce_none,
- 1, 152, :_reduce_none,
- 2, 152, :_reduce_none,
- 3, 152, :_reduce_none,
+ 1, 152, :_reduce_90,
+ 2, 152, :_reduce_91,
+ 3, 152, :_reduce_92,
  3, 154, :_reduce_93,
  1, 155, :_reduce_94,
@@ -929,10 +929,10 @@
  3, 160, :_reduce_102,
  1, 161, :_reduce_103,
- 1, 162, :_reduce_none,
- 2, 162, :_reduce_none,
+ 1, 162, :_reduce_104,
+ 2, 162, :_reduce_105,
  3, 163, :_reduce_106,
  3, 164, :_reduce_107,
- 1, 158, :_reduce_none,
- 2, 158, :_reduce_none,
+ 1, 158, :_reduce_108,
+ 2, 158, :_reduce_109,
  2, 166, :_reduce_110,
  3, 166, :_reduce_111,
@@ -992,7 +992,7 @@
  4, 193, :_reduce_none,
  3, 193, :_reduce_none,
- 1, 176, :_reduce_none,
- 2, 176, :_reduce_none,
- 2, 176, :_reduce_none,
+ 1, 176, :_reduce_167,
+ 2, 176, :_reduce_168,
+ 2, 176, :_reduce_169,
  3, 186, :_reduce_none,
  3, 186, :_reduce_none,
@@ -1007,6 +1007,6 @@
  4, 194, :_reduce_none,
  3, 194, :_reduce_none,
- 1, 177, :_reduce_none,
- 1, 177, :_reduce_none,
+ 1, 177, :_reduce_182,
+ 1, 177, :_reduce_183,
  3, 187, :_reduce_none,
  3, 187, :_reduce_none,
@@ -1131,5 +1131,5 @@
  1, 210, :_reduce_none,
  0, 116, :_reduce_none,
- 5, 116, :_reduce_none,
+ 5, 116, :_reduce_306,
  2, 116, :_reduce_none,
  1, 209, :_reduce_none,
@@ -2106,41 +2106,56 @@
   def _reduce_26( val, _values, result )
     assert_at(__FILE__,__LINE__){val[0].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT)}
-                      
-    result = val[0]
-   result
-  end
-.,.,
-
- # reduce 27 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 118
+    @@log.info("#{__FILE__}:#{__LINE__}: c_complex_object = #{val[0]} at #{@filename}:#{@lineno}")
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 114
+  def _reduce_27( val, _values, result )
+    result = val[0]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 125
   def _reduce_28( val, _values, result )
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 125
+    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', 133
   def _reduce_29( val, _values, result )
-    result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new(
-                                                                            :assumed_value => val[0],
-                                                                            :attributes => val[2]
-                                                                            )
-   result
-  end
-.,.,
-
- # reduce 30 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 134
+    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', 140
+  def _reduce_30( val, _values, result )
+    result = {:c_complex_object_id => val[0], :c_occurrences => val[1]}
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 145
   def _reduce_31( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 138
+    result = {:type_identifier => val[0]}
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 149
   def _reduce_32( val, _values, result )
-    result = {:c_complex_object_id => {:type_identifier => val[0], :V_LOCAL_TERM_CODE_REF => val[1]}}
+    result = {:type_identifier => val[0], :local_term_code_ref => val[1]}
    result
   end
@@ -2149,5 +2164,5 @@
  # reduce 33 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 144
+module_eval <<'.,.,', 'lib/parser.y', 155
   def _reduce_34( val, _values, result )
     result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new(:attributes => val[0])
@@ -2156,5 +2171,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 152
+module_eval <<'.,.,', 'lib/parser.y', 163
   def _reduce_35( val, _values, result )
     result = val[0]
@@ -2163,5 +2178,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 156
+module_eval <<'.,.,', 'lib/parser.y', 167
   def _reduce_36( val, _values, result )
     result = OpenEHR::AM::Archetype::Constraint_Model::C_COMPLEX_OBJECT.new
@@ -2170,5 +2185,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 160
+module_eval <<'.,.,', 'lib/parser.y', 171
   def _reduce_37( val, _values, result )
     result = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_INTERNAL_REF.new
@@ -2177,5 +2192,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 164
+module_eval <<'.,.,', 'lib/parser.y', 175
   def _reduce_38( val, _values, result )
     result = OpenEHR::AM::Archetype::Constraint_Model::ARCHETYPE_SLOT.new
@@ -2184,5 +2199,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 168
+module_eval <<'.,.,', 'lib/parser.y', 179
   def _reduce_39( val, _values, result )
     result = OpenEHR::AM::Archetype::Constraint_Model::CONSTRAINT_REF.new
@@ -2191,5 +2206,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 172
+module_eval <<'.,.,', 'lib/parser.y', 183
   def _reduce_40( val, _values, result )
     result = val[0]
@@ -2198,5 +2213,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 176
+module_eval <<'.,.,', 'lib/parser.y', 187
   def _reduce_41( val, _values, result )
     result = val[0]
@@ -2205,5 +2220,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 180
+module_eval <<'.,.,', 'lib/parser.y', 191
   def _reduce_42( val, _values, result )
     result = val[0]
@@ -2216,5 +2231,10 @@
  # reduce 44 omitted
 
- # reduce 45 omitted
+module_eval <<'.,.,', 'lib/parser.y', 206
+  def _reduce_45( val, _values, result )
+    result = val[1]
+   result
+  end
+.,.,
 
  # reduce 46 omitted
@@ -2232,5 +2252,5 @@
  # reduce 52 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 212
+module_eval <<'.,.,', 'lib/parser.y', 226
   def _reduce_53( val, _values, result )
     assert_at(__FILE__,__LINE__){val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_PRIMITIVE)}
@@ -2240,5 +2260,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 218
+module_eval <<'.,.,', 'lib/parser.y', 232
   def _reduce_54( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: c_integer = #{val[0]} at #{@filename}:#{@lineno}")
@@ -2248,5 +2268,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 223
+module_eval <<'.,.,', 'lib/parser.y', 237
   def _reduce_55( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: c_real = #{val[0]} at #{@filename}:#{@lineno}")
@@ -2256,5 +2276,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 228
+module_eval <<'.,.,', 'lib/parser.y', 242
   def _reduce_56( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: c_date = #{val[0]} at #{@filename}:#{@lineno}")
@@ -2264,5 +2284,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 233
+module_eval <<'.,.,', 'lib/parser.y', 247
   def _reduce_57( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: c_time = #{val[0]} at #{@filename}:#{@lineno}")
@@ -2272,5 +2292,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 238
+module_eval <<'.,.,', 'lib/parser.y', 252
   def _reduce_58( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: c_date_time = #{val[0]} at #{@filename}:#{@lineno}")
@@ -2280,5 +2300,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 243
+module_eval <<'.,.,', 'lib/parser.y', 257
   def _reduce_59( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: c_duration = #{val[0]} at #{@filename}:#{@lineno}")
@@ -2288,5 +2308,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 248
+module_eval <<'.,.,', 'lib/parser.y', 262
   def _reduce_60( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: c_string = #{val[0]} at #{@filename}:#{@lineno}")
@@ -2296,5 +2316,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 254
+module_eval <<'.,.,', 'lib/parser.y', 268
   def _reduce_61( val, _values, result )
     assert_at(__FILE__,__LINE__){val[0].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN)}
@@ -2307,5 +2327,5 @@
  # reduce 62 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 264
+module_eval <<'.,.,', 'lib/parser.y', 278
   def _reduce_63( val, _values, result )
     result = [val[0]]
@@ -2314,5 +2334,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 268
+module_eval <<'.,.,', 'lib/parser.y', 282
   def _reduce_64( val, _values, result )
     result = (val[0] << val[1])
@@ -2321,5 +2341,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 277
+module_eval <<'.,.,', 'lib/parser.y', 291
   def _reduce_65( val, _values, result )
     assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE)}
@@ -2331,5 +2351,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 282
+module_eval <<'.,.,', 'lib/parser.y', 296
   def _reduce_66( val, _values, result )
     assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE)}
@@ -2339,5 +2359,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 287
+module_eval <<'.,.,', 'lib/parser.y', 301
   def _reduce_67( val, _values, result )
     assert_at(__FILE__,__LINE__){ val[0].kind_of?(OpenEHR::AM::Archetype::Constraint_Model::C_ATTRIBUTE)}
@@ -2347,5 +2367,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 298
+module_eval <<'.,.,', 'lib/parser.y', 312
   def _reduce_68( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER = #{val[0]}, c_existence = #{val[1]} at #{@filename}")
@@ -2358,5 +2378,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 308
+module_eval <<'.,.,', 'lib/parser.y', 322
   def _reduce_69( val, _values, result )
     assert_at(__FILE__,__LINE__){ val[2].instance_of?(OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY) }
@@ -2371,5 +2391,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 313
+module_eval <<'.,.,', 'lib/parser.y', 327
   def _reduce_70( val, _values, result )
     result = Array[val[0]]
@@ -2378,5 +2398,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 317
+module_eval <<'.,.,', 'lib/parser.y', 331
   def _reduce_71( val, _values, result )
     result = (val[0] << val[1])
@@ -2385,5 +2405,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 321
+module_eval <<'.,.,', 'lib/parser.y', 335
   def _reduce_72( val, _values, result )
     result = Array[val[0]]
@@ -2416,6 +2436,7 @@
  # reduce 84 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 351
+module_eval <<'.,.,', 'lib/parser.y', 366
   def _reduce_85( val, _values, result )
+    dadl_sections = val[1]
     result = OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY.new
    result
@@ -2431,18 +2452,34 @@
  # reduce 89 omitted
 
- # reduce 90 omitted
-
- # reduce 91 omitted
-
- # reduce 92 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 370
+module_eval <<'.,.,', 'lib/parser.y', 380
+  def _reduce_90( val, _values, result )
+    result = Array[val[0]]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 384
+  def _reduce_91( val, _values, result )
+    result = (val[0] << val[1])
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 388
+  def _reduce_92( val, _values, result )
+    result = (val[0] << val[2])
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 394
   def _reduce_93( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: attr_id = #{val[0]}, object_block = #{val[2]} at #{@filename}:#{@lineno}")
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 376
+    result = {:attr_id => val[0], :object_block => val[2]}
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 400
   def _reduce_94( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}:#{@lineno}")
@@ -2454,5 +2491,5 @@
  # reduce 95 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 382
+module_eval <<'.,.,', 'lib/parser.y', 406
   def _reduce_96( val, _values, result )
     result = val[0]
@@ -2461,5 +2498,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 386
+module_eval <<'.,.,', 'lib/parser.y', 410
   def _reduce_97( val, _values, result )
     result = val[0]
@@ -2468,5 +2505,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 391
+module_eval <<'.,.,', 'lib/parser.y', 415
   def _reduce_98( val, _values, result )
     result = val[0]
@@ -2475,5 +2512,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 395
+module_eval <<'.,.,', 'lib/parser.y', 419
   def _reduce_99( val, _values, result )
     result = val[0]
@@ -2482,26 +2519,26 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 400
+module_eval <<'.,.,', 'lib/parser.y', 424
   def _reduce_100( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 404
+    result = {:untyped_multiple_attr_object_block => val[0]}
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 428
   def _reduce_101( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 409
+    result = {:type_identifier => val[0], :untyped_multiple_attr_object_block => val[1]}
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 433
   def _reduce_102( val, _values, result )
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 415
+    result = {:multiple_attr_object_block_head => val[0], :keyed_objects => val[1]}
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 439
   def _reduce_103( val, _values, result )
     @@log.info("SYM_START_DBLOCK: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2511,16 +2548,27 @@
 .,.,
 
- # reduce 104 omitted
-
- # reduce 105 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 423
+module_eval <<'.,.,', 'lib/parser.y', 444
+  def _reduce_104( val, _values, result )
+    result = Array[val[0]]
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 448
+  def _reduce_105( val, _values, result )
+    result = (val[0] << val[1])
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 454
   def _reduce_106( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: keyed_object = #{val[0]}, object_block = #{val[2]} at #{@filename}:#{@lineno}")
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 429
+    result = {:object_key => val[0], :object_block => val[1]}
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 460
   def _reduce_107( val, _values, result )
     @@log.info("object_key: [#{val[1]}] at #{@filename}:#{@lineno}")
@@ -2530,20 +2578,30 @@
 .,.,
 
- # reduce 108 omitted
-
- # reduce 109 omitted
-
-module_eval <<'.,.,', 'lib/parser.y', 437
+module_eval <<'.,.,', 'lib/parser.y', 465
+  def _reduce_108( val, _values, result )
+    result = {:untyped_single_attr_object_block => val[0]}
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 469
+  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', 475
   def _reduce_110( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: single_attr_object_complex_head = #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 442
+    result = {:single_attr_object_complex_head => val[0]}
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 480
   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 = val[0]
+    result = {:single_attr_object_complex_head => val[0], :attr_vals => val[1]}
    result
   end
@@ -2552,21 +2610,21 @@
  # reduce 112 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 448
+module_eval <<'.,.,', 'lib/parser.y', 486
   def _reduce_113( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: untyped_primitive_object_block = #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 453
+    result = {:untyped_primitive_object_block => val[0]}
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 491
   def _reduce_114( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: type_identifier = #{val[0]}, untyped_primitive_object_block = #{val[1]} at #{@filename}:#{@lineno}")
-    result = val[0]
-   result
-  end
-.,.,
-
-module_eval <<'.,.,', 'lib/parser.y', 458
+    result = {:type_identifier => val[0], :untyped_primitive_object_block => val[1]}
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 496
   def _reduce_115( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: primitive_object_block = <#{val[1]}> at #{@filename}:#{@lineno}")
@@ -2576,5 +2634,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 462
+module_eval <<'.,.,', 'lib/parser.y', 500
   def _reduce_116( val, _values, result )
     result = val[0]
@@ -2583,5 +2641,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 466
+module_eval <<'.,.,', 'lib/parser.y', 504
   def _reduce_117( val, _values, result )
     result = val[0]
@@ -2590,5 +2648,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 470
+module_eval <<'.,.,', 'lib/parser.y', 508
   def _reduce_118( val, _values, result )
     result = val[0]
@@ -2597,5 +2655,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 474
+module_eval <<'.,.,', 'lib/parser.y', 512
   def _reduce_119( val, _values, result )
     result = val[0]
@@ -2604,5 +2662,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 478
+module_eval <<'.,.,', 'lib/parser.y', 516
   def _reduce_120( val, _values, result )
     result = val[0]
@@ -2611,5 +2669,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 483
+module_eval <<'.,.,', 'lib/parser.y', 521
   def _reduce_121( val, _values, result )
     @@log.info("string_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2619,5 +2677,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 488
+module_eval <<'.,.,', 'lib/parser.y', 526
   def _reduce_122( val, _values, result )
     @@log.info("integer_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2627,5 +2685,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 493
+module_eval <<'.,.,', 'lib/parser.y', 531
   def _reduce_123( val, _values, result )
     @@log.info("real_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2635,5 +2693,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 498
+module_eval <<'.,.,', 'lib/parser.y', 536
   def _reduce_124( val, _values, result )
     @@log.info("boolean_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2643,5 +2701,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 503
+module_eval <<'.,.,', 'lib/parser.y', 541
   def _reduce_125( val, _values, result )
     @@log.info("character_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2651,5 +2709,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 508
+module_eval <<'.,.,', 'lib/parser.y', 546
   def _reduce_126( val, _values, result )
     @@log.info("date_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2659,5 +2717,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 513
+module_eval <<'.,.,', 'lib/parser.y', 551
   def _reduce_127( val, _values, result )
     @@log.info("time_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2667,5 +2725,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 518
+module_eval <<'.,.,', 'lib/parser.y', 556
   def _reduce_128( val, _values, result )
     @@log.info("date_time_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2675,5 +2733,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 523
+module_eval <<'.,.,', 'lib/parser.y', 561
   def _reduce_129( val, _values, result )
     @@log.info("duration_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2683,5 +2741,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 528
+module_eval <<'.,.,', 'lib/parser.y', 566
   def _reduce_130( val, _values, result )
     @@log.info("uri_value: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2721,5 +2779,5 @@
  # reduce 145 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 551
+module_eval <<'.,.,', 'lib/parser.y', 589
   def _reduce_146( val, _values, result )
     @@log.info("V_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2729,5 +2787,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 556
+module_eval <<'.,.,', 'lib/parser.y', 594
   def _reduce_147( val, _values, result )
     @@log.info("V_GENERIC_TYPE_IDENTIFIER: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2737,5 +2795,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 562
+module_eval <<'.,.,', 'lib/parser.y', 600
   def _reduce_148( val, _values, result )
     @@log.info("V_STRING: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2751,5 +2809,5 @@
  # reduce 151 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 576
+module_eval <<'.,.,', 'lib/parser.y', 614
   def _reduce_152( val, _values, result )
     begin
@@ -2763,5 +2821,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 585
+module_eval <<'.,.,', 'lib/parser.y', 623
   def _reduce_153( val, _values, result )
     begin
@@ -2775,5 +2833,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 594
+module_eval <<'.,.,', 'lib/parser.y', 632
   def _reduce_154( val, _values, result )
     begin
@@ -2811,9 +2869,39 @@
  # reduce 166 omitted
 
- # reduce 167 omitted
-
- # reduce 168 omitted
-
- # reduce 169 omitted
+module_eval <<'.,.,', 'lib/parser.y', 658
+  def _reduce_167( val, _values, result )
+    begin
+      real = Float(val[0])
+    rescue
+      raise
+    end
+    result = real
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 667
+  def _reduce_168( val, _values, result )
+    begin
+      real = Float(val[0])
+    rescue
+      raise
+    end
+    result = real
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 676
+  def _reduce_169( val, _values, result )
+    begin
+      real = Float(val[0])
+    rescue
+      raise
+    end
+    result = - real
+   result
+  end
+.,.,
 
  # reduce 170 omitted
@@ -2841,7 +2929,17 @@
  # reduce 181 omitted
 
- # reduce 182 omitted
-
- # reduce 183 omitted
+module_eval <<'.,.,', 'lib/parser.y', 696
+  def _reduce_182( val, _values, result )
+    result = true
+   result
+  end
+.,.,
+
+module_eval <<'.,.,', 'lib/parser.y', 700
+  def _reduce_183( val, _values, result )
+    result = false
+   result
+  end
+.,.,
 
  # reduce 184 omitted
@@ -2937,5 +3035,5 @@
  # reduce 229 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 698
+module_eval <<'.,.,', 'lib/parser.y', 764
   def _reduce_230( val, _values, result )
     @@log.info("V_ISO8601_DURATION: #{val[0]} at #{@filename}:#{@lineno}")
@@ -2969,5 +3067,5 @@
  # reduce 242 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 717
+module_eval <<'.,.,', 'lib/parser.y', 783
   def _reduce_243( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: V_QUALIFIED_TERM_CODE_REF = #{val[0]} at #{@filename}:#{@lineno}")
@@ -2982,5 +3080,5 @@
  # reduce 246 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 726
+module_eval <<'.,.,', 'lib/parser.y', 792
   def _reduce_247( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}: V_URI = #{val[0]} at #{@filename}:#{@lineno}")
@@ -3069,5 +3167,5 @@
  # reduce 287 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 795
+module_eval <<'.,.,', 'lib/parser.y', 861
   def _reduce_288( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}")
@@ -3076,5 +3174,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 799
+module_eval <<'.,.,', 'lib/parser.y', 865
   def _reduce_289( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{val[0]} at #{@filename}")
@@ -3083,5 +3181,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 810
+module_eval <<'.,.,', 'lib/parser.y', 876
   def _reduce_290( val, _values, result )
     result = Range.new(1,1)
@@ -3090,5 +3188,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 814
+module_eval <<'.,.,', 'lib/parser.y', 880
   def _reduce_291( val, _values, result )
     result = val[3]
@@ -3097,5 +3195,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 824
+module_eval <<'.,.,', 'lib/parser.y', 890
   def _reduce_292( val, _values, result )
     begin
@@ -3109,5 +3207,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 834
+module_eval <<'.,.,', 'lib/parser.y', 900
   def _reduce_293( val, _values, result )
     begin
@@ -3122,5 +3220,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 839
+module_eval <<'.,.,', 'lib/parser.y', 905
   def _reduce_294( val, _values, result )
     result = OpenEHR::AM::Archetype::Constraint_Model::CARDINALITY.new
@@ -3151,5 +3249,10 @@
  # reduce 305 omitted
 
- # reduce 306 omitted
+module_eval <<'.,.,', 'lib/parser.y', 924
+  def _reduce_306( val, _values, result )
+    result = val[3]
+   result
+  end
+.,.,
 
  # reduce 307 omitted
@@ -3245,5 +3348,5 @@
  # reduce 352 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 925
+module_eval <<'.,.,', 'lib/parser.y', 994
   def _reduce_353( val, _values, result )
     result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true)
@@ -3252,5 +3355,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 929
+module_eval <<'.,.,', 'lib/parser.y', 998
   def _reduce_354( val, _values, result )
     result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => false)
@@ -3259,5 +3362,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 933
+module_eval <<'.,.,', 'lib/parser.y', 1002
   def _reduce_355( val, _values, result )
     result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => true,:false_valid => false)
@@ -3266,5 +3369,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 937
+module_eval <<'.,.,', 'lib/parser.y', 1006
   def _reduce_356( val, _values, result )
     result = OpenEHR::AM::Archetype::Constraint_Model::Primitive::C_BOOLEAN.new(:true_valid => false,:false_valid => true)
@@ -3273,5 +3376,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 942
+module_eval <<'.,.,', 'lib/parser.y', 1011
   def _reduce_357( val, _values, result )
     result = val[0]
@@ -3280,5 +3383,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 946
+module_eval <<'.,.,', 'lib/parser.y', 1015
   def _reduce_358( val, _values, result )
     raise 'Not implemented yet'
@@ -3287,5 +3390,5 @@
 .,.,
 
-module_eval <<'.,.,', 'lib/parser.y', 950
+module_eval <<'.,.,', 'lib/parser.y', 1019
   def _reduce_359( val, _values, result )
     raise 'Not implemented yet'
@@ -3304,5 +3407,5 @@
  # reduce 364 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 963
+module_eval <<'.,.,', 'lib/parser.y', 1032
   def _reduce_365( val, _values, result )
     @in_interval = false
@@ -3328,5 +3431,5 @@
  # reduce 373 omitted
 
-module_eval <<'.,.,', 'lib/parser.y', 985
+module_eval <<'.,.,', 'lib/parser.y', 1054
   def _reduce_374( val, _values, result )
     @@log.info("#{__FILE__}:#{__LINE__}, V_ATTRIBUTE_IDENTIFIER = #{word} at #{@filename}")
Index: /ruby/trunk/adl_parser/lib/parser.y
===================================================================
--- /ruby/trunk/adl_parser/lib/parser.y	(revision 22)
+++ /ruby/trunk/adl_parser/lib/parser.y	(revision 23)
@@ -106,8 +106,11 @@
   { 
     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
 
@@ -115,12 +118,17 @@
 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.new
+    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.new(
-                                                                            :assumed_value => val[0],
-                                                                            :attributes => val[2]
-                                                                            )
+    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
@@ -128,12 +136,15 @@
 
 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 = val[0]
+    result = {:type_identifier => val[0]}
   }
   | type_identifier V_LOCAL_TERM_CODE_REF
   {
-    result = {:c_complex_object_id => {:type_identifier => val[0], :V_LOCAL_TERM_CODE_REF => val[1]}}
+    result = {:type_identifier => val[0], :local_term_code_ref => val[1]}
   }
 
@@ -191,4 +202,7 @@
 
 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.
@@ -348,4 +362,5 @@
 arch_ontology: SYM_ONTOLOGY dadl_section
   { 
+    dadl_sections = val[1]
     result = OpenEHR::AM::Archetype::Ontology::ARCHETYPE_ONTOLOGY.new
   }
@@ -361,11 +376,20 @@
 
 attr_vals: attr_val
+  {
+    result = Array[val[0]]
+  }
   | attr_vals attr_val
+  {
+    result = (val[0] << val[1])
+  }
   | attr_vals Semicolon_code attr_val
-#  | attr_vals ';' attr_val
+  {
+    result = (val[0] << val[2])
+  }
 
 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]}
   }
 
@@ -397,14 +421,14 @@
 multiple_attr_object_block: untyped_multiple_attr_object_block
   { 
-    result = val[0]
+    result = {:untyped_multiple_attr_object_block => val[0]}
   }
   | type_identifier untyped_multiple_attr_object_block
   { 
-    result = val[0]
+    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 = val[0]
+    result = {:multiple_attr_object_block_head => val[0], :keyed_objects => val[1]}
   }
 
@@ -416,9 +440,16 @@
 
 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]}
   }
 
@@ -430,14 +461,21 @@
 
 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 = val[0]
+    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 = val[0]
+    result = {:single_attr_object_complex_head => val[0], :attr_vals => val[1]}
   }
 single_attr_object_complex_head: SYM_START_DBLOCK
@@ -445,10 +483,10 @@
   {
     @@log.info("#{__FILE__}:#{__LINE__}: untyped_primitive_object_block = #{val[0]} at #{@filename}:#{@lineno}")
-    result = val[0]
+    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 = val[0]
+    result = {:type_identifier => val[0], :untyped_primitive_object_block => val[1]}
   }
 untyped_primitive_object_block: SYM_START_DBLOCK primitive_object_value SYM_END_DBLOCK
@@ -611,8 +649,30 @@
 
 real_value: V_REAL
+  {
+    begin
+      real = Float(val[0])
+    rescue
+      raise
+    end
+    result = real
+  }
   | Plus_code V_REAL
+  {
+    begin
+      real = Float(val[0])
+    rescue
+      raise
+    end
+    result = real
+  }
   | Minus_code V_REAL
-#  | '+' V_REAL
-#  | '-' V_REAL
+  {
+    begin
+      real = Float(val[0])
+    rescue
+      raise
+    end
+    result = - real
+  }
 
 real_list_value: real_value Comma_code real_value
@@ -632,5 +692,11 @@
 
 boolean_value: SYM_TRUE
+  { 
+    result = true
+  }
   | SYM_FALSE
+  { 
+    result = false
+  }
 
 boolean_list_value: boolean_value Comma_code boolean_value
@@ -854,4 +920,7 @@
 c_occurrences:  #-- default to 1..1
   | SYM_OCCURRENCES SYM_MATCHES SYM_START_CBLOCK occurrence_spec SYM_END_CBLOCK
+  { 
+    result = val[3]
+  }
   | SYM_OCCURRENCES error
 
Index: /ruby/trunk/adl_parser/tests/parser_test.rb
===================================================================
--- /ruby/trunk/adl_parser/tests/parser_test.rb	(revision 22)
+++ /ruby/trunk/adl_parser/tests/parser_test.rb	(revision 23)
@@ -18,4 +18,5 @@
       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
     end
 
Index: /ruby/trunk/models/Rakefile
===================================================================
--- /ruby/trunk/models/Rakefile	(revision 22)
+++ /ruby/trunk/models/Rakefile	(revision 23)
@@ -48,5 +48,5 @@
 #  s.require_paths += [".","am","rm"]
   s.require_path = "."
-#  s.has_rdoc = true
+  s.has_rdoc = true
 #  s.extra_rdoc_files = ["README"]
 end
Index: /ruby/trunk/models/am.rb
===================================================================
--- /ruby/trunk/models/am.rb	(revision 22)
+++ /ruby/trunk/models/am.rb	(revision 23)
@@ -27,8 +27,30 @@
       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 22)
+++ /ruby/trunk/models/am/archetype/archetype.rb	(revision 23)
@@ -77,8 +77,13 @@
         def version
         end
-      end
+      end # end of ARCHETYPE
       # original file:
       # ref_imple_eiffel/components/adl_parser/src/interface/adl_definition.e
-    end # end of Archetype
+
+      class VALIDITY_KIND
+      end
+    end
+
+
   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 22)
+++ /ruby/trunk/models/am/archetype/archetype_description/archetype_description.rb	(revision 23)
@@ -11,5 +11,5 @@
         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 22)
+++ /ruby/trunk/models/am/archetype/constraint_model/archetype_constraint.rb	(revision 23)
@@ -8,18 +8,45 @@
         end
 
-        class C_OBJECT < ARCHETYPE_CONSTRAINT
+        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
 
@@ -27,4 +54,16 @@
           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
 
@@ -49,4 +88,22 @@
         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
     end
Index: /ruby/trunk/models/am/archetype/constraint_model/assertion.rb
===================================================================
--- /ruby/trunk/models/am/archetype/constraint_model/assertion.rb	(revision 22)
+++ /ruby/trunk/models/am/archetype/constraint_model/assertion.rb	(revision 23)
@@ -2,8 +2,27 @@
   module AM
     module Archetype
-      module Constraint_Model
-        module Assertion
-          class Assertion
-          end
+      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
         end
       end
Index: /ruby/trunk/models/am/archetype/constraint_model/primitive.rb
===================================================================
--- /ruby/trunk/models/am/archetype/constraint_model/primitive.rb	(revision 22)
+++ /ruby/trunk/models/am/archetype/constraint_model/primitive.rb	(revision 23)
@@ -6,5 +6,5 @@
         module Primitive
 
-          class C_Primitive
+          class C_PRIMITIVE
             def assumed_value
               raise NotImplementedError, "assumed_value should be implemented"
@@ -21,30 +21,29 @@
           end
 
-          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
+          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)
             end
-            def set_true_valid(true_valid)
+
+            def true_valid=(true_valid)
               binary_consistency(true_valid, @false_valid)
               @true_valid = true_valid
             end
-            def set_false_valid(false_valid)
+
+            def 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
@@ -63,7 +62,34 @@
           end # of C_Boolean
 
-          class C_Integer < C_Primitive
+          class C_STRING < 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
+            
+          end
+
+
+
         end # of Primitive
       end # of Constraint_Model
Index: /ruby/trunk/models/am/archetype/ontology.rb
===================================================================
--- /ruby/trunk/models/am/archetype/ontology.rb	(revision 22)
+++ /ruby/trunk/models/am/archetype/ontology.rb	(revision 23)
@@ -3,35 +3,47 @@
     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(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
+
+          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
           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 22)
+++ /ruby/trunk/models/am/openehr_profile/data_types/basic.rb	(revision 23)
@@ -1,6 +1,27 @@
 module OpenEHR
-  module RM
+  module AM
     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: /ruby/trunk/models/am/openehr_profile/data_types/quantity.rb
===================================================================
--- /ruby/trunk/models/am/openehr_profile/data_types/quantity.rb	(revision 23)
+++ /ruby/trunk/models/am/openehr_profile/data_types/quantity.rb	(revision 23)
@@ -0,0 +1,19 @@
+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: /ruby/trunk/models/am/openehr_profile/data_types/text.rb
===================================================================
--- /ruby/trunk/models/am/openehr_profile/data_types/text.rb	(revision 23)
+++ /ruby/trunk/models/am/openehr_profile/data_types/text.rb	(revision 23)
@@ -0,0 +1,12 @@
+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/tests/test_archetype_model.rb
===================================================================
--- /ruby/trunk/models/tests/test_archetype_model.rb	(revision 22)
+++ /ruby/trunk/models/tests/test_archetype_model.rb	(revision 23)
@@ -5,17 +5,31 @@
 class ArchetypeModelTest < Test::Unit::TestCase
   def setup
-    @archetype = OpenEHR::AM::Archetype::ARCHETYPE.new #(nil,nil,nil,nil,nil,nil,nil,nil)
+    @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
+  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
+  end
+end
+
+class ArchetypeModelConstraintTest < Test::Unit::TestCase
+  def setup
     @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
-
+    @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
@@ -24,19 +38,16 @@
     @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
+    @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::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
     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
@@ -46,16 +57,129 @@
     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) {@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)}
+    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
   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
