Index: ruby/trunk/lib/open_ehr/serializer.rb
===================================================================
--- ruby/trunk/lib/open_ehr/serializer.rb	(revision 406)
+++ ruby/trunk/lib/open_ehr/serializer.rb	(revision 407)
@@ -4,4 +4,7 @@
 module OpenEHR
   module Serializer
+    NL = "\r\n"
+    INDENT = '    '
+
     class BaseSerializer
       def initialize(archetype)
@@ -16,11 +19,14 @@
     class ADLSerializer < BaseSerializer
       def header
-        return <<HERE
-archetype (adl_version = #{@archetype.adl_version})
-\t#{@archetype.archetype_id.value}
-
-concept
-\t[#{@archetype.concept}]
-HERE
+        hd = 'archetype'
+        unless @archetype.adl_version.nil?
+          hd << " (adl_version = #{@archetype.adl_version})"
+        end
+        hd << NL+INDENT + "#{@archetype.archetype_id.value}"+NL+NL
+        hd << 'concept'+NL+ INDENT+"[#{@archetype.concept}]"+NL
+        hd << NL+'language'+NL+INDENT+'original_language = <['+
+          @archetype.original_language.terminology_id.value+'::'+
+          @archetype.original_language.code_string+']>'+NL
+        return hd
       end
 
@@ -52,4 +58,10 @@
         end
         xml.concept @archetype.concept
+        xml.original_language do
+          xml.code_string @archetype.original_language.code_string
+          xml.terminology_id do
+            xml.value @archetype.original_language.terminology_id.value
+          end
+        end
         return header
       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 406)
+++ ruby/trunk/spec/lib/open_ehr/serializer/adl_serializer_spec.rb	(revision 407)
@@ -7,4 +7,13 @@
 describe ADLSerializer do
   it_should_behave_like 'sample archetype'
+
+  before(:all) do
+    current_dir = File.dirname(__FILE__)
+    adl_file = File.open(current_dir + '/openEHR-EHR-SECTION.test.v1.adl')
+    adl = adl_file.readlines
+    @sample_header = adl[0..7].join
+    @sample_description = adl[8..24].join
+    adl_file.close
+  end
 
   before(:each) do
@@ -17,11 +26,5 @@
 
   it 'header should return archetype context' do
-    @adl_serializer.header.should == <<HERE
-archetype (adl_version = 1.4)
-\tadl-test-ENTRY.most_minimal.v1
-
-concept
-\t[at0000]
-HERE
+    @adl_serializer.header.should == @sample_header
   end
 end
Index: ruby/trunk/spec/lib/open_ehr/serializer/openEHR-EHR-SECTION.test.v1.adl
===================================================================
--- ruby/trunk/spec/lib/open_ehr/serializer/openEHR-EHR-SECTION.test.v1.adl	(revision 407)
+++ ruby/trunk/spec/lib/open_ehr/serializer/openEHR-EHR-SECTION.test.v1.adl	(revision 407)
@@ -0,0 +1,38 @@
+archetype
+    openEHR-EHR-SECTION.test.v1
+
+concept
+    [at0000]
+
+language
+    original_language = <[openEHR::ja]>
+
+description
+    original_author = <
+        ["email"] = <"skoba@moss.gr.jp">
+        ["organisation"] = <"openEHR.jp">
+        ["name"] = <"Shinji KOBAYASHI">
+    >
+    lifecycle_state = <"draft">
+    details = <
+        ["ja"] = <
+            language = <[openEHR::ja]>
+            purpose = <"Serializer test">
+            misuse = <"evaluate message">
+        >
+    >
+
+definition
+    SECTION[at0000] matches {*}
+
+ontology
+    term_definitions = <
+        ["ja"] = <
+            items = <
+                ["at0000"] = <
+                    text = <"simple test">
+                    description = <"simple test for serializer">
+                >
+            >
+        >
+    >
Index: ruby/trunk/spec/lib/open_ehr/serializer/sample_archetype_spec.rb
===================================================================
--- ruby/trunk/spec/lib/open_ehr/serializer/sample_archetype_spec.rb	(revision 406)
+++ ruby/trunk/spec/lib/open_ehr/serializer/sample_archetype_spec.rb	(revision 407)
@@ -1,17 +1,52 @@
 require File.dirname(__FILE__) + '/../../../spec_helper'
 include OpenEHR::AM::Archetype
+include OpenEHR::AM::Archetype::ConstraintModel
+include OpenEHR::AM::Archetype::Ontology
 include OpenEHR::RM::Support::Identification
 include OpenEHR::RM::DataTypes::Text
+include OpenEHR::AssumedLibraryTypes
 
 shared_examples_for 'sample archetype' do
   before(:all) do
+    terminologies_available = Set.new('ja')
+    term_codes = ['at0000']
+    archetype_term = ArchetypeTerm.new(:code => 'ja',
+                                       :items => {'text' => 'simple test',
+                                         'description' => 'simple test for serializer'})
+    term_definitions = {'ja' => {'at0000' => archetype_term}}
+    ontology =
+      ArchetypeOntology.new(:terminologies_available => terminologies_available,
+                            :specialisation_depth => 0,
+                            :term_codes => term_codes,
+                            :constraint_codes => [],
+                            :term_attribute_names => ['text','description'],
+                            :term_definitions => term_definitions)
     archetype_id = ArchetypeID.new(:value => 
-                                   'adl-test-ENTRY.most_minimal.v1')
-    terminology_id = TerminologyID.new(:value => 'ISO_639-1')
-    original_language = CodePhrase.new(:code_string => 'en',
+                                   'openEHR-EHR-SECTION.test.v1')
+    terminology_id = TerminologyID.new(:value => 'openEHR')
+    original_language = CodePhrase.new(:code_string => 'ja',
                                        :terminology_id => terminology_id)
-    @archetype = stub(Archetype, :adl_version => '1.4',
-                      :archetype_id => archetype_id,
-                      :concept => 'at0000')
+    occurrences = Interval.new(:upper => 1, :lower => 1)
+    definition = CComplexObject.new(:path => '/',
+                                    :rm_type_name => 'SECTION',
+                                    :occurrences => occurrences,
+                                    :node_id => 'at0000')
+    original_author = {'email' => 'skoba@moss.gr.jp',
+      'organisation' => 'openEHR.jp',
+      'name' => 'Shinji KOBAYASHI'}
+    resource_description_item =
+      ResourceDescriptionItem.new(:language => original_language,
+                                  :purpose => 'Serializer test',
+                                  :misuse => 'evaluate message')
+    details = {'ja' => resource_description_item}
+    decription = ResourceDescription.new(:original_author => original_author,
+                                         :lifecycle_state => 'draft',
+                                         :details => details)
+    @archetype = Archetype.new(:archetype_id => archetype_id,
+                               :concept => 'at0000',
+                               :original_language => original_language,
+                               :ontology => ontology,
+                               :description => description,
+                               :definition => definition)
   end
 end
Index: ruby/trunk/spec/lib/open_ehr/serializer/xml_serializer_spec.rb
===================================================================
--- ruby/trunk/spec/lib/open_ehr/serializer/xml_serializer_spec.rb	(revision 406)
+++ ruby/trunk/spec/lib/open_ehr/serializer/xml_serializer_spec.rb	(revision 407)
@@ -18,7 +18,13 @@
     @xml_serializer.header.should == <<END
 <archetype_id>
-  <value>adl-test-ENTRY.most_minimal.v1</value>
+  <value>openEHR-EHR-SECTION.test.v1</value>
 </archetype_id>
 <concept>at0000</concept>
+<original_language>
+  <code_string>ja</code_string>
+  <terminology_id>
+    <value>openEHR</value>
+  </terminology_id>
+</original_language>
 END
   end
