# Need help with using the reference implementation library

**URL:** <https://discourse.openehr.org/t/need-help-with-using-the-reference-implementation-library/13362>\
**Category:** Reference Implementation: Java (archive)\
**Created:** [23 March 2013 11:30 UTC](https://discourse.openehr.org/t/need-help-with-using-the-reference-implementation-library/13362 "2013-03-23T11:30:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kumar\_Saurabh](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/k/c4cdca/32.png) [@Kumar\_Saurabh](https://discourse.openehr.org/u/Kumar_Saurabh)\
**Post date:** [23 March 2013 11:30 UTC](https://discourse.openehr.org/t/need-help-with-using-the-reference-implementation-library/13362/1 "2013-03-23T11:30:21Z")

</div>

Hi,

I am a student trying to use OpenEHR reference implementation. I downloaded the jars and  
was able to use it to parse an ADL file and get the AOM. But i am not able to find the  
correct way of acessing the AOM (Archetype object) to find the leaf nodes. I could get  
to the definition and the children at the fist level but beyond that i was not able to  
do anything. I am just trying to create a simple UI for a very simple observation model  
(only body temperature) by parsing an ADL. But i am struggling to find a correct way of  
doing it. I am not able to locate useful documentation either.

Can somebody please help?

Thanks and Regards,  
Saurabh

---

<div class="post-metadata">

**Author:** ![gerardo.iago.corbal](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/g/6bbea6/32.png) [@gerardo.iago.corbal](https://discourse.openehr.org/u/gerardo.iago.corbal)\
**Post date:** [24 March 2013 13:40 UTC](https://discourse.openehr.org/t/need-help-with-using-the-reference-implementation-library/13362/2 "2013-03-24T13:40:02Z")

</div>

Hi Saurabh,  
you can iterate through each one of the paths and filter what you need:

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Map\<String, CObject\> pathObjectMap = ar.getPathNodeMap();  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ArrayList\<String\> paths = new ArrayList\<String\>(pathObjectMap.keySet());  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//Sort paths. Shortest path first (to access clusters before children)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Collections.sort(paths);  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (String path : paths) {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CObject cObject = pathObjectMap.get(path);  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//manage cObject  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}

In the GDL project you have a full example:  
[https://github.com/openEHR/gdl-tools/blob/master/cds/cds-openehr/src/main/java/se/cambio/cds/openehr/model/facade/archetype/plain/PlainArchetypeFacadeDelegate.java](https://github.com/openEHR/gdl-tools/blob/master/cds/cds-openehr/src/main/java/se/cambio/cds/openehr/model/facade/archetype/plain/PlainArchetypeFacadeDelegate.java)  
(loadArchetypeObjects method)

Cheers,

iago
