Index: ruby/trunk/lib/open_ehr/am/archetype/ontology.rb
===================================================================
--- ruby/trunk/lib/open_ehr/am/archetype/ontology.rb	(revision 411)
+++ ruby/trunk/lib/open_ehr/am/archetype/ontology.rb	(revision 412)
@@ -14,11 +14,4 @@
             self.term_bindings = args[:term_bindings]
           end
-
-          # def terminologies_available=(terminologies_available)
-          #   if terminologies_available.nil?
-          #     raise ArgumentError, 'terminologies_available is mandatory'
-          #   end
-          #   @terminologies_available = terminologies_available
-          # end
 
           def term_definitions=(term_definitions)
@@ -41,4 +34,8 @@
                 value.collect {|term| term.code}}.flatten.uniq
             end
+          end
+
+          def terminologies_available
+            return @term_bindings.keys
           end
 
Index: ruby/trunk/lib/open_ehr/parser.rb
===================================================================
--- ruby/trunk/lib/open_ehr/parser.rb	(revision 411)
+++ ruby/trunk/lib/open_ehr/parser.rb	(revision 412)
@@ -15,5 +15,5 @@
 
   class XMLParser < Parser
-
+    
   end
 end
Index: ruby/trunk/lib/open_ehr/serializer.rb
===================================================================
--- ruby/trunk/lib/open_ehr/serializer.rb	(revision 411)
+++ ruby/trunk/lib/open_ehr/serializer.rb	(revision 412)
@@ -105,15 +105,15 @@
         ontology = 'ontology'+NL
         ontology << INDENT + 'term_definitions = <' + NL
-        ao.term_codes.each do |term, items|
-          ontology << INDENT*2 + "[\"#{term}\"] = <" + NL
+        ao.term_definitions.each do |lang, items|
+          ontology << INDENT*2 + "[\"#{lang}\"] = <" + NL
           ontology << INDENT*3 + 'items = <'  + NL
-          items.each do |code, attribute|
-            ontology << INDENT*4 + "[\"#{code}\] = <" + NL
-            terms.each do |name, description|
-              ontology << INDENT*5 + "#{name} = <\"#{description}\">" +NL
+          items.each do |item|
+            ontology << INDENT*4 + "[\"#{item.code}\"] = <" + NL            
+            item.items.each do |name, desc|
+              ontology << INDENT*5 + "#{name} = <\"#{desc}\">" +NL
             end
             ontology << INDENT*4 + '>'+NL
           end
-          ontogoly << INDENT*3 + '>' + NL
+          ontology << INDENT*3 + '>' + NL
           ontology << INDENT*2 + '>' + NL
         end
Index: ruby/trunk/spec/lib/open_ehr/am/archetype/ontology/archetype_ontology_spec.rb
===================================================================
--- ruby/trunk/spec/lib/open_ehr/am/archetype/ontology/archetype_ontology_spec.rb	(revision 411)
+++ ruby/trunk/spec/lib/open_ehr/am/archetype/ontology/archetype_ontology_spec.rb	(revision 412)
@@ -52,4 +52,8 @@
       code_string.should == '163020007'
   end
+
+  it 'terminologies_available should return available terminology' do
+    @archetype_ontology.terminologies_available.should == ['SNOMED-CT(2003)']
+  end
 end
                             
Index: ruby/trunk/spec/lib/open_ehr/serializer/adl_serializer_spec.rb
===================================================================
--- ruby/trunk/spec/lib/open_ehr/serializer/adl_serializer_spec.rb	(revision 411)
+++ ruby/trunk/spec/lib/open_ehr/serializer/adl_serializer_spec.rb	(revision 412)
@@ -40,5 +40,5 @@
 
   it 'ontology should return ADL formatted ontology' do
-    @adl_serializer.ontology.should == @sample_definition
+    @adl_serializer.ontology.should == @sample_ontology
   end
 end
Index: ruby/trunk/spec/lib/open_ehr/serializer/sample_archetype_spec.rb
===================================================================
--- ruby/trunk/spec/lib/open_ehr/serializer/sample_archetype_spec.rb	(revision 411)
+++ ruby/trunk/spec/lib/open_ehr/serializer/sample_archetype_spec.rb	(revision 412)
@@ -9,16 +9,10 @@
 shared_examples_for 'sample archetype' do
   before(:all) do
-    terminologies_available = Set.new('ja')
-    term_codes = ['at0000']
-    archetype_term = ArchetypeTerm.new(:code => 'ja',
+    archetype_term = ArchetypeTerm.new(:code => 'at0000',
                                        :items => {'text' => 'simple test',
                                          'description' => 'simple test for serializer'})
-    term_definitions = {'ja' => {'at0000' => archetype_term}}
+    term_definitions = {'ja' => [archetype_term]}
     ontology =
-      ArchetypeOntology.new(:terminologies_available => terminologies_available,
-                            :specialisation_depth => 0,
-                            :term_codes => term_codes,
-                            :constraint_codes => [],
-                            :term_attribute_names => ['text','description'],
+      ArchetypeOntology.new(:specialisation_depth => 0,
                             :term_definitions => term_definitions)
     archetype_id = ArchetypeID.new(:value => 
