Java ADL Parser Guide

1. DESCRIPTION
This is a Java implementation of a parser that can read openEHR archetypes in Archetype Definition Language (ADL) format and output a object tree in the form of Archetype Object Model (AOM). It also provides some validation of archetypes after parsing.

2. STATUS

Based on Archetype Definition Language (ADL) 1.4 and Archetype Object Model and other related Information Models from openEHR release 1.0.1.

3. USAGE

3.1. One-time use
You can create the parser for one time use and throw away the instance. The parser constructor can either take a ADL file name or a String which contains the archetype in ADL format.

1) Initialize the parser instance:
   File adlFile = new File("my_archetype.adl");
   ADLParser parser = new ADLParser(adlFile);
or
   String adlText = ...; // probably loaded from database
   ADLParser parser = new ADLParser(adlText);

2) Then call parser.parse() to get the Archetype instance

3.2. Multiple-use
You can also keep the same parser instance after the first use and ask it to parse more archetypes.

1) Same as above to get the parser instance _and_ parse the first archetype

2) From the _second_ archetype, you need to call the following method:

   parser.reInit(File  adlFile)
or
   parser.reInit(String adlText)

3) Then call parser.parse() to get the Archetype instance.

3.3. Command Line Interface
The parser has a command line interface built mainly to provide a interactive way for validating archetypes. Just include all the dependent libraries and type the following.

java se.acode.openehr.parser.ADLParser [adlFile]