Index: /ruby/trunk/tests/adl_parser/Rakefile
===================================================================
--- /ruby/trunk/tests/adl_parser/Rakefile	(revision 46)
+++ /ruby/trunk/tests/adl_parser/Rakefile	(revision 46)
@@ -0,0 +1,116 @@
+require 'rubygems'
+Gem::manage_gems
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+require 'rake/clean'
+require 'rake/gempackagetask'
+require 'yaml'
+
+$DEBUG = false
+
+RACC_SRC = FileList["lib/*.y"]
+RACC_PARSER = FileList['lib/parser.rb']
+
+task :default => [:racc]
+
+desc "Generate parser by racc."
+task :racc => RACC_PARSER
+rule '.rb' => '.y' do |target|
+  if $DEBUG == true
+    sh "racc -v -g #{target.source} -o #{target.name}"
+  else
+    sh "racc #{target.source} -o #{target.name}"
+  end
+end
+
+
+RB_SRC = FileList["lib/*.rb"]
+TAGS = FileList['TAGS']
+desc "Generate TAGS by rtags."
+task :tags => TAGS
+rule 'TAGS' => RB_SRC do |target|
+  sh "rtags #{target.prerequisites.join(' ')}"
+end
+
+
+desc "Whole Unit tests"
+task 'test' => ['test:shell', 'test:validator', 'test:parser', 'test:scanner']
+
+
+Rake::TestTask.new('test:shell') do |t|
+  t.libs = ["lib"]
+  t.pattern = ['shell_test.rb']
+  t.warning = true
+  t.verbose = true
+end
+
+Rake::TestTask.new('test:validator') do |t|
+  t.libs = ["lib"]
+  t.pattern = ['validator_test.rb']
+  t.warning = true
+  t.verbose = true
+end
+
+Rake::TestTask.new('test:parser') do |t|
+  t.libs = ["lib"]
+  t.pattern = ['parser_test.rb']
+  t.warning = true
+  t.verbose = true
+end
+
+Rake::TestTask.new('test:scanner') do |t|
+  t.libs = ["lib"]
+  t.pattern = ['scanner_test.rb']
+  t.warning = true
+  t.verbose = true
+end
+
+
+Rake::RDocTask.new('rdoc') do |t|
+  t.rdoc_dir = 'rdoc'
+  t.rdoc_files.include('README', 'lib/*.rb', 'bin/*.rb')
+  t.main = 'README'
+  t.title = "ADL parser API documentation"
+end
+
+gem_spec = Gem::Specification.new do |s|
+  s.name = 'adl_parser'
+  s.author = 'Akimichi Tatsukawa'
+  s.version = '0.0.2'
+  s.summary = 'ADL parser'
+  s.email = 'akimichi_tatsukawa@nifty.com'
+  s.test_files = FileList['tests/*_test.rb', '*.adl']
+  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']
+  s.require_path = "lib"
+  s.has_rdoc = true
+  s.extra_rdoc_files = ["README"]
+  s.add_dependency("yaparc", ">= 0.2.2")
+  s.add_dependency("openehr_models", ">= 0.0.1")
+end
+
+Rake::GemPackageTask.new(gem_spec) do |pkg|
+  pkg.need_zip = false
+  pkg.need_tar = false
+end
+
+
+CLOBBER.include('rdoc')
+CLEAN.include('lib/*.output', 'log/*.log')
+
+
+
+
+### Local Variables:
+### mode:ruby
+### mode:font-lock
+### comment-column:0
+### comment-start: "### "
+### comment-end:"" 
+### End:
+
+
Index: /ruby/trunk/tests/adl_parser/dadl_embedded_cadl.dadl
===================================================================
--- /ruby/trunk/tests/adl_parser/dadl_embedded_cadl.dadl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/dadl_embedded_cadl.dadl	(revision 46)
@@ -0,0 +1,48 @@
+archetype_id = <"adl-test-OUTER.mixed_types.draft">
+concept = <"at0000">	--  empty definition test
+description = <
+	original_author = <
+		["name"] = <"Thomas Beale">
+		["organisation"] = <"OceanInformatics.biz">
+		["submission"] = <"01/05/2004">
+	>
+	lifecycle_state = <"draft">
+	details = <
+		["en"] = <
+			language = <"en">
+			purpose = <"Test archetype for mixed node types">
+			keywords = <"ADL", "test">
+			copyright = <"copyright (c) 2004 The openEHR Foundation">
+		>
+	>
+>
+definition = <{
+	OUTER[at0000] matches {
+		items cardinality matches {0..*; ordered} matches {
+			COMPLEX_OBJECT[at0001] matches {*}
+
+			use_node COMPLEX_OBJECT /items[at0001]
+
+			use_node COMPLEX_OBJECT /items[at0002]
+
+			COMPLEX_OBJECT[at0002] matches {*}
+
+			allow_archetype COMPLEX_OBJECT matches {
+				include
+					id matches {/.*/}
+			}
+
+			COMPLEX_OBJECT[at0003] matches {*}
+		}
+	}
+}>
+ontology = <
+	term_definitions = <
+		["en"] = <
+			["at0000"] = <text = <"outer object">; description = <"outer object">>
+			["at0001"] = <text = <"complex object 1">; description = <"complex object 1">>
+			["at0002"] = <text = <"complex object 2">; description = <"complex object 2">>
+			["at0003"] = <text = <"complex object 3">; description = <"complex object 3">>
+		>
+	>
+>
Index: /ruby/trunk/tests/adl_parser/dadl_line_break.dadl
===================================================================
--- /ruby/trunk/tests/adl_parser/dadl_line_break.dadl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/dadl_line_break.dadl	(revision 46)
@@ -0,0 +1,23 @@
+archetype_id = <"adl-test-OUTER.mixed_types.draft">
+concept = <"at0000">	--  empty definition test
+description = <
+	original_author = <
+		["name"] = <"Thomas Beale">
+		["organisation"] = <"OceanInformatics.biz">
+		["submission"] = <"01/05/2004">
+	>
+	lifecycle_state = <"draft">
+	details = <
+		["en"] = <
+			language = <"en">
+			purpose = <"Test archetype for mixed node types. This is a really long
+				paragraph in which all kinds of annoying whitespace and linebreaks
+				appear.
+				
+				Even new paragraphs. But you have to admit it makes the text more 
+				readable.">
+			keywords = <"ADL", "test">
+			copyright = <"copyright (c) 2004 The openEHR Foundation">
+		>
+	>
+>
Index: /ruby/trunk/tests/adl_parser/dparser_test.rb
===================================================================
--- /ruby/trunk/tests/adl_parser/dparser_test.rb	(revision 46)
+++ /ruby/trunk/tests/adl_parser/dparser_test.rb	(revision 46)
@@ -0,0 +1,22 @@
+#$:.unshift File.join(File.dirname(__FILE__))
+
+require 'lib/dparser.rb'
+require 'test/unit'
+
+class DADLParserTest < Test::Unit::TestCase
+  def setup
+    @parser = ::OpenEHR::DADLParser.new
+  end
+
+  def test_init
+    assert_instance_of ::OpenEHR::DADLParser,@parser
+  end
+
+  def test_parse
+    dadl_line_break = File.read('tests/dadl_line_break.dadl')
+    assert_nothing_raised do
+      @parser.parse(dadl_line_break, 'dadl_line_break')
+    end
+  end
+
+end
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-ACTION.imaging.v1.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-ACTION.imaging.v1.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-ACTION.imaging.v1.adl	(revision 46)
@@ -0,0 +1,275 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-ACTION.imaging.v1
+
+concept
+	[at0000]	-- Imaging investigation
+language
+	original_language = <[ISO_639-1::en]>
+description
+	original_author = <
+		["name"] = <"Sam Heard">
+		["organisation"] = <"Ocean Informatics">
+		["date"] = <"17/04/2006">
+		["email"] = <"sam.heard@oceaninformatics.biz">
+	>
+	details = <
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"To record actions regarding imaging investigations.">
+			use = <"">
+			keywords = <"Xray", "ultrasound", "MRI", "magnetic resonance", "CT", "scan", "tomography">
+			misuse = <"Not used for recording the findings of the investigation; use openEHR-EHR-OBSERVATION.imaging for the findings.">
+		>
+	>
+	lifecycle_state = <"AuthorDraft">
+	other_contributors = <>
+
+definition
+	ACTION[at0000] matches {	-- Imaging investigation
+		ism_transition matches {
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::524]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0001]}		-- Planned
+					}
+				}
+			}
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::524]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0004]}		-- Requested
+					}
+				}
+			}
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::527]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0002]}		-- Postponed
+					}
+				}
+			}
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::528]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0003]}		-- Cancelled
+					}
+				}
+			}
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::529]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0005]}		-- Appointment made
+					}
+				}
+			}
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::529]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0006]}		-- Resheduled
+					}
+				}
+			}
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::245]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0007]}		-- Commenced
+					}
+				}
+			}
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::245]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0008]}		-- Investigation complete
+					}
+				}
+			}
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::245]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0009]}		-- Reported
+					}
+				}
+			}
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::245]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0011]}		-- Report communicated
+					}
+				}
+			}
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::245]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0012]}		-- Further imaging required
+					}
+				}
+			}
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::530]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0013]}		-- Imaging suspended
+					}
+				}
+			}
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::531]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0014]}		-- Imaging aborted
+					}
+				}
+			}
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::532]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0010]}		-- Completed
+					}
+				}
+			}
+		}
+		description matches {
+			allow_archetype ITEM_TREE occurrences matches {0..1} matches {
+				include
+					archetype_id/value matches {/imaging\.v1/}
+				exclude
+					archetype_id/value matches {/.*/}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["en"] = <
+			items = <
+				["at0000"] = <
+					description = <"An action related to an investigation by an imaging technique">
+					text = <"Imaging investigation">
+				>
+				["at0001"] = <
+					description = <"Imaging investigation is planned">
+					text = <"Planned">
+				>
+				["at0002"] = <
+					description = <"Imaging investigation is postponed">
+					text = <"Postponed">
+				>
+				["at0003"] = <
+					description = <"Imaging investigation is cancelled">
+					text = <"Cancelled">
+				>
+				["at0004"] = <
+					description = <"Imaging investigation has been requested">
+					text = <"Requested">
+				>
+				["at0005"] = <
+					description = <"Imaging investigation scheduled for specific date and time">
+					text = <"Appointment made">
+				>
+				["at0006"] = <
+					description = <"Appointment for imaging investigation has been altered">
+					text = <"Resheduled">
+				>
+				["at0007"] = <
+					description = <"Imaging investigation has commenced">
+					text = <"Commenced">
+				>
+				["at0008"] = <
+					description = <"The imaging investigation has been completed; awaiting report">
+					text = <"Investigation complete">
+				>
+				["at0009"] = <
+					description = <"The imaging investigation has been reported">
+					text = <"Reported">
+				>
+				["at0010"] = <
+					description = <"The imaging investigation is completed and report processed">
+					text = <"Completed">
+				>
+				["at0011"] = <
+					description = <"The imaging investigation has been reported and communicated to the referer">
+					text = <"Report communicated">
+				>
+				["at0012"] = <
+					description = <"The investigator has established that further imaging is required">
+					text = <"Further imaging required">
+				>
+				["at0013"] = <
+					description = <"The imaging was not able to be completed">
+					text = <"Imaging suspended">
+				>
+				["at0014"] = <
+					description = <"The imaging investigation was not and will not be completed.">
+					text = <"Imaging aborted">
+				>
+			>
+		>
+	>
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-ACTION.referral.v1.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-ACTION.referral.v1.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-ACTION.referral.v1.adl	(revision 46)
@@ -0,0 +1,351 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-ACTION.referral.v1
+
+concept
+	[at0000]	-- Referral actions
+language
+	original_language = <[ISO_639-1::en]>
+	translations = <
+		["de"] = <
+			language = <[ISO_639-1::de]>
+			author = <
+				["name"] = <"Jasmin Buck, Sebastian Garde">
+				["organisation"] = <"University of Heidelberg, Central Queensland University">
+			>
+		>
+	>
+description
+	original_author = <
+		["name"] = <"Sam Heard">
+		["email"] = <"sam.heard@oceaninformatics.biz">
+	>
+	details = <
+		["de"] = <
+			language = <[ISO_639-1::de]>
+			purpose = <"Zur Dokumentation von Handlungen, die auf eine Behandlungsanfrage an einen zweiten Gesundheitsdienstleister basieren">
+			use = <"">
+			misuse = <"">
+		>
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"For recording actions based on a request for a second provider to provide care">
+			use = <"">
+			misuse = <"">
+		>
+	>
+	lifecycle_state = <"NotSet">
+	other_contributors = <>
+
+definition
+	ACTION[at0000] matches {	-- Referral actions
+		ism_transition matches {
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::524]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0001]}		-- Planned
+					}
+				}
+			}
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::524]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0002]}		-- Communicated
+					}
+				}
+			}
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::524]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0003]}		-- Acknowledged
+					}
+				}
+			}
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::527]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0005]}		-- Postponed
+					}
+				}
+			}
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::528]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0006]}		-- Cancelled
+					}
+				}
+			}
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::529]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0004]}		-- Appointment
+					}
+				}
+			}
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::245]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0008]}		-- Attended
+					}
+				}
+			}
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::245]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0009]}		-- Secondary referral
+					}
+				}
+			}
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::245]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0010]}		-- Secondary referral completed
+					}
+				}
+			}
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::245]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0011]}		-- Return of care
+					}
+				}
+			}
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::530]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0007]}		-- Did not attend
+					}
+				}
+			}
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::531]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0013]}		-- No further contact
+					}
+				}
+			}
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::531]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0014]}		-- Multiple 'did not attend'
+					}
+				}
+			}
+			ISM_TRANSITION matches {
+				current_state matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[openehr::532]}
+					}
+				}
+				careflow_step matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::at0012]}		-- Completed
+					}
+				}
+			}
+		}
+		description matches {
+			allow_archetype ITEM_TREE occurrences matches {0..1} matches {
+				include
+					domain_concept matches {/referral\.v1/}
+				exclude
+					domain_concept matches {/.*/}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["de"] = <
+			items = <
+				["at0000"] = <
+					description = <"Zur Dokumentation von Handlungen, die auf eine Behandlungsanfrage an einen zweiten Gesundheitsdienstleister basieren">
+					text = <"Überweisungshandlungen">
+				>
+				["at0001"] = <
+					description = <"Überweisung wurde geplant, aber keine weiter Handlung hat stattgefunden">
+					text = <"Geplant">
+				>
+				["at0002"] = <
+					description = <"Die Anfrage für die Überweisung wurde übermittelt">
+					text = <"Übermittelt">
+				>
+				["at0003"] = <
+					description = <"Die Überweisungsanfrage wurde vom zweiten Gesundheitsdienstleister bestätigt">
+					text = <"Bestätigt">
+				>
+				["at0004"] = <
+					description = <"Ein Termin mit dem zweiten Gesundheitsdienstleister wurde vereinbart">
+					text = <"Termin">
+				>
+				["at0005"] = <
+					description = <"Die Überweisung wurde verschoben, wird aber in der Zukunft durchgeführt werden">
+					text = <"Verschoben">
+				>
+				["at0006"] = <
+					description = <"Die Überweisung wurde gestrichen">
+					text = <"Gestrichen">
+				>
+				["at0007"] = <
+					description = <"Die Person ist zu ihrem Termin nicht erschienen">
+					text = <"Nicht erschienen">
+				>
+				["at0008"] = <
+					description = <"Die Person suchte den zweiten Gesundheitsdienstleister auf">
+					text = <"Erschienen">
+				>
+				["at0009"] = <
+					description = <"Eine Überweisung zu einem dritten Gesundheisdienstleister wurde organisiert">
+					text = <"Zweite Überweisung">
+				>
+				["at0010"] = <
+					description = <"Die zweite Überweisung ist abgeschlossen">
+					text = <"Zweite Überweisung abgeschlossen">
+				>
+				["at0011"] = <
+					description = <"Die Behandlung wurde zurück zum überweisenden Gesundheitsdienstleister gegeben">
+					text = <"Behandlung zurückgegeben">
+				>
+				["at0012"] = <
+					description = <"Der Überweisungsprozess ist abgeschlossen">
+					text = <"Abgeschlossen">
+				>
+				["at0013"] = <
+					description = <"Der Überweisungsprozess ist nicht abgeschlossen, es besteht aber kein Kontakt zum zweiten Gesundheitsdienstleister mehr">
+					text = <"Kein weiterer Kontakt">
+				>
+				["at0014"] = <
+					description = <"Die Person ist zu wiederholten Gelegenheiten nicht erschienen - es werden keine weiteren Termine vereinbart">
+					text = <"Wiederholtes 'nicht erschienen'">
+				>
+			>
+		>
+		["en"] = <
+			items = <
+				["at0000"] = <
+					description = <"Actions arising based on a request for health care from a second health care provider.">
+					text = <"Referral actions">
+				>
+				["at0001"] = <
+					description = <"Referral has been planned but no further action">
+					text = <"Planned">
+				>
+				["at0002"] = <
+					description = <"The request for referral has been communicated">
+					text = <"Communicated">
+				>
+				["at0003"] = <
+					description = <"The referral request has been acknowledged by second provider">
+					text = <"Acknowledged">
+				>
+				["at0004"] = <
+					description = <"An appointment with the second provider has been arranged">
+					text = <"Appointment">
+				>
+				["at0005"] = <
+					description = <"Referral has been postponed but will be organised in the future">
+					text = <"Postponed">
+				>
+				["at0006"] = <
+					description = <"Referral has been cancelled">
+					text = <"Cancelled">
+				>
+				["at0007"] = <
+					description = <"The person did not attend for their appointment">
+					text = <"Did not attend">
+				>
+				["at0008"] = <
+					description = <"The person attended the second provider">
+					text = <"Attended">
+				>
+				["at0009"] = <
+					description = <"Referral to a third provider has been organised">
+					text = <"Secondary referral">
+				>
+				["at0010"] = <
+					description = <"Secondary referral is complete">
+					text = <"Secondary referral completed">
+				>
+				["at0011"] = <
+					description = <"Care is transferred back to referrer">
+					text = <"Return of care">
+				>
+				["at0012"] = <
+					description = <"Referral process is complete">
+					text = <"Completed">
+				>
+				["at0013"] = <
+					description = <"The referral process was not completed but no further contact with second provider is organised">
+					text = <"No further contact">
+				>
+				["at0014"] = <
+					description = <"The person did not attend on multiple occasions - no further appointments will been sent">
+					text = <"Multiple 'did not attend'">
+				>
+			>
+		>
+	>
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.auscultation-chest.v1.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.auscultation-chest.v1.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.auscultation-chest.v1.adl	(revision 46)
@@ -0,0 +1,765 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-CLUSTER.auscultation-chest.v1
+specialize
+	openEHR-EHR-CLUSTER.auscultation.v1
+
+concept
+	[at0000.1]	-- Auscultation of the chest
+language
+	original_language = <[ISO_639-1::en]>
+description
+	original_author = <
+		["name"] = <"Sam Heard">
+		["organisation"] = <"Ocean Informatics">
+		["date"] = <"7/04/2007">
+		["email"] = <"sam.heard@oceaninformatics.biz">
+	>
+	details = <
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"To record data found on examination of the chest by auscultation/listening">
+			use = <"To be embedded in an openEHR-EHR-OBSERVATION.exam cluster to express findings determined by auscultation of the chest">
+			keywords = <"auscultate", "listen", "auscultation", "listening", "lungs", "chest", "bruit", "heart", "bowel sounds", "breath sounds", "heart sounds">
+			misuse = <"Not for use in any other context at present">
+		>
+	>
+	lifecycle_state = <"Initial">
+	other_contributors = <"Heather Leslie", ...>
+
+definition
+	CLUSTER[at0000.1] matches {	-- Auscultation of the chest
+		items cardinality matches {0..*; unordered} matches {
+			CLUSTER[at0001] occurrences matches {0..1} matches {	-- Normal Statements
+				items cardinality matches {0..*; unordered} matches {
+					ELEMENT[at0003] occurrences matches {0..*} matches {	-- Normal Statement
+						value matches {
+							DV_CODED_TEXT matches {
+								defining_code matches {
+									[local::
+									at0.1, 	-- Clear
+									at0.2, 	-- No rhonchi
+									at0.3, 	-- No wheeze
+									at0.4, 	-- No crepitations
+									at0.5, 	-- No crackles
+									at0.6, 	-- Two heart sounds, no bruits
+									at0.7, 	-- Two heart sounds, no murmurs
+									at0.8, 	-- Two normal heart sounds
+									at0056, 	-- No murmur
+									at0057, 	-- No bruit
+									at0.9, 	-- Normal first heart sound
+									at0.10, 	-- Normal second heart sound
+									at0.11, 	-- No Bronchial breathing
+									at0.12, 	-- No Amphoric breathing
+									at0.13, 	-- Normal Vocal Resonance
+									at0.14, 	-- No abnormal added sounds
+									at0073, 	-- Normal bowel sounds
+									at0085]	-- No abnormality detected
+								}
+							}
+						}
+					}
+				}
+			}
+			ELEMENT[at0004] occurrences matches {0..1} matches {	-- Clinical Description
+				value matches {
+					DV_TEXT matches {*}
+				}
+			}
+			CLUSTER[at0002] occurrences matches {0..1} matches {	-- Findings
+				items cardinality matches {0..*; unordered} matches {
+					CLUSTER[at0.15] occurrences matches {0..1} matches {	-- Heart sounds and bruits
+						items cardinality matches {0..*; unordered} matches {
+							CLUSTER[at0.16] occurrences matches {0..1} matches {	-- First heart sound
+								items cardinality matches {0..*; unordered} matches {
+									ELEMENT[at0.17] occurrences matches {0..1} matches {	-- Volume
+										value matches {
+											0|[local::at0.18], 	-- Not heard
+											1|[local::at0.19], 	-- Variable
+											2|[local::at0.20], 	-- Soft
+											3|[local::at0.21], 	-- Normal
+											4|[local::at0.22]; 	-- Loud
+											0  	-- assumed value
+										}
+									}
+									ELEMENT[at0.23] occurrences matches {0..1} matches {	-- Splitting
+										value matches {
+											DV_CODED_TEXT matches {
+												defining_code matches {
+													[local::
+													at0.24, 	-- No splitting
+													at0.25, 	-- Physiological splitting
+													at0.26, 	-- Fixed splitting
+													at0.27, 	-- Paradoxical splitting
+													at0.28]	-- Exaggerated splitting
+												}
+											}
+										}
+									}
+									use_node ELEMENT /items[at0004]
+								}
+							}
+							CLUSTER[at0.29] occurrences matches {0..1} matches {	-- Second heart sound
+								items cardinality matches {0..*; unordered} matches {
+									use_node ELEMENT /items[at0002]/items[at0.15]/items[at0.16]/items[at0.17]
+									use_node ELEMENT /items[at0002]/items[at0.15]/items[at0.16]/items[at0.23]
+									use_node ELEMENT /items[at0004]
+								}
+							}
+							CLUSTER[at0.75] occurrences matches {0..*} matches {	-- Added heart sound
+								items cardinality matches {0..*; unordered} matches {
+									ELEMENT[at0.76] occurrences matches {0..*} matches {	-- Specific sound
+										value matches {
+											DV_CODED_TEXT matches {
+												defining_code matches {
+													[local::
+													at0.30, 	-- Opening snap
+													at0.32, 	-- Ejection click
+													at0.33, 	-- Pericardial rub
+													at0.57, 	-- Third heart sound
+													at0.58, 	-- Fourth heart sound
+													at0.65, 	-- Prosthetic valve sound
+													at0.66]	-- Gallop rythm
+												}
+											}
+										}
+									}
+									ELEMENT[at0.43] occurrences matches {0..*} matches {	-- Phase of heart cycle
+										value matches {
+											DV_CODED_TEXT matches {
+												defining_code matches {
+													[local::
+													at0.44, 	-- Continuous
+													at0.45, 	-- Systolic
+													at0.46, 	-- Diastolic
+													at0.47, 	-- Pan-systolic
+													at0.48, 	-- Pan-diastolic
+													at0.49, 	-- Early systolic
+													at0.50, 	-- Mid-Systolic
+													at0.51, 	-- Late Systolic
+													at0.52, 	-- Early Diastolic
+													at0.53, 	-- Mid-diastolic
+													at0.54]	-- Late Diastolic
+												}
+											}
+										}
+									}
+									ELEMENT[at0.59] occurrences matches {0..1} matches {	-- Volume
+										value matches {
+											0|[local::at0.60], 	-- Not audible
+											1|[local::at0.61], 	-- Variable
+											2|[local::at0.62], 	-- Soft
+											3|[local::at0.63], 	-- Moderate
+											4|[local::at0.64]; 	-- Loud
+											0  	-- assumed value
+										}
+									}
+									use_node ELEMENT /items[at0004]
+								}
+							}
+							CLUSTER[at0.31] occurrences matches {0..*} matches {	-- Bruits
+								items cardinality matches {0..*; unordered} matches {
+									ELEMENT[at0.35] occurrences matches {0..1} matches {	-- Maximal Location
+										value matches {
+											DV_TEXT matches {*}
+										}
+									}
+									ELEMENT[at0.36] occurrences matches {0..*} matches {	-- Radiation
+										value matches {
+											DV_TEXT matches {*}
+										}
+									}
+									ELEMENT[at0.34] occurrences matches {0..1} matches {	-- Grading
+										value matches {
+											1|[local::at0.37], 	-- Grade 1
+											2|[local::at0.38], 	-- Grade 2
+											3|[local::at0.39], 	-- Grade 3
+											4|[local::at0.40], 	-- Grade 4
+											5|[local::at0.41], 	-- Grade 5
+											6|[local::at0.42]  	-- Grade 6
+										}
+									}
+									ELEMENT[at0.55] occurrences matches {0..1} matches {	-- Character
+										value matches {
+											DV_TEXT matches {*}
+										}
+									}
+									ELEMENT[at0.56] occurrences matches {0..1} matches {	-- Pitch
+										value matches {
+											DV_TEXT matches {*}
+										}
+									}
+									use_node ELEMENT /items[at0002]/items[at0.15]/items[at0.75]/items[at0.43]
+									use_node ELEMENT /items[at0004]
+								}
+							}
+							ELEMENT[at0.67] occurrences matches {0..1} matches {	-- Drawing
+								value matches {
+									DV_MULTIMEDIA matches {
+										media_type matches {
+											[openEHR::
+											425, 
+											426, 
+											427, 
+											428, 
+											429]
+										}
+									}
+								}
+							}
+							ELEMENT[at0.68] occurrences matches {0..1} matches {	-- Phonogram
+								value matches {
+									DV_MULTIMEDIA matches {
+										media_type matches {
+											[openEHR::
+											409, 
+											410]
+										}
+									}
+								}
+							}
+						}
+					}
+					CLUSTER[at0.69] occurrences matches {0..1} matches {	-- Lung
+						items cardinality matches {0..*; unordered} matches {
+							CLUSTER[at0.70] occurrences matches {0..1} matches {	-- Area
+								items cardinality matches {0..*; unordered} matches {
+									ELEMENT[at0.83] occurrences matches {0..1} matches {	-- Region
+										value matches {
+											DV_TEXT matches {*}
+										}
+									}
+									ELEMENT[at0.72] occurrences matches {0..1} matches {	-- Phase of respiratory cycle
+										value matches {
+											DV_CODED_TEXT matches {
+												defining_code matches {
+													[local::
+													at0.73, 	-- Inspiratory
+													at0.74, 	-- Expiratory
+													at0.77, 	-- Early Inspiratory
+													at0.78, 	-- Late inspiratory
+													at0.79, 	-- Early expiratory
+													at0.80]	-- Late expiratory
+												}
+											}
+										}
+									}
+									ELEMENT[at0.81] occurrences matches {0..1} matches {	-- Findings
+										value matches {
+											DV_TEXT matches {*}
+										}
+									}
+								}
+							}
+							ELEMENT[at0.82] occurrences matches {0..1} matches {	-- Drawing
+								value matches {
+									DV_MULTIMEDIA matches {
+										media_type matches {
+											[openEHR::
+											425, 
+											426, 
+											427, 
+											428, 
+											429]
+										}
+									}
+								}
+							}
+							use_node ELEMENT /items[at0004]
+						}
+					}
+					CLUSTER[at0009] occurrences matches {0..1} matches {	-- Bowel sounds
+						items cardinality matches {0..*; unordered} matches {
+							ELEMENT[at0074] occurrences matches {0..*} matches {	-- Specific Findings
+								value matches {
+									DV_CODED_TEXT matches {
+										defining_code matches {
+											[local::
+											at0078, 	-- Absent bowel sounds
+											at0079, 	-- Decreased bowel sounds
+											at0080, 	-- Increased bowel sounds
+											at0081]	-- Tinkling bowel sounds
+										}
+									}
+								}
+							}
+							use_node ELEMENT /items[at0004]
+						}
+					}
+					CLUSTER[at0010] occurrences matches {0..1} matches {	-- Vessel bruit
+						items cardinality matches {0..*; unordered} matches {
+							ELEMENT[at0088] matches {	-- Vessel name
+								value matches {
+									DV_TEXT matches {*}
+								}
+							}
+							ELEMENT[at0030] occurrences matches {0..1} matches {	-- Maximal Location
+								value matches {
+									DV_TEXT matches {*}
+								}
+							}
+							ELEMENT[at0091] occurrences matches {0..1} matches {	-- Description
+								value matches {
+									DV_TEXT matches {*}
+								}
+							}
+						}
+					}
+					CLUSTER[at0089] occurrences matches {0..1} matches {	-- Other sounds
+						items cardinality matches {0..*; unordered} matches {
+							ELEMENT[at0090] matches {	-- Description
+								value matches {
+									DV_TEXT matches {*}
+								}
+							}
+							use_node ELEMENT /items[at0002]/items[at0010]/items[at0030]
+						}
+					}
+					CLUSTER[at0086] occurrences matches {0..*} matches {	-- Localised auscultation
+						items cardinality matches {0..*; unordered} matches {
+							ELEMENT[at0087] matches {	-- Site or region
+								value matches {
+									DV_TEXT matches {*}
+								}
+							}
+							allow_archetype CLUSTER occurrences matches {0..1} matches {
+								include
+									archetype_id/value matches {/auscultation\.v1/}
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["en"] = <
+			items = <
+				["at0.1"] = <
+					description = <"No abnormal breath sounds">
+					text = <"Clear">
+				>
+				["at0.10"] = <
+					description = <"*">
+					text = <"Normal second heart sound">
+				>
+				["at0.11"] = <
+					description = <"*">
+					text = <"No Bronchial breathing">
+				>
+				["at0.12"] = <
+					description = <"*">
+					text = <"No Amphoric breathing">
+				>
+				["at0.13"] = <
+					description = <"*">
+					text = <"Normal Vocal Resonance">
+				>
+				["at0.14"] = <
+					description = <"*">
+					text = <"No abnormal added sounds">
+				>
+				["at0.15"] = <
+					description = <"*">
+					text = <"Heart sounds and bruits">
+				>
+				["at0.16"] = <
+					description = <"Findings about the first heart sound">
+					text = <"First heart sound">
+				>
+				["at0.17"] = <
+					description = <"The volume of the first heart sound">
+					text = <"Volume">
+				>
+				["at0.18"] = <
+					description = <"The first heart sound is not heard">
+					text = <"Not heard">
+				>
+				["at0.19"] = <
+					description = <"The sound is variable in volume">
+					text = <"Variable">
+				>
+				["at0.2"] = <
+					description = <"No high or low pitched wheezes">
+					text = <"No rhonchi">
+				>
+				["at0.20"] = <
+					description = <"The sound is softer than normal">
+					text = <"Soft">
+				>
+				["at0.21"] = <
+					description = <"The sound is of normal volume">
+					text = <"Normal">
+				>
+				["at0.22"] = <
+					description = <"The volume is increased">
+					text = <"Loud">
+				>
+				["at0.23"] = <
+					description = <"Splitting of the heart sound">
+					text = <"Splitting">
+				>
+				["at0.24"] = <
+					description = <"The heart sound is not split">
+					text = <"No splitting">
+				>
+				["at0.25"] = <
+					description = <"The heart sound is split due to physiological changes">
+					text = <"Physiological splitting">
+				>
+				["at0.26"] = <
+					description = <"The heart sound is always split">
+					text = <"Fixed splitting">
+				>
+				["at0.27"] = <
+					description = <"The variable splitting is not physiological">
+					text = <"Paradoxical splitting">
+				>
+				["at0.28"] = <
+					description = <"The timing of the splitting is physiological but it is more obvious than normal">
+					text = <"Exaggerated splitting">
+				>
+				["at0.29"] = <
+					description = <"Findings about the second heart sound">
+					text = <"Second heart sound">
+				>
+				["at0.3"] = <
+					description = <"No wheezing noises">
+					text = <"No wheeze">
+				>
+				["at0.30"] = <
+					description = <"Opening sound of the mitral valve">
+					text = <"Opening snap">
+				>
+				["at0.31"] = <
+					description = <"Group of findings about auscultation of the heart">
+					text = <"Bruits">
+				>
+				["at0.32"] = <
+					description = <"Systolic click when the heart contracts">
+					text = <"Ejection click">
+				>
+				["at0.33"] = <
+					description = <"Rubbing noise during contractions on the pericardium">
+					text = <"Pericardial rub">
+				>
+				["at0.34"] = <
+					description = <"Grading of the loudness of a heart murmur">
+					text = <"Grading">
+				>
+				["at0.35"] = <
+					description = <"Site where finding is heard maximally">
+					text = <"Maximal Location">
+				>
+				["at0.36"] = <
+					description = <"Sites where finding is heard in addition to maximal site">
+					text = <"Radiation">
+				>
+				["at0.37"] = <
+					description = <"very faint to recognize the murmur even after listening for a while">
+					text = <"Grade 1">
+				>
+				["at0.38"] = <
+					description = <"faint, but easy to recognize the murmur right after the stethoscope is placed on the chest">
+					text = <"Grade 2">
+				>
+				["at0.39"] = <
+					description = <"intermediate loudness between II/VI -IV/VI">
+					text = <"Grade 3">
+				>
+				["at0.4"] = <
+					description = <"No high pitched crackling sounds">
+					text = <"No crepitations">
+				>
+				["at0.40"] = <
+					description = <"with loud murmur (palpable thrill)">
+					text = <"Grade 4">
+				>
+				["at0.41"] = <
+					description = <"very loud, but you can not hear the murmur, if the stethoscope is away from the chest wall">
+					text = <"Grade 5">
+				>
+				["at0.42"] = <
+					description = <"the loudest murmur you can hear, even if the stethoscope is off the chest wall">
+					text = <"Grade 6">
+				>
+				["at0.43"] = <
+					description = <"The timing in relation to the contraction of the heart">
+					text = <"Phase of heart cycle">
+				>
+				["at0.44"] = <
+					description = <"*">
+					text = <"Continuous">
+				>
+				["at0.45"] = <
+					description = <"*">
+					text = <"Systolic">
+				>
+				["at0.46"] = <
+					description = <"*">
+					text = <"Diastolic">
+				>
+				["at0.47"] = <
+					description = <"*">
+					text = <"Pan-systolic">
+				>
+				["at0.48"] = <
+					description = <"*">
+					text = <"Pan-diastolic">
+				>
+				["at0.49"] = <
+					description = <"*">
+					text = <"Early systolic">
+				>
+				["at0.5"] = <
+					description = <"No high pitched crackling sounds">
+					text = <"No crackles">
+				>
+				["at0.50"] = <
+					description = <"*">
+					text = <"Mid-Systolic">
+				>
+				["at0.51"] = <
+					description = <"*">
+					text = <"Late Systolic">
+				>
+				["at0.52"] = <
+					description = <"*">
+					text = <"Early Diastolic">
+				>
+				["at0.53"] = <
+					description = <"*">
+					text = <"Mid-diastolic">
+				>
+				["at0.54"] = <
+					description = <"*">
+					text = <"Late Diastolic">
+				>
+				["at0.55"] = <
+					description = <"The character of the sound">
+					text = <"Character">
+				>
+				["at0.56"] = <
+					description = <"The pitch of the sound">
+					text = <"Pitch">
+				>
+				["at0.57"] = <
+					description = <"A heart sound in early diastole">
+					text = <"Third heart sound">
+				>
+				["at0.58"] = <
+					description = <"A heart sound in late diastole">
+					text = <"Fourth heart sound">
+				>
+				["at0.59"] = <
+					description = <"The volume of the sound">
+					text = <"Volume">
+				>
+				["at0.6"] = <
+					description = <"Normal heart sounds">
+					text = <"Two heart sounds, no bruits">
+				>
+				["at0.60"] = <
+					description = <"The sound is not audible">
+					text = <"Not audible">
+				>
+				["at0.61"] = <
+					description = <"The sound is variable">
+					text = <"Variable">
+				>
+				["at0.62"] = <
+					description = <"The sound is soft">
+					text = <"Soft">
+				>
+				["at0.63"] = <
+					description = <"The sound is at about the expected level the first heart sound">
+					text = <"Moderate">
+				>
+				["at0.64"] = <
+					description = <"The sound is louder than the first heart sound">
+					text = <"Loud">
+				>
+				["at0.65"] = <
+					description = <"Sound due to a prosthetic heart valve">
+					text = <"Prosthetic valve sound">
+				>
+				["at0.66"] = <
+					description = <"Audible rythm similar to a horse galloping due to added heart sounds">
+					text = <"Gallop rythm">
+				>
+				["at0.67"] = <
+					description = <"Drawing of the sounds of the heart">
+					text = <"Drawing">
+				>
+				["at0.68"] = <
+					description = <"Recording of the heart sounds">
+					text = <"Phonogram">
+				>
+				["at0.69"] = <
+					description = <"Group of findings about auscultation of the lung">
+					text = <"Lung">
+				>
+				["at0.7"] = <
+					description = <"Normal heart sounds">
+					text = <"Two heart sounds, no murmurs">
+				>
+				["at0.70"] = <
+					description = <"*">
+					text = <"Area">
+				>
+				["at0.72"] = <
+					description = <"The timing of the sounds in relation to breathing">
+					text = <"Phase of respiratory cycle">
+				>
+				["at0.73"] = <
+					description = <"During inspiration">
+					text = <"Inspiratory">
+				>
+				["at0.74"] = <
+					description = <"During expiration">
+					text = <"Expiratory">
+				>
+				["at0.75"] = <
+					description = <"A grouping of discription of one or more added heart sounds">
+					text = <"Added heart sound">
+				>
+				["at0.76"] = <
+					description = <"Specific auscultatory findings related to examination of the heart">
+					text = <"Specific sound">
+				>
+				["at0.77"] = <
+					description = <"Soon after inspiration begins">
+					text = <"Early Inspiratory">
+				>
+				["at0.78"] = <
+					description = <"At the final stages of inspiration">
+					text = <"Late inspiratory">
+				>
+				["at0.79"] = <
+					description = <"Soon after expiration begins">
+					text = <"Early expiratory">
+				>
+				["at0.8"] = <
+					description = <"*">
+					text = <"Two normal heart sounds">
+				>
+				["at0.80"] = <
+					description = <"At the late stages of expiration">
+					text = <"Late expiratory">
+				>
+				["at0.81"] = <
+					description = <"Specific auscultatory findings related to examination of the lungs">
+					text = <"Findings">
+				>
+				["at0.82"] = <
+					description = <"Drawing of the breath sounds">
+					text = <"Drawing">
+				>
+				["at0.83"] = <
+					description = <"The region to which the findings relate">
+					text = <"Region">
+				>
+				["at0.9"] = <
+					description = <"*">
+					text = <"Normal first heart sound">
+				>
+				["at0000"] = <
+					description = <"Findings on Auscultation">
+					text = <"Auscultation">
+				>
+				["at0000.1"] = <
+					description = <"Findings on auscultation of the chest">
+					text = <"Auscultation of the chest">
+				>
+				["at0001"] = <
+					description = <"A group of statements about the normality of auscultation">
+					text = <"Normal Statements">
+				>
+				["at0002"] = <
+					description = <"Findings on auscultation">
+					text = <"Findings">
+				>
+				["at0003"] = <
+					description = <"Statements about the normality of the auscultation">
+					text = <"Normal Statement">
+				>
+				["at0004"] = <
+					description = <"Detailed clinical description of the findings on auscultation">
+					text = <"Clinical Description">
+				>
+				["at0009"] = <
+					description = <"Group of findings about auscultation of the bowel">
+					text = <"Bowel sounds">
+				>
+				["at0010"] = <
+					description = <"Group of findings about auscultation of a major blood vessel">
+					text = <"Vessel bruit">
+				>
+				["at0030"] = <
+					description = <"Site where finding is heard maximally">
+					text = <"Maximal Location">
+				>
+				["at0056"] = <
+					description = <"No murmur is heard">
+					text = <"No murmur">
+				>
+				["at0057"] = <
+					description = <"No bruit is heard">
+					text = <"No bruit">
+				>
+				["at0073"] = <
+					description = <"Bowel sounds are normal in intensity and character">
+					text = <"Normal bowel sounds">
+				>
+				["at0074"] = <
+					description = <"Specific auscultatory findings related to examination of the bowels">
+					text = <"Specific Findings">
+				>
+				["at0078"] = <
+					description = <"No bowel sounds can be heard">
+					text = <"Absent bowel sounds">
+				>
+				["at0079"] = <
+					description = <"Bowel sounds are less than normal">
+					text = <"Decreased bowel sounds">
+				>
+				["at0080"] = <
+					description = <"Bowel sounds are more intense than normal">
+					text = <"Increased bowel sounds">
+				>
+				["at0081"] = <
+					description = <"High pitched and very frequent bowel sounds can be heard">
+					text = <"Tinkling bowel sounds">
+				>
+				["at0085"] = <
+					description = <"Nothing abnormal on auscultation">
+					text = <"No abnormality detected">
+				>
+				["at0086"] = <
+					description = <"Auscultation in a particular site">
+					text = <"Localised auscultation">
+				>
+				["at0087"] = <
+					description = <"The site of the localised findings">
+					text = <"Site or region">
+				>
+				["at0088"] = <
+					description = <"The name of the vessel to which is being listened">
+					text = <"Vessel name">
+				>
+				["at0089"] = <
+					description = <"Recording of sounds of a different nature">
+					text = <"Other sounds">
+				>
+				["at0090"] = <
+					description = <"Description of other sounds">
+					text = <"Description">
+				>
+				["at0091"] = <
+					description = <"Description of the bruit">
+					text = <"Description">
+				>
+			>
+		>
+	>
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.auscultation.v1.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.auscultation.v1.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.auscultation.v1.adl	(revision 46)
@@ -0,0 +1,217 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-CLUSTER.auscultation.v1
+
+concept
+	[at0000]	-- Auscultation
+language
+	original_language = <[ISO_639-1::en]>
+description
+	original_author = <
+		["name"] = <"Sam Heard">
+		["organisation"] = <"Ocean Informatics">
+		["date"] = <"7/04/2007">
+		["email"] = <"sam.heard@oceaninformatics.biz">
+	>
+	details = <
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"To record data found on examination by auscultation/listening">
+			use = <"To be embedded in an openEHR-EHR-OBSERVATION.exam cluster to express findings determined by auscultation">
+			keywords = <"auscultate", "listen", "auscultation", "listening", "bruit", "bowel sounds", "sounds">
+			misuse = <"Not for use in any other context at present">
+		>
+	>
+	lifecycle_state = <"OrganisationDraft">
+	other_contributors = <"Heather Leslie", ...>
+
+definition
+	CLUSTER[at0000] matches {	-- Auscultation
+		items cardinality matches {0..*; unordered} matches {
+			CLUSTER[at0001] occurrences matches {0..1} matches {	-- Normal Statements
+				items cardinality matches {0..*; unordered} matches {
+					ELEMENT[at0003] occurrences matches {0..*} matches {	-- Normal Statement
+						value matches {
+							DV_CODED_TEXT matches {
+								defining_code matches {
+									[local::
+									at0056, 	-- No murmur
+									at0057, 	-- No bruit
+									at0073, 	-- Normal bowel sounds
+									at0085]	-- No abnormality detected
+								}
+							}
+						}
+					}
+				}
+			}
+			ELEMENT[at0004] occurrences matches {0..1} matches {	-- Clinical Description
+				value matches {
+					DV_TEXT matches {*}
+				}
+			}
+			CLUSTER[at0002] occurrences matches {0..1} matches {	-- Findings
+				items cardinality matches {0..*; unordered} matches {
+					CLUSTER[at0009] occurrences matches {0..1} matches {	-- Bowel sounds
+						items cardinality matches {0..*; unordered} matches {
+							ELEMENT[at0074] occurrences matches {0..*} matches {	-- Specific Findings
+								value matches {
+									DV_CODED_TEXT matches {
+										defining_code matches {
+											[local::
+											at0078, 	-- Absent bowel sounds
+											at0079, 	-- Decreased bowel sounds
+											at0080, 	-- Increased bowel sounds
+											at0081]	-- Tinkling bowel sounds
+										}
+									}
+								}
+							}
+							use_node ELEMENT /items[at0004]
+						}
+					}
+					CLUSTER[at0010] occurrences matches {0..1} matches {	-- Vessel bruit
+						items cardinality matches {0..*; unordered} matches {
+							ELEMENT[at0088] matches {	-- Vessel name
+								value matches {
+									DV_TEXT matches {*}
+								}
+							}
+							ELEMENT[at0030] occurrences matches {0..1} matches {	-- Maximal Location
+								value matches {
+									DV_TEXT matches {*}
+								}
+							}
+							ELEMENT[at0091] occurrences matches {0..1} matches {	-- Description
+								value matches {
+									DV_TEXT matches {*}
+								}
+							}
+						}
+					}
+					CLUSTER[at0089] occurrences matches {0..1} matches {	-- Other sounds
+						items cardinality matches {0..*; unordered} matches {
+							ELEMENT[at0090] matches {	-- Description
+								value matches {
+									DV_TEXT matches {*}
+								}
+							}
+							use_node ELEMENT /items[at0002]/items[at0010]/items[at0030]
+						}
+					}
+					CLUSTER[at0086] occurrences matches {0..*} matches {	-- Localised auscultation
+						items cardinality matches {0..*; unordered} matches {
+							ELEMENT[at0087] matches {	-- Site or region
+								value matches {
+									DV_TEXT matches {*}
+								}
+							}
+							allow_archetype CLUSTER occurrences matches {0..1} matches {
+								include
+									archetype_id/value matches {/auscultation\.v1/}
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["en"] = <
+			items = <
+				["at0000"] = <
+					description = <"Findings on Auscultation">
+					text = <"Auscultation">
+				>
+				["at0001"] = <
+					description = <"A group of statements about the normality of auscultation">
+					text = <"Normal Statements">
+				>
+				["at0002"] = <
+					description = <"Findings on auscultation">
+					text = <"Findings">
+				>
+				["at0003"] = <
+					description = <"Statements about the normality of the auscultation">
+					text = <"Normal Statement">
+				>
+				["at0004"] = <
+					description = <"Detailed clinical description of the findings on auscultation">
+					text = <"Clinical Description">
+				>
+				["at0009"] = <
+					description = <"Group of findings about auscultation of the bowel">
+					text = <"Bowel sounds">
+				>
+				["at0010"] = <
+					description = <"Group of findings about auscultation of a major blood vessel">
+					text = <"Vessel bruit">
+				>
+				["at0030"] = <
+					description = <"Site where finding is heard maximally">
+					text = <"Maximal Location">
+				>
+				["at0056"] = <
+					description = <"No murmur is heard">
+					text = <"No murmur">
+				>
+				["at0057"] = <
+					description = <"No bruit is heard">
+					text = <"No bruit">
+				>
+				["at0073"] = <
+					description = <"Bowel sounds are normal in intensity and character">
+					text = <"Normal bowel sounds">
+				>
+				["at0074"] = <
+					description = <"Specific auscultatory findings related to examination of the bowels">
+					text = <"Specific Findings">
+				>
+				["at0078"] = <
+					description = <"No bowel sounds can be heard">
+					text = <"Absent bowel sounds">
+				>
+				["at0079"] = <
+					description = <"Bowel sounds are less than normal">
+					text = <"Decreased bowel sounds">
+				>
+				["at0080"] = <
+					description = <"Bowel sounds are more intense than normal">
+					text = <"Increased bowel sounds">
+				>
+				["at0081"] = <
+					description = <"High pitched and very frequent bowel sounds can be heard">
+					text = <"Tinkling bowel sounds">
+				>
+				["at0085"] = <
+					description = <"Nothing abnormal on auscultation">
+					text = <"No abnormality detected">
+				>
+				["at0086"] = <
+					description = <"Auscultation in a particular site">
+					text = <"Localised auscultation">
+				>
+				["at0087"] = <
+					description = <"The site of the localised findings">
+					text = <"Site or region">
+				>
+				["at0088"] = <
+					description = <"The name of the vessel to which is being listened">
+					text = <"Vessel name">
+				>
+				["at0089"] = <
+					description = <"Recording of sounds of a different nature">
+					text = <"Other sounds">
+				>
+				["at0090"] = <
+					description = <"Description of other sounds">
+					text = <"Description">
+				>
+				["at0091"] = <
+					description = <"Description of the bruit">
+					text = <"Description">
+				>
+			>
+		>
+	>
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.dimensions-circumference.v1.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.dimensions-circumference.v1.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.dimensions-circumference.v1.adl	(revision 46)
@@ -0,0 +1,134 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-CLUSTER.dimensions-circumference.v1
+specialize
+	openEHR-EHR-CLUSTER.dimensions.v1
+
+concept
+	[at0000.1]	-- Circumference
+language
+	original_language = <[ISO_639-1::en]>
+	translations = <
+		["de"] = <
+			language = <[ISO_639-1::de]>
+			author = <
+				["name"] = <"Jasmin Buck, Sebastian Garde">
+				["organisation"] = <"University of Heidelberg, Central Queensland University">
+			>
+		>
+	>
+description
+	original_author = <
+		["name"] = <"unknown">
+	>
+	details = <
+		["de"] = <
+			language = <[ISO_639-1::de]>
+			purpose = <"Zur Beschreibung der Umfangs eines betrachteten Körperteils.">
+			use = <"Zur Messung des Umfangs von Körperteilen, wie Taille oder Kopfumfang">
+			keywords = <"Umfang", ...>
+			misuse = <"">
+		>
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"To describe the circumference of a body part examined">
+			use = <"For use when measuring the circumference of body parts such as waist, head circumference">
+			keywords = <"circumference", ...>
+			misuse = <"">
+		>
+	>
+	lifecycle_state = <"OrganisationDraft">
+	other_contributors = <>
+
+definition
+	CLUSTER[at0000.1] matches {	-- Circumference
+		items cardinality matches {0..*; unordered} matches {
+			ELEMENT[at0001] occurrences matches {0..1} matches {	-- Circumference
+				value matches {
+					C_DV_QUANTITY <
+						property = <[openehr::122]>
+						list = <
+							["1"] = <
+								units = <"cm">
+							>
+						>
+					>
+				}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["de"] = <
+			items = <
+				["at0000"] = <
+					description = <"Die Ausmaße eines betrachteten Teils">
+					text = <"Ausmaße">
+				>
+				["at0000.1"] = <
+					description = <"Der Umfang des betrachteten Körperteils">
+					text = <"Umfang">
+				>
+				["at0001"] = <
+					description = <"Der Umfang des betrachteten Teils">
+					text = <"Umfang">
+				>
+				["at0002"] = <
+					description = <"Die Länge des betrachteten Teils (longidudinale Körperachse)">
+					text = <"Länge">
+				>
+				["at0003"] = <
+					description = <"Die Breite oder Weite (transversale Körperachse)">
+					text = <"Breite">
+				>
+				["at0004"] = <
+					description = <"Die Tiefe des betrachteten Teils (dorsal-ventrale Körperachse)">
+					text = <"Tiefe">
+				>
+				["at0005"] = <
+					description = <"Die Fläche des betrachteten Teils">
+					text = <"Fläche">
+				>
+				["at0006"] = <
+					description = <"Das Volumen des betrachteten Teils">
+					text = <"Volumen">
+				>
+			>
+		>
+		["en"] = <
+			items = <
+				["at0000"] = <
+					description = <"The physical dimensions of a part examined">
+					text = <"Dimensions">
+				>
+				["at0000.1"] = <
+					description = <"The circumference of the body part examined">
+					text = <"Circumference">
+				>
+				["at0001"] = <
+					description = <"The circumference of the part examined">
+					text = <"Circumference">
+				>
+				["at0002"] = <
+					description = <"The length of the part examined (longitudinal anatomical axis)">
+					text = <"Length">
+				>
+				["at0003"] = <
+					description = <"The width or breadth (transverse anatomical axis)">
+					text = <"Breadth">
+				>
+				["at0004"] = <
+					description = <"The depth of the part examined (dorso-ventral anatomical axis)">
+					text = <"Depth">
+				>
+				["at0005"] = <
+					description = <"The area of the part examined">
+					text = <"Area">
+				>
+				["at0006"] = <
+					description = <"The volume of the part examined">
+					text = <"Volume">
+				>
+			>
+		>
+	>
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.dimensions.v1.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.dimensions.v1.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.dimensions.v1.adl	(revision 46)
@@ -0,0 +1,241 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-CLUSTER.dimensions.v1
+
+concept
+	[at0000]	-- Dimensions
+language
+	original_language = <[ISO_639-1::en]>
+	translations = <
+		["de"] = <
+			language = <[ISO_639-1::de]>
+			author = <
+				["name"] = <"Jasmin Buck, Sebastian Garde">
+				["organisation"] = <"University of Heidelberg, Central Queensland University">
+			>
+		>
+	>
+description
+	original_author = <
+		["name"] = <"unknown">
+	>
+	details = <
+		["de"] = <
+			language = <[ISO_639-1::de]>
+			purpose = <"Zur Beschreibung der Ausmaße eines betrachteten Teils.">
+			use = <"">
+			keywords = <"Größe", "Volumen">
+			misuse = <"">
+		>
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"To describe the dimensions of a part examined or viewed">
+			use = <"">
+			keywords = <"size", "volume">
+			misuse = <"">
+		>
+	>
+	lifecycle_state = <"Initial">
+	other_contributors = <>
+
+definition
+	CLUSTER[at0000] matches {	-- Dimensions
+		items cardinality matches {0..*; unordered} matches {
+			ELEMENT[at0001] occurrences matches {0..1} matches {	-- Circumference
+				value matches {
+					C_DV_QUANTITY <
+						property = <[openehr::122]>
+						list = <
+							["1"] = <
+								units = <"µm">
+							>
+							["2"] = <
+								units = <"mm">
+							>
+							["3"] = <
+								units = <"cm">
+							>
+							["4"] = <
+								units = <"m">
+							>
+						>
+					>
+				}
+			}
+			ELEMENT[at0002] occurrences matches {0..1} matches {	-- Length
+				value matches {
+					C_DV_QUANTITY <
+						property = <[openehr::122]>
+						list = <
+							["1"] = <
+								units = <"µm">
+							>
+							["2"] = <
+								units = <"mm">
+							>
+							["3"] = <
+								units = <"cm">
+							>
+							["4"] = <
+								units = <"m">
+							>
+						>
+					>
+				}
+			}
+			ELEMENT[at0003] occurrences matches {0..1} matches {	-- Breadth
+				value matches {
+					C_DV_QUANTITY <
+						property = <[openehr::122]>
+						list = <
+							["1"] = <
+								units = <"µm">
+							>
+							["2"] = <
+								units = <"mm">
+							>
+							["3"] = <
+								units = <"cm">
+							>
+							["4"] = <
+								units = <"m">
+							>
+						>
+					>
+				}
+			}
+			ELEMENT[at0004] occurrences matches {0..1} matches {	-- Depth
+				value matches {
+					C_DV_QUANTITY <
+						property = <[openehr::122]>
+						list = <
+							["1"] = <
+								units = <"µm">
+							>
+							["2"] = <
+								units = <"mm">
+							>
+							["3"] = <
+								units = <"cm">
+							>
+							["4"] = <
+								units = <"m">
+							>
+						>
+					>
+				}
+			}
+			ELEMENT[at0005] occurrences matches {0..1} matches {	-- Area
+				value matches {
+					C_DV_QUANTITY <
+						property = <[openehr::335]>
+						list = <
+							["1"] = <
+								units = <"mm2">
+							>
+							["2"] = <
+								units = <"cm2">
+							>
+							["3"] = <
+								units = <"% body">
+							>
+							["4"] = <
+								units = <"% head, neck">
+							>
+							["5"] = <
+								units = <"% lower limb">
+							>
+							["6"] = <
+								units = <"% trunk">
+							>
+							["7"] = <
+								units = <"% upper limb">
+							>
+						>
+					>
+				}
+			}
+			ELEMENT[at0006] occurrences matches {0..1} matches {	-- Volume
+				value matches {
+					C_DV_QUANTITY <
+						property = <[openehr::129]>
+						list = <
+							["1"] = <
+								units = <"mm3">
+							>
+							["2"] = <
+								units = <"ml">
+							>
+						>
+					>
+				}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["de"] = <
+			items = <
+				["at0000"] = <
+					description = <"Die Ausmaße eines betrachteten Teils">
+					text = <"Ausmaße">
+				>
+				["at0001"] = <
+					description = <"Der Umfang des betrachteten Teils">
+					text = <"Umfang">
+				>
+				["at0002"] = <
+					description = <"Die Länge des betrachteten Teils (longidudinale Körperachse)">
+					text = <"Länge">
+				>
+				["at0003"] = <
+					description = <"Die Breite oder Weite (transversale Körperachse)">
+					text = <"Breite">
+				>
+				["at0004"] = <
+					description = <"Die Tiefe des betrachteten Teils (dorsal-ventrale Körperachse)">
+					text = <"Tiefe">
+				>
+				["at0005"] = <
+					description = <"Die Fläche des betrachteten Teils">
+					text = <"Fläche">
+				>
+				["at0006"] = <
+					description = <"Das Volumen des betrachteten Teils">
+					text = <"Volumen">
+				>
+			>
+		>
+		["en"] = <
+			items = <
+				["at0000"] = <
+					description = <"The physical dimensions of a part examined">
+					text = <"Dimensions">
+				>
+				["at0001"] = <
+					description = <"The circumference of the part examined">
+					text = <"Circumference">
+				>
+				["at0002"] = <
+					description = <"The length of the part examined (longitudinal anatomical axis)">
+					text = <"Length">
+				>
+				["at0003"] = <
+					description = <"The width or breadth (transverse anatomical axis)">
+					text = <"Breadth">
+				>
+				["at0004"] = <
+					description = <"The depth of the part examined (dorso-ventral anatomical axis)">
+					text = <"Depth">
+				>
+				["at0005"] = <
+					description = <"The area of the part examined">
+					text = <"Area">
+				>
+				["at0006"] = <
+					description = <"The volume of the part examined">
+					text = <"Volume">
+				>
+			>
+		>
+	>
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.exam-abdomen.v1.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.exam-abdomen.v1.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.exam-abdomen.v1.adl	(revision 46)
@@ -0,0 +1,321 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-CLUSTER.exam-abdomen.v1
+specialize
+	openEHR-EHR-CLUSTER.exam.v1
+
+concept
+	[at0000.1]	-- Examination of the abdomen
+language
+	original_language = <[ISO_639-1::en]>
+description
+	original_author = <
+		["name"] = <"Heather Leslie">
+		["organisation"] = <"Ocean Informatics">
+		["date"] = <"11/04/2007">
+		["email"] = <"heather.leslie@oceaninformatics.biz">
+	>
+	details = <
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"A cluster for recording findings on physical examination of the abdomen">
+			use = <"">
+			keywords = <"examination", "physical">
+			misuse = <"">
+		>
+	>
+	lifecycle_state = <"Initial">
+	other_contributors = <>
+
+definition
+	CLUSTER[at0000.1] matches {	-- Examination of the abdomen
+		items cardinality matches {0..*; unordered} matches {
+			CLUSTER[at0004] occurrences matches {0..1} matches {	-- Normal statements
+				items cardinality matches {0..*; unordered} matches {
+					ELEMENT[at0005] occurrences matches {0..*} matches {	-- Normal statement
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+				}
+			}
+			ELEMENT[at0002] occurrences matches {0..1} matches {	-- Clinical description
+				value matches {
+					DV_TEXT matches {*}
+				}
+			}
+			CLUSTER[at0008] occurrences matches {0..1} matches {	-- Findings
+				items cardinality matches {0..*; unordered} matches {
+					CLUSTER[at0.2] occurrences matches {0..1} matches {	-- Abdominal wall
+						items cardinality matches {0..*; unordered} matches {
+							ELEMENT[at0.3] occurrences matches {0..1} matches {	-- Description
+								value matches {
+									DV_CODED_TEXT matches {
+										defining_code matches {[local::]}
+									}
+								}
+							}
+							allow_archetype CLUSTER occurrences matches {0..1} matches {
+								include
+									archetype_id/value matches {/inspection\.v1draft/}
+									archetype_id/value matches {/exam-generic-mass\.v1/}
+									archetype_id/value matches {/palpation\.v1/}
+									archetype_id/value matches {/inspection-skin\.v1draft/}
+									archetype_id/value matches {/exam-generic-lymphnode\.v1/}
+							}
+						}
+					}
+					CLUSTER[at0.9] occurrences matches {0..1} matches {	-- Abdominal Region
+						items cardinality matches {0..*; unordered} matches {
+							ELEMENT[at0.10] occurrences matches {0..1} matches {	-- Region
+								value matches {
+									DV_CODED_TEXT matches {
+										defining_code matches {
+											[local::
+											at0.11, 	-- Left upper quadrant
+											at0.12, 	-- Epigastrium
+											at0.16, 	-- Left upper quadrant
+											at0.17, 	-- Right loin
+											at0.18, 	-- Central/peri-umbilical
+											at0.19, 	-- Left loin
+											at0.20, 	-- Right iliac fossa
+											at0.21]	-- Left iliac fossa
+										}
+									}
+								}
+							}
+							allow_archetype CLUSTER occurrences matches {0..1} matches {
+								include
+									archetype_id/value matches {/palpation\.v1/}
+									archetype_id/value matches {/percussion\.v1/}
+							}
+							use_node ELEMENT /items[at0008]/items[at0.2]/items[at0.3]
+						}
+					}
+					CLUSTER[at0.5] occurrences matches {0..1} matches {	-- Abdomen Contents
+						items cardinality matches {0..*; unordered} matches {
+							allow_archetype CLUSTER occurrences matches {0..1} matches {
+								include
+									archetype_id/value matches {/exam-generic-mass\.v1/}
+									archetype_id/value matches {/exam-generic-lympnode\.v1/}
+									archetype_id/value matches {/exam-generic\.v1/}
+									archetype_id/value matches {/exam\.v1/}
+									archetype_id/value matches {/auscultation\.v1/}
+							}
+							CLUSTER[at0.13] occurrences matches {0..1} matches {	-- Organs
+								items cardinality matches {0..*; unordered} matches {
+									CLUSTER[at0.14] occurrences matches {0..1} matches {	-- Liver
+										items cardinality matches {0..*; unordered} matches {
+											allow_archetype CLUSTER occurrences matches {0..1} matches {
+												include
+													archetype_id/value matches {/palpation\.v1/}
+													archetype_id/value matches {/percussion\.v1/}
+													archetype_id/value matches {/dimensions\.v1/}
+													archetype_id/value matches {/relative_position_abdomen\.v1draft/}
+													archetype_id/value matches {/size\.v1/}
+													archetype_id/value matches {/exam-generic-mass\.v1/}
+											}
+											use_node ELEMENT /items[at0008]/items[at0.2]/items[at0.3]
+										}
+									}
+									CLUSTER[at0.7] occurrences matches {0..1} matches {	-- Spleen
+										items cardinality matches {0..*; unordered} matches {
+											allow_archetype CLUSTER occurrences matches {0..1} matches {
+												include
+													archetype_id/value matches {/dimensions\.v1/}
+													archetype_id/value matches {/exam-generic-mass\.v1/}
+													archetype_id/value matches {/exam-generic\.v1/}
+													archetype_id/value matches {/exam\.v1/}
+													archetype_id/value matches {/palpation\.v1/}
+													archetype_id/value matches {/percussion\.v1/}
+													archetype_id/value matches {/relative_position_abdomen\.v1draft/}
+													archetype_id/value matches {/size\.v1/}
+											}
+											use_node ELEMENT /items[at0008]/items[at0.2]/items[at0.3]
+										}
+									}
+									CLUSTER[at0.8] occurrences matches {0..1} matches {	-- Kidney
+										items cardinality matches {0..*; unordered} matches {
+											allow_archetype CLUSTER occurrences matches {0..1} matches {
+												include
+													archetype_id/value matches {/dimensions\.v1/}
+													archetype_id/value matches {/exam-generic-mass\.v1/}
+													archetype_id/value matches {/exam-generic\.v1/}
+													archetype_id/value matches {/exam\.v1/}
+													archetype_id/value matches {/palpation\.v1/}
+													archetype_id/value matches {/percussion\.v1/}
+													archetype_id/value matches {/relative_position_abdomen\.v1draft/}
+											}
+											use_node ELEMENT /items[at0008]/items[at0.2]/items[at0.3]
+										}
+									}
+									CLUSTER[at0.15] occurrences matches {0..1} matches {	-- Bowel
+										items cardinality matches {0..*; unordered} matches {
+											allow_archetype CLUSTER occurrences matches {0..1} matches {
+												include
+													archetype_id/value matches {/palpation\.v1/}
+													archetype_id/value matches {/exam-generic-mass\.v1/}
+													archetype_id/value matches {/exam-generic\.v1/}
+													archetype_id/value matches {/exam\.v1/}
+													archetype_id/value matches {/percussion\.v1/}
+													archetype_id/value matches {/relative_position_abdomen\.v1draft/}
+											}
+											use_node ELEMENT /items[at0008]/items[at0.2]/items[at0.3]
+										}
+									}
+								}
+							}
+							use_node ELEMENT /items[at0008]/items[at0.2]/items[at0.3]
+						}
+					}
+					CLUSTER[at0003] occurrences matches {0..1} matches {	-- Detail
+						items cardinality matches {0..*; unordered} matches {
+							allow_archetype CLUSTER occurrences matches {0..1} matches {
+								include
+									archetype_id/value matches {/exam-generic\.v1/}
+							}
+						}
+					}
+				}
+			}
+			ELEMENT[at0006] occurrences matches {0..*} matches {	-- Image
+				value matches {
+					DV_MULTIMEDIA matches {
+						media_type matches {
+							[openEHR::
+							426, 
+							427, 
+							429]
+						}
+					}
+				}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["en"] = <
+			items = <
+				["at0.10"] = <
+					description = <"*">
+					text = <"Region">
+				>
+				["at0.11"] = <
+					description = <"*">
+					text = <"Left upper quadrant">
+				>
+				["at0.12"] = <
+					description = <"*">
+					text = <"Epigastrium">
+				>
+				["at0.13"] = <
+					description = <"*">
+					text = <"Organs">
+				>
+				["at0.14"] = <
+					description = <"*">
+					text = <"Liver">
+				>
+				["at0.15"] = <
+					description = <"*">
+					text = <"Bowel">
+				>
+				["at0.16"] = <
+					description = <"*">
+					text = <"Left upper quadrant">
+				>
+				["at0.17"] = <
+					description = <"*">
+					text = <"Right loin">
+				>
+				["at0.18"] = <
+					description = <"*">
+					text = <"Central/peri-umbilical">
+				>
+				["at0.19"] = <
+					description = <"*">
+					text = <"Left loin">
+				>
+				["at0.2"] = <
+					description = <"*">
+					text = <"Abdominal wall">
+				>
+				["at0.20"] = <
+					description = <"*">
+					text = <"Right iliac fossa">
+				>
+				["at0.21"] = <
+					description = <"*">
+					text = <"Left iliac fossa">
+				>
+				["at0.22"] = <
+					description = <"*">
+					text = <"New element">
+				>
+				["at0.23"] = <
+					description = <"Clinical description of finding">
+					text = <"Description">
+				>
+				["at0.3"] = <
+					description = <"Clincial description of findings">
+					text = <"Description">
+				>
+				["at0.4"] = <
+					description = <"Shape of abdomen">
+					text = <"Shape">
+				>
+				["at0.5"] = <
+					description = <"*">
+					text = <"Abdomen Contents">
+				>
+				["at0.6"] = <
+					description = <"Clinical description">
+					text = <"Description">
+				>
+				["at0.7"] = <
+					description = <"*">
+					text = <"Spleen">
+				>
+				["at0.8"] = <
+					description = <"*">
+					text = <"Kidney">
+				>
+				["at0.9"] = <
+					description = <"*">
+					text = <"Abdominal Region">
+				>
+				["at0000"] = <
+					description = <"Basic examination cluster for describing findings on physical examination when there is no named focus of examination">
+					text = <"Examination">
+				>
+				["at0000.1"] = <
+					description = <"For recording findings on physical examination of the abdomen">
+					text = <"Examination of the abdomen">
+				>
+				["at0002"] = <
+					description = <"Textural description of the part examined">
+					text = <"Clinical description">
+				>
+				["at0003"] = <
+					description = <"More focused examination findings">
+					text = <"Detail">
+				>
+				["at0004"] = <
+					description = <"A group of statements about the normality of the examination">
+					text = <"Normal statements">
+				>
+				["at0005"] = <
+					description = <"A specific statement of normality">
+					text = <"Normal statement">
+				>
+				["at0006"] = <
+					description = <"Drawing or image of the area examined">
+					text = <"Image">
+				>
+				["at0008"] = <
+					description = <"Clinical findings">
+					text = <"Findings">
+				>
+			>
+		>
+	>
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.exam-chest.v1.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.exam-chest.v1.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.exam-chest.v1.adl	(revision 46)
@@ -0,0 +1,379 @@
+archetype (adl_version=1.4)
+        openEHR-EHR-CLUSTER.exam-chest.v1
+specialize
+        openEHR-EHR-CLUSTER.exam.v1
+
+concept
+        [at0000.1]      -- Examination of the chest
+language
+        original_language = <[ISO_639-1::en]>
+description
+        original_author = <
+                ["name"] = <"Sam Heard">
+                ["organisation"] = <"Ocean Informatics">
+                ["date"] = <"9/04/2007">
+                ["email"] = <"Sam.Heard@OceanInformatics.biz">
+        >
+        details = <
+                ["en"] = <
+                        language = <[ISO_639-1::en]>
+                        purpose = <"A cluster for recording findings on physical examination of the chest">
+                        use = <"">
+                        keywords = <"examination", "physical", "chest", "thorax", "lungs">
+                        misuse = <"">
+                >
+        >
+        lifecycle_state = <"Initial">
+        other_contributors = <>
+
+definition
+        CLUSTER[at0000.1] matches {     -- Examination of the chest
+                items cardinality matches {0..*; unordered} matches {
+                        CLUSTER[at0004] occurrences matches {0..1} matches {    -- Normal statements
+                                items cardinality matches {0..*; unordered} matches {
+                                        ELEMENT[at0005] occurrences matches {0..*} matches {    -- Normal statement
+                                                value matches {
+                                                        DV_TEXT matches {*}
+                                                }
+                                        }
+                                }
+                        }
+                        ELEMENT[at0002] occurrences matches {0..1} matches {    -- Clinical description
+                                value matches {
+                                        DV_TEXT matches {*}
+                                }
+                        }
+                        CLUSTER[at0008] occurrences matches {0..1} matches {    -- Findings
+                                items cardinality matches {0..*; unordered} matches {
+                                        CLUSTER[at0.1] occurrences matches {0..1} matches {     -- Chest wall
+                                                items cardinality matches {0..*; unordered} matches {
+                                                        ELEMENT[at0.2] occurrences matches {0..1} matches {     -- Description
+                                                                value matches {
+                                                                        DV_CODED_TEXT matches {
+                                                                                defining_code matches {[local::]}
+                                                                        }
+                                                                }
+                                                        }
+                                                        ELEMENT[at0.28] occurrences matches {0..1} matches {    -- Shape
+                                                                value matches {
+                                                                        DV_TEXT matches {*}
+                                                                }
+                                                        }
+                                                        CLUSTER[at0.30] occurrences matches {0..1} matches {    -- Heart - Apex beat
+                                                                items cardinality matches {0..*; unordered} matches {
+                                                                        ELEMENT[at0.31] occurrences matches {0..1} matches {    -- Visible
+                                                                                value matches {
+                                                                                        DV_BOOLEAN matches {
+                                                                                                value matches {True, False}
+                                                                                        }
+                                                                                }
+                                                                        }
+                                                                        CLUSTER[at0.32] occurrences matches {0..1} matches {    -- Palpation
+                                                                                items cardinality matches {0..*; unordered} matches {
+                                                                                        ELEMENT[at0.33] occurrences matches {0..1} matches {    -- Palpable
+                                                                                                value matches {
+                                                                                                        DV_BOOLEAN matches {
+                                                                                                                value matches {True, False}
+                                                                                                        }
+                                                                                                }
+                                                                                        }
+                                                                                        ELEMENT[at0.34] occurrences matches {0..1} matches {    -- Maximal location
+                                                                                                value matches {
+                                                                                                        DV_TEXT matches {*}
+                                                                                                }
+                                                                                        }
+                                                                                }
+                                                                        }
+                                                                }
+                                                        }
+                                                        allow_archetype CLUSTER occurrences matches {0..1} matches {
+                                                                include
+                                                                        archetype_id/value matches {/palpation\.v1draft/}
+                                                                        archetype_id/value matches {/inspection\.v1draft/}
+                                                                        archetype_id/value matches {/auscultation-chest\.v1/}
+                                                        }
+                                                }
+                                        }
+                                        CLUSTER[at0.3] occurrences matches {0..1} matches {     -- Respiratory system
+                                                items cardinality matches {0..*; unordered} matches {
+                                                        ELEMENT[at0.4] occurrences matches {0..1} matches {     -- Trachea
+                                                                value matches {
+                                                                        DV_CODED_TEXT matches {
+                                                                                defining_code matches {
+                                                                                        [local::
+                                                                                        at0.5,  -- Midline
+                                                                                        at0.6,  -- Deviated to the left
+                                                                                        at0.7]  -- Deviated to the right
+                                                                                }
+                                                                        }
+                                                                }
+                                                        }
+                                                        CLUSTER[at0.8] occurrences matches {0..1} matches {     -- Breathing
+                                                                items cardinality matches {0..*; unordered} matches {
+                                                                        ELEMENT[at0.19] occurrences matches {0..1} matches {    -- Description
+                                                                                value matches {
+                                                                                        DV_TEXT matches {*}
+                                                                                }
+                                                                        }
+                                                                        ELEMENT[at0.9] occurrences matches {0..1} matches {     -- Type
+                                                                                value matches {
+                                                                                        DV_CODED_TEXT matches {
+                                                                                                defining_code matches {
+                                                                                                        [local::
+                                                                                                        at0.10,         -- Diaphragmatic breathing
+                                                                                                        at0.11] -- Thoracic breathing
+                                                                                                }
+                                                                                        }
+                                                                                }
+                                                                        }
+                                                                        ELEMENT[at0.12] occurrences matches {0..1} matches {    -- Effort
+                                                                                value matches {
+                                                                                        5|[local::at0.13],      -- Normal breathing effort
+                                                                                        6|[local::at0.14],      -- Mild increase in effort
+                                                                                        8|[local::at0.15],      -- Moderate increased effort
+                                                                                        10|[local::at0.16]      -- Major increased effort
+                                                                                }
+                                                                        }
+                                                                        CLUSTER[at0.17] occurrences matches {0..1} matches {    -- Signs of increased effort
+                                                                                items cardinality matches {0..*; unordered} matches {
+                                                                                        ELEMENT[at0.18] occurrences matches {0..*} matches {    -- Sign
+                                                                                                value matches {
+                                                                                                        DV_CODED_TEXT matches {
+                                                                                                                defining_code matches {
+                                                                                                                        [local::
+                                                                                                                        at0.25,         -- Using accessory muscles
+                                                                                                                        at0.20,         -- Intercostal recession
+                                                                                                                        at0.24,         -- Subcostal recession
+                                                                                                                        at0.23,         -- Suprasternal recession
+                                                                                                                        at0.21,         -- Sternal recession
+                                                                                                                        at0.22] -- Rib retraction
+                                                                                                                }
+                                                                                                        }
+                                                                                                }
+                                                                                        }
+                                                                                }
+                                                                        }
+                                                                        ELEMENT[at0.26] occurrences matches {0..1} matches {    -- Paradoxical movement (flail chest)
+                                                                                value matches {
+                                                                                        DV_BOOLEAN matches {
+                                                                                                value matches {True, False}
+                                                                                        }
+                                                                                }
+                                                                        }
+                                                                }
+                                                        }
+                                                }
+                                        }
+                                        CLUSTER[at0003] occurrences matches {0..1} matches {    -- Detail
+                                                items cardinality matches {0..*; unordered} matches {
+                                                        allow_archetype CLUSTER occurrences matches {0..1} matches {
+                                                                include
+                                                                        archetype_id/value matches {/exam-generic\.v1/}
+                                                                        archetype_id/value matches {/auscultation-chest\.v1/}
+                                                                        archetype_id/value matches {/palpation\.v1/}
+                                                                        archetype_id/value matches {/inspection\.v1draft/}
+                                                                        archetype_id/value matches {/percussion\.v1/}
+                                                        }
+                                                }
+                                        }
+                                }
+                        }
+                        CLUSTER[at0.27] occurrences matches {0..1} matches {    -- Lymph nodes
+                                items cardinality matches {0..*; unordered} matches {
+                                        allow_archetype CLUSTER occurrences matches {0..1} matches {
+                                                include
+                                                        archetype_id/value matches {/exam-generic-lympnode\.v1/}
+                                        }
+                                }
+                        }
+                        ELEMENT[at0006] occurrences matches {0..*} matches {    -- Image
+                                value matches {
+                                        DV_MULTIMEDIA matches {
+                                                media_type matches {
+                                                        [openEHR::
+                                                        426, 
+                                                        427, 
+                                                        429]
+                                                }
+                                        }
+                                }
+                        }
+                }
+        }
+
+ontology
+        term_definitions = <
+                ["en"] = <
+                        items = <
+                                ["at0.1"] = <
+                                        description = <"Findings about the chest wall">
+                                        text = <"Chest wall">
+                                >
+                                ["at0.10"] = <
+                                        description = <"Breathing using the diaphragm and not the chest wall">
+                                        text = <"Diaphragmatic breathing">
+                                >
+                                ["at0.11"] = <
+                                        description = <"Breathing using expansion of the chest wall">
+                                        text = <"Thoracic breathing">
+                                >
+                                ["at0.12"] = <
+                                        description = <"Effort required for breathing">
+                                        text = <"Effort">
+                                >
+                                ["at0.13"] = <
+                                        description = <"Diaphragmatic breathing as at rest">
+                                        text = <"Normal breathing effort">
+                                >
+                                ["at0.14"] = <
+                                        description = <"Breathing using obvious chest expansion">
+                                        text = <"Mild increase in effort">
+                                >
+                                ["at0.15"] = <
+                                        description = <"Breathing with signs of abnormal breathing">
+                                        text = <"Moderate increased effort">
+                                >
+                                ["at0.16"] = <
+                                        description = <"Many signs of increased breathing effort">
+                                        text = <"Major increased effort">
+                                >
+                                ["at0.17"] = <
+                                        description = <"Signs of increased respiratory effort">
+                                        text = <"Signs of increased effort">
+                                >
+                                ["at0.18"] = <
+                                        description = <"Use of accessory respiratory muscles">
+                                        text = <"Sign">
+                                >
+                                ["at0.19"] = <
+                                        description = <"Description of breathing">
+                                        text = <"Description">
+                                >
+                                ["at0.2"] = <
+                                        description = <"The contour of the chest wall">
+                                        text = <"Description">
+                                >
+                                ["at0.20"] = <
+                                        description = <"Drawing in between the ribs on inspiration">
+                                        text = <"Intercostal recession">
+                                >
+                                ["at0.21"] = <
+                                        description = <"Drawing in of the sternum on inspiration">
+                                        text = <"Sternal recession">
+                                >
+                                ["at0.22"] = <
+                                        description = <"Indrawing of the chest wall on inspiration">
+                                        text = <"Rib retraction">
+                                >
+                                ["at0.23"] = <
+                                        description = <"Indrawing above the sternum on inspiration">
+                                        text = <"Suprasternal recession">
+                                >
+                                ["at0.24"] = <
+                                        description = <"Indrawing of the subcostal abdominal wall ">
+                                        text = <"Subcostal recession">
+                                >
+                                ["at0.25"] = <
+                                        description = <"Use of accessory respiratory muscles during inspiration">
+                                        text = <"Using accessory muscles">
+                                >
+                                ["at0.26"] = <
+                                        description = <"Any paradoxical movement of the chest wall during respiration">
+                                        text = <"Paradoxical movement (flail chest)">
+                                >
+                                ["at0.27"] = <
+                                        description = <"Lymphnodes">
+                                        text = <"Lymph nodes">
+                                >
+                                ["at0.28"] = <
+                                        description = <"The shape of the chest">
+                                        text = <"Shape">
+                                        comment = <"ChestShape SNOMED query">
+                                >
+                                ["at0.29"] = <
+                                        description = <"Pidgeon chest, with prominent lower sternum">
+                                        text = <"Pectus carinatum">
+                                >
+                                ["at0.3"] = <
+                                        description = <"Respiratory findings">
+                                        text = <"Respiratory system">
+                                >
+                                ["at0.30"] = <
+                                        description = <"*">
+                                        text = <"Heart - Apex beat">
+                                >
+                                ["at0.31"] = <
+                                        description = <"Apex beat is visible">
+                                        text = <"Visible">
+                                >
+                                ["at0.32"] = <
+                                        description = <"*">
+                                        text = <"Palpation">
+                                >
+                                ["at0.33"] = <
+                                        description = <"Apex beat is palpable">
+                                        text = <"Palpable">
+                                >
+                                ["at0.34"] = <
+                                        description = <"Site of maximal location of apex beat">
+                                        text = <"Maximal location">
+                                >
+                                ["at0.4"] = <
+                                        description = <"The position of the trachea">
+                                        text = <"Trachea">
+                                >
+                                ["at0.5"] = <
+                                        description = <"The trachea is in the midline position">
+                                        text = <"Midline">
+                                >
+                                ["at0.6"] = <
+                                        description = <"The trachea is deviated to the left">
+                                        text = <"Deviated to the left">
+                                >
+                                ["at0.7"] = <
+                                        description = <"The trachea is deviated to the right">
+                                        text = <"Deviated to the right">
+                                >
+                                ["at0.8"] = <
+                                        description = <"Findings about breathing">
+                                        text = <"Breathing">
+                                >
+                                ["at0.9"] = <
+                                        description = <"Type of breathing">
+                                        text = <"Type">
+                                >
+                                ["at0000"] = <
+                                        description = <"Basic examination cluster for describing findings on physical examination when there is no named focus of examination">
+                                        text = <"Examination">
+                                >
+                                ["at0000.1"] = <
+                                        description = <"For recording findings on physical examination of the chest wall and lungs">
+                                        text = <"Examination of the chest">
+                                >
+                                ["at0002"] = <
+                                        description = <"Textural description of the part examined">
+                                        text = <"Clinical description">
+                                >
+                                ["at0003"] = <
+                                        description = <"More focused examination findings">
+                                        text = <"Detail">
+                                >
+                                ["at0004"] = <
+                                        description = <"A group of statements about the normality of the examination">
+                                        text = <"Normal statements">
+                                >
+                                ["at0005"] = <
+                                        description = <"A specific statement of normality">
+                                        text = <"Normal statement">
+                                >
+                                ["at0006"] = <
+                                        description = <"Drawing or image of the area examined">
+                                        text = <"Image">
+                                >
+                                ["at0008"] = <
+                                        description = <"Clinical findings">
+                                        text = <"Findings">
+                                >
+                        >
+                >
+        >
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.exam-fetus.v1.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.exam-fetus.v1.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.exam-fetus.v1.adl	(revision 46)
@@ -0,0 +1,577 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-CLUSTER.exam-fetus.v1
+specialize
+	openEHR-EHR-CLUSTER.exam.v1
+
+concept
+	[at0000.1]	-- Examination of the fetus
+language
+	original_language = <[ISO_639-1::en]>
+description
+	original_author = <
+		["name"] = <"unknown">
+	>
+	details = <
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"For recording findings on physical examination relating to the fetus while in the uterus">
+			use = <"">
+			keywords = <"foetus", "fetal", "foetal">
+			misuse = <"">
+		>
+	>
+	lifecycle_state = <"Initial">
+	other_contributors = <>
+
+definition
+	CLUSTER[at0000.1] matches {	-- Examination of the fetus
+		items cardinality matches {0..*; unordered} matches {
+			CLUSTER[at0004] occurrences matches {0..1} matches {	-- Normal statements
+				items cardinality matches {0..*; unordered} matches {
+					ELEMENT[at0005] occurrences matches {0..*} matches {	-- Normal statement
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+				}
+			}
+			ELEMENT[at0002] occurrences matches {0..1} matches {	-- Clinical description
+				value matches {
+					DV_TEXT matches {*}
+				}
+			}
+			CLUSTER[at0008] occurrences matches {0..1} matches {	-- Findings
+				items cardinality matches {0..*; unordered} matches {
+					ELEMENT[at0.4] occurrences matches {0..1} matches {	-- Lie of the fetus
+						value matches {
+							DV_CODED_TEXT matches {
+								defining_code matches {
+									[local::
+									at0.5, 	-- Longitudinal
+									at0.6, 	-- Transverse
+									at0.7]	-- Oblique
+								}
+							}
+						}
+					}
+					ELEMENT[at0.8] occurrences matches {0..1} matches {	-- Presentation
+						value matches {
+							DV_CODED_TEXT matches {
+								defining_code matches {
+									[local::
+									at0.9, 	-- Cephalic
+									at0.10, 	-- Breech
+									at0.11, 	-- Full breech
+									at0.12, 	-- Extended breech
+									at0.13, 	-- Shoulder
+									at0.69, 	-- Footling breech
+									at0.70, 	-- Face
+									at0.71, 	-- Cord
+									at0.72]	-- Compound
+								}
+							}
+						}
+					}
+					ELEMENT[at0.42] occurrences matches {0..1} matches {	-- Position
+						value matches {
+							DV_CODED_TEXT matches {
+								defining_code matches {
+									[local::
+									at0.43, 	-- Right Occipito-transverse
+									at0.44, 	-- Right Occipito-anterior
+									at0.45, 	-- Right Occipito-posterior
+									at0.46, 	-- Occipito-anterior
+									at0.47, 	-- Occipito-posterior
+									at0.48, 	-- Left Occipito-transverse
+									at0.49, 	-- Left Occipito-anterior
+									at0.50, 	-- Left Occipito-posterior
+									at0.51, 	-- Right Sacro-transverse
+									at0.52, 	-- Right Sacro-anterior
+									at0.53, 	-- Right Sacro-posterior
+									at0.54, 	-- Sacro-Anterior
+									at0.55, 	-- Sacro-Posterior
+									at0.56, 	-- Left Sacro-transverse
+									at0.57, 	-- Left Sacro-anterior
+									at0.58, 	-- Left Sacro-posterior
+									at0.59, 	-- Right Mento-transverse
+									at0.60, 	-- Right Mento-anterior
+									at0.61, 	-- Right Mento-posterior
+									at0.62, 	-- Mento-Anterior
+									at0.63, 	-- Mento-Posterior
+									at0.64, 	-- Left Mento-transverse
+									at0.65, 	-- Left Mento-anterior
+									at0.61]	-- Right Mento-posterior
+								}
+							}
+						}
+					}
+					ELEMENT[at0.32] occurrences matches {0..1} matches {	-- Attitude
+						value matches {
+							DV_CODED_TEXT matches {
+								defining_code matches {
+									[local::
+									at0.33, 	-- Flexed
+									at0.34, 	-- Deflexed
+									at0.35]	-- Extended
+								}
+							}
+						}
+					}
+					CLUSTER[at0.74] occurrences matches {0..1} matches {	-- Engagement
+						items cardinality matches {0..*; unordered} matches {
+							ELEMENT[at0.22] occurrences matches {0..1} matches {	-- Fifths
+								value matches {
+									DV_CODED_TEXT matches {
+										defining_code matches {
+											[local::
+											at0.23, 	-- Not engaged (0/5)
+											at0.24, 	-- 1/5
+											at0.25, 	-- 2/5
+											at0.26, 	-- 3/5
+											at0.27, 	-- 4/5
+											at0.28]	-- Fully engaged (5/5)
+										}
+									}
+								}
+							}
+							ELEMENT[at0.75] occurrences matches {0..1} matches {	-- Qualitative
+								value matches {
+									DV_CODED_TEXT matches {
+										defining_code matches {
+											[local::
+											at0.76, 	-- High and mobile
+											at0.77, 	-- At pelvic brim
+											at0.78]	-- Engaged
+										}
+									}
+								}
+							}
+						}
+					}
+					ELEMENT[at0.14] occurrences matches {0..1} matches {	-- Size relative to gestation
+						value matches {
+							DV_CODED_TEXT matches {
+								defining_code matches {
+									[local::
+									at0.15, 	-- Small for dates
+									at0.67, 	-- ? small for dates
+									at0.16, 	-- Normal
+									at0.68, 	-- ? large for dates
+									at0.17]	-- Large for dates
+								}
+							}
+						}
+					}
+					ELEMENT[at0.29] occurrences matches {0..1} matches {	-- Station
+						value matches {
+							C_DV_QUANTITY <
+								property = <[openehr::122]>
+								list = <
+									["1"] = <
+										units = <"cm">
+										magnitude = <|-5.0..5.0|>
+										precision = <|0|>
+									>
+								>
+							>
+						}
+					}
+					ELEMENT[at0.18] occurrences matches {0..1} matches {	-- Estimated fetal weight
+						value matches {
+							C_DV_QUANTITY <
+								property = <[openehr::124]>
+								list = <
+									["1"] = <
+										units = <"kg">
+										magnitude = <|0.0..20.0|>
+									>
+									["2"] = <
+										units = <"gm">
+										magnitude = <|0.0..20000.0|>
+										precision = <|0|>
+									>
+								>
+							>
+						}
+					}
+					CLUSTER[at0007] occurrences matches {0..1} matches {	-- Size
+						items cardinality matches {0..*; unordered} matches {
+							allow_archetype CLUSTER occurrences matches {0..1} matches {
+								include
+									archetype_id/value matches {/dimensions\.v1/}
+									archetype_id/value matches {/size\.v1draft/}
+							}
+						}
+					}
+					CLUSTER[at0003] occurrences matches {0..1} matches {	-- Detail
+						items cardinality matches {0..*; unordered} matches {
+							allow_archetype CLUSTER occurrences matches {0..1} matches {
+								include
+									archetype_id/value matches {/exam\.v1/}
+							}
+						}
+					}
+				}
+			}
+			ELEMENT[at0006] occurrences matches {0..*} matches {	-- Image
+				value matches {
+					DV_MULTIMEDIA matches {
+						media_type matches {
+							[openEHR::
+							426, 
+							427, 
+							429]
+						}
+					}
+				}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["en"] = <
+			items = <
+				["at0.10"] = <
+					description = <"The breech is the presenting part">
+					text = <"Breech">
+				>
+				["at0.11"] = <
+					description = <"The breech is presenting with the legs flexed">
+					text = <"Full breech">
+				>
+				["at0.12"] = <
+					description = <"The breech is the presenting part with the leg(s) extended">
+					text = <"Extended breech">
+				>
+				["at0.13"] = <
+					description = <"The shoulder is the presenting part">
+					text = <"Shoulder">
+				>
+				["at0.14"] = <
+					description = <"The apparent size of the baby relative to normal for gestation">
+					text = <"Size relative to gestation">
+				>
+				["at0.15"] = <
+					description = <"The size of the baby is smaller than expected for gestation">
+					text = <"Small for dates">
+				>
+				["at0.16"] = <
+					description = <"The size of the baby is normal for gestation">
+					text = <"Normal">
+				>
+				["at0.17"] = <
+					description = <"The size of the baby is larger than expected for gestation">
+					text = <"Large for dates">
+				>
+				["at0.18"] = <
+					description = <"The estimated weight of the baby on examination">
+					text = <"Estimated fetal weight">
+				>
+				["at0.19"] = <
+					description = <"The position of the head in relation to the pelvis">
+					text = <"Denominator">
+				>
+				["at0.20"] = <
+					description = <"The occiput is anterior rotated to the anterior">
+					text = <"Left occipito-anterior">
+				>
+				["at0.21"] = <
+					description = <"The occiput is at the back">
+					text = <"Occipito-posterior">
+				>
+				["at0.22"] = <
+					description = <"The proportion of the presenting part which is felt above the pelvis">
+					text = <"Fifths">
+				>
+				["at0.23"] = <
+					description = <"The head is not engaged in the pelvis">
+					text = <"Not engaged (0/5)">
+				>
+				["at0.24"] = <
+					description = <"About 20% of the head is inside the pelvis">
+					text = <"1/5">
+				>
+				["at0.25"] = <
+					description = <"About 40% of the head is inside the pelvis">
+					text = <"2/5">
+				>
+				["at0.26"] = <
+					description = <"About 60% of the head is inside the pelvis">
+					text = <"3/5">
+				>
+				["at0.27"] = <
+					description = <"About 80% of the head is inside the pelvis">
+					text = <"4/5">
+				>
+				["at0.28"] = <
+					description = <"The head is inside the pelvis">
+					text = <"Fully engaged (5/5)">
+				>
+				["at0.29"] = <
+					description = <"Posiiton relative to the ischial spines (minus is above, 0 is at the spines and plus is below)">
+					text = <"Station">
+				>
+				["at0.30"] = <
+					description = <"The occiput is adjacent to the symphasis pubis">
+					text = <"Occipito-anterior">
+				>
+				["at0.31"] = <
+					description = <"The occiput is anterior rotated to the right">
+					text = <"Right occipito-anterior">
+				>
+				["at0.32"] = <
+					description = <"The degree of flexion of the body">
+					text = <"Attitude">
+				>
+				["at0.33"] = <
+					description = <"The fetus is fully flexed">
+					text = <"Flexed">
+				>
+				["at0.34"] = <
+					description = <"The fetus is not flexed">
+					text = <"Deflexed">
+				>
+				["at0.35"] = <
+					description = <"The fetus is extended">
+					text = <"Extended">
+				>
+				["at0.36"] = <
+					description = <"The occiput is on the left">
+					text = <"Left occipito-transverse">
+				>
+				["at0.37"] = <
+					description = <"The occiput is on the right">
+					text = <"Right occipito-transverse">
+				>
+				["at0.38"] = <
+					description = <"*">
+					text = <"Position">
+				>
+				["at0.39"] = <
+					description = <"The occipital bone">
+					text = <"Occipito">
+				>
+				["at0.4"] = <
+					description = <"The position of the fetus">
+					text = <"Lie of the fetus">
+				>
+				["at0.40"] = <
+					description = <"The chin">
+					text = <"Mento">
+				>
+				["at0.41"] = <
+					description = <"The sacral bone">
+					text = <"Sacro">
+				>
+				["at0.42"] = <
+					description = <"The orientation of the denominator">
+					text = <"Position">
+				>
+				["at0.43"] = <
+					description = <"The occiput is towards the right">
+					text = <"Right Occipito-transverse">
+				>
+				["at0.44"] = <
+					description = <"The occiput is towards the right and anterior">
+					text = <"Right Occipito-anterior">
+				>
+				["at0.45"] = <
+					description = <"The occiput is to the right and posterior">
+					text = <"Right Occipito-posterior">
+				>
+				["at0.46"] = <
+					description = <"The occiput is towards the symphasis">
+					text = <"Occipito-anterior">
+				>
+				["at0.47"] = <
+					description = <"The occiput is towards the sacrum">
+					text = <"Occipito-posterior">
+				>
+				["at0.48"] = <
+					description = <"The occiput is towards the left">
+					text = <"Left Occipito-transverse">
+				>
+				["at0.49"] = <
+					description = <"The occiput is to the left and symphasis">
+					text = <"Left Occipito-anterior">
+				>
+				["at0.5"] = <
+					description = <"The lie is along the line of the mother's spine">
+					text = <"Longitudinal">
+				>
+				["at0.50"] = <
+					description = <"The occiput is to the left and posterior">
+					text = <"Left Occipito-posterior">
+				>
+				["at0.51"] = <
+					description = <"The fetal sacrum is towards the right">
+					text = <"Right Sacro-transverse">
+				>
+				["at0.52"] = <
+					description = <"The fetal sacrum is towards the right and anterior">
+					text = <"Right Sacro-anterior">
+				>
+				["at0.53"] = <
+					description = <"The fetal sacrum is to the right and posterior">
+					text = <"Right Sacro-posterior">
+				>
+				["at0.54"] = <
+					description = <"The fetal sacrum is towards the symphasis">
+					text = <"Sacro-Anterior">
+				>
+				["at0.55"] = <
+					description = <"The fetal sacrum is towards the sacrum">
+					text = <"Sacro-Posterior">
+				>
+				["at0.56"] = <
+					description = <"The fetal sacrum is towards the left">
+					text = <"Left Sacro-transverse">
+				>
+				["at0.57"] = <
+					description = <"The fetal sacrum is to the left and symphasis">
+					text = <"Left Sacro-anterior">
+				>
+				["at0.58"] = <
+					description = <"The fetal sacrum is to the left and posterior">
+					text = <"Left Sacro-posterior">
+				>
+				["at0.59"] = <
+					description = <"The fetal chin is towards the right">
+					text = <"Right Mento-transverse">
+				>
+				["at0.6"] = <
+					description = <"The lie is perpendicular to the mother's spine">
+					text = <"Transverse">
+				>
+				["at0.60"] = <
+					description = <"The fetal chin is towards the right and anterior">
+					text = <"Right Mento-anterior">
+				>
+				["at0.61"] = <
+					description = <"The fetal chin is to the right and posterior">
+					text = <"Right Mento-posterior">
+				>
+				["at0.62"] = <
+					description = <"The fetal chin is towards the symphasis">
+					text = <"Mento-Anterior">
+				>
+				["at0.63"] = <
+					description = <"The fetal chin is towards the sacrum">
+					text = <"Mento-Posterior">
+				>
+				["at0.64"] = <
+					description = <"The fetal chin is towards the left">
+					text = <"Left Mento-transverse">
+				>
+				["at0.65"] = <
+					description = <"The fetal chin is to the left and symphasis">
+					text = <"Left Mento-anterior">
+				>
+				["at0.66"] = <
+					description = <"The fetal chin is to the left and posterior">
+					text = <"Left Mento-posterior">
+				>
+				["at0.67"] = <
+					description = <"Possibly small for this gestation">
+					text = <"? small for dates">
+				>
+				["at0.68"] = <
+					description = <"Possibly larger than expected for this gestation">
+					text = <"? large for dates">
+				>
+				["at0.69"] = <
+					description = <"A fetal foot is extended and presenting">
+					text = <"Footling breech">
+				>
+				["at0.7"] = <
+					description = <"The lie is oblique to the mother's spine">
+					text = <"Oblique">
+				>
+				["at0.70"] = <
+					description = <"The head is extended and the face is presenting">
+					text = <"Face">
+				>
+				["at0.71"] = <
+					description = <"The umbilical cord is presenting">
+					text = <"Cord">
+				>
+				["at0.72"] = <
+					description = <"There is a compound presentation">
+					text = <"Compound">
+				>
+				["at0.73"] = <
+					description = <"*">
+					text = <"Station">
+				>
+				["at0.74"] = <
+					description = <"Estimation of presenting part in relation to pelvic brim">
+					text = <"Engagement">
+				>
+				["at0.75"] = <
+					description = <"Description of engagement of fetal head">
+					text = <"Qualitative">
+				>
+				["at0.76"] = <
+					description = <"*">
+					text = <"High and mobile">
+				>
+				["at0.77"] = <
+					description = <"*">
+					text = <"At pelvic brim">
+				>
+				["at0.78"] = <
+					description = <"*">
+					text = <"Engaged">
+				>
+				["at0.79"] = <
+					description = <"*">
+					text = <"Estimation">
+				>
+				["at0.8"] = <
+					description = <"The presenting part of the fetus">
+					text = <"Presentation">
+				>
+				["at0.9"] = <
+					description = <"The head is the presenting part">
+					text = <"Cephalic">
+				>
+				["at0000"] = <
+					description = <"Generic examination cluster for describing a finding on physical examination">
+					text = <"Examination">
+				>
+				["at0000.1"] = <
+					description = <"Examination cluster for describing a finding on physical examination of a fetus">
+					text = <"Examination of the fetus">
+				>
+				["at0002"] = <
+					description = <"Textural description of the part examined">
+					text = <"Clinical description">
+				>
+				["at0003"] = <
+					description = <"More focused examination findings">
+					text = <"Detail">
+				>
+				["at0004"] = <
+					description = <"A group of statements about the normality of the examination">
+					text = <"Normal statements">
+				>
+				["at0005"] = <
+					description = <"A specific statement of normality">
+					text = <"Normal statement">
+				>
+				["at0006"] = <
+					description = <"Drawing or image of the area examined">
+					text = <"Image">
+				>
+				["at0007"] = <
+					description = <"Information about the size of the object for examination">
+					text = <"Size">
+				>
+				["at0008"] = <
+					description = <"Clinical findings">
+					text = <"Findings">
+				>
+			>
+		>
+	>
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.exam-generic-joint.v1.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.exam-generic-joint.v1.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.exam-generic-joint.v1.adl	(revision 46)
@@ -0,0 +1,146 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-CLUSTER.exam-generic-joint.v1
+specialize
+	openEHR-EHR-CLUSTER.exam-generic.v1
+
+concept
+	[at0000.1.1]	-- Examination of a named joint
+language
+	original_language = <[ISO_639-1::en]>
+description
+	original_author = <
+		["name"] = <"unknown">
+	>
+	details = <
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"A generic cluster for recording findings on physical examination.">
+			use = <"">
+			keywords = <"examination", "physical">
+			misuse = <"">
+		>
+	>
+	lifecycle_state = <"Initial">
+	other_contributors = <>
+
+definition
+	CLUSTER[at0000.1.1] matches {	-- Examination of a named joint
+		items cardinality matches {0..*; unordered} matches {
+			ELEMENT[at0.9.1] matches {	-- Joint
+				value matches {
+					DV_TEXT matches {*}
+				}
+			}
+			CLUSTER[at0004] occurrences matches {0..1} matches {	-- Normal statements
+				items cardinality matches {0..*; unordered} matches {
+					ELEMENT[at0005] occurrences matches {0..*} matches {	-- Normal statement
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+				}
+			}
+			ELEMENT[at0002] occurrences matches {0..1} matches {	-- Clinical description
+				value matches {
+					DV_TEXT matches {*}
+				}
+			}
+			CLUSTER[at0008] occurrences matches {0..1} matches {	-- Findings
+				items cardinality matches {0..*; unordered} matches {
+					allow_archetype CLUSTER occurrences matches {0..*} matches {
+						include
+							archetype_id/value matches {/palpation\.v1draft/}
+							archetype_id/value matches {/inspection\.v1draft/}
+							archetype_id/value matches {/move-joint\.v1draft/}
+						exclude
+							archetype_id/value matches {/.*/}
+					}
+					CLUSTER[at0.1] occurrences matches {0..1} matches {	-- Size
+						items cardinality matches {0..*; unordered} matches {
+							allow_archetype CLUSTER occurrences matches {0..1} matches {
+								include
+									archetype_id/value matches {/dimensions\.v1/}
+									archetype_id/value matches {/size\.v1draft/}
+							}
+						}
+					}
+					CLUSTER[at0003] occurrences matches {0..1} matches {	-- Detail
+						items cardinality matches {0..*; unordered} matches {
+							allow_archetype CLUSTER occurrences matches {0..1} matches {
+								include
+									archetype_id/value matches {/exam\.v1/}
+							}
+						}
+					}
+				}
+			}
+			ELEMENT[at0006] occurrences matches {0..*} matches {	-- Image
+				value matches {
+					DV_MULTIMEDIA matches {
+						media_type matches {
+							[openEHR::
+							426, 
+							427, 
+							429]
+						}
+					}
+				}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["en"] = <
+			items = <
+				["at0.1"] = <
+					description = <"Information about the size of the object for examination">
+					text = <"Size">
+				>
+				["at0.9"] = <
+					description = <"The object of examination">
+					text = <"Object">
+				>
+				["at0.9.1"] = <
+					description = <"The joint examined">
+					text = <"Joint">
+				>
+				["at0000"] = <
+					description = <"Generic examination cluster for describing a finding on physical examination">
+					text = <"Examination">
+				>
+				["at0000.1"] = <
+					description = <"Generic examination cluster for describing a finding on physical examination">
+					text = <"Examination of a named body part">
+				>
+				["at0000.1.1"] = <
+					description = <"Generic examination cluster for describing findings relating to a joint on physical examination">
+					text = <"Examination of a named joint">
+				>
+				["at0002"] = <
+					description = <"Textural description of the part examined">
+					text = <"Clinical description">
+				>
+				["at0003"] = <
+					description = <"More focused examination findings">
+					text = <"Detail">
+				>
+				["at0004"] = <
+					description = <"A group of statements about the normality of the examination">
+					text = <"Normal statements">
+				>
+				["at0005"] = <
+					description = <"A specific statement of normality">
+					text = <"Normal statement">
+				>
+				["at0006"] = <
+					description = <"Drawing or image of the area examined">
+					text = <"Image">
+				>
+				["at0008"] = <
+					description = <"Clinical findings">
+					text = <"Findings">
+				>
+			>
+		>
+	>
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.exam-generic-lymphnode.v1.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.exam-generic-lymphnode.v1.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.exam-generic-lymphnode.v1.adl	(revision 46)
@@ -0,0 +1,176 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-CLUSTER.exam-generic-lymphnode.v1
+specialize
+	openEHR-EHR-CLUSTER.exam-generic.v1
+
+concept
+	[at0000.1.1]	-- Examination of lymph nodes
+language
+	original_language = <[ISO_639-1::en]>
+description
+	original_author = <
+		["name"] = <"unknown">
+	>
+	details = <
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"For recording findings on physical examination of lymph nodes">
+			use = <"">
+			keywords = <"examination", "physical", "lymph", "nodes">
+			misuse = <"">
+		>
+	>
+	lifecycle_state = <"OrganisationDraft">
+	other_contributors = <>
+
+definition
+	CLUSTER[at0000.1.1] matches {	-- Examination of lymph nodes
+		items cardinality matches {0..*; unordered} matches {
+			ELEMENT[at0.9.1] matches {	-- Lymph node group
+				value matches {
+					DV_TEXT matches {*}
+				}
+			}
+			CLUSTER[at0004] occurrences matches {0..1} matches {	-- Normal statements
+				items cardinality matches {0..*; unordered} matches {
+					ELEMENT[at0005] occurrences matches {0..*} matches {	-- Normal statement
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+				}
+			}
+			ELEMENT[at0002] occurrences matches {0..1} matches {	-- Clinical description
+				value matches {
+					DV_TEXT matches {*}
+				}
+			}
+			CLUSTER[at0008] occurrences matches {0..1} matches {	-- Findings
+				items cardinality matches {0..*; unordered} matches {
+					allow_archetype CLUSTER occurrences matches {0..*} matches {
+						include
+							archetype_id/value matches {/palpation\.v1draft/}
+							archetype_id/value matches {/inspection\.v1draft/}
+						exclude
+							archetype_id/value matches {/.*/}
+					}
+					CLUSTER[at0.1] occurrences matches {0..1} matches {	-- Size
+						items cardinality matches {0..*; unordered} matches {
+							allow_archetype CLUSTER occurrences matches {0..1} matches {
+								include
+									archetype_id/value matches {/size\.v1draft/}
+							}
+						}
+					}
+					CLUSTER[at0003.0.1] occurrences matches {0..1} matches {	-- Individual nodes
+						items cardinality matches {0..*; unordered} matches {
+							CLUSTER[at0.0.12] occurrences matches {0..1} matches {	-- Node
+								items cardinality matches {1..*; unordered} matches {
+									ELEMENT[at0.0.11] occurrences matches {0..1} matches {	-- Node name
+										value matches {
+											DV_TEXT matches {*}
+										}
+									}
+									ELEMENT[at0.0.13] occurrences matches {0..1} matches {	-- Description
+										value matches {
+											DV_TEXT matches {*}
+										}
+									}
+								}
+							}
+						}
+					}
+				}
+			}
+			ELEMENT[at0006] occurrences matches {0..*} matches {	-- Image
+				value matches {
+					DV_MULTIMEDIA matches {
+						media_type matches {
+							[openEHR::
+							426, 
+							427, 
+							429]
+						}
+					}
+				}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["en"] = <
+			items = <
+				["at0.0.10"] = <
+					description = <"All major lymph nodes">
+					text = <"Lymph nodes">
+				>
+				["at0.0.11"] = <
+					description = <"The name of the node">
+					text = <"Node name">
+					comment = <"SNOMED Lymphnode">
+				>
+				["at0.0.12"] = <
+					description = <"Group of findings relating to an individual node">
+					text = <"Node">
+				>
+				["at0.0.13"] = <
+					description = <"Description of individual node">
+					text = <"Description">
+				>
+				["at0.1"] = <
+					description = <"Information about the size of the object for examination">
+					text = <"Size">
+				>
+				["at0.9"] = <
+					description = <"The object of examination">
+					text = <"Object">
+				>
+				["at0.9.1"] = <
+					description = <"The group of nodes examined">
+					text = <"Lymph node group">
+					comment = <"SNOMED query LymphnodeGroup">
+				>
+				["at0000"] = <
+					description = <"Generic examination cluster for describing a finding on physical examination">
+					text = <"Examination">
+				>
+				["at0000.1"] = <
+					description = <"Generic examination cluster for describing a finding on physical examination">
+					text = <"Examination of a named body part">
+				>
+				["at0000.1.1"] = <
+					description = <"For recording the findings on physical examination of lymph nodes">
+					text = <"Examination of lymph nodes">
+				>
+				["at0002"] = <
+					description = <"Textural description of the part examined">
+					text = <"Clinical description">
+				>
+				["at0003"] = <
+					description = <"More focused examination findings">
+					text = <"Detail">
+				>
+				["at0003.0.1"] = <
+					description = <"More focused examination findings on each node">
+					text = <"Individual nodes">
+				>
+				["at0004"] = <
+					description = <"A group of statements about the normality of the examination">
+					text = <"Normal statements">
+				>
+				["at0005"] = <
+					description = <"A specific statement of normality">
+					text = <"Normal statement">
+				>
+				["at0006"] = <
+					description = <"Drawing or image of the area examined">
+					text = <"Image">
+				>
+				["at0008"] = <
+					description = <"Clinical findings">
+					text = <"Findings">
+				>
+			>
+		>
+	>
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.exam-generic-mass.v1.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.exam-generic-mass.v1.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.exam-generic-mass.v1.adl	(revision 46)
@@ -0,0 +1,221 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-CLUSTER.exam-generic-mass.v1
+specialize
+	openEHR-EHR-CLUSTER.exam-generic.v1
+
+concept
+	[at0000.1]	-- Examination of a named mass
+language
+	original_language = <[ISO_639-1::en]>
+description
+	original_author = <
+		["name"] = <"unknown">
+	>
+	details = <
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"A generic cluster for recording findings on physical examination of the findings when examining a pathological mass occupying lesion which might be a swelling, lump or mass.">
+			use = <"">
+			keywords = <"examination", "physical">
+			misuse = <"">
+		>
+	>
+	lifecycle_state = <"Initial">
+	other_contributors = <>
+
+definition
+	CLUSTER[at0000.1.1] matches {	-- Examination of a mass lesion
+		items cardinality matches {0..*; unordered} matches {
+			ELEMENT[at0.9] matches {	-- Object
+				value matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {
+							[local::
+							at0.0.1, 	-- Mass
+							at0.0.2, 	-- Lump
+							at0.0.3]	-- Swelling
+						}
+					}
+				}
+			}
+			CLUSTER[at0004] occurrences matches {0..1} matches {	-- Normal statements
+				items cardinality matches {0..*; unordered} matches {
+					ELEMENT[at0005] occurrences matches {0..*} matches {	-- Normal statement
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+				}
+			}
+			ELEMENT[at0002] occurrences matches {0..1} matches {	-- Clinical description
+				value matches {
+					DV_TEXT matches {*}
+				}
+			}
+			CLUSTER[at0008] occurrences matches {0..1} matches {	-- Findings
+				items cardinality matches {0..*; unordered} matches {
+					allow_archetype CLUSTER occurrences matches {0..*} matches {
+						include
+							archetype_id/value matches {/palpation\.v1draft/}
+							archetype_id/value matches {/inspection\.v1draft/}
+					}
+					CLUSTER[at0.1] occurrences matches {0..1} matches {	-- Size
+						items cardinality matches {0..*; unordered} matches {
+							allow_archetype CLUSTER occurrences matches {0..1} matches {
+								include
+									archetype_id/value matches {/dimensions\.v1/}
+									archetype_id/value matches {/size\.v1draft/}
+							}
+						}
+					}
+					ELEMENT[at0.0.4] occurrences matches {0..1} matches {	-- Location
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+					ELEMENT[at0.0.5] occurrences matches {0..1} matches {	-- Arising from
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+					ELEMENT[at0.0.6] occurrences matches {0..1} matches {	-- Mobility
+						value matches {
+							DV_CODED_TEXT matches {
+								defining_code matches {
+									[local::
+									at0.0.7, 	-- Highly mobile
+									at0.0.8, 	-- Mobile
+									at0.0.9, 	-- Fixed
+									at0.0.10]	-- Adherent
+								}
+							}
+						}
+					}
+					allow_archetype CLUSTER occurrences matches {0..*} matches {
+						include
+							archetype_id/value matches {/palpation\.v1draft/}
+							archetype_id/value matches {/auscultation\.v1draft/}
+							archetype_id/value matches {/inspection\.v1draft/}
+						exclude
+							archetype_id/value matches {/.*/}
+					}
+					CLUSTER[at0003] occurrences matches {0..1} matches {	-- Detail
+						items cardinality matches {0..*; unordered} matches {
+							allow_archetype CLUSTER occurrences matches {0..1} matches {
+								include
+									archetype_id/value matches {/exam\.v1/}
+							}
+						}
+					}
+				}
+			}
+			ELEMENT[at0006] occurrences matches {0..*} matches {	-- Image
+				value matches {
+					DV_MULTIMEDIA matches {
+						media_type matches {
+							[openEHR::
+							426, 
+							427, 
+							429]
+						}
+					}
+				}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["en"] = <
+			items = <
+				["at0.0.1"] = <
+					description = <"The object is a mass lesion">
+					text = <"Mass">
+				>
+				["at0.0.10"] = <
+					description = <"The mass merges with surrounding structures">
+					text = <"Adherent">
+				>
+				["at0.0.2"] = <
+					description = <"The object is a lump">
+					text = <"Lump">
+				>
+				["at0.0.3"] = <
+					description = <"The object of examination is a swelling">
+					text = <"Swelling">
+				>
+				["at0.0.4"] = <
+					description = <"The location of the mass">
+					text = <"Location">
+				>
+				["at0.0.5"] = <
+					description = <"The organ or body structure from which the lesion is arising">
+					text = <"Arising from">
+				>
+				["at0.0.6"] = <
+					description = <"The mobility of the mass lesion">
+					text = <"Mobility">
+				>
+				["at0.0.7"] = <
+					description = <"The mass lesion is apparently untethered to surrounding structures">
+					text = <"Highly mobile">
+				>
+				["at0.0.8"] = <
+					description = <"The mass is tethered but moves freely">
+					text = <"Mobile">
+				>
+				["at0.0.9"] = <
+					description = <"The mass is fixed to surrounding structures">
+					text = <"Fixed">
+				>
+				["at0.1"] = <
+					description = <"Information about the size of the object for examination">
+					text = <"Size">
+				>
+				["at0.9"] = <
+					description = <"The object of examination">
+					text = <"Object">
+				>
+				["at0000"] = <
+					description = <"Generic examination cluster for describing a finding on physical examination">
+					text = <"Examination">
+				>
+				["at0000.1"] = <
+					description = <"For describing findings on physical examination relating to a mass">
+					text = <"Examination of a named mass">
+				>
+				["at0000.1.1"] = <
+					description = <"Generic examination cluster for describing the findings on physical examination of a mass, lump or swelling">
+					text = <"Examination of a mass lesion">
+				>
+				["at0001"] = <
+					description = <"The object of the examination">
+					text = <"Object">
+				>
+				["at0002"] = <
+					description = <"Textural description of the part examined">
+					text = <"Clinical description">
+				>
+				["at0003"] = <
+					description = <"More focused examination findings">
+					text = <"Detail">
+				>
+				["at0004"] = <
+					description = <"A group of statements about the normality of the examination">
+					text = <"Normal statements">
+				>
+				["at0005"] = <
+					description = <"A specific statement of normality">
+					text = <"Normal statement">
+				>
+				["at0006"] = <
+					description = <"Drawing or image of the area examined">
+					text = <"Image">
+				>
+				["at0008"] = <
+					description = <"Clinical findings">
+					text = <"Findings">
+				>
+			>
+		>
+	>
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.exam-generic.v1.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.exam-generic.v1.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.exam-generic.v1.adl	(revision 46)
@@ -0,0 +1,139 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-CLUSTER.exam-generic.v1
+specialize
+	openEHR-EHR-CLUSTER.exam.v1
+
+concept
+	[at0000.1]	-- Examination of a named body part
+language
+	original_language = <[ISO_639-1::en]>
+description
+	original_author = <
+		["name"] = <"unknown">
+	>
+	details = <
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"A generic cluster for recording findings on physical examination.">
+			use = <"">
+			keywords = <"examination", "physical">
+			misuse = <"">
+		>
+	>
+	lifecycle_state = <"Initial">
+	other_contributors = <>
+
+definition
+	CLUSTER[at0000.1] matches {	-- Examination of a named body part
+		items cardinality matches {0..*; unordered} matches {
+			ELEMENT[at0.9] matches {	-- Object
+				value matches {
+					DV_TEXT matches {*}
+				}
+			}
+			CLUSTER[at0004] occurrences matches {0..1} matches {	-- Normal statements
+				items cardinality matches {0..*; unordered} matches {
+					ELEMENT[at0005] occurrences matches {0..*} matches {	-- Normal statement
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+				}
+			}
+			ELEMENT[at0002] occurrences matches {0..1} matches {	-- Clinical description
+				value matches {
+					DV_TEXT matches {*}
+				}
+			}
+			CLUSTER[at0008] occurrences matches {0..1} matches {	-- Findings
+				items cardinality matches {0..*; unordered} matches {
+					allow_archetype CLUSTER occurrences matches {0..*} matches {
+						include
+							archetype_id/value matches {/palpation\.v1draft/}
+							archetype_id/value matches {/auscultation\.v1draft/}
+							archetype_id/value matches {/inspection\.v1draft/}
+							archetype_id/value matches {/percussion\.v1draft/}
+						exclude
+							archetype_id/value matches {/.*/}
+					}
+					CLUSTER[at0.1] occurrences matches {0..1} matches {	-- Size
+						items cardinality matches {0..*; unordered} matches {
+							allow_archetype CLUSTER occurrences matches {0..1} matches {
+								include
+									archetype_id/value matches {/dimensions\.v1/}
+									archetype_id/value matches {/size\.v1draft/}
+							}
+						}
+					}
+					CLUSTER[at0003] occurrences matches {0..1} matches {	-- Detail
+						items cardinality matches {0..*; unordered} matches {
+							allow_archetype CLUSTER occurrences matches {0..1} matches {
+								include
+									archetype_id/value matches {/exam-generic\.v1/}
+							}
+						}
+					}
+				}
+			}
+			ELEMENT[at0006] occurrences matches {0..*} matches {	-- Image
+				value matches {
+					DV_MULTIMEDIA matches {
+						media_type matches {
+							[openEHR::
+							426, 
+							427, 
+							429]
+						}
+					}
+				}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["en"] = <
+			items = <
+				["at0.1"] = <
+					description = <"Information about the size of the object for examination">
+					text = <"Size">
+				>
+				["at0.9"] = <
+					description = <"The object of examination">
+					text = <"Object">
+				>
+				["at0000"] = <
+					description = <"Generic examination cluster for describing a finding on physical examination">
+					text = <"Examination">
+				>
+				["at0000.1"] = <
+					description = <"Generic examination cluster for describing a finding on physical examination">
+					text = <"Examination of a named body part">
+				>
+				["at0002"] = <
+					description = <"Textural description of the part examined">
+					text = <"Clinical description">
+				>
+				["at0003"] = <
+					description = <"More focused examination findings">
+					text = <"Detail">
+				>
+				["at0004"] = <
+					description = <"A group of statements about the normality of the examination">
+					text = <"Normal statements">
+				>
+				["at0005"] = <
+					description = <"A specific statement of normality">
+					text = <"Normal statement">
+				>
+				["at0006"] = <
+					description = <"Drawing or image of the area examined">
+					text = <"Image">
+				>
+				["at0008"] = <
+					description = <"Clinical findings">
+					text = <"Findings">
+				>
+			>
+		>
+	>
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl	(revision 46)
@@ -0,0 +1,116 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-CLUSTER.exam-nervous_system.v1
+specialize
+	openEHR-EHR-CLUSTER.exam.v1
+
+concept
+	[at0000.1]	-- Examination of nervous system
+language
+	original_language = <[ISO_639-1::en]>
+description
+	original_author = <
+		["name"] = <"unknown">
+	>
+	details = <
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"A generic cluster for recording findings on physical examination of the nervous system.">
+			use = <"">
+			keywords = <"examination", "physical">
+			misuse = <"">
+		>
+	>
+	lifecycle_state = <"Initial">
+	other_contributors = <>
+
+definition
+	CLUSTER[at0000.1] matches {	-- Examination of nervous system
+		items cardinality matches {0..*; unordered} matches {
+			CLUSTER[at0004] occurrences matches {0..1} matches {	-- Normal statements
+				items cardinality matches {0..*; unordered} matches {
+					ELEMENT[at0005] occurrences matches {0..*} matches {	-- Normal statement
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+				}
+			}
+			ELEMENT[at0002] occurrences matches {0..1} matches {	-- Clinical description
+				value matches {
+					DV_TEXT matches {*}
+				}
+			}
+			CLUSTER[at0008] occurrences matches {0..1} matches {	-- Findings
+				items cardinality matches {0..*; unordered} matches {
+					allow_archetype CLUSTER occurrences matches {0..1} matches {
+						include
+							archetype_id/value matches {/cranial_nerves\.v1draft/}
+							archetype_id/value matches {/coordination\.v1draft/}
+							archetype_id/value matches {/balance\.v1draft/}
+							archetype_id/value matches {/gait\.v1draft/}
+							archetype_id/value matches {/move\.v1/}
+					}
+					CLUSTER[at0003] occurrences matches {0..1} matches {	-- Detail
+						items cardinality matches {0..*; unordered} matches {
+							allow_archetype CLUSTER occurrences matches {0..1} matches {
+								include
+									archetype_id/value matches {/exam-generic\.v1/}
+							}
+						}
+					}
+				}
+			}
+			ELEMENT[at0006] occurrences matches {0..*} matches {	-- Image
+				value matches {
+					DV_MULTIMEDIA matches {
+						media_type matches {
+							[openEHR::
+							426, 
+							427, 
+							429]
+						}
+					}
+				}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["en"] = <
+			items = <
+				["at0000"] = <
+					description = <"Basic examination cluster for describing findings on physical examination when there is no named focus of examination">
+					text = <"Examination">
+				>
+				["at0000.1"] = <
+					description = <"Basic examination cluster for describing findings on physical examination of the nervous system">
+					text = <"Examination of nervous system">
+				>
+				["at0002"] = <
+					description = <"Textural description of the part examined">
+					text = <"Clinical description">
+				>
+				["at0003"] = <
+					description = <"More focused examination findings">
+					text = <"Detail">
+				>
+				["at0004"] = <
+					description = <"A group of statements about the normality of the examination">
+					text = <"Normal statements">
+				>
+				["at0005"] = <
+					description = <"A specific statement of normality">
+					text = <"Normal statement">
+				>
+				["at0006"] = <
+					description = <"Drawing or image of the area examined">
+					text = <"Image">
+				>
+				["at0008"] = <
+					description = <"Clinical findings">
+					text = <"Findings">
+				>
+			>
+		>
+	>
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.exam-uterine_cervix.v1.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.exam-uterine_cervix.v1.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-CLUSTER.exam-uterine_cervix.v1.adl	(revision 46)
@@ -0,0 +1,420 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-CLUSTER.exam-uterine_cervix.v1
+specialize
+	openEHR-EHR-CLUSTER.exam.v1
+
+concept
+	[at0000.1]	-- Examination of the cervix
+language
+	original_language = <[ISO_639-1::en]>
+description
+	original_author = <
+		["name"] = <"unknown">
+	>
+	details = <
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"A cluster for recording findings regarding the uterine cervix on physical examination.">
+			use = <"">
+			keywords = <"examination", "physical", "cervix", "uterine">
+			misuse = <"">
+		>
+	>
+	lifecycle_state = <"Initial">
+	other_contributors = <>
+
+definition
+	CLUSTER[at0000.1] matches {	-- Examination of the cervix
+		items cardinality matches {0..*; unordered} matches {
+			CLUSTER[at0004] occurrences matches {0..1} matches {	-- Normal statements
+				items cardinality matches {0..*; unordered} matches {
+					ELEMENT[at0005] occurrences matches {0..*} matches {	-- Normal statement
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+				}
+			}
+			ELEMENT[at0002] occurrences matches {0..1} matches {	-- Clinical description
+				value matches {
+					DV_TEXT matches {*}
+				}
+			}
+			CLUSTER[at0008] occurrences matches {0..1} matches {	-- Findings
+				items cardinality matches {0..*; unordered} matches {
+					ELEMENT[at0.8] occurrences matches {0..1} matches {	-- Position
+						value matches {
+							DV_CODED_TEXT matches {
+								defining_code matches {
+									[local::
+									at0.9, 	-- Central
+									at0.10, 	-- To the right
+									at0.11, 	-- To the left
+									at0.12, 	-- Anterior
+									at0.13]	-- Posterior
+								}
+							}
+						}
+					}
+					ELEMENT[at0.36] occurrences matches {0..1} matches {	-- Consistency
+						value matches {
+							DV_CODED_TEXT matches {
+								defining_code matches {
+									[local::
+									at0.37, 	-- Soft
+									at0.38]	-- Firm
+								}
+							}
+						}
+					}
+					CLUSTER[at0007] occurrences matches {0..1} matches {	-- Size
+						items cardinality matches {0..*; unordered} matches {
+							allow_archetype CLUSTER occurrences matches {0..1} matches {
+								include
+									archetype_id/value matches {/dimensions\.v1/}
+							}
+						}
+					}
+					CLUSTER[at0.48] occurrences matches {0..1} matches {	-- Labour-specific findings
+						items cardinality matches {0..*; unordered} matches {
+							ELEMENT[at0.14] occurrences matches {0..1} matches {	-- Effacement
+								value matches {
+									0|[local::at0.15], 	-- Uneffaced
+									5|[local::at0.26], 	-- Ripe
+									10|[local::at0.16], 	-- 10% effaced
+									20|[local::at0.17], 	-- 20% effaced
+									30|[local::at0.18], 	-- 30% effaced
+									40|[local::at0.19], 	-- 40% effaced
+									50|[local::at0.20], 	-- Partially (50%) effaced
+									60|[local::at0.21], 	-- 60% effaced
+									70|[local::at0.22], 	-- 70% effaced
+									80|[local::at0.23], 	-- 80% effaced
+									90|[local::at0.24], 	-- 90% effaced
+									100|[local::at0.25]  	-- Fully effaced
+								}
+							}
+							ELEMENT[at0.40] occurrences matches {0..1} matches {	-- Thickness
+								value matches {
+									DV_CODED_TEXT matches {
+										defining_code matches {
+											[local::
+											at0.41, 	-- Thick
+											at0.42, 	-- Thin
+											at0.43, 	-- Paper-thin
+											at0.44]	-- Oedematous
+										}
+									}
+								}
+							}
+							ELEMENT[at0.45] occurrences matches {0..1} matches {	-- Application to presenting part
+								value matches {
+									DV_CODED_TEXT matches {
+										defining_code matches {
+											[local::
+											at0.46, 	-- Loosely applied
+											at0.47]	-- Tightly applied
+										}
+									}
+								}
+							}
+							CLUSTER[at0.27] occurrences matches {0..2} matches {	-- Cervical os
+								items cardinality matches {0..*; unordered} matches {
+									ELEMENT[at0.32] occurrences matches {0..1} matches {	-- Site
+										value matches {
+											DV_CODED_TEXT matches {
+												defining_code matches {
+													[local::
+													at0.33, 	-- External os
+													at0.34]	-- Internal os
+												}
+											}
+										}
+									}
+									CLUSTER[at0.31] occurrences matches {0..1} matches {	-- Dilation
+										items cardinality matches {0..*; unordered} matches {
+											ELEMENT[at0.28] occurrences matches {0..1} matches {	-- Estimate
+												value matches {
+													C_DV_QUANTITY <
+														property = <[openehr::122]>
+														list = <
+															["1"] = <
+																units = <"cm">
+																magnitude = <|0.0..10.0|>
+																precision = <|1|>
+															>
+														>
+													>
+												}
+											}
+											ELEMENT[at0.35] occurrences matches {0..1} matches {	-- Number of finger tips admitted
+												value matches {
+													DV_COUNT matches {*}
+												}
+											}
+										}
+									}
+									ELEMENT[at0.29] occurrences matches {0..1} matches {	-- Findings
+										value matches {
+											DV_TEXT matches {*}
+										}
+									}
+								}
+							}
+						}
+					}
+					allow_archetype CLUSTER occurrences matches {0..*} matches {
+						include
+							archetype_id/value matches {/palpation\.v1draft/}
+							archetype_id/value matches {/inspection\.v1draft/}
+						exclude
+							archetype_id/value matches {/.*/}
+					}
+					CLUSTER[at0.30] occurrences matches {0..1} matches {	-- Vaginal fluid
+						items cardinality matches {0..*; unordered} matches {
+							allow_archetype CLUSTER occurrences matches {0..1} matches {
+								include
+									archetype_id/value matches {/fluid\.v1/}
+							}
+						}
+					}
+					CLUSTER[at0003] occurrences matches {0..1} matches {	-- Detail
+						items cardinality matches {0..*; unordered} matches {
+							allow_archetype CLUSTER occurrences matches {0..1} matches {
+								include
+									archetype_id/value matches {/exam\.v1/}
+									archetype_id/value matches {/exam-fetus\.v1/}
+							}
+						}
+					}
+				}
+			}
+			ELEMENT[at0006] occurrences matches {0..*} matches {	-- Image
+				value matches {
+					DV_MULTIMEDIA matches {
+						media_type matches {
+							[openEHR::
+							426, 
+							427, 
+							429]
+						}
+					}
+				}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["en"] = <
+			items = <
+				["at0.1"] = <
+					description = <"Information about the size of the object for examination">
+					text = <"Size">
+				>
+				["at0.10"] = <
+					description = <"The cervix is deviated to the right">
+					text = <"To the right">
+				>
+				["at0.11"] = <
+					description = <"The cervix is deviated to the left">
+					text = <"To the left">
+				>
+				["at0.12"] = <
+					description = <"The cervix is anterior near the pubis">
+					text = <"Anterior">
+				>
+				["at0.13"] = <
+					description = <"The cervix is at the back near the sacrum">
+					text = <"Posterior">
+				>
+				["at0.14"] = <
+					description = <"The effacement of the uterine cervix in late pregnancy or labour.">
+					text = <"Effacement">
+				>
+				["at0.15"] = <
+					description = <"The cervix has not changed its form">
+					text = <"Uneffaced">
+				>
+				["at0.16"] = <
+					description = <"The cervix is effaced to about 10%">
+					text = <"10% effaced">
+				>
+				["at0.17"] = <
+					description = <"The cervix is effaced to about 20%">
+					text = <"20% effaced">
+				>
+				["at0.18"] = <
+					description = <"The cervix is effaced to about 30%">
+					text = <"30% effaced">
+				>
+				["at0.19"] = <
+					description = <"The cervix is effaced to about 40%">
+					text = <"40% effaced">
+				>
+				["at0.20"] = <
+					description = <"The cervix is partially effaced to about 50%">
+					text = <"Partially (50%) effaced">
+				>
+				["at0.21"] = <
+					description = <"The cervix is effaced to about 60%">
+					text = <"60% effaced">
+				>
+				["at0.22"] = <
+					description = <"The cervix is effaced to about 70%">
+					text = <"70% effaced">
+				>
+				["at0.23"] = <
+					description = <"The cervix is effaced to about 80%">
+					text = <"80% effaced">
+				>
+				["at0.24"] = <
+					description = <"The cervix is effaced to about 90%">
+					text = <"90% effaced">
+				>
+				["at0.25"] = <
+					description = <"The cervix is fully effaced to 100%">
+					text = <"Fully effaced">
+				>
+				["at0.26"] = <
+					description = <"The cervix is ripe and beginning to efface">
+					text = <"Ripe">
+				>
+				["at0.27"] = <
+					description = <"The outlet of the uterus">
+					text = <"Cervical os">
+				>
+				["at0.28"] = <
+					description = <"The dilation of the os">
+					text = <"Estimate">
+				>
+				["at0.29"] = <
+					description = <"Findings about the cervical os">
+					text = <"Findings">
+				>
+				["at0.30"] = <
+					description = <"Vaginal loss or discharge">
+					text = <"Vaginal fluid">
+				>
+				["at0.31"] = <
+					description = <"Dilation of cervix">
+					text = <"Dilation">
+				>
+				["at0.32"] = <
+					description = <"Identify part of cervix which is being examined">
+					text = <"Site">
+				>
+				["at0.33"] = <
+					description = <"External opening of the cervix to the vagina">
+					text = <"External os">
+				>
+				["at0.34"] = <
+					description = <"Internal opening of the cervix to the uterus">
+					text = <"Internal os">
+				>
+				["at0.35"] = <
+					description = <"Number of finger tips that are able to be admitted into the internal or external os">
+					text = <"Number of finger tips admitted">
+				>
+				["at0.36"] = <
+					description = <"Consistency of cervix">
+					text = <"Consistency">
+				>
+				["at0.37"] = <
+					description = <"Soft">
+					text = <"Soft">
+				>
+				["at0.38"] = <
+					description = <"Firm">
+					text = <"Firm">
+				>
+				["at0.39"] = <
+					description = <"Length of cervix">
+					text = <"Length">
+				>
+				["at0.40"] = <
+					description = <"Cervical thickness">
+					text = <"Thickness">
+				>
+				["at0.41"] = <
+					description = <"Thick">
+					text = <"Thick">
+				>
+				["at0.42"] = <
+					description = <"Thin">
+					text = <"Thin">
+				>
+				["at0.43"] = <
+					description = <"Very thin">
+					text = <"Paper-thin">
+				>
+				["at0.44"] = <
+					description = <"Thickened and swollen">
+					text = <"Oedematous">
+				>
+				["at0.45"] = <
+					description = <"Application of cervix to fetal presenting part">
+					text = <"Application to presenting part">
+				>
+				["at0.46"] = <
+					description = <"Not moulded to presenting part">
+					text = <"Loosely applied">
+				>
+				["at0.47"] = <
+					description = <"Moulded to presenting part">
+					text = <"Tightly applied">
+				>
+				["at0.48"] = <
+					description = <"*">
+					text = <"Labour-specific findings">
+				>
+				["at0.8"] = <
+					description = <"The position in relation to the normal anatomical position">
+					text = <"Position">
+				>
+				["at0.9"] = <
+					description = <"The cervix is central and in the normal position">
+					text = <"Central">
+				>
+				["at0000"] = <
+					description = <"Generic examination cluster for describing a finding on physical examination">
+					text = <"Examination">
+				>
+				["at0000.1"] = <
+					description = <"Examination findings on physical examination of the uterine cervix">
+					text = <"Examination of the cervix">
+				>
+				["at0001"] = <
+					description = <"The object of the examination">
+					text = <"Object">
+				>
+				["at0002"] = <
+					description = <"Textural description of the part examined">
+					text = <"Clinical description">
+				>
+				["at0003"] = <
+					description = <"More focused examination findings">
+					text = <"Detail">
+				>
+				["at0004"] = <
+					description = <"A group of statements about the normality of the examination">
+					text = <"Normal statements">
+				>
+				["at0005"] = <
+					description = <"A specific statement of normality">
+					text = <"Normal statement">
+				>
+				["at0006"] = <
+					description = <"Drawing or image of the area examined">
+					text = <"Image">
+				>
+				["at0007"] = <
+					description = <"Information about the size of the object for examination">
+					text = <"Size">
+				>
+				["at0008"] = <
+					description = <"Clinical findings">
+					text = <"Findings">
+				>
+			>
+		>
+	>
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-COMPOSITION.discharge.v1draft.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-COMPOSITION.discharge.v1draft.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-COMPOSITION.discharge.v1draft.adl	(revision 46)
@@ -0,0 +1,53 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-COMPOSITION.discharge.v1draft
+
+concept
+	[at0000]	-- Discharge
+language
+	original_language = <[ISO_639-1::en]>
+description
+	original_author = <
+		["name"] = <"unknown">
+	>
+	details = <
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"For communication at the time of discharge from an episode of care or an institution.">
+			use = <"">
+			misuse = <"">
+		>
+	>
+	lifecycle_state = <"Initial">
+	other_contributors = <>
+
+definition
+	COMPOSITION[at0000] matches {	-- Discharge
+		category matches {
+			DV_CODED_TEXT matches {
+				defining_code matches {[openehr::433]}
+			}
+		}
+		context matches {
+			EVENT_CONTEXT matches {
+				other_context matches {
+					ITEM_TREE[at0001] matches {*}
+				}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["en"] = <
+			items = <
+				["at0000"] = <
+					description = <"A summarising communication about at the time of discharge from an institution or an episode of care">
+					text = <"Discharge">
+				>
+				["at0001"] = <
+					description = <"@ internal @">
+					text = <"Tree">
+				>
+			>
+		>
+	>
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-COMPOSITION.encounter.v1draft.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-COMPOSITION.encounter.v1draft.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-COMPOSITION.encounter.v1draft.adl	(revision 46)
@@ -0,0 +1,45 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-COMPOSITION.encounter.v1draft
+
+concept
+	[at0000]	-- Encounter
+language
+	original_language = <[ISO_639-1::en]>
+description
+	original_author = <
+		["name"] = <"Thomas Beale">
+		["organisation"] = <"Ocean Informatics">
+		["date"] = <"2005-10-10">
+	>
+	details = <
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"Record of encounter as a progress note.">
+			use = <"">
+			keywords = <"progress", "note", "encounter">
+			misuse = <"">
+		>
+	>
+	lifecycle_state = <"AuthorDraft">
+	other_contributors = <>
+
+definition
+	COMPOSITION[at0000] matches {	-- Encounter
+		category matches {
+			DV_CODED_TEXT matches {
+				defining_code matches {[openehr::433]}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["en"] = <
+			items = <
+				["at0000"] = <
+					description = <"Generic encounter or progress note composition">
+					text = <"Encounter">
+				>
+			>
+		>
+	>
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-EVALUATION.adverse.v1.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-EVALUATION.adverse.v1.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-EVALUATION.adverse.v1.adl	(revision 46)
@@ -0,0 +1,411 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-EVALUATION.adverse.v1
+
+concept
+	[at0000]	-- Adverse reaction
+language
+	original_language = <[ISO_639-1::en]>
+	translations = <
+		["de"] = <
+			language = <[ISO_639-1::de]>
+			author = <
+				["name"] = <"Jasmin Buck, Sebastian Garde">
+				["organisation"] = <"University of Heidelberg, Central Queensland University">
+			>
+		>
+	>
+description
+	original_author = <
+		["name"] = <"Sam Heard">
+		["organisation"] = <"Ocean Informatics">
+		["date"] = <"23/04/2006">
+		["email"] = <"sam.heard@oceaninformatics.biz">
+	>
+	details = <
+		["de"] = <
+			language = <[ISO_639-1::de]>
+			purpose = <"Zur Dokumentation von Nebenwirkungen auf einen bestimmten Wirkstoff. Die Art dieses Stoffes kann ebenfalls Dokumentiert werden. Früherer Aufzeichnungen können hinzugefügt werden und auch die Art der Reaktion beim jeweiligen Ereignis.">
+			use = <"">
+			keywords = <"Reaktion", "allergisch", "Allergie", "Intoleranz">
+			misuse = <"Nicht zur Dokumentation keines Verlaufs einer Reaktion auf eine Substanz. Für diesen Zweck openEHR-EVALUATION.excluded-adverse  benutzen. Für unbekannte Reaktionen auf beliebige Wirkstoffe openEHR-EVALUATION.excluded benutzen.">
+		>
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"For recording adverse reaction(s) to a particular 'Agent' the type of which may be recorded also. Historical recordings may be added and the type of reaction on each occasion.">
+			use = <"">
+			keywords = <"reaction", "allergic", "allergy", "intolerance">
+			misuse = <"Do not use for recording no history of a reaction to a substance. Use openEHR-EVALUATION.excluded-adverse for this purpose. No known reactions to any agents, use openEHR-EVALUATION.excluded.">
+		>
+	>
+	lifecycle_state = <"AuthorDraft">
+	other_contributors = <"NEHTA data groups (Australia)", "General Practice Computing Group (Australia)">
+
+definition
+	EVALUATION[at0000] matches {	-- Adverse reaction
+		data matches {
+			ITEM_TREE[at0002] matches {	-- structure
+				items cardinality matches {0..*; unordered} matches {
+					ELEMENT[at0003] matches {	-- Agent
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+					ELEMENT[at0010] occurrences matches {0..1} matches {	-- Agent category
+						value matches {
+							DV_CODED_TEXT matches {
+								defining_code matches {
+									[local::
+									at0011, 	-- Food
+									at0012, 	-- Animal
+									at0013, 	-- Medication
+									at0014, 	-- Other chemical or substance
+									at0031, 	-- Non-active ingredient of medication
+									at0033, 	-- Imaging dye or media
+									at0034]	-- Environmental
+								}
+							}
+						}
+					}
+					CLUSTER[at0019] occurrences matches {0..*} matches {	-- Exposure and reaction detail
+						items cardinality matches {1..*; unordered} matches {
+							ELEMENT[at0032] occurrences matches {0..1} matches {	-- Specific substance
+								value matches {
+									DV_TEXT matches {*}
+								}
+							}
+							ELEMENT[at0015] occurrences matches {0..1} matches {	-- Reaction category
+								value matches {
+									DV_CODED_TEXT matches {
+										defining_code matches {
+											[local::
+											at0016, 	-- Intolerance
+											at0017, 	-- Sensitivity
+											at0018, 	-- Allergy
+											at0030]	-- No reaction
+										}
+									}
+								}
+							}
+							ELEMENT[at0004] occurrences matches {0..1} matches {	-- Probability of causation
+								value matches {
+									DV_CODED_TEXT matches {
+										defining_code matches {
+											[local::
+											at0005, 	-- Certain/Highly likely
+											at0006, 	-- Probable
+											at0007]	-- Possible
+										}
+									}
+								}
+							}
+							ELEMENT[at0020] occurrences matches {0..1} matches {	-- Date of exposure
+								value matches {
+									DV_DATE_TIME matches {
+										value matches {yyyy-??-??T??:??:??}
+									}
+								}
+							}
+							ELEMENT[at0021] occurrences matches {0..1} matches {	-- Duration of the exposure
+								value matches {
+									DV_DURATION matches {
+										value matches {PYMWDTHMS}
+									}
+								}
+							}
+							ELEMENT[at0023] occurrences matches {0..1} matches {	-- Reaction severity
+								value matches {
+									DV_CODED_TEXT matches {
+										defining_code matches {
+											[local::
+											at0024, 	-- Mild
+											at0025, 	-- Disabling
+											at0026]	-- Life threatening
+										}
+									}
+								}
+							}
+							ELEMENT[at0022] matches {	-- Reaction description
+								value matches {
+									DV_TEXT matches {*}
+								}
+							}
+							ELEMENT[at0027] occurrences matches {0..1} matches {	-- Date of onset of reaction
+								value matches {
+									DV_DATE_TIME matches {
+										value matches {yyyy-??-??T??:??:??}
+									}
+								}
+							}
+							ELEMENT[at0028] occurrences matches {0..1} matches {	-- Duration of the reaction
+								value matches {
+									C_DV_QUANTITY <
+										property = <[openehr::128]>
+									>
+								}
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["de"] = <
+			items = <
+				["at0000"] = <
+					description = <"Zur Dokumentation des Vorhandenseins von schädlichen oder unerwünschten Reaktionen auf einen Wirkstoff oder eine Substanz, einschließlich Nahrung, festgestellt von einem Klinikarzt - Vergiftungen und unsachgemäßer Gebrauch ausgeschlossen">
+					text = <"Nebenwirkung">
+				>
+				["at0002"] = <
+					description = <"@ internal @">
+					text = <"Structure">
+				>
+				["at0003"] = <
+					description = <"Der Wirkstoff, die Substanz oder die Klasse, welche die Nebenwirkung ausgelöst hat">
+					text = <"Wirkstoff">
+				>
+				["at0004"] = <
+					description = <"Grad an Sicherheit, dass der Wirkstoff der Auslöser der Reaktion war">
+					text = <"Wahrscheinlichkeit für kausalen Zusammenhang">
+				>
+				["at0005"] = <
+					description = <"Die Reaktion ist laut einem Klinikarzt auf den Wirkstoff zurückzuführen">
+					text = <"Sicher/ sehr wahrscheinlich">
+				>
+				["at0006"] = <
+					description = <"Die Reaktion ist wahrscheinlich auf den Wirkstoff zurückzuführen">
+					text = <"Wahrscheinlich">
+				>
+				["at0007"] = <
+					description = <"Die Reaktion ist möglicherweise auf den Wirkstoff zurückzuführen">
+					text = <"Möglicherweise">
+				>
+				["at0010"] = <
+					description = <"Die Gruppe des Wirkstoffs">
+					text = <"Wirkstoffgruppe">
+				>
+				["at0011"] = <
+					description = <"Eine Substanz, die als Teil der Ernährung zugeführt wurde ">
+					text = <"Nahrungsmittel">
+				>
+				["at0012"] = <
+					description = <"Ein lebender Organismus und dessen Gift oder produzierter Stoff">
+					text = <"Tier">
+				>
+				["at0013"] = <
+					description = <"Eine Substanz, die aus medizinischen Gründen eingenommen oder verabreicht wurde">
+					text = <"Medikament">
+				>
+				["at0014"] = <
+					description = <"Nicht-medizinische Chemikalie oder Substanz">
+					text = <"Andere Chemikalie oder Substanz">
+				>
+				["at0015"] = <
+					description = <"Die Art der von der Person erfahrenen Reaktion, von einem Klinikarzt ermittelt">
+					text = <"Reaktionsart">
+				>
+				["at0016"] = <
+					description = <"Führt zu unerfreulichen Symptomen, die ausreichen um einen Gebrauch in der Zukunft zu vermeiden">
+					text = <"Intoleranz">
+				>
+				["at0017"] = <
+					description = <"Führt zu Krankhaftigkeit die eventuell zum Wohle des Patienten behandelt werden muss">
+					text = <"Empfindlichkeit">
+				>
+				["at0018"] = <
+					description = <"Führt zu einer IgE Reaktion">
+					text = <"Allergie">
+				>
+				["at0019"] = <
+					description = <"Einzelheiten der von der Person erfahrenen Reaktion">
+					text = <"Exposition und Einzelheiten der Reaktion">
+				>
+				["at0020"] = <
+					description = <"Das Datum (+/- Zeit) wann die Person gegenüber dem Wirkstoff exponiert wurde">
+					text = <"Datum der Exposition">
+				>
+				["at0021"] = <
+					description = <"Die Dauer der Exposition gegenüber dem Wirkstoff">
+					text = <"Dauer der Exposition">
+				>
+				["at0022"] = <
+					description = <"Eine Beschreibung der von einer Person erfahrenen Reaktion auf einen Wirkstoff">
+					text = <"Beschreibung der Reaktion">
+				>
+				["at0023"] = <
+					description = <"Die Klasse der Reaktion für zukünftige Empfehlungen">
+					text = <"Schweregrad der Reaktion">
+				>
+				["at0024"] = <
+					description = <"Eine Reaktion, die wenig Leiden und keinen Verlust der Arbeitsfähigkeit/ Schulfähigkeit verursacht">
+					text = <"Gelinde">
+				>
+				["at0025"] = <
+					description = <"Eine Reaktion, die Krankheit und/oder den Verlust Funktionen verursacht">
+					text = <"Unfähig machend">
+				>
+				["at0026"] = <
+					description = <"Eine Reaktion die lebensbedrohlich wahr oder sein kann">
+					text = <"Lebensbedrohlich">
+				>
+				["at0027"] = <
+					description = <"Das Datum, an dem die Reaktion eintrat">
+					text = <"Datum des Beginns der Reaktion">
+				>
+				["at0028"] = <
+					description = <"Die Dauer der Reaktion">
+					text = <"Dauer der Reaktion">
+				>
+				["at0030"] = <
+					description = <"Die Person war ohne Reaktion exponiert">
+					text = <"Keine Reaktion">
+				>
+				["at0031"] = <
+					description = <"Ein nicht-medizinischer Bestandteil des Medikaments, wie Farbstoff, Konservierungsstoff, usw. (Untertyp von andere Chemikalien)">
+					text = <"Inaktiver Bestandteil des Medikaments">
+				>
+				["at0032"] = <
+					description = <"Die charakteristische Substanz, die die Reaktion verursacht, falls verschieden vom Wirkstoff (z.B. Marken oder Teile einer Klasse)">
+					text = <"Charakteristische Substanz">
+				>
+				["at0033"] = <
+					description = <"Zur diagnostischen Bildgebung benutzter Farbstoff oder Medium (Untertyp von anderen Chemikalien)">
+					text = <"Abbildender Farbstoff oder Medium">
+				>
+				["at0034"] = <
+					description = <"Ein in der Umwelt vorhandener Wirkstoff">
+					text = <"Umgebend">
+				>
+			>
+		>
+		["en"] = <
+			items = <
+				["at0000"] = <
+					description = <"Recording the presence of a harmful or undesirable response to an agent or substance including food, as determined by the clinician - excluding poisoning and abnormal use">
+					text = <"Adverse reaction">
+				>
+				["at0002"] = <
+					description = <"@ internal @">
+					text = <"structure">
+				>
+				["at0003"] = <
+					description = <"The agent or substance or class that caused the adverse reaction">
+					text = <"Agent">
+				>
+				["at0004"] = <
+					description = <"Degree of certainty that the agent was the cause of the reaction">
+					text = <"Probability of causation">
+				>
+				["at0005"] = <
+					description = <"A reaction to the agent is deemed to be or have been present by the clinician">
+					text = <"Certain/Highly likely">
+				>
+				["at0006"] = <
+					description = <"The reaction is deemed to be the probable cause of the reaction">
+					text = <"Probable">
+				>
+				["at0007"] = <
+					description = <"The agent is deemed to be a possible cause of the reaction">
+					text = <"Possible">
+				>
+				["at0010"] = <
+					description = <"The category of the agent">
+					text = <"Agent category">
+				>
+				["at0011"] = <
+					description = <"A substance taken as part of the diet">
+					text = <"Food">
+				>
+				["at0012"] = <
+					description = <"A living organism or its venom or produce">
+					text = <"Animal">
+				>
+				["at0013"] = <
+					description = <"A substance taken or applied  for medicinal purposes">
+					text = <"Medication">
+				>
+				["at0014"] = <
+					description = <"Non-medicinal chemicals or substances">
+					text = <"Other chemical or substance">
+				>
+				["at0015"] = <
+					description = <"The type of reaction experience by the person as determined by the clinician">
+					text = <"Reaction category">
+				>
+				["at0016"] = <
+					description = <"Leads to unpleasant symptoms which are sufficient to avoid use in the future">
+					text = <"Intolerance">
+				>
+				["at0017"] = <
+					description = <"Leads to morbidity which is potentially threatening to the wellbeing of the person">
+					text = <"Sensitivity">
+				>
+				["at0018"] = <
+					description = <"Leads to an IgE mediated reaction">
+					text = <"Allergy">
+				>
+				["at0019"] = <
+					description = <"Details of the reaction experienced by the person">
+					text = <"Exposure and reaction detail">
+				>
+				["at0020"] = <
+					description = <"The date (+/- time) when the person became exposed to the agent">
+					text = <"Date of exposure">
+				>
+				["at0021"] = <
+					description = <"The duration of the exposure to the agent">
+					text = <"Duration of the exposure">
+				>
+				["at0022"] = <
+					description = <"A description of the reaction to this agent as experienced by the person">
+					text = <"Reaction description">
+				>
+				["at0023"] = <
+					description = <"The category of the reaction for future reference">
+					text = <"Reaction severity">
+				>
+				["at0024"] = <
+					description = <"A reaction which causes little distress and no loss of work/school">
+					text = <"Mild">
+				>
+				["at0025"] = <
+					description = <"A reaction which causes morbidity and/or loss of function">
+					text = <"Disabling">
+				>
+				["at0026"] = <
+					description = <"A reaction which was or could be lifethreatening">
+					text = <"Life threatening">
+				>
+				["at0027"] = <
+					description = <"The date the reaction began">
+					text = <"Date of onset of reaction">
+				>
+				["at0028"] = <
+					description = <"The duration of the reaction">
+					text = <"Duration of the reaction">
+				>
+				["at0030"] = <
+					description = <"Person has been exposed with no reaction">
+					text = <"No reaction">
+				>
+				["at0031"] = <
+					description = <"A non-medicinal ingredient of medication such as colouring, preservative, etc (subtype of other chemical)">
+					text = <"Non-active ingredient of medication">
+				>
+				["at0032"] = <
+					description = <"The specific substance that caused the reaction if different from the agent (e.g. brands or members of a class)">
+					text = <"Specific substance">
+				>
+				["at0033"] = <
+					description = <"A dye or media used in diagnostic imaging (subtype of other chemical)">
+					text = <"Imaging dye or media">
+				>
+				["at0034"] = <
+					description = <"An agent present in the environment">
+					text = <"Environmental">
+				>
+			>
+		>
+	>
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-INSTRUCTION.medication.v1.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-INSTRUCTION.medication.v1.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-INSTRUCTION.medication.v1.adl	(revision 46)
@@ -0,0 +1,88 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-INSTRUCTION.medication.v1
+
+concept
+	[at0000]	-- Medication order
+language
+	original_language = <[ISO_639-1::en]>
+	translations = <
+		["de"] = <
+			language = <[ISO_639-1::de]>
+			author = <
+				["name"] = <"Jasmin Buck, Sebastian Garde">
+				["organisation"] = <"University of Heidelberg, Central Queensland University">
+			>
+		>
+	>
+description
+	original_author = <
+		["name"] = <"Sam Heard">
+		["organisation"] = <"Ocean Informatics">
+		["date"] = <"21/04/2006">
+		["email"] = <"sam.heard@oceaninformatics.biz">
+	>
+	details = <
+		["de"] = <
+			language = <[ISO_639-1::de]>
+			purpose = <"Zur Dokumentation einer Medikationsverordnung, kann mehr als eine Aktivität enthalten, aber immer mit der selben Struktur">
+			use = <"Zur Dokumentation von Anweisungen bezüglich eines Medikaments">
+			keywords = <"Verschreibung", "Medikationsverordnung", "Verordnung">
+			misuse = <"Nicht zur Dokumentation der Verabreichung, der Gabe usw. benutzen. Für diese Dokumentation openEHR-EHR-ACTION.medication benutzen.">
+		>
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"For recording a medication order, which may involve more than one activity, but all have the same structure.">
+			use = <"For recording an instruction about medication.">
+			keywords = <"prescribe", "medication order", "order">
+			misuse = <"Do not use for recording administration, dispensing etc. Use openEHR-EHR-ACTION.medication for these recordings.">
+		>
+	>
+	lifecycle_state = <"AuthorDraft">
+	other_contributors = <"NEHTA (Australia) data groups", ...>
+
+definition
+	INSTRUCTION[at0000] matches {	-- Medication order
+		activities cardinality matches {0..*; unordered} matches {
+			ACTIVITY[at0001] occurrences matches {0..*} matches {	-- Medication activity
+				action_archetype_id matches {/medication\.v1/}
+				description matches {
+					allow_archetype ITEM_TREE occurrences matches {0..1} matches {
+						include
+							archetype_id/value matches {/medication\.v1/}
+							archetype_id/value matches {/medication-formulation\.v1/}
+							archetype_id/value matches {/medication-vaccine\.v1/}
+						exclude
+							archetype_id/value matches {/.*/}
+					}
+				}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["de"] = <
+			items = <
+				["at0000"] = <
+					description = <"Eine von einem Klinikarzt verfasste Verordnung oder Anweisung, die beschreibt welches Medikament wann, für wie lange usw. eingenommen werden soll">
+					text = <"Medikationsverordnung">
+				>
+				["at0001"] = <
+					description = <"Informationen über die auszuführende Medikationshandlung">
+					text = <"Medikationshandlung">
+				>
+			>
+		>
+		["en"] = <
+			items = <
+				["at0000"] = <
+					description = <"An order or instruction created by a clinician which specifies which medication to take, when, for how long etc.">
+					text = <"Medication order">
+				>
+				["at0001"] = <
+					description = <"Information about the medication action(s) to be carried out">
+					text = <"Medication activity">
+				>
+			>
+		>
+	>
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-INSTRUCTION.referral.v1.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-INSTRUCTION.referral.v1.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-INSTRUCTION.referral.v1.adl	(revision 46)
@@ -0,0 +1,84 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-INSTRUCTION.referral.v1
+
+concept
+	[at0000]	-- Referral to second provider
+language
+	original_language = <[ISO_639-1::en]>
+	translations = <
+		["de"] = <
+			language = <[ISO_639-1::de]>
+			author = <
+				["name"] = <"Jasmin Buck, Sebastian Garde">
+				["organisation"] = <"University of Heidelberg, Central Queensland University">
+			>
+		>
+	>
+description
+	original_author = <
+		["name"] = <"Sam Heard">
+		["email"] = <"sam.heard@oceaninformatics.biz">
+	>
+	details = <
+		["de"] = <
+			language = <[ISO_639-1::de]>
+			purpose = <"Zur Dokumentation einer Bitte nach Behandlung (Überweisung) durch einen zweiten Gesundheitsdienstleister.">
+			use = <"">
+			keywords = <"Überweisung", "Anfrage", "Anordnung">
+			misuse = <"">
+		>
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"For recording a request for care (referral to) a second health provider">
+			use = <"">
+			keywords = <"refer", "request", "order">
+			misuse = <"">
+		>
+	>
+	lifecycle_state = <"AuthorDraft">
+	other_contributors = <>
+
+definition
+	INSTRUCTION[at0000] matches {	-- Referral to second provider
+		activities cardinality matches {0..*; unordered} matches {
+			ACTIVITY[at0001] occurrences matches {0..1} matches {	-- Refer
+				action_archetype_id matches {/referral\.v1/}
+				description matches {
+					allow_archetype ITEM_TREE occurrences matches {0..1} matches {
+						include
+							archetype_id/value matches {/referral\.v1/}
+						exclude
+							archetype_id/value matches {/.*/}
+					}
+				}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["de"] = <
+			items = <
+				["at0000"] = <
+					description = <"Eine Bitte nach Gesundheitsdienstleistung von einem Anbieter zu einem zweiten.">
+					text = <"Überweisung zu einem zweiten Gesundheitsdienstleister">
+				>
+				["at0001"] = <
+					description = <"Die Handlung der Überweisung zu einem zweiten Gesundheitsdienstleister">
+					text = <"Überweisung">
+				>
+			>
+		>
+		["en"] = <
+			items = <
+				["at0000"] = <
+					description = <"A request for health care from one provider to a second provider">
+					text = <"Referral to second provider">
+				>
+				["at0001"] = <
+					description = <"The activity of referring to a second health provider">
+					text = <"Refer">
+				>
+			>
+		>
+	>
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-ITEM_TREE.Laboratory_request.v1.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-ITEM_TREE.Laboratory_request.v1.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-ITEM_TREE.Laboratory_request.v1.adl	(revision 46)
@@ -0,0 +1,492 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-ITEM_TREE.laboratory_request.v1
+
+concept
+	[at0000]	-- Laboratory test request
+language
+	original_language = <[ISO_639-1::en]>
+	translations = <
+		["de"] = <
+			language = <[ISO_639-1::de]>
+			author = <
+				["name"] = <"Jasmin Buck, Sebastian Garde">
+				["organisation"] = <"University of Heidelberg, Central Queensland University">
+			>
+		>
+	>
+description
+	original_author = <
+		["name"] = <"unknown">
+	>
+	details = <
+		["de"] = <
+			language = <[ISO_639-1::de]>
+			purpose = <"Laboranforderung">
+			use = <"*">
+			misuse = <"*">
+		>
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"Laboratory request">
+			use = <"">
+			misuse = <"">
+		>
+	>
+	lifecycle_state = <"Initial">
+	other_contributors = <>
+
+definition
+	ITEM_TREE[at0000] occurrences matches {0..*} matches {	-- Laboratory test request
+		items cardinality matches {0..*; unordered} matches {
+			CLUSTER[at0002] occurrences matches {0..1} matches {	-- Clinical information
+				items cardinality matches {0..*; unordered} matches {
+					ELEMENT[at0003] occurrences matches {0..1} matches {	-- Findings
+						value matches {
+							DV_CODED_TEXT matches {
+								defining_code matches {[local::]}
+							}
+						}
+					}
+				}
+			}
+			CLUSTER[at0004] occurrences matches {0..1} matches {	-- Tests required
+				items cardinality matches {0..*; unordered} matches {
+					ELEMENT[at0005] occurrences matches {0..*} matches {	-- Test name
+						value matches {
+							DV_CODED_TEXT matches {
+								defining_code matches {[local::]}
+							}
+						}
+					}
+				}
+			}
+			ELEMENT[at0006] occurrences matches {0..1} matches {	-- DateTime requested
+				value matches {
+					DV_DATE_TIME matches {
+						value matches {yyyy-??-??T??:??:??}
+					}
+				}
+			}
+			ELEMENT[at0007] occurrences matches {0..1} matches {	-- Special instructions
+				value matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[local::]}
+					}
+				}
+			}
+			CLUSTER[at0008] occurrences matches {0..1} matches {	-- Requesting provider details
+				items cardinality matches {0..*; unordered} matches {
+					ELEMENT[at0009] occurrences matches {0..1} matches {	-- Name
+						value matches {
+							DV_CODED_TEXT matches {
+								defining_code matches {[local::]}
+							}
+						}
+					}
+					CLUSTER[at0010] occurrences matches {0..1} matches {	-- Contact details
+						items cardinality matches {0..*; unordered} matches {
+							ELEMENT[at0011] occurrences matches {0..1} matches {	-- Telephone
+								value matches {
+									DV_CODED_TEXT matches {
+										defining_code matches {[local::]}
+									}
+								}
+							}
+							ELEMENT[at0012] occurrences matches {0..1} matches {	-- Email
+								value matches {
+									DV_CODED_TEXT matches {
+										defining_code matches {[local::]}
+									}
+								}
+							}
+							ELEMENT[at0013] occurrences matches {0..1} matches {	-- Facsimile
+								value matches {
+									DV_CODED_TEXT matches {
+										defining_code matches {[local::]}
+									}
+								}
+							}
+							ELEMENT[at0014] occurrences matches {0..1} matches {	-- Address
+								value matches {
+									DV_CODED_TEXT matches {
+										defining_code matches {[local::]}
+									}
+								}
+							}
+						}
+					}
+				}
+			}
+			CLUSTER[at0015] occurrences matches {0..1} matches {	-- Laboratory details
+				items cardinality matches {0..*; unordered} matches {
+					ELEMENT[at0016] occurrences matches {0..1} matches {	-- Name
+						value matches {
+							DV_CODED_TEXT matches {
+								defining_code matches {[local::]}
+							}
+						}
+					}
+					CLUSTER[at0017] occurrences matches {0..1} matches {	-- Contact details
+						items cardinality matches {0..*; unordered} matches {
+							ELEMENT[at0018] occurrences matches {0..1} matches {	-- Telephone
+								value matches {
+									DV_CODED_TEXT matches {
+										defining_code matches {[local::]}
+									}
+								}
+							}
+							ELEMENT[at0019] occurrences matches {0..1} matches {	-- Email
+								value matches {
+									DV_CODED_TEXT matches {
+										defining_code matches {[local::]}
+									}
+								}
+							}
+							ELEMENT[at0020] occurrences matches {0..1} matches {	-- Facsimile
+								value matches {
+									DV_CODED_TEXT matches {
+										defining_code matches {[local::]}
+									}
+								}
+							}
+							ELEMENT[at0021] occurrences matches {0..1} matches {	-- Address
+								value matches {
+									DV_CODED_TEXT matches {
+										defining_code matches {[local::]}
+									}
+								}
+							}
+						}
+					}
+				}
+			}
+			CLUSTER[at0022] occurrences matches {0..1} matches {	-- Process
+				items cardinality matches {0..*; unordered} matches {
+					CLUSTER[at0024] occurrences matches {0..1} matches {	-- Urgency
+						items cardinality matches {0..*; unordered} matches {
+							ELEMENT[at0025] occurrences matches {0..1} matches {	-- Timing
+								value matches {
+									0|[local::at0026], 	-- Emergency
+									1|[local::at0027], 	-- Urgent
+									2|[local::at0028]  	-- Non-urgent
+								}
+							}
+						}
+					}
+					CLUSTER[at0029] occurrences matches {0..1} matches {	-- Specimen details
+						items cardinality matches {0..*; unordered} matches {
+							ELEMENT[at0030] occurrences matches {0..1} matches {	-- Descriptions
+								value matches {
+									DV_CODED_TEXT matches {
+										defining_code matches {[local::]}
+									}
+								}
+							}
+							ELEMENT[at0031] occurrences matches {0..1} matches {	-- Body site
+								value matches {
+									DV_CODED_TEXT matches {
+										defining_code matches {[local::]}
+									}
+								}
+							}
+							ELEMENT[at0032] occurrences matches {0..1} matches {	-- Collection DateTime
+								value matches {
+									DV_DATE_TIME matches {
+										value matches {yyyy-??-??T??:??:??}
+									}
+								}
+							}
+							ELEMENT[at0033] occurrences matches {0..1} matches {	-- Collector name
+								value matches {
+									DV_CODED_TEXT matches {
+										defining_code matches {[local::]}
+									}
+								}
+							}
+							ELEMENT[at0034] occurrences matches {0..1} matches {	-- Tubes collected
+								value matches {
+									DV_COUNT matches {*}
+								}
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["de"] = <
+			items = <
+				["at0000"] = <
+					description = <"Angeforderte Daten eines Labortests als Teil einer Anweisung">
+					text = <"Labortest Anforderung">
+				>
+				["at0002"] = <
+					description = <"Für die Laboranfrage relevante klinische Informationen">
+					text = <"Klinische Informationen">
+				>
+				["at0003"] = <
+					description = <"Für die Laboranfrage relevante klinische Befunde">
+					text = <"Befunde">
+				>
+				["at0004"] = <
+					description = <"Die angeforderten Test bei dieser Laboranfrage">
+					text = <"Angeforderte Tests">
+				>
+				["at0005"] = <
+					description = <"Testname">
+					text = <"Testname">
+				>
+				["at0006"] = <
+					description = <"Datum und Zeitpunkt, wann der Labortest in Auftrag gegeben wurde">
+					text = <"Zeitpunkt des Auftrags">
+				>
+				["at0007"] = <
+					description = <"Besondere Anweisungen dieser Labortestanforderung">
+					text = <"Besondere Anweisungen">
+				>
+				["at0008"] = <
+					description = <"Einzelheiten des Anfordernden">
+					text = <"Einzelheiten des Anfordernden">
+				>
+				["at0009"] = <
+					description = <"Name des Anfordernden">
+					text = <"Name">
+				>
+				["at0010"] = <
+					description = <"Kontakteinzelheiten des Dienstleisters, die den Labortest angefordert hat">
+					text = <"Kantakteinzelheiten">
+				>
+				["at0011"] = <
+					description = <"*">
+					text = <"Telefonnummer">
+				>
+				["at0012"] = <
+					description = <"*">
+					text = <"E-Mail">
+				>
+				["at0013"] = <
+					description = <"*">
+					text = <"Faxnummer">
+				>
+				["at0014"] = <
+					description = <"*">
+					text = <"Adress">
+				>
+				["at0015"] = <
+					description = <"Einzelheiten des Labors zu dem die Anforderung übermittelt wurde">
+					text = <"Einzelheiten des Labors">
+				>
+				["at0016"] = <
+					description = <"*">
+					text = <"Name">
+				>
+				["at0017"] = <
+					description = <"*">
+					text = <"Kontakteinzelheiten">
+				>
+				["at0018"] = <
+					description = <"*">
+					text = <"Telefonnummer">
+				>
+				["at0019"] = <
+					description = <"*">
+					text = <"E-Mail">
+				>
+				["at0020"] = <
+					description = <"*">
+					text = <"Faxnummer">
+				>
+				["at0021"] = <
+					description = <"*">
+					text = <"Adresse">
+				>
+				["at0022"] = <
+					description = <"Informationen zum Ablauf der Laboranforderung">
+					text = <"Ablauf">
+				>
+				["at0024"] = <
+					description = <"*">
+					text = <"Dringlichkeit">
+				>
+				["at0025"] = <
+					description = <"*">
+					text = <"Zeitvorgabe">
+				>
+				["at0026"] = <
+					description = <"Angeforderter Labortest muss sofort ausgeführt werden">
+					text = <"Notfall">
+				>
+				["at0027"] = <
+					description = <"Der angeforderte Labortest muss so bald wie möglich ausgeführt werden">
+					text = <"Dringend">
+				>
+				["at0028"] = <
+					description = <"Ausführung des angeforderter Labortest wenn es dem Labor möglich ist">
+					text = <"Nicht dringend">
+				>
+				["at0029"] = <
+					description = <"Einzelheiten der Probe">
+					text = <"Einzelheiten der Probe">
+				>
+				["at0030"] = <
+					description = <"Beschreibung der Probe">
+					text = <"Beschreibung">
+				>
+				["at0031"] = <
+					description = <"Die Körperstelle, an der die Probe genommen wurde">
+					text = <"Körperstelle">
+				>
+				["at0032"] = <
+					description = <"Das Datum und der Zeitpunkt, wann die Probe gewonnen wurde">
+					text = <"Zeitpunkt der Gewinnung">
+				>
+				["at0033"] = <
+					description = <"Der Name des Abnehmers der Probe">
+					text = <"Name des Abnehmers">
+				>
+				["at0034"] = <
+					description = <"Anzahl der Sammelröhrchen">
+					text = <"Sammelröhrchen">
+				>
+			>
+		>
+		["en"] = <
+			items = <
+				["at0000"] = <
+					description = <"Data about a laboratory test request as part of an instruction">
+					text = <"Laboratory test request">
+				>
+				["at0002"] = <
+					description = <"Clinical information relevant to the laboratory request">
+					text = <"Clinical information">
+				>
+				["at0003"] = <
+					description = <"Clinical findings relevant to the laboratory request.">
+					text = <"Findings">
+				>
+				["at0004"] = <
+					description = <"The required tests by this laboratory request">
+					text = <"Tests required">
+				>
+				["at0005"] = <
+					description = <"Test name">
+					text = <"Test name">
+				>
+				["at0006"] = <
+					description = <"The date and time when the laboratory tests were requested">
+					text = <"DateTime requested">
+				>
+				["at0007"] = <
+					description = <"The special instructions of this laboratory request">
+					text = <"Special instructions">
+				>
+				["at0008"] = <
+					description = <"The laboratory request provider details">
+					text = <"Requesting provider details">
+				>
+				["at0009"] = <
+					description = <"Name of the requesting provider">
+					text = <"Name">
+				>
+				["at0010"] = <
+					description = <"Contact details of the provider who made the laboratory request">
+					text = <"Contact details">
+				>
+				["at0011"] = <
+					description = <"*">
+					text = <"Telephone">
+				>
+				["at0012"] = <
+					description = <"*">
+					text = <"Email">
+				>
+				["at0013"] = <
+					description = <"*">
+					text = <"Facsimile">
+				>
+				["at0014"] = <
+					description = <"*">
+					text = <"Address">
+				>
+				["at0015"] = <
+					description = <"The details of the laboratory to which the laboratory request was referred.">
+					text = <"Laboratory details">
+				>
+				["at0016"] = <
+					description = <"Name of the laboratory">
+					text = <"Name">
+				>
+				["at0017"] = <
+					description = <"*">
+					text = <"Contact details">
+				>
+				["at0018"] = <
+					description = <"*">
+					text = <"Telephone">
+				>
+				["at0019"] = <
+					description = <"*">
+					text = <"Email">
+				>
+				["at0020"] = <
+					description = <"*">
+					text = <"Facsimile">
+				>
+				["at0021"] = <
+					description = <"*">
+					text = <"Address">
+				>
+				["at0022"] = <
+					description = <"Information about the process of the laboratory request">
+					text = <"Process">
+				>
+				["at0024"] = <
+					description = <"*">
+					text = <"Urgency">
+				>
+				["at0025"] = <
+					description = <"*">
+					text = <"Timing">
+				>
+				["at0026"] = <
+					description = <"Require the laboratory test done immediately">
+					text = <"Emergency">
+				>
+				["at0027"] = <
+					description = <"Require the laboratory test done as soon as possible">
+					text = <"Urgent">
+				>
+				["at0028"] = <
+					description = <"Require the laboratory test at laboratories convenience">
+					text = <"Non-urgent">
+				>
+				["at0029"] = <
+					description = <"Specimen details">
+					text = <"Specimen details">
+				>
+				["at0030"] = <
+					description = <"Descriptions of the specimen">
+					text = <"Descriptions">
+				>
+				["at0031"] = <
+					description = <"The site of the body where the specimen was collected">
+					text = <"Body site">
+				>
+				["at0032"] = <
+					description = <"The date and time when the specimen was collected.">
+					text = <"Collection DateTime">
+				>
+				["at0033"] = <
+					description = <"The specimen collector name">
+					text = <"Collector name">
+				>
+				["at0034"] = <
+					description = <"Indicate number of tubes">
+					text = <"Tubes collected">
+				>
+			>
+		>
+	>
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-ITEM_TREE.imaging.v1.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-ITEM_TREE.imaging.v1.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-ITEM_TREE.imaging.v1.adl	(revision 46)
@@ -0,0 +1,127 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-ITEM_TREE.imaging.v1
+
+concept
+	[at0000]	-- Imaging data
+language
+	original_language = <[ISO_639-1::en]>
+description
+	original_author = <
+		["name"] = <"Sam Heard">
+		["organisation"] = <"Ocean Informatics">
+		["date"] = <"9/01/2007">
+		["email"] = <"sam.heard@oceaninformatics.biz">
+	>
+	details = <
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"Data for the description of the action or instruction related to imaging">
+			use = <"">
+			keywords = <"Xray", "scan", "MRI", "CT", "nuclear", "ultrasound">
+			misuse = <"">
+		>
+	>
+	lifecycle_state = <"AuthorDraft">
+	other_contributors = <>
+
+definition
+	ITEM_TREE[at0001] occurrences matches {0..*} matches {	-- Tree
+		items cardinality matches {0..*; ordered} matches {
+			CLUSTER[at0002] occurrences matches {0..1} matches {	-- Clinical information
+				items cardinality matches {1; unordered} matches {
+					ELEMENT[at0003] matches {	-- Findings
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+				}
+			}
+			CLUSTER[at0004] occurrences matches {1..*} matches {	-- Imaging
+				items cardinality matches {1..*; unordered} matches {
+					ELEMENT[at0005] matches {	-- Imaging procedure
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+					ELEMENT[at0007] occurrences matches {0..1} matches {	-- Anatomical site
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+					ELEMENT[at0006] occurrences matches {0..*} matches {	-- Views
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+				}
+			}
+			CLUSTER[at0008] occurrences matches {0..1} matches {	-- Process
+				items cardinality matches {0..*; unordered} matches {
+					ELEMENT[at0009] occurrences matches {0..1} matches {	-- Date of imaging
+						value matches {
+							DV_DATE_TIME matches {
+								value matches {yyyy-??-??T??:??:??}
+							}
+						}
+					}
+					ELEMENT[at0010] occurrences matches {0..1} matches {	-- Location
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+				}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["en"] = <
+			items = <
+				["at0000"] = <
+					description = <"Data recorded about an imaging action or instruction">
+					text = <"Imaging data">
+				>
+				["at0001"] = <
+					description = <"@ internal @">
+					text = <"Tree">
+				>
+				["at0002"] = <
+					description = <"Clinical information relevant to the imaging investigation">
+					text = <"Clinical information">
+				>
+				["at0003"] = <
+					description = <"Clinical findings relevant to the imaging investigation">
+					text = <"Findings">
+				>
+				["at0004"] = <
+					description = <"Information about the imaging">
+					text = <"Imaging">
+				>
+				["at0005"] = <
+					description = <"The type of imaging">
+					text = <"Imaging procedure">
+				>
+				["at0006"] = <
+					description = <"The imaging views">
+					text = <"Views">
+				>
+				["at0007"] = <
+					description = <"The anatomical site (or object) for imaging">
+					text = <"Anatomical site">
+				>
+				["at0008"] = <
+					description = <"The process of the imaging investigation">
+					text = <"Process">
+				>
+				["at0009"] = <
+					description = <"The date the imaging is to be or was carried out.">
+					text = <"Date of imaging">
+				>
+				["at0010"] = <
+					description = <"The location where the imaging is to be or was carried out">
+					text = <"Location">
+				>
+			>
+		>
+	>
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-ITEM_TREE.medication.v1.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-ITEM_TREE.medication.v1.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-ITEM_TREE.medication.v1.adl	(revision 46)
@@ -0,0 +1,869 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-ITEM_TREE.medication.v1
+
+concept
+	[at0000]	-- Medication description
+language
+	original_language = <[ISO_639-1::en]>
+	translations = <
+		["de"] = <
+			language = <[ISO_639-1::de]>
+			author = <
+				["name"] = <"Jasmin Buck, Sebastian Garde">
+				["organisation"] = <"University of Heidelberg, Central Queensland University">
+			>
+		>
+	>
+description
+	original_author = <
+		["name"] = <"Sam Heard">
+		["organisation"] = <"Ocean Informatics">
+		["date"] = <"12/03/2006">
+		["email"] = <"sam.heard@oceaninformatics.biz">
+	>
+	details = <
+		["de"] = <
+			language = <[ISO_639-1::de]>
+			purpose = <"Zur Dokumentation der präzisierten Beschreibung der Medikation als Teil einer INSTRUCTION oder ACTION hinsichtlich der Medikation. Dies wird üblicherweise als Erwiderung auf eine Medikationsverordnung oder Verschreibung erfolgen. Kann selbst verabreicht oder durch einen Pharmazeuten bereitgestellt werden.">
+			use = <"Zum Gebrauch mit INSTRUCTION.medication und ACTION.medication zur Beschreibung der Medikation">
+			keywords = <"Medikation", "Beschreibung">
+			misuse = <"*">
+		>
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"Specifies the description of the medication as part of an INSTRUCTION or ACTION recording taken with regard to medication. This will usually be in response to a medication order or prescription, but may be self administered or supplied by a pharmacy.">
+			use = <"For use with INSTRUCTION.medication and ACTION.medication to describe the medication">
+			keywords = <"medication", "description">
+			misuse = <"">
+		>
+	>
+	lifecycle_state = <"AuthorDraft">
+	other_contributors = <>
+
+definition
+	ITEM_TREE[at0000] occurrences matches {0..*} matches {	-- Medication description
+		items cardinality matches {0..*; ordered} matches {
+			ELEMENT[at0001] matches {	-- Name of medication
+				value matches {
+					DV_TEXT matches {*}
+				}
+			}
+			ELEMENT[at0002] occurrences matches {0..1} matches {	-- Administration instructions
+				value matches {
+					DV_TEXT matches {*}
+				}
+			}
+			ELEMENT[at0003] occurrences matches {0..1} matches {	-- Strength per dose unit
+				value matches {
+					C_DV_QUANTITY <
+						property = <[openehr::124]>
+						list = <
+							["1"] = <
+								units = <"pg">
+								magnitude = <|>=0.0|>
+							>
+							["2"] = <
+								units = <"µg">
+								magnitude = <|>=0.0|>
+							>
+							["3"] = <
+								units = <"mg">
+								magnitude = <|>=0.0|>
+							>
+							["4"] = <
+								units = <"gm">
+								magnitude = <|>=0.0|>
+							>
+						>
+					>
+					C_DV_QUANTITY <
+						property = <[openehr::385]>
+						list = <
+							["1"] = <
+								units = <"IU">
+								magnitude = <|>=0.0|>
+							>
+							["2"] = <
+								units = <"mIU">
+								magnitude = <|>=0.0|>
+							>
+						>
+					>
+					C_DV_QUANTITY <
+						property = <[openehr::445]>
+						list = <
+							["1"] = <
+								units = <"mU">
+								magnitude = <|>=0.0|>
+							>
+							["2"] = <
+								units = <"U">
+								magnitude = <|>=0.0|>
+							>
+						>
+					>
+				}
+			}
+			ELEMENT[at0006] matches {	-- Dose unit
+				value matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[ac0001]}		-- any term that 'is a' Dose unit for this form
+					}
+				}
+			}
+			ELEMENT[at0004] occurrences matches {0..1} matches {	-- Form
+				value matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[ac0000]}		-- Any term that 'is_a' form of medication
+					}
+				}
+			}
+			CLUSTER[at0033] occurrences matches {0..1} matches {	-- Dose
+				items cardinality matches {1; unordered} matches {
+					CLUSTER[at0035] occurrences matches {0..1} matches {	-- By absolute quantity
+						items cardinality matches {0..*; unordered} matches {
+							ELEMENT[at0036] occurrences matches {1..2} matches {	-- Quantity by volume
+								value matches {
+									C_DV_QUANTITY <
+										property = <[openehr::129]>
+										list = <
+											["1"] = <
+												units = <"ml">
+												magnitude = <|>=0.0|>
+											>
+											["2"] = <
+												units = <"l">
+												magnitude = <|>=0.0|>
+											>
+										>
+									>
+									DV_INTERVAL<DV_QUANTITY> matches {
+										upper matches {
+											C_DV_QUANTITY <
+												property = <[openehr::129]>
+												list = <
+													["1"] = <
+														units = <"ml">
+														magnitude = <|>=0.0|>
+													>
+													["2"] = <
+														units = <"l">
+														magnitude = <|>=0.0|>
+													>
+												>
+											>
+										}
+										lower matches {
+											C_DV_QUANTITY <
+												property = <[openehr::129]>
+												list = <
+													["1"] = <
+														units = <"ml">
+														magnitude = <|>=0.0|>
+													>
+													["2"] = <
+														units = <"l">
+														magnitude = <|>=0.0|>
+													>
+												>
+											>
+										}
+									}
+								}
+							}
+							ELEMENT[at0037] occurrences matches {0..1} matches {	-- Quantity by mass
+								value matches {
+									C_DV_QUANTITY <
+										property = <[openehr::124]>
+										list = <
+											["1"] = <
+												units = <"µg">
+												magnitude = <|>=0.0|>
+											>
+											["2"] = <
+												units = <"mg">
+											>
+											["3"] = <
+												units = <"gm">
+											>
+										>
+									>
+									DV_INTERVAL<DV_QUANTITY> matches {
+										upper matches {
+											C_DV_QUANTITY <
+												property = <[openehr::124]>
+												list = <
+													["1"] = <
+														units = <"µg">
+														magnitude = <|>=0.0|>
+													>
+													["2"] = <
+														units = <"mg">
+														magnitude = <|>=0.0|>
+													>
+													["3"] = <
+														units = <"gm">
+														magnitude = <|>=0.0|>
+													>
+												>
+											>
+										}
+										lower matches {
+											C_DV_QUANTITY <
+												property = <[openehr::124]>
+												list = <
+													["1"] = <
+														units = <"µg">
+														magnitude = <|>=0.0|>
+													>
+													["2"] = <
+														units = <"mg">
+														magnitude = <|>=0.0|>
+													>
+													["3"] = <
+														units = <"gm">
+														magnitude = <|>=0.0|>
+													>
+												>
+											>
+										}
+									}
+								}
+							}
+						}
+					}
+					CLUSTER[at0034] occurrences matches {0..1} matches {	-- By dose units
+						items cardinality matches {0..*; unordered} matches {
+							ELEMENT[at0005] matches {	-- Number or fraction
+								value matches {
+									DV_COUNT matches {
+										magnitude matches {|>=1|}
+									}
+									DV_INTERVAL<DV_COUNT> matches {
+										upper matches {
+											DV_COUNT matches {
+												magnitude matches {|>=1|}
+											}
+										}
+										lower matches {
+											DV_COUNT matches {
+												magnitude matches {|>=1|}
+											}
+										}
+									}
+									DV_PROPORTION matches {
+										numerator matches {|>=1.0|}
+										denominator matches {|1.0..4.0|}
+										type matches {1, 2, 4}
+									}
+								}
+							}
+						}
+					}
+				}
+			}
+			ELEMENT[at0007] occurrences matches {0..1} matches {	-- Dose duration
+				value matches {
+					C_DV_QUANTITY <
+						property = <[openehr::128]>
+						list = <
+							["1"] = <
+								units = <"d">
+							>
+							["2"] = <
+								units = <"h">
+							>
+							["3"] = <
+								units = <"min">
+							>
+							["4"] = <
+								units = <"s">
+								magnitude = <|>=0.0|>
+							>
+						>
+					>
+				}
+			}
+			ELEMENT[at0008] occurrences matches {0..1} matches {	-- Route
+				value matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[ac0002]}		-- Any term that 'is_a' route of administration
+					}
+				}
+			}
+			ELEMENT[at0009] occurrences matches {0..1} matches {	-- Is long term
+				value matches {
+					DV_BOOLEAN matches {
+						value matches {True, False}
+					}
+				}
+			}
+			CLUSTER[at0010] occurrences matches {0..1} matches {	-- Indications
+				items cardinality matches {0..*; unordered} matches {
+					ELEMENT[at0011] occurrences matches {0..*} matches {	-- Indication
+						value matches {
+							DV_TEXT matches {*}
+							DV_URI matches {*}
+						}
+					}
+				}
+			}
+			ELEMENT[at0012] occurrences matches {0..1} matches {	-- Generic name
+				name matches {
+					DV_CODED_TEXT matches {
+						defining_code matches {[ac0003]}		-- =Generic name OR Brand name
+					}
+				}
+				value matches {
+					DV_TEXT matches {*}
+				}
+			}
+			CLUSTER[at0013] occurrences matches {0..1} matches {	-- Safety limits
+				items cardinality matches {1..4; ordered} matches {
+					ELEMENT[at0014] occurrences matches {0..1} matches {	-- Maximum dose unit frequency
+						value matches {
+							C_DV_QUANTITY <
+								assumed_value = <
+									units = <"{QUALIFIED REAL/TIME}">
+									precision = <-1>
+									magnitude = <1.0>
+								>
+								property = <[openehr::382]>
+								list = <
+									["1"] = <
+										units = <"{QUALIFIED REAL/TIME}">
+										magnitude = <|>0.0|>
+									>
+								>
+							>
+						}
+					}
+					ELEMENT[at0015] occurrences matches {0..1} matches {	-- Dosage per kg body weight
+						value matches {
+							DV_INTERVAL<DV_QUANTITY> matches {
+								upper matches {
+									C_DV_QUANTITY <
+										property = <[openehr::0]>
+									>
+								}
+								lower matches {
+									C_DV_QUANTITY <
+										property = <[openehr::0]>
+									>
+								}
+							}
+						}
+					}
+					ELEMENT[at0016] occurrences matches {0..1} matches {	-- Minimum dose interval
+						value matches {
+							C_DV_QUANTITY <
+								property = <[openehr::128]>
+								list = <
+									["1"] = <
+										units = <"min">
+										magnitude = <|>=0.0|>
+									>
+									["2"] = <
+										units = <"h">
+										magnitude = <|>=0.0|>
+									>
+									["3"] = <
+										units = <"d">
+										magnitude = <|>=0.0|>
+									>
+									["4"] = <
+										units = <"wk">
+										magnitude = <|>=0.0|>
+									>
+									["5"] = <
+										units = <"mo">
+										magnitude = <|>=0.0|>
+									>
+								>
+							>
+						}
+					}
+					ELEMENT[at0017] occurrences matches {0..1} matches {	-- Maximum dose interval
+						value matches {
+							C_DV_QUANTITY <
+								property = <[openehr::128]>
+								list = <
+									["1"] = <
+										units = <"d">
+										magnitude = <|>=0.0|>
+									>
+									["2"] = <
+										units = <"h">
+										magnitude = <|>=0.0|>
+									>
+									["3"] = <
+										units = <"min">
+										magnitude = <|>=0.0|>
+									>
+									["4"] = <
+										units = <"wk">
+										magnitude = <|>=0.0|>
+									>
+									["5"] = <
+										units = <"mo">
+										magnitude = <|>=0.0|>
+									>
+								>
+							>
+						}
+					}
+				}
+			}
+			CLUSTER[at0018] occurrences matches {0..1} matches {	-- Administration information
+				items cardinality matches {0..*; unordered} matches {
+					ELEMENT[at0019] occurrences matches {0..1} matches {	-- Date (time) of first administration
+						value matches {
+							DV_DATE_TIME matches {
+								value matches {yyyy-??-??T??:??:??}
+							}
+						}
+					}
+					ELEMENT[at0020] occurrences matches {0..1} matches {	-- Batch number
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+					ELEMENT[at0021] occurrences matches {0..1} matches {	-- Site of administration
+						value matches {
+							DV_CODED_TEXT matches {
+								defining_code matches {[local::]}
+							}
+						}
+					}
+					ELEMENT[at0022] occurrences matches {0..1} matches {	-- Sequence number
+						value matches {
+							DV_COUNT matches {*}
+						}
+					}
+					ELEMENT[at0032] occurrences matches {0..1} matches {	-- Date (time) of last administration
+						value matches {
+							DV_DATE_TIME matches {
+								value matches {yyyy-??-??T??:??:??}
+							}
+						}
+					}
+				}
+			}
+			CLUSTER[at0023] occurrences matches {0..1} matches {	-- Dispensing information
+				items cardinality matches {0..*; unordered} matches {
+					ELEMENT[at0024] occurrences matches {0..1} matches {	-- Quantity to be dispensed
+						value matches {
+							C_DV_QUANTITY <
+								property = <[openehr::445]>
+							>
+							DV_COUNT matches {
+								magnitude matches {|>0|; 1}
+							}
+							DV_TEXT matches {*}
+						}
+					}
+					ELEMENT[at0025] occurrences matches {0..1} matches {	-- Number of authorised repeat dispensing
+						value matches {
+							DV_COUNT matches {
+								magnitude matches {|>=0|}
+							}
+						}
+					}
+					ELEMENT[at0026] occurrences matches {0..1} matches {	-- Dispensed product
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+					ELEMENT[at0027] occurrences matches {0..1} matches {	-- Brand substitution allowed
+						value matches {
+							DV_BOOLEAN matches {
+								value matches {True, False}
+							}
+						}
+					}
+					ELEMENT[at0028] occurrences matches {0..1} matches {	-- Authority approval number
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+					ELEMENT[at0029] occurrences matches {0..1} matches {	-- Patient counselled on CMI
+						value matches {
+							DV_BOOLEAN matches {
+								value matches {True, False}
+							}
+						}
+					}
+					ELEMENT[at0030] occurrences matches {0..1} matches {	-- Deferred supply
+						value matches {
+							DV_BOOLEAN matches {
+								value matches {True, False}
+							}
+						}
+					}
+					ELEMENT[at0031] occurrences matches {0..1} matches {	-- Reason for deferred supply
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+				}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["de"] = <
+			items = <
+				["at0000"] = <
+					description = <"Die Angabe einer Medikation zur Dokumentation als Teil einer ACTION oder INSTRUCTION">
+					text = <"Medikationsangabe">
+				>
+				["at0001"] = <
+					description = <"Der Name des Medikaments - kann kodiert sein">
+					text = <"Name des Medikaments">
+				>
+				["at0002"] = <
+					description = <"Detaillierte Anweisungen, wie dieses Medikament verabreicht wird">
+					text = <"Verabreichungsanweisungen">
+				>
+				["at0003"] = <
+					description = <"Die Stärke des Medikaments">
+					text = <"Stärke pro Dosiseinheit">
+				>
+				["at0004"] = <
+					description = <"Die Form des Medikaments">
+					text = <"Form">
+				>
+				["at0005"] = <
+					description = <"Die Anzahl (oder Teil) an Dosiseinheiten, die zu einem bestimmten Zeitpunkt eingenommen wird">
+					text = <"Anzahl oder Teil">
+				>
+				["at0006"] = <
+					description = <"Die Dosiseinheit in der dieses Medikament verabreicht wird">
+					text = <"Dosiseinheit">
+				>
+				["at0007"] = <
+					description = <"Die Zeit über die eine einzelne Dosis verabreicht wird">
+					text = <"Dosisdauer">
+				>
+				["at0008"] = <
+					description = <"Die Art der Verabreichung">
+					text = <"Art">
+				>
+				["at0009"] = <
+					description = <"Eingefügt und auf True gesetzt, wenn dieses Medikament fortlaufend oder immer wieder über einen signifikanten Zeitraum eingenommen wird ">
+					text = <"Ist Langzeit">
+				>
+				["at0010"] = <
+					description = <"Hinweise zu verwandten Problemen und Diagnosen, unnormale Testergebnisse usw.">
+					text = <"Hinweise">
+				>
+				["at0011"] = <
+					description = <"Die Bezeichnung der Verabreichung">
+					text = <"Bezeichnung">
+				>
+				["at0012"] = <
+					description = <"Der allgemeine Name des Wirkstoffes als alternativer Name zum Medikamentenname">
+					text = <"Allgemeiner Name">
+				>
+				["at0013"] = <
+					description = <"*">
+					text = <"Sicherheitsgrenze">
+				>
+				["at0014"] = <
+					description = <"Die maximale Anzahl an Dosiseinheiten die in einem bestimmten Zeitintervall eingenommen werden darf">
+					text = <"Maximale Dosiseinheit Frequenz">
+				>
+				["at0015"] = <
+					description = <"Die Dosis pro kg Körpergewicht">
+					text = <"Dosis pro kg Körpergewicht">
+				>
+				["at0016"] = <
+					description = <"Das minimale sichere Intervall zwischen zwei Dosen">
+					text = <"Minimales Dosisintervall">
+				>
+				["at0017"] = <
+					description = <"Das maximale sichere Intervall zwischen zwei Dosen">
+					text = <"Maximales Dosisintervall">
+				>
+				["at0018"] = <
+					description = <"Informationen bezüglich der Verabreichung der verordneten Medikation">
+					text = <"Verabreichungsinformationen">
+				>
+				["at0019"] = <
+					description = <"Das Datum und der Zeitpunkt (wenn erforderlich) wann das Medikament zum ersten Mal verabreicht wird/ wurde">
+					text = <"Zeitpunkt der ersten Verabreichung">
+				>
+				["at0020"] = <
+					description = <"Nummer zur Identifikation der Erzeugung">
+					text = <"Chargennummer">
+				>
+				["at0021"] = <
+					description = <"Die Lokalisation der Verabreichung, z.B. äußerer Oberschenkel wenn intramuskulär, per PEG bei Patienten mit Schluckstörung">
+					text = <"Lokalisation der Verabreichung">
+				>
+				["at0022"] = <
+					description = <"Die Dosisnummer oder Abfolge">
+					text = <"Laufnummer">
+				>
+				["at0023"] = <
+					description = <"Daten, die die Rezeptur betreffen">
+					text = <"Informationen zur Rezeptur">
+				>
+				["at0024"] = <
+					description = <"Die gesamte, zu verabreichende Menge">
+					text = <"Zu verabreichende Menge">
+				>
+				["at0025"] = <
+					description = <"Die Anzahl, wie oft diese Menge des Medikaments verabreicht werden darf, bevor eine erneute Verschreibung notwendig ist">
+					text = <"Anzahl an berechtigten Verabreichungswiederholungen">
+				>
+				["at0026"] = <
+					description = <"Der Name des verabreichten Produkts">
+					text = <"Verabreichtes Produkt">
+				>
+				["at0027"] = <
+					description = <"True, wenn das Fabrikat bei der Verabreichung ausgetauscht werden darf">
+					text = <"Ersetzen des Fabrikats erlaub">
+				>
+				["at0028"] = <
+					description = <"*">
+					text = <"Zulassungsnummer">
+				>
+				["at0029"] = <
+					description = <"Arzneibesteller berät den Patient">
+					text = <"Patient wird beraten">
+				>
+				["at0030"] = <
+					description = <"True, wenn sich die Bereitstellung des Medikaments verzögert">
+					text = <"Verzögerte Bereitstellung">
+				>
+				["at0031"] = <
+					description = <"Informationen bezüglich der Verzögerung der Bereitstellung">
+					text = <"Gründe für die Verzögerung der Bereitstellung">
+				>
+				["at0032"] = <
+					description = <"Das Datum und der Zeitpunkt (wenn erforderlich) an dem das Medikament zum letzten Mal verabreicht wurde">
+					text = <"Zeitpunkt der letzten Verabreichung">
+				>
+				["at0033"] = <
+					description = <"Die Einzeldosis">
+					text = <"Dosis">
+				>
+				["at0034"] = <
+					description = <"Dosis als Anzahl (oder Teil) von Dosiseinheiten">
+					text = <"Spezifiziert durch Dosiseinheit">
+				>
+				["at0035"] = <
+					description = <"Absolute Dosierung">
+					text = <"Spezifiert durch absolute Menge">
+				>
+				["at0036"] = <
+					description = <"Volumenbasierte Menge oder Mengenintervall der Einzeldosis">
+					text = <"Volumen">
+				>
+				["at0037"] = <
+					description = <"Massenbasierte Menge oder Mengenintervall der Einzeldosis">
+					text = <"Masse">
+				>
+			>
+		>
+		["en"] = <
+			items = <
+				["at0000"] = <
+					description = <"The description of a medication for recording as part of an ACTION or INSTRUCTION">
+					text = <"Medication description">
+				>
+				["at0001"] = <
+					description = <"The name of the intervention - which may be coded">
+					text = <"Name of medication">
+				>
+				["at0002"] = <
+					description = <"Detailed instructions about how to administer this medication">
+					text = <"Administration instructions">
+				>
+				["at0003"] = <
+					description = <"The strength of the medication">
+					text = <"Strength per dose unit">
+				>
+				["at0004"] = <
+					description = <"The form of the medication">
+					text = <"Form">
+				>
+				["at0005"] = <
+					description = <"The number of dose units to be taken at any time">
+					text = <"Number or fraction">
+				>
+				["at0006"] = <
+					description = <"The dose unit that is given for this type of medication">
+					text = <"Dose unit">
+				>
+				["at0007"] = <
+					description = <"The time over which an individual dose is to be administered">
+					text = <"Dose duration">
+				>
+				["at0008"] = <
+					description = <"The route of administration">
+					text = <"Route">
+				>
+				["at0009"] = <
+					description = <"Included and set to true if this medication is to be used continuously or repeatedly over a significant period of time.">
+					text = <"Is long term">
+				>
+				["at0010"] = <
+					description = <"Indications including related problems and diagnoses, abnormal test results etc">
+					text = <"Indications">
+				>
+				["at0011"] = <
+					description = <"The indication for the intervention">
+					text = <"Indication">
+				>
+				["at0012"] = <
+					description = <"The generic name of the drug which is an alternative name to the name of medication">
+					text = <"Generic name">
+				>
+				["at0013"] = <
+					description = <"*">
+					text = <"Safety limits">
+				>
+				["at0014"] = <
+					description = <"The maximum number of dose units to be taken in a particular time">
+					text = <"Maximum dose unit frequency">
+				>
+				["at0015"] = <
+					description = <"The dose per kg of body weight">
+					text = <"Dosage per kg body weight">
+				>
+				["at0016"] = <
+					description = <"The minimum safe interval between doses">
+					text = <"Minimum dose interval">
+				>
+				["at0017"] = <
+					description = <"The maximum safe interval between doses">
+					text = <"Maximum dose interval">
+				>
+				["at0018"] = <
+					description = <"Information relating to the administration of the medication order">
+					text = <"Administration information">
+				>
+				["at0019"] = <
+					description = <"The date and time (if required) the medication is/was first administered">
+					text = <"Date (time) of first administration">
+				>
+				["at0020"] = <
+					description = <"Manufacturer's identification number">
+					text = <"Batch number">
+				>
+				["at0021"] = <
+					description = <"The site of administration e.g. outer thigh if intramuscular, via PEG if patient is nil orally">
+					text = <"Site of administration">
+				>
+				["at0022"] = <
+					description = <"The dose number or sequence">
+					text = <"Sequence number">
+				>
+				["at0023"] = <
+					description = <"Data relating to dispensing">
+					text = <"Dispensing information">
+				>
+				["at0024"] = <
+					description = <"The total quantity to be dispensed">
+					text = <"Quantity to be dispensed">
+				>
+				["at0025"] = <
+					description = <"The number of times this quantity of medication may be dispensed before a further prescription is required">
+					text = <"Number of authorised repeat dispensing">
+				>
+				["at0026"] = <
+					description = <"The name of the product dispensed">
+					text = <"Dispensed product">
+				>
+				["at0027"] = <
+					description = <"True if an alternative brand may be substituted when dispensing">
+					text = <"Brand substitution allowed">
+				>
+				["at0028"] = <
+					description = <"*">
+					text = <"Authority approval number">
+				>
+				["at0029"] = <
+					description = <"Dispenser counselled the patient with regard to the Consumer Medicines Information">
+					text = <"Patient counselled on CMI">
+				>
+				["at0030"] = <
+					description = <"True if the supply of the medication has been deferred">
+					text = <"Deferred supply">
+				>
+				["at0031"] = <
+					description = <"Information relating to the reason for deferred supply">
+					text = <"Reason for deferred supply">
+				>
+				["at0032"] = <
+					description = <"The date and time (if required) the medication is  to be administered for the last time">
+					text = <"Date (time) of last administration">
+				>
+				["at0033"] = <
+					description = <"The dose to be administered at one time">
+					text = <"Dose">
+				>
+				["at0034"] = <
+					description = <"Dose as number (or fraction) of the dose units">
+					text = <"By dose units">
+				>
+				["at0035"] = <
+					description = <"Dosage by absolute quantity">
+					text = <"By absolute quantity">
+				>
+				["at0036"] = <
+					description = <"The quantity (or range) to be administered as a single dose">
+					text = <"Quantity by volume">
+				>
+				["at0037"] = <
+					description = <"*">
+					text = <"Quantity by mass">
+				>
+			>
+		>
+	>
+	constraint_definitions = <
+		["de"] = <
+			items = <
+				["ac0000"] = <
+					description = <"Begriffe wie Tablette, Inhalator, Flüssigkeit...">
+					text = <"Beliebiger Begriff, der eine Form eines Medikaments ist">
+				>
+				["ac0001"] = <
+					description = <"Eine Menge an Begriffen, die die Dosiseinheiten für eine Medikation beschreiben - z.B. Tablette, Stoß, Ampulle usw. - erlaubt es, die Dosis als Zahl auszudrücken">
+					text = <"Beliebiger Ausdruck, der eine Dosiseinheit für diese Form ist">
+				>
+				["ac0002"] = <
+					description = <"Der Weg, auf welchem dieses Medikament verabreicht wird">
+					text = <"Beliebiger Ausdruck, der ein Weg der Verabreichung ist">
+				>
+				["ac0003"] = <
+					description = <"*">
+					text = <"=Name des Generikums oder Markenname">
+				>
+			>
+		>
+		["en"] = <
+			items = <
+				["ac0000"] = <
+					description = <"Terms such as tablet, inhaler, liquid....">
+					text = <"Any term that 'is_a' form of medication">
+				>
+				["ac0001"] = <
+					description = <"A set of terms that describes the dose units for medication - e.g. tablet, puff, ampule etc - which allow the dose to be expressed as a number.">
+					text = <"any term that 'is a' Dose unit for this form">
+				>
+				["ac0002"] = <
+					description = <"The route by which the medication is administered">
+					text = <"Any term that 'is_a' route of administration">
+				>
+				["ac0003"] = <
+					description = <"*">
+					text = <"=Generic name OR Brand name">
+				>
+			>
+		>
+	>
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-ITEM_TREE.referral.v1.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-ITEM_TREE.referral.v1.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-ITEM_TREE.referral.v1.adl	(revision 46)
@@ -0,0 +1,494 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-ITEM_TREE.referral.v1
+
+concept
+	[at0000]	-- Referral data
+language
+	original_language = <[ISO_639-1::en]>
+	translations = <
+		["de"] = <
+			language = <[ISO_639-1::de]>
+			author = <
+				["name"] = <"Jasmin Buck, Sebastian Garde">
+				["organisation"] = <"University of Heidelberg, Central Queensland University">
+			>
+		>
+	>
+description
+	original_author = <
+		["name"] = <"Sam Heard">
+		["organisation"] = <"Ocean Informatics">
+		["date"] = <"22/04/2006">
+		["email"] = <"sam.heard@oceaninformatics.biz">
+	>
+	details = <
+		["de"] = <
+			language = <[ISO_639-1::de]>
+			purpose = <"Zur Dokumentation von Informationen einer Überweisung als Teil einer Anweisung (INSTRUCTION) oder Handlung (ACTION)">
+			use = <"*">
+			misuse = <"*">
+		>
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"For recording information about a referral as part of an instruction or action.">
+			use = <"">
+			misuse = <"">
+		>
+	>
+	lifecycle_state = <"Initial">
+	other_contributors = <>
+
+definition
+	ITEM_TREE[at0000] occurrences matches {0..*} matches {	-- Referral data
+		items cardinality matches {0..*; unordered} matches {
+			ELEMENT[at0002] matches {	-- Clinical issue
+				value matches {
+					DV_TEXT matches {*}
+				}
+			}
+			ELEMENT[at0035] occurrences matches {0..1} matches {	-- Other details
+				value matches {
+					DV_TEXT matches {*}
+				}
+			}
+			CLUSTER[at0014] occurrences matches {0..1} matches {	-- Referring provider details
+				items cardinality matches {1; unordered} matches {
+					ELEMENT[at0015] matches {	-- Name of referring provider
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+					ELEMENT[at0017] occurrences matches {0..1} matches {	-- Role of referring provider
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+					ELEMENT[at0016] occurrences matches {0..1} matches {	-- Address of referring provider
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+					CLUSTER[at0026] occurrences matches {0..1} matches {	-- Contact details of the referring provider
+						items cardinality matches {0..*; unordered} matches {
+							ELEMENT[at0025] occurrences matches {0..*} matches {	-- Telephone
+								name matches {
+									DV_CODED_TEXT matches {
+										defining_code matches {
+											[local::
+											at0029, 	-- Mobile
+											at0030, 	-- Work
+											at0031, 	-- Alternative work
+											at0032, 	-- Direct work line
+											at0033]	-- Pager
+										}
+									}
+								}
+								value matches {
+									DV_TEXT matches {*}
+								}
+							}
+							ELEMENT[at0028] occurrences matches {0..1} matches {	-- Email
+								value matches {
+									DV_TEXT matches {*}
+								}
+							}
+							ELEMENT[at0027] occurrences matches {0..1} matches {	-- Faxsimile
+								value matches {
+									DV_TEXT matches {*}
+								}
+							}
+						}
+					}
+				}
+			}
+			CLUSTER[at0021] matches {	-- Secondary provider details
+				items cardinality matches {1..*; unordered} matches {
+					ELEMENT[at0022] occurrences matches {0..1} matches {	-- Name of secondary provider
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+					ELEMENT[at0024] occurrences matches {0..1} matches {	-- Role of secondary provider
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+					ELEMENT[at0023] occurrences matches {0..1} matches {	-- Address of secondary provider
+						value matches {
+							DV_TEXT matches {*}
+						}
+					}
+					CLUSTER[at0034] occurrences matches {0..1} matches {	-- Contact details of the secondary provider
+						items cardinality matches {0..*; unordered} matches {
+							use_node ELEMENT /items[at0014]/items[at0026]/items[at0025]
+							use_node ELEMENT /items[at0014]/items[at0026]/items[at0028]
+							use_node ELEMENT /items[at0014]/items[at0026]/items[at0027]
+						}
+					}
+				}
+			}
+			CLUSTER[at0003] occurrences matches {0..1} matches {	-- Process
+				items cardinality matches {0..*; unordered} matches {
+					CLUSTER[at0004] occurrences matches {0..1} matches {	-- Urgency
+						items cardinality matches {0..*; unordered} matches {
+							ELEMENT[at0005] occurrences matches {0..1} matches {	-- Timing
+								value matches {
+									0|[local::at0006], 	-- Emergency
+									1|[local::at0007], 	-- Urgent
+									2|[local::at0008]  	-- Non-urgent
+								}
+							}
+							ELEMENT[at0009] occurrences matches {0..1} matches {	-- Impact
+								value matches {
+									0|[local::at0010], 	-- High
+									1|[local::at0011], 	-- Moderate
+									2|[local::at0012]  	-- Low
+								}
+							}
+							ELEMENT[at0013] occurrences matches {0..1} matches {	-- Maximal delay
+								value matches {
+									C_DV_QUANTITY <
+										property = <[openehr::128]>
+										list = <
+											["1"] = <
+												units = <"h">
+												magnitude = <|>0.0|>
+											>
+											["2"] = <
+												units = <"d">
+												magnitude = <|>0.0|>
+											>
+											["3"] = <
+												units = <"wk">
+												magnitude = <|>0.0|>
+											>
+											["4"] = <
+												units = <"mo">
+												magnitude = <|>0.0|>
+											>
+											["5"] = <
+												units = <"min">
+											>
+										>
+									>
+								}
+							}
+						}
+					}
+					ELEMENT[at0018] occurrences matches {0..1} matches {	-- Date referred
+						value matches {
+							DV_DATE_TIME matches {
+								value matches {yyyy-??-??T??:??:??}
+							}
+						}
+					}
+					ELEMENT[at0019] occurrences matches {0..1} matches {	-- Date first attended
+						value matches {
+							DV_DATE_TIME matches {
+								value matches {yyyy-??-??T??:??:??}
+							}
+						}
+					}
+					ELEMENT[at0020] occurrences matches {0..1} matches {	-- Date last attended
+						value matches {
+							DV_DATE_TIME matches {
+								value matches {yyyy-??-??T??:??:??}
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["de"] = <
+			items = <
+				["at0000"] = <
+					description = <"Daten einer Überweisung, dokumentiert als Teil einer INSTRUCTION oder ACTION">
+					text = <"Überweisungsdaten">
+				>
+				["at0002"] = <
+					description = <"die klinische Fragestellung, die eine Behandlung eines zweiten Gesundheitdienstleisters erfordert">
+					text = <"Klinische Fragestellung">
+				>
+				["at0003"] = <
+					description = <"Informationen zum Ablauf der Überweisung">
+					text = <"Ablauf">
+				>
+				["at0004"] = <
+					description = <"Informationen zur Dringlichkeit der Überweisung">
+					text = <"Dringlichkeit">
+				>
+				["at0005"] = <
+					description = <"eine angemessene Zeitberechung des Auftrages">
+					text = <"Zeitliche Dringlichkeit ">
+				>
+				["at0006"] = <
+					description = <"die Person benötigt sofortige Behandlung">
+					text = <"Notfall">
+				>
+				["at0007"] = <
+					description = <"die Person benötigt so bald wie möglich eine Behandlung">
+					text = <"Eilig">
+				>
+				["at0008"] = <
+					description = <"die Person benötigt zum nächstmöglichen Termin eine Behandlung">
+					text = <"nicht eilig">
+				>
+				["at0009"] = <
+					description = <"der Einfluss des Zustandes auf das Leben der Person">
+					text = <"Einfluss">
+				>
+				["at0010"] = <
+					description = <"der Zustand hat einen bedeutenden Einfluss auf die Körperfunktionen der Person">
+					text = <"hoch">
+				>
+				["at0011"] = <
+					description = <"der Zustand hat einen Einfluss, aber die Person hat die meisten Körperfunktionen">
+					text = <"moderat">
+				>
+				["at0012"] = <
+					description = <"der Zustand hat geringen oder keinen Einfluss auf die Körperfunktionen der Person">
+					text = <"gering">
+				>
+				["at0013"] = <
+					description = <"Ein Angabe des maximalen Verzugs, der bis zur Behandlung der Person als vertretbar angesehen wird">
+					text = <"Maximaler Verzug">
+				>
+				["at0014"] = <
+					description = <"Informationen über überweisenden Dienstleister bzw. den ersten Dienstleister">
+					text = <"Einzelheiten des überweisenden Dienstleisters">
+				>
+				["at0015"] = <
+					description = <"Name des überweisenden Dienstleisters">
+					text = <"Name des überweisenden Dienstleisters">
+				>
+				["at0016"] = <
+					description = <"*">
+					text = <"Adresse des überweisenden Dienstleisters">
+				>
+				["at0017"] = <
+					description = <"*">
+					text = <"Aufgabe des überweisenden Dienstleisters">
+				>
+				["at0018"] = <
+					description = <"das Datum der ursprünglichen Überweisung">
+					text = <"Datum der Überweisung">
+				>
+				["at0019"] = <
+					description = <"das Datum, an dem die Person das erste Mal vom zweiten Gesundheitsdienstleister behandelt wurde">
+					text = <"Datum der ersten Behandlung">
+				>
+				["at0020"] = <
+					description = <"das Datum, an dem die Person das letzte Mal vom zweiten Gesundheitsdienstleister behandelt wurde">
+					text = <"Datum der letzten Behandlung">
+				>
+				["at0021"] = <
+					description = <"Einzelheiten des Gesundheitsdienstleisters, an den die Überweisung gerichtet ist">
+					text = <"Einzelheiten des zweiten Gesundheitsdienstleisters">
+				>
+				["at0022"] = <
+					description = <"der Name des Gesundheitsdienstleisters, an den die Überweisung gerichtet ist">
+					text = <"Name des zweiten Gesundheitsdienstleisters">
+				>
+				["at0023"] = <
+					description = <"die Adresse des Gesundheitsdienstleisters, an den die Überweisung gerichtet ist">
+					text = <"Adresse des zweiten Gesundheitsdienstleisters">
+				>
+				["at0024"] = <
+					description = <"die Aufgabe des Gesundheitsdienstleisters, an den die Überweisung gerichtet ist">
+					text = <"Aufgabe des zweiten Gesundheitsdienstleisters">
+				>
+				["at0025"] = <
+					description = <"Telefonnummern">
+					text = <"Telefon">
+				>
+				["at0026"] = <
+					description = <"die Kontakteinzelheiten des überweisenden Dienstleisters">
+					text = <"Kontakteinzelheiten des überweisenden Dienstleisters">
+				>
+				["at0027"] = <
+					description = <"die Faxnummer des Anbieters">
+					text = <"Fax">
+				>
+				["at0028"] = <
+					description = <"E-Mail Adresse des Anbieters">
+					text = <"E-Mail">
+				>
+				["at0029"] = <
+					description = <"die Nummer eines mobilen Telefons oder Handys">
+					text = <"Mobil">
+				>
+				["at0030"] = <
+					description = <"die Telefonnummer des Arbeitsplatzes">
+					text = <"Nummer">
+				>
+				["at0031"] = <
+					description = <"eine Alternative Telefonnummer">
+					text = <"alternative Nummer">
+				>
+				["at0032"] = <
+					description = <"eine Telefonnummer, die direkt zum Dienstleiter vermittlelt">
+					text = <"Durchwahl">
+				>
+				["at0033"] = <
+					description = <"eine Pagernummer zum Hinterlassen von Nachrichten">
+					text = <"Pager">
+				>
+				["at0034"] = <
+					description = <"*">
+					text = <"Kontaktdetails des zweiten Gesundheitsdienstleisters">
+				>
+				["at0035"] = <
+					description = <"andere für die Überweisung relevante Einzelheiten">
+					text = <"Andere Einzelheiten">
+				>
+			>
+		>
+		["en"] = <
+			items = <
+				["at0000"] = <
+					description = <"Data about a referral recorded as part of an instruction or action">
+					text = <"Referral data">
+				>
+				["at0002"] = <
+					description = <"The clinical issue that requires care from the second provider">
+					text = <"Clinical issue">
+				>
+				["at0003"] = <
+					description = <"Information about the process of the referral">
+					text = <"Process">
+				>
+				["at0004"] = <
+					description = <"information about the urgency of the referral">
+					text = <"Urgency">
+				>
+				["at0005"] = <
+					description = <"The appropriate timing of the appointment">
+					text = <"Timing">
+				>
+				["at0006"] = <
+					description = <"Person requires care immediately">
+					text = <"Emergency">
+				>
+				["at0007"] = <
+					description = <"Person requires care as soon as possible">
+					text = <"Urgent">
+				>
+				["at0008"] = <
+					description = <"Person requires care at providers convenience">
+					text = <"Non-urgent">
+				>
+				["at0009"] = <
+					description = <"The impact of the condition on the person's life">
+					text = <"Impact">
+				>
+				["at0010"] = <
+					description = <"The condition is having major impact on the person's ability to function">
+					text = <"High">
+				>
+				["at0011"] = <
+					description = <"The condition is having an impact but the person is able to function to a large extent">
+					text = <"Moderate">
+				>
+				["at0012"] = <
+					description = <"The condition is having little or no impact on the person's ability to function">
+					text = <"Low">
+				>
+				["at0013"] = <
+					description = <"An indication of the maximum delay that would be reasonable before the person is seen">
+					text = <"Maximal delay">
+				>
+				["at0014"] = <
+					description = <"Information about the referrer or primary provider">
+					text = <"Referring provider details">
+				>
+				["at0015"] = <
+					description = <"The name of the referring provider">
+					text = <"Name of referring provider">
+				>
+				["at0016"] = <
+					description = <"*">
+					text = <"Address of referring provider">
+				>
+				["at0017"] = <
+					description = <"*">
+					text = <"Role of referring provider">
+				>
+				["at0018"] = <
+					description = <"The date of the original referral">
+					text = <"Date referred">
+				>
+				["at0019"] = <
+					description = <"The date the person first attended the secondary provider">
+					text = <"Date first attended">
+				>
+				["at0020"] = <
+					description = <"The date the person last attended the second provider">
+					text = <"Date last attended">
+				>
+				["at0021"] = <
+					description = <"Details about the provider to whom the referral is directed">
+					text = <"Secondary provider details">
+				>
+				["at0022"] = <
+					description = <"The name of the provider to which the referral is directed">
+					text = <"Name of secondary provider">
+				>
+				["at0023"] = <
+					description = <"The address of the provider to which the referral is directed">
+					text = <"Address of secondary provider">
+				>
+				["at0024"] = <
+					description = <"The role of the provider to which the referral is directed">
+					text = <"Role of secondary provider">
+				>
+				["at0025"] = <
+					description = <"Telephone contact information">
+					text = <"Telephone">
+				>
+				["at0026"] = <
+					description = <"Contact details of the referring provider">
+					text = <"Contact details of the referring provider">
+				>
+				["at0027"] = <
+					description = <"The faxsimile number of the provider">
+					text = <"Faxsimile">
+				>
+				["at0028"] = <
+					description = <"Email address of the provider">
+					text = <"Email">
+				>
+				["at0029"] = <
+					description = <"The mobile or cell phone number">
+					text = <"Mobile">
+				>
+				["at0030"] = <
+					description = <"The work telephone number">
+					text = <"Work">
+				>
+				["at0031"] = <
+					description = <"An alternative work telephone number">
+					text = <"Alternative work">
+				>
+				["at0032"] = <
+					description = <"A phone number that is direct to the provider">
+					text = <"Direct work line">
+				>
+				["at0033"] = <
+					description = <"A pager number to leave messages">
+					text = <"Pager">
+				>
+				["at0034"] = <
+					description = <"*">
+					text = <"Contact details of the secondary provider">
+				>
+				["at0035"] = <
+					description = <"Other details relevant to the referral">
+					text = <"Other details">
+				>
+			>
+		>
+	>
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-OBSERVATION.apgar.v1.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-OBSERVATION.apgar.v1.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-OBSERVATION.apgar.v1.adl	(revision 46)
@@ -0,0 +1,545 @@
+archetype (adl_version=1.4)
+    openEHR-EHR-OBSERVATION.apgar.v1
+
+concept
+    [at0000]	-- Apgar score
+language
+    original_language = <[ISO_639-1::en]>
+    translations = <
+        ["de"] = <
+            language = <[ISO_639-1::de]>
+            author = <
+                ["name"] = <"Jasmin Buck, Sebastian Garde">
+                ["organisation"] = <"University of Heidelberg, Central Queensland University">
+            >
+        >
+        ["en-us"] = <
+            language = <[ISO_639-1::en-us]>
+            author = <
+                ["name"] = <"????">
+            >
+        >
+    >
+description
+    original_author = <
+        ["name"] = <"Sam Heard">
+        ["organisation"] = <"Ocean Informatics">
+        ["date"] = <"2004-05-18">
+        ["email"] = <"sam.heard@oceaninformatics.biz">
+    >
+    details = <
+        ["en-us"] = <
+            language = <[ISO_639-1::en-us]>
+            purpose = <"Record Apgar index or assessment for newborn. The root time of the event series is always birth.">
+            use = <"Allows recording of infant well-being at 1,2,5 and or 10 mintues after birth. The total may be recorded alone - if this is all that is available - but all five ordinal values should be completed in order that the total can be calculated. The total is the sum of the five ordinal values (min 0, max 10).">
+            keywords = <"apgar", "index", "score", "newborn">
+            misuse = <"Only partially completing the score and adding less than five values to give the total.">
+        >
+        ["en"] = <
+            language = <[ISO_639-1::en]>
+            purpose = <"Record Apgar index or assessment for newborn. The root time of the event series is always birth.">
+            use = <"Allows recording of infant well-being at 1,2,5 and or 10 mintues after birth. The total may be recorded alone - if this is all that is available - but all five ordinal values should be completed in order that the total can be calculated. The total is the sum of the five ordinal values (min 0, max 10).">
+            keywords = <"apgar", "newborn", "index", "score">
+            misuse = <"Only partially completing the score and adding less than five values to give the total.">
+        >
+        ["de"] = <
+            language = <[ISO_639-1::de]>
+            purpose = <"Zur Dokumentation des Apgar Wertes oder Beurteilung f%Gï¿½%@r Neugeborene. Der zu Grunde liegende Zeitpunkt der Ereignisreihe ist immer die Geburt.">
+            use = <"Erm%Gï¿½%@glicht die Dokumentation des Wohlergehens des S%Gï¿½%@uglings 1, 2, 5 und/ oder 10 Minuten nach der Geburt. Die Summe kann einzeln dokumentiert werden - falls nur diese verf%Gï¿½%@gbar ist - es sollten aber alle f%Gï¿½%@nf Zahlenwerte vervollst%Gï¿½%@ndigt werden, damit die Summe errechnet werden kann. Die Gesamtsumme ist die Summe der f%Gï¿½%@nf Zahlenwerte (minimal 0, maximal 10).">
+            keywords = <"Apgar", "Neugeborenes", "Index", "Wert">
+            misuse = <"Nur teilweise Vervollst%Gï¿½%@ndigung der Werte und Addieren von weniger als f%Gï¿½%@nf Werten zur Gesamtsumme.">
+        >
+    >
+    lifecycle_state = <"AuthorDraft">
+    other_contributors = <>
+
+definition
+    OBSERVATION[at0000] matches {	-- Apgar score
+        data matches {
+            HISTORY[at0002] matches {	-- history
+                events cardinality matches {1..*; unordered} matches {
+                    POINT_EVENT[at0003] occurrences matches {0..1} matches {	-- 1 minute
+                        offset matches {
+                            DV_DURATION matches {
+                                value matches {|PT1M|}
+                            }
+                        }
+                        data matches {
+                            ITEM_LIST[at0001] matches {	-- structure
+                                items cardinality matches {1..6; ordered} matches {
+                                    ELEMENT[at0005] occurrences matches {0..1} matches {	-- Heart rate
+                                        value matches {
+                                            0|[local::at0006], 	-- No heart beat
+                                            1|[local::at0007], 	-- Less than 100 beats per minute
+                                            2|[local::at0008]  	-- Greater than or equal to 100 beats per minute
+                                        }
+                                    }
+                                    ELEMENT[at0009] occurrences matches {0..1} matches {	-- Breathing
+                                        value matches {
+                                            0|[local::at0010], 	-- No effort
+                                            1|[local::at0011], 	-- Moderate effort
+                                            2|[local::at0012]  	-- Crying
+                                        }
+                                    }
+                                    ELEMENT[at0013] occurrences matches {0..1} matches {	-- Muscle tone
+                                        value matches {
+                                            0|[local::at0014], 	-- Limp
+                                            1|[local::at0015], 	-- Some flexing of arms and legs
+                                            2|[local::at0016]  	-- Active motion
+                                        }
+                                    }
+                                    ELEMENT[at0017] occurrences matches {0..1} matches {	-- Reflex response
+                                        value matches {
+                                            0|[local::at0018], 	-- No response to airways suction
+                                            1|[local::at0019], 	-- Grimace during airways suction
+                                            2|[local::at0020]  	-- Grimace and cough/sneeze during airways suction
+                                        }
+                                    }
+                                    ELEMENT[at0021] occurrences matches {0..1} matches {	-- Colour
+                                        value matches {
+                                            0|[local::at0022], 	-- Whole body is blue or pale
+                                            1|[local::at0023], 	-- Good colour in body, hands or feet blue 
+                                            2|[local::at0024]  	-- Completely pink or good colour
+                                        }
+                                    }
+                                    ELEMENT[at0025] matches {	-- Total
+                                        value matches {
+                                            DV_COUNT matches {
+                                                magnitude matches {|0..10|}
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                    POINT_EVENT[at0026] occurrences matches {0..1} matches {	-- 2 minute
+                        offset matches {
+                            DV_DURATION matches {
+                                value matches {|PT2M|}
+                            }
+                        }
+                        data matches {
+                            use_node ITEM_LIST /data[at0002]/events[at0003]/data[at0001]
+                        }
+                    }
+                    POINT_EVENT[at0027] occurrences matches {0..1} matches {	-- 5 minute
+                        offset matches {
+                            DV_DURATION matches {
+                                value matches {|PT5M|}
+                            }
+                        }
+                        data matches {
+                            use_node ITEM_LIST /data[at0002]/events[at0003]/data[at0001]
+                        }
+                    }
+                    POINT_EVENT[at0028] occurrences matches {0..1} matches {	-- 10 minute
+                        offset matches {
+                            DV_DURATION matches {
+                                value matches {|PT10M|}
+                            }
+                        }
+                        data matches {
+                            use_node ITEM_LIST /data[at0002]/events[at0003]/data[at0001]
+                        }
+                    }
+                }
+            }
+        }
+        protocol matches {
+            ITEM_LIST[at0029] matches {	-- List
+                items cardinality matches {0..*; unordered} matches {
+                    ELEMENT[at0030] occurrences matches {0..1} matches {	-- Notes on measurement
+                        value matches {
+                            DV_TEXT matches {*}
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+ontology
+    terminologies_available = <"LNC205", ...>
+    term_definitions = <
+        ["en"] = <
+            items = <
+                ["at0000"] = <
+                    description = <"Clinical score derived from assessment of breathing, colour, muscle tone, heart rate and reflex response usually taken at 1, 5 and 10 minutes after birth">
+                    text = <"Apgar score">
+                >
+                ["at0001"] = <
+                    description = <"@ internal @">
+                    text = <"structure">
+                >
+                ["at0002"] = <
+                    description = <"@ internal @">
+                    text = <"history">
+                >
+                ["at0003"] = <
+                    description = <"Apgar score at one minute from birth">
+                    text = <"1 minute">
+                >
+                ["at0005"] = <
+                    description = <"Assessment of heart function in the new born">
+                    text = <"Heart rate">
+                >
+                ["at0006"] = <
+                    description = <"No heart beat is present (palpation at base of umbilical cord)">
+                    text = <"No heart beat">
+                >
+                ["at0007"] = <
+                    description = <"Heart rate of less than 100 beats per minute">
+                    text = <"Less than 100 beats per minute">
+                >
+                ["at0008"] = <
+                    description = <"Heart rate of greater than or equal to 100 beats per minute">
+                    text = <"Greater than or equal to 100 beats per minute">
+                >
+                ["at0009"] = <
+                    description = <"Assessment of the neonate's breathing effort">
+                    text = <"Breathing">
+                >
+                ["at0010"] = <
+                    description = <"No effort to breath">
+                    text = <"No effort">
+                >
+                ["at0011"] = <
+                    description = <"Some effort to breath, moving chest">
+                    text = <"Moderate effort">
+                >
+                ["at0012"] = <
+                    description = <"Crying or breathing normally">
+                    text = <"Crying">
+                >
+                ["at0013"] = <
+                    description = <"Assessment of the baby's muscle tone">
+                    text = <"Muscle tone">
+                >
+                ["at0014"] = <
+                    description = <"Limp or floppy and not moving spontaneously">
+                    text = <"Limp">
+                >
+                ["at0015"] = <
+                    description = <"Some movement and flexion of the arms or legs">
+                    text = <"Some flexing of arms and legs">
+                >
+                ["at0016"] = <
+                    description = <"Active and mobile">
+                    text = <"Active motion">
+                >
+                ["at0017"] = <
+                    description = <"Assessment of the response of the baby to suction from a nostril">
+                    text = <"Reflex response">
+                >
+                ["at0018"] = <
+                    description = <"No gag or response to suction of the airway">
+                    text = <"No response to airways suction">
+                >
+                ["at0019"] = <
+                    description = <"Grimace only as reaction to airways suction">
+                    text = <"Grimace during airways suction">
+                >
+                ["at0020"] = <
+                    description = <"Grimace and cough, sneeze or gag as response to airway suction">
+                    text = <"Grimace and cough/sneeze during airways suction">
+                >
+                ["at0021"] = <
+                    description = <"The colour of the skin on the body and trunk and limbs">
+                    text = <"Colour">
+                >
+                ["at0022"] = <
+                    description = <"The body is pale or blue in color">
+                    text = <"Whole body is blue or pale">
+                >
+                ["at0023"] = <
+                    description = <"The body is pink, hands and feet pale or blue">
+                    text = <"Good colour in body, hands or feet blue ">
+                >
+                ["at0024"] = <
+                    description = <"Pink or good color to whole body">
+                    text = <"Completely pink or good colour">
+                >
+                ["at0025"] = <
+                    description = <"The total of the ordinal scores for each parameter">
+                    text = <"Total">
+                >
+                ["at0026"] = <
+                    description = <"Apgar score 2 minutes after birth">
+                    text = <"2 minute">
+                >
+                ["at0027"] = <
+                    description = <"Apgar score 5 minutes after birth">
+                    text = <"5 minute">
+                >
+                ["at0028"] = <
+                    description = <"Apgar score 10 minutes after birth">
+                    text = <"10 minute">
+                >
+                ["at0029"] = <
+                    description = <"@ internal @">
+                    text = <"List">
+                >
+                ["at0030"] = <
+                    description = <"Notes on measurement of the apgar">
+                    text = <"Notes on measurement">
+                >
+            >
+        >
+        ["en-us"] = <
+            items = <
+                ["at0000"] = <
+                    description = <"Clinical score derived from assessment of breathing, colour, muscle tone, heart rate and reflex response usually taken at 1, 5 and 10 minutes after birth">
+                    text = <"Apgar score">
+                >
+                ["at0001"] = <
+                    description = <"@ internal @">
+                    text = <"structure">
+                >
+                ["at0002"] = <
+                    description = <"@ internal @">
+                    text = <"history">
+                >
+                ["at0003"] = <
+                    description = <"Apgar score at one minute from birth">
+                    text = <"1 minute">
+                >
+                ["at0005"] = <
+                    description = <"Assessment of heart function in the new born">
+                    text = <"Heart rate">
+                >
+                ["at0006"] = <
+                    description = <"No heart beat is present - palpation of the base of umbilical cord">
+                    text = <"No heart beat">
+                >
+                ["at0007"] = <
+                    description = <"Less than 100 beats per minute">
+                    text = <"Less than 100 beats per minute">
+                >
+                ["at0008"] = <
+                    description = <"Heart rate of greater than or equal to 100 beats per minute">
+                    text = <"Greater than or equal to 100 beats per minute">
+                >
+                ["at0009"] = <
+                    description = <"Assessment of the neonate's breathing effort">
+                    text = <"Breathing">
+                >
+                ["at0010"] = <
+                    description = <"No effort to breath">
+                    text = <"No effort">
+                >
+                ["at0011"] = <
+                    description = <"Some effort to breath">
+                    text = <"Moderate effort">
+                >
+                ["at0012"] = <
+                    description = <"Crying or breathing normally">
+                    text = <"Crying">
+                >
+                ["at0013"] = <
+                    description = <"Assessment of the baby's muscle tone">
+                    text = <"Muscle tone">
+                >
+                ["at0014"] = <
+                    description = <"Limp or floppy and not moving spontaneously">
+                    text = <"Limp">
+                >
+                ["at0015"] = <
+                    description = <"Some movement and flexion of the arms or legs">
+                    text = <"Some flexing of arms and legs">
+                >
+                ["at0016"] = <
+                    description = <"Active and mobile">
+                    text = <"Active motion">
+                >
+                ["at0017"] = <
+                    description = <"Assessment of the response of the baby to suction from a nostril">
+                    text = <"Reflex response">
+                >
+                ["at0018"] = <
+                    description = <"No gag or response to suction of the airway">
+                    text = <"No response to airways suction">
+                >
+                ["at0019"] = <
+                    description = <"Grimace only as reaction to airways suction">
+                    text = <"Grimace during airways suction">
+                >
+                ["at0020"] = <
+                    description = <"Grimace and cough, sneeze or gag as response to airway suction">
+                    text = <"Grimace and cough/sneeze during airways suction">
+                >
+                ["at0021"] = <
+                    description = <"The color of the skin on the body, trunk and limbs">
+                    text = <"Color">
+                >
+                ["at0022"] = <
+                    description = <"The body is gray or blue in color">
+                    text = <"Whole body is gray">
+                >
+                ["at0023"] = <
+                    description = <"The body is pink, hands and feet gray or blue">
+                    text = <"Good color in body, hands or feet blue">
+                >
+                ["at0024"] = <
+                    description = <"Pink or good color to whole body">
+                    text = <"Completely pink or good color">
+                >
+                ["at0025"] = <
+                    description = <"The total of the ordinal scores for each parameter">
+                    text = <"Score">
+                >
+                ["at0026"] = <
+                    description = <"Apgar score 2 minutes after birth">
+                    text = <"2 minute">
+                >
+                ["at0027"] = <
+                    description = <"Apgar score 5 minutes after birth">
+                    text = <"5 minute">
+                >
+                ["at0028"] = <
+                    description = <"Apgar score 10 minutes after birth">
+                    text = <"10 minute">
+                >
+                ["at0029"] = <
+                    description = <"@ internal @">
+                    text = <"List">
+                >
+                ["at0030"] = <
+                    description = <"Any notes on the measurement of the apgar">
+                    text = <"Notes on measurement">
+                >
+            >
+        >
+        ["de"] = <
+            items = <
+                ["at0000"] = <
+                    description = <"Klinischer Wert, abgeleitet von der Beurteilung der Atmung, der Hautfarbe, dem Muskeltonus, der Herzfrequenz und der Reaktion von Reflexen, %Gï¿½%@blicherweise 1, 5 und 10 Minuten nach der Geburt erhoben">
+                    text = <"Apgar Wert">
+                >
+                ["at0001"] = <
+                    description = <"@ internal @">
+                    text = <"Structure">
+                >
+                ["at0002"] = <
+                    description = <"@ internal @">
+                    text = <"History">
+                >
+                ["at0003"] = <
+                    description = <"Apgar Wert 1 Minute nach der Geburt">
+                    text = <"1 Minute">
+                >
+                ["at0005"] = <
+                    description = <"Beurteilung der Herzfunktion des Neubegorenen">
+                    text = <"Herzfrequenz">
+                >
+                ["at0006"] = <
+                    description = <"Kein Herzschlag vorhanden (Palpation am Ende der Nabelschnur)">
+                    text = <"Kein Herzschlag">
+                >
+                ["at0007"] = <
+                    description = <"Herzfrequenz von weniger als 100 Schl%Gï¿½%@gen pro Minute">
+                    text = <"Weniger als 100 Schl%Gï¿½%@ge pro Minute">
+                >
+                ["at0008"] = <
+                    description = <"Herzfrequenz von mehr als oder genau 100 Schl%Gï¿½%@gen pro Minute">
+                    text = <"Mehr als oder genau 100 Schl%Gï¿½%@ge pro Minute">
+                >
+                ["at0009"] = <
+                    description = <"Beurteilung des Atmungsbestreben des Neugeborenen">
+                    text = <"Atmung">
+                >
+                ["at0010"] = <
+                    description = <"Kein Bestreben zu atmen">
+                    text = <"Kein Bestreben">
+                >
+                ["at0011"] = <
+                    description = <"Etwas bestrebt zu atmen, bewegter Brustkorb">
+                    text = <"Geringes Bestreben">
+                >
+                ["at0012"] = <
+                    description = <"Normales Schreien oder normale Atmung">
+                    text = <"Schreien">
+                >
+                ["at0013"] = <
+                    description = <"Beurteilung des Muskeltonus des Neugeborenen">
+                    text = <"Muskeltonus">
+                >
+                ["at0014"] = <
+                    description = <"Schlaff oder schlapp und keine spontane Bewegung">
+                    text = <"Schlaff">
+                >
+                ["at0015"] = <
+                    description = <"Etwas Bewegung und Beugen der Arme oder der Beine">
+                    text = <"Beugen der Arme und Beine">
+                >
+                ["at0016"] = <
+                    description = <"Lebhaft und beweglich">
+                    text = <"Lebhafte Bewegung">
+                >
+                ["at0017"] = <
+                    description = <"Beurteilung der Reaktion des Neugeborenen auf die Absaugung der Nasenl%Gï¿½%@cher">
+                    text = <"Reflexantwort">
+                >
+                ["at0018"] = <
+                    description = <"kein W%Gï¿½%@rgen oder keine Reaktion auf das Absaugen der Atemwege">
+                    text = <"Keine Reaktion auf die Absaugung der Atemwege">
+                >
+                ["at0019"] = <
+                    description = <"Grimasse als einzige Reaktion auf das Absaugen der Atemwege">
+                    text = <"Grimasse w%Gï¿½%@hrend der Absaugung der Atemwege">
+                >
+                ["at0020"] = <
+                    description = <"Grimasse und husten, niesen oder w%Gï¿½%@rgen als Reaktion auf die Absaugung der Atemwege">
+                    text = <"Grimasse und Husten/Niesen w%Gï¿½%@hrend der Absaugung der Atemwege ">
+                >
+                ["at0021"] = <
+                    description = <"Die Farbe der Haut am K%Gï¿½%@rper, am Rumpf und an den Gliedern">
+                    text = <"Hautfarbe">
+                >
+                ["at0022"] = <
+                    description = <"Der K%Gï¿½%@rper ist blass oder blau gef%Gï¿½%@rbt">
+                    text = <"Gesamter K%Gï¿½%@rper ist blau oder blass">
+                >
+                ["at0023"] = <
+                    description = <"Der K%Gï¿½%@rper ist rosig, H%Gï¿½%@nde und F%Gï¿½ï¿½%@e sind blass oder blau">
+                    text = <"Gesunde K%Gï¿½%@rperfarbe, blaue H%Gï¿½%@nde oder F%Gï¿½ï¿½%@e">
+                >
+                ["at0024"] = <
+                    description = <"Rosige oder gesunde F%Gï¿½%@rbung des gesamten K%Gï¿½%@rpers">
+                    text = <"Vollst%Gï¿½%@ndig gesunde oder rosige Farbe">
+                >
+                ["at0025"] = <
+                    description = <"Die Summe der Zahlenwerte aller Parameter">
+                    text = <"Summe">
+                >
+                ["at0026"] = <
+                    description = <"Apgar Wert 2 Minuten nach der Geburt">
+                    text = <"2 Minuten">
+                >
+                ["at0027"] = <
+                    description = <"Apgar Wert 5 Minuten nach der Geburt">
+                    text = <"5 Minuten">
+                >
+                ["at0028"] = <
+                    description = <"Apgar Wert 10 Minuten nach der Geburt">
+                    text = <"10 Minuten">
+                >
+                ["at0029"] = <
+                    description = <"@ internal @">
+                    text = <"List">
+                >
+                ["at0030"] = <
+                    description = <"Anmerkungen zur Messung des Apgar Wertes">
+                    text = <"Anmerkungen zur Messung">
+                >
+            >
+        >
+    >
+    term_binding = <
+        ["LNC205"] = <
+            items = <
+                ["/data[at0002]/events[at0003]/data[at0001]/items[at0025]"] = <[LNC205::9272-6]>
+                ["/data[at0002]/events[at0028]/data/items[at0025]"] = <[LNC205::9271-8]>
+            >
+        >
+    >
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-SECTION.findings.v1.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-SECTION.findings.v1.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-SECTION.findings.v1.adl	(revision 46)
@@ -0,0 +1,47 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-SECTION.findings.v1
+
+concept
+	[at0000]	-- Clinical findings
+language
+	original_language = <[ISO_639-1::en]>
+description
+	original_author = <
+		["name"] = <"Sam Heard">
+		["organisation"] = <"Ocean Informatics">
+		["date"] = <"9/01/2007">
+		["email"] = <"sam.heard@oceaninformatics.biz">
+	>
+	details = <
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"A heading to contain clinical findings">
+			use = <"A section which only contains observations">
+			keywords = <"findings", ...>
+			misuse = <"">
+		>
+	>
+	lifecycle_state = <"Initial">
+	other_contributors = <>
+
+definition
+	SECTION[at0000] matches {	-- Clinical findings
+		items cardinality matches {0..*; unordered} matches {
+			allow_archetype OBSERVATION occurrences matches {0..1} matches {
+				include
+					archetype_id/value matches {/.*/}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["en"] = <
+			items = <
+				["at0000"] = <
+					description = <"The findings at this contact">
+					text = <"Clinical findings">
+				>
+			>
+		>
+	>
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-SECTION.reason_for_encounter.v1.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-SECTION.reason_for_encounter.v1.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-SECTION.reason_for_encounter.v1.adl	(revision 46)
@@ -0,0 +1,51 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-SECTION.reason_for_encounter.v1
+
+concept
+	[at0000]	-- Reason for encounter
+language
+	original_language = <[ISO_639-1::en]>
+description
+	original_author = <
+		["name"] = <"Sam Heard">
+		["organisation"] = <"Ocean Informatics">
+		["date"] = <"9/01/2007">
+		["email"] = <"sam.heard@oceaninformatics.biz">
+	>
+	details = <
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"A heading to display the reason for encounter">
+			use = <"To record a symptom, problem or other reason for encounter">
+			keywords = <"rfe", "reason">
+			misuse = <"">
+		>
+	>
+	lifecycle_state = <"Initial">
+	other_contributors = <>
+
+definition
+	SECTION[at0000] matches {	-- Reason for encounter
+		items cardinality matches {0..*; unordered} matches {
+			allow_archetype OBSERVATION occurrences matches {1..*} matches {
+				include
+					archetype_id/value matches {/.*/}
+			}
+			allow_archetype EVALUATION occurrences matches {0..1} matches {
+				include
+					archetype_id/value matches {/.*/}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["en"] = <
+			items = <
+				["at0000"] = <
+					description = <"The reason(s) for this particular encounter">
+					text = <"Reason for encounter">
+				>
+			>
+		>
+	>
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-SECTION.summary.v1.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-SECTION.summary.v1.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-SECTION.summary.v1.adl	(revision 46)
@@ -0,0 +1,52 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-SECTION.summary.v1
+
+concept
+	[at0000]	-- Summary
+language
+	original_language = <[ISO_639-1::en]>
+description
+	original_author = <
+		["name"] = <"Sam Heard">
+		["organisation"] = <"Ocean Informatics">
+		["date"] = <"9/01/2007">
+		["email"] = <"sam.heard@oceaninformatics.biz">
+	>
+	details = <
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"A heading containing summary information based on particular evaluation entries">
+			use = <"A heading for organising clinical data under a heading of summary">
+			keywords = <"review", "conclusions", "risk">
+			misuse = <"">
+		>
+	>
+	lifecycle_state = <"Initial">
+	other_contributors = <>
+
+definition
+	SECTION[at0000] matches {	-- Summary
+		items cardinality matches {0..*; unordered} matches {
+			allow_archetype EVALUATION occurrences matches {0..1} matches {
+				include
+					archetype_id/value matches {/clinical_synopsis\.v1/}
+					archetype_id/value matches {/problem\.v1/}
+					archetype_id/value matches {/problem-diagnosis\.v1/}
+					archetype_id/value matches {/problem-diagnosis-histological\.v1/}
+					archetype_id/value matches {/problem-genetic\.v1/}
+					archetype_id/value matches {/risk\.v1/}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["en"] = <
+			items = <
+				["at0000"] = <
+					description = <"A heading for conclusions and other evaluations">
+					text = <"Summary">
+				>
+			>
+		>
+	>
Index: /ruby/trunk/tests/adl_parser/openEHR-EHR-SECTION.vital_signs.v1.adl
===================================================================
--- /ruby/trunk/tests/adl_parser/openEHR-EHR-SECTION.vital_signs.v1.adl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/openEHR-EHR-SECTION.vital_signs.v1.adl	(revision 46)
@@ -0,0 +1,54 @@
+archetype (adl_version=1.4)
+	openEHR-EHR-SECTION.vital_signs.v1
+
+concept
+	[at0000]	-- Vital signs
+language
+	original_language = <[ISO_639-1::en]>
+description
+	original_author = <
+		["name"] = <"Sam Heard">
+		["organisation"] = <"Ocean Informatics">
+		["date"] = <"14/03/2006">
+		["email"] = <"sam.heard@oceaninformatics.biz">
+	>
+	details = <
+		["en"] = <
+			language = <[ISO_639-1::en]>
+			purpose = <"A heading or section which can only contain observations considered to be vital signs. This group of observations is a common set in medicine, and while these often occur separately in health records, when they are measured together this is a significant assessment of wellbeing.">
+			use = <"An organisational heading for vital signs">
+			keywords = <"blood pressure", "temperature", "pulse", "oxygen saturation", "respirations", "observations", "vital", "signs">
+			misuse = <"Does not need to be used to record these entries separately">
+		>
+	>
+	lifecycle_state = <"AuthorDraft">
+	other_contributors = <>
+
+definition
+	SECTION[at0000] matches {	-- Vital signs
+		items cardinality matches {0..*; unordered} matches {
+			allow_archetype OBSERVATION occurrences matches {1..5} matches {
+				include
+					archetype_id/value matches {/blood_pressure\.v1/}
+					archetype_id/value matches {/heart_rate-pulse\.v1/}
+					archetype_id/value matches {/respiration\.v1/}
+					archetype_id/value matches {/body_temperature\.v1/}
+					archetype_id/value matches {/oximetry\.v1/}
+					archetype_id/value matches {/heart_rate\.v1/}
+				exclude
+					archetype_id/value matches {/.*/}
+			}
+		}
+	}
+
+ontology
+	term_definitions = <
+		["en"] = <
+			items = <
+				["at0000"] = <
+					description = <"A group of observations that are recorded at the same time and record the blood pressure, pulse, temperature and other readings">
+					text = <"Vital signs">
+				>
+			>
+		>
+	>
Index: /ruby/trunk/tests/adl_parser/parser_test.rb
===================================================================
--- /ruby/trunk/tests/adl_parser/parser_test.rb	(revision 46)
+++ /ruby/trunk/tests/adl_parser/parser_test.rb	(revision 46)
@@ -0,0 +1,151 @@
+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
+    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
+    end
+
+    apgar = File.read('tests/openEHR-EHR-OBSERVATION.apgar.v1.adl')
+    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
+    end
+
+    evaluation = File.read('tests/openEHR-EHR-EVALUATION.adverse.v1.adl')
+    assert_nothing_raised do
+      @parser.parse(evaluation, 'openEHR-EHR-EVALUATION.adverse.v1.adl')
+    end
+
+
+
+    referral = File.read('tests/openEHR-EHR-ITEM_TREE.referral.v1.adl')
+    assert_nothing_raised do
+      @parser.parse(referral, 'openEHR-EHR-ITEM_TREE.referral.v1.adl')
+    end
+
+    exam_fetus = File.read('tests/openEHR-EHR-CLUSTER.exam-fetus.v1.adl')
+    assert_nothing_raised do
+      @parser.parse(exam_fetus, 'openEHR-EHR-CLUSTER.exam-fetus.v1.adl')
+    end
+
+    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
+
+    imaging = File.read('tests/openEHR-EHR-ACTION.imaging.v1.adl')
+    assert_nothing_raised do
+      @parser.parse(imaging, 'openEHR-EHR-ACTION.imaging.v1.adl')
+    end
+
+    exam_nervous_system = File.read('tests/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl')
+    assert_nothing_raised do
+      @parser.parse(exam_nervous_system, 'openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl')
+    end
+    exam_generic = File.read('tests/openEHR-EHR-CLUSTER.exam-generic.v1.adl')
+    assert_nothing_raised do
+      @parser.parse(exam_generic, 'openEHR-EHR-CLUSTER.exam-generic.v1.adl')
+    end
+    exam_generic_mass = File.read('tests/openEHR-EHR-CLUSTER.exam-generic-mass.v1.adl')
+    assert_nothing_raised do
+      @parser.parse(exam_generic_mass, 'openEHR-EHR-CLUSTER.exam-generic-mass.v1.adl')
+    end
+    exam_generic_lymphnode = File.read('tests/openEHR-EHR-CLUSTER.exam-generic-lymphnode.v1.adl')
+    assert_nothing_raised do
+      @parser.parse(exam_generic_lymphnode, 'openEHR-EHR-CLUSTER.exam-generic-lymphnode.v1.adl')
+    end
+    exam_generic_joint = File.read('tests/openEHR-EHR-CLUSTER.exam-generic-joint.v1.adl')
+    assert_nothing_raised do
+      @parser.parse(exam_generic_joint, 'openEHR-EHR-CLUSTER.exam-generic-joint.v1.adl')
+    end
+    exam_chest = File.read('tests/openEHR-EHR-CLUSTER.exam-chest.v1.adl')
+    assert_nothing_raised do
+      @parser.parse(exam_chest, 'openEHR-EHR-CLUSTER.exam-chest.v1.adl')
+    end
+    exam_abdomen = File.read('tests/openEHR-EHR-CLUSTER.exam-abdomen.v1.adl')
+    assert_nothing_raised do
+      @parser.parse(exam_abdomen, 'openEHR-EHR-CLUSTER.exam-abdomen.v1.adl')
+    end
+    cluster_auscultation = File.read('tests/openEHR-EHR-CLUSTER.auscultation.v1.adl')
+    assert_nothing_raised do
+      @parser.parse(cluster_auscultation, 'openEHR-EHR-CLUSTER.auscultation.v1.adl')
+    end
+    cluster_auscultation_chest = File.read('tests/openEHR-EHR-CLUSTER.auscultation-chest.v1.adl')
+    assert_nothing_raised do
+      @parser.parse(cluster_auscultation_chest, 'openEHR-EHR-CLUSTER.auscultation-chest.v1.adl')
+    end
+    vital_signs = File.read('tests/openEHR-EHR-SECTION.vital_signs.v1.adl')
+    assert_nothing_raised do
+      @parser.parse(vital_signs, 'openEHR-EHR-SECTION.vital_signs.v1')
+    end
+    summary = File.read('tests/openEHR-EHR-SECTION.summary.v1.adl')
+    assert_nothing_raised do
+      @parser.parse(summary, 'openEHR-EHR-SECTION.summary.v1.adl')
+    end
+
+    findings = File.read('tests/openEHR-EHR-SECTION.findings.v1.adl')
+    assert_nothing_raised do
+      @parser.parse(findings, 'openEHR-EHR-SECTION.findings.v1.adl')
+    end
+
+    reason_for_encounter = File.read('tests/openEHR-EHR-SECTION.reason_for_encounter.v1.adl')
+    assert_nothing_raised do
+      @parser.parse(reason_for_encounter, 'openEHR-EHR-SECTION.reason_for_encounter.v1.adl')
+    end
+
+    imaging = File.read('tests/openEHR-EHR-ITEM_TREE.imaging.v1.adl')
+    assert_nothing_raised do
+      @parser.parse(imaging, 'openEHR-EHR-ITEM_TREE.imaging.v1.adl')
+    end
+    instruction_referral = File.read('tests/openEHR-EHR-INSTRUCTION.referral.v1.adl')
+    assert_nothing_raised do
+      @parser.parse(instruction_referral, 'openEHR-EHR-INSTRUCTION.referral.v1.adl')
+    end
+    instruction_medication = File.read('tests/openEHR-EHR-INSTRUCTION.medication.v1.adl')
+    assert_nothing_raised do
+      @parser.parse(instruction_medication, 'openEHR-EHR-INSTRUCTION.medication.v1.adl')
+    end
+    action_referral = File.read('tests/openEHR-EHR-ACTION.referral.v1.adl')
+    assert_nothing_raised do
+      @parser.parse(action_referral, 'openEHR-EHR-ACTION.referral.v1.adl')
+    end
+
+    dimensions_circumference = File.read('tests/openEHR-EHR-CLUSTER.dimensions.v1.adl')
+    assert_nothing_raised do
+      @parser.parse(dimensions_circumference, 'openEHR-EHR-CLUSTER.dimensions.v1.adl')
+    end
+
+    discharge = File.read('tests/openEHR-EHR-COMPOSITION.discharge.v1draft.adl')
+    assert_nothing_raised do
+      @parser.parse(discharge, 'openEHR-EHR-COMPOSITION.discharge.v1draft.adl')
+    end
+
+    encounter = File.read('tests/openEHR-EHR-COMPOSITION.encounter.v1draft.adl')
+    assert_nothing_raised do
+      @parser.parse(encounter, 'openEHR-EHR-COMPOSITION.encounter.v1draft.adl')
+    end
+
+
+#     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: /ruby/trunk/tests/adl_parser/scanner_test.rb
===================================================================
--- /ruby/trunk/tests/adl_parser/scanner_test.rb	(revision 46)
+++ /ruby/trunk/tests/adl_parser/scanner_test.rb	(revision 46)
@@ -0,0 +1,112 @@
+require 'lib/scanner.rb'
+require 'test/unit'
+
+class YaparcParserTest < Test::Unit::TestCase
+  def test_RootScanner
+    parser = OpenEHR::ADL::Scanner::DADL::RootScanner.new
+    assert_instance_of OpenEHR::ADL::Scanner::DADL::RootScanner,parser
+    result = parser.parse('')
+  end
+
+  def test_V_LOCAL_TERM_CODE_REF
+    parser = OpenEHR::ADL::Scanner::Common::V_LOCAL_TERM_CODE_REF.new
+    assert_instance_of OpenEHR::ADL::Scanner::Common::V_LOCAL_TERM_CODE_REF,parser
+    result = parser.parse('[en-us]')
+    assert_instance_of Yaparc::Result::OK, result
+  end
+
+  def test_V_QUALIFIED_TERM_CODE_REF
+    parser = OpenEHR::ADL::Scanner::Common::V_QUALIFIED_TERM_CODE_REF.new
+    assert_instance_of OpenEHR::ADL::Scanner::Common::V_QUALIFIED_TERM_CODE_REF,parser
+    result = parser.parse('[ISO_639::en]')
+    assert_instance_of Yaparc::Result::OK, result
+    result = parser.parse('[ISO_639::en-us]')
+    assert_instance_of Yaparc::Result::OK, result
+  end
+
+  def test_V_STRING
+    parser = OpenEHR::ADL::Scanner::Common::V_STRING.new
+    assert_instance_of OpenEHR::ADL::Scanner::Common::V_STRING,parser
+    result = parser.parse('"this is a string"')
+    assert_instance_of Yaparc::Result::OK, result
+    result = parser.parse('"en-us"')
+    assert_instance_of Yaparc::Result::OK, result
+  end
+
+  def test_V_REAL
+    parser = OpenEHR::ADL::Scanner::Common::V_REAL.new
+    assert_instance_of OpenEHR::ADL::Scanner::Common::V_REAL,parser
+    result = parser.parse('0.1')
+    assert_instance_of Yaparc::Result::OK, result
+    result = parser.parse('0.0..20000.0')
+    assert_instance_of Yaparc::Result::OK, result
+    assert_equal [:V_REAL, "0.0"], result.value
+    assert_equal "..20000.0", result.input
+  end
+
+  def test_V_ISO8601_DURATION
+    parser = OpenEHR::ADL::Scanner::Common::V_ISO8601_DURATION.new
+    assert_instance_of OpenEHR::ADL::Scanner::Common::V_ISO8601_DURATION,parser
+    result = parser.parse('PT1M')
+    assert_instance_of Yaparc::Result::OK, result
+    result = parser.parse('PYMWDTHMS')
+    assert_instance_of Yaparc::Result::OK, result
+    assert_equal [:V_ISO8601_DURATION, "PYMWDTHMS"], result.value
+  end
+
+  def test_V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN
+    parser = OpenEHR::ADL::Scanner::CADL::V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN.new
+    assert_instance_of OpenEHR::ADL::Scanner::CADL::V_ISO8601_DATE_TIME_CONSTRAINT_PATTERN,parser
+    result = parser.parse('yyyy-??-??T??:??:??')
+    assert_instance_of Yaparc::Result::OK, result
+  end
+
+  def test_V_ISO8601_DATE_CONSTRAINT_PATTERN
+    parser = OpenEHR::ADL::Scanner::CADL::V_ISO8601_DATE_CONSTRAINT_PATTERN.new
+    assert_instance_of OpenEHR::ADL::Scanner::CADL::V_ISO8601_DATE_CONSTRAINT_PATTERN,parser
+    result = parser.parse('yyyy-mm-XX-dd')
+    assert_instance_of Yaparc::Result::OK, result
+  end
+
+  def test_V_ISO8601_TIME_CONSTRAINT_PATTERN
+    parser = OpenEHR::ADL::Scanner::CADL::V_ISO8601_TIME_CONSTRAINT_PATTERN.new
+    assert_instance_of OpenEHR::ADL::Scanner::CADL::V_ISO8601_TIME_CONSTRAINT_PATTERN,parser
+    result = parser.parse('hh:mm:ss:??')
+    assert_instance_of Yaparc::Result::OK, result
+  end
+
+  def test_dadl_reserved
+    parser = OpenEHR::ADL::Scanner::DADL::RootScanner.new
+    result = parser.parse('then')
+    assert_instance_of Yaparc::Result::OK, result
+    result = parser.parse('infinity')
+    assert_instance_of Yaparc::Result::OK, result
+    assert_equal [:SYM_INFINITY, :SYM_INFINITY], result.value
+  end
+
+  def test_cadl
+    parser = OpenEHR::ADL::Scanner::CADL::RootScanner.new
+    assert_instance_of OpenEHR::ADL::Scanner::CADL::RootScanner,parser
+    result = parser.parse('PT1M')
+    assert_instance_of Yaparc::Result::OK, result
+    assert_equal [:V_ISO8601_DURATION, "PT1M"], result.value
+    result = parser.parse('PYMWDTHMS')
+    assert_instance_of Yaparc::Result::OK, result
+    assert_equal [:V_ISO8601_DURATION, "PYMWDTHMS"], result.value
+  end
+
+  def test_cadl_reserved
+    parser = OpenEHR::ADL::Scanner::CADL::RootScanner.new
+    result = parser.parse('then')
+    assert_instance_of Yaparc::Result::OK, result
+    result = parser.parse('cardinality')
+    assert_instance_of Yaparc::Result::OK, result
+    assert_equal [:SYM_CARDINALITY, :SYM_CARDINALITY], result.value
+    result = parser.parse('ordered')
+    assert_instance_of Yaparc::Result::OK, result
+    assert_equal "", result.input
+    assert_equal [:SYM_ORDERED, :SYM_ORDERED], result.value
+  end
+
+  
+end
Index: /ruby/trunk/tests/adl_parser/semantic_test.rb
===================================================================
--- /ruby/trunk/tests/adl_parser/semantic_test.rb	(revision 46)
+++ /ruby/trunk/tests/adl_parser/semantic_test.rb	(revision 46)
@@ -0,0 +1,12 @@
+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/tests/adl_parser/shell_test.rb
===================================================================
--- /ruby/trunk/tests/adl_parser/shell_test.rb	(revision 46)
+++ /ruby/trunk/tests/adl_parser/shell_test.rb	(revision 46)
@@ -0,0 +1,27 @@
+require '../../lib/adl_parser/shell.rb'
+require 'test/unit'
+
+class ShellADLValidatorTest < Test::Unit::TestCase
+  def setup
+    @adl_validator = ::OpenEHR::Application::ADLValidator.new(::OpenEHR::ADL::Validator.new(::OpenEHR::ADL::Parser.new))
+    @file = File.open('openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl')
+    @string = File.read('openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl')
+    @stringio = StringIO.new(@string)
+  end
+
+  def test_init
+    assert_instance_of ::OpenEHR::Application::ADLValidator,@adl_validator
+  end
+
+  def test_run
+    assert_nothing_raised do
+      @adl_validator.run(@file)
+    end
+    assert_nothing_raised do
+      @adl_validator.run(@string)
+    end
+    assert_nothing_raised do
+      @adl_validator.run(@stringio)
+    end
+  end
+end
Index: /ruby/trunk/tests/adl_parser/validator_test.rb
===================================================================
--- /ruby/trunk/tests/adl_parser/validator_test.rb	(revision 46)
+++ /ruby/trunk/tests/adl_parser/validator_test.rb	(revision 46)
@@ -0,0 +1,25 @@
+require 'lib/validator.rb'
+require 'test/unit'
+
+class ADLValidatorTest < Test::Unit::TestCase
+  def setup
+    @validator = ::OpenEHR::ADL::Validator.new(::OpenEHR::ADL::Parser.new)
+  end
+
+  def test_init
+    assert_instance_of ::OpenEHR::ADL::Validator,@validator
+  end
+
+  def test_validate
+    exam_nervous_system = File.read('tests/openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl')
+    assert_nothing_raised do
+      @validator.validate(exam_nervous_system, 'openEHR-EHR-CLUSTER.exam-nervous_system.v1.adl')
+    end
+
+#     exam_uterine_cervix = File.read('tests/openEHR-EHR-CLUSTER.exam-uterine_cervix.v1.adl')
+# #    assert_raise(Racc::ParseError) do
+#    @validator.validate(exam_uterine_cervix, 'openEHR-EHR-CLUSTER.exam-uterine_cervix.v1.adl')
+# #    end
+
+  end
+end
Index: /ruby/trunk/tests/adl_parser/vital_signs.cadl
===================================================================
--- /ruby/trunk/tests/adl_parser/vital_signs.cadl	(revision 46)
+++ /ruby/trunk/tests/adl_parser/vital_signs.cadl	(revision 46)
@@ -0,0 +1,14 @@
+	SECTION[at0000] matches {	-- Vital signs or clinical 'observations'
+		items cardinality matches {0..*; unordered} matches {
+			allow_archetype OBSERVATION occurrences matches {1..5} matches {
+				include
+					domain_concept matches {/blood_pressure.v1/}
+					domain_concept matches {/heart_rate-pulse.v1/}
+					domain_concept matches {/temperature.v1/}
+					domain_concept matches {/blood_gases.v1/}
+					domain_concept matches {/respirations.v1/}
+				exclude
+					domain_concept matches {/.*/}
+			}
+		}
+	}
