# getting the concept name

**URL:** https://discourse.openehr.org/t/getting-the-concept-name/14691
**Category:** Reference Implementation: Java (archive)
**Created:** [26 October 2007 00:55 UTC](https://discourse.openehr.org/t/getting-the-concept-name/14691 "2007-10-26T00:55:57Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![sebastian.garde](https://discourse.openehr.org/user_avatar/discourse.openehr.org/sebastian.garde/32/3070_2.png) [@sebastian.garde](https://discourse.openehr.org/u/sebastian.garde)
#### Post date: [26 October 2007 00:55 UTC](https://discourse.openehr.org/t/getting-the-concept-name/14691/1 "2007-10-26T00:55:57Z")

</div>

Hi,

I am trying to get the (full!) concept name for a parsed archetype.

The best I can come up with is:

String conceptName="";

List\<ArchetypeTerm\> terms =  
myArchetype.getOntology().getTermDefinitionsList().get(0).getDefinitions  
();

for (int i=0; i\< terms.size(); i++) {

if (terms.get(i).getCode().equals(myArchetype.getConcept())) {

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;conceptName= terms.get(i).getItem(ArchetypeTerm.TEXT);

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}

}

Note that this doesn't even take into account the language I want it in,  
I just take the first language I come across (0), otherwise the code  
would further blow up.

Is there a smarter way to do this...in essence something like an indexOf  
for the Code only, not the full ArchetypeTerm?

Or a convenience method like String getArchetypeTermText(String code,  
String language)?

Am I missing something?

Regards

Sebastian

Dr Sebastian Garde  
Dr. sc. hum., Dipl.-Inform. Med, FACHI

Faculty of Business and Informatics, Central Queensland University  
Austin Centre for Applied Clinical Informatics, Austin Health  
Heidelberg Vic 3084, Australia

s.garde@cqu.edu.au \<mailto:s.garde@cqu.edu.au\>  
Ph: +61 (0)3 9496 4040  
Fax: +61 (0)3 9496 4224

[http://healthinformatics.cqu.edu.au](http://healthinformatics.cqu.edu.au)  
[http://www.acaci.org.au](http://www.acaci.org.au)

Visit the new open access electronic Journal of Health Informatics  
(eJHI): [http://ejhi.net/&gt](http://ejhi.net/&gt);

---

<div class="post-metadata">

### Author: ![system](https://discourse.openehr.org/uploads/default/original/2X/f/f0a1dedb20c42747bddcafd6c7df9db5f34f003c.svg) [@system](https://discourse.openehr.org/u/system)
#### Post date: [26 October 2007 08:06 UTC](https://discourse.openehr.org/t/getting-the-concept-name/14691/2 "2007-10-26T08:06:36Z")

</div>

Hi Sebastian,

There is a convenient method termDefinition(String language, String code) in class ArchetypeOntology to get ArchetypeTerm so you don’t need to step through the term list by yourself.

You can do the following already:

String conceptCode = myArchetype.getConcept();  
ArchetypeTerm term = myArchetype.getOntology().termDefinition(yourLanguage, conceptCode);  
String conceptName = term. getItem(ArchetypeTerm.TEXT);

Still there are two things we could improve here:

1. Add a method in Archetype to facilitate this task  
public String getConcept(String Language);

2. Add two convenient methods in ArchetypeTerm to facilitate fetching text and description  
public String getText(); // instead of getItem(ArchetypeTerm.TEXT)  
public String getDescription(): // instead of getItem(ArchetypeTerm.DESCRIPTION )

Cheers,  
Rong

---

<div class="post-metadata">

### Author: ![system](https://discourse.openehr.org/uploads/default/original/2X/f/f0a1dedb20c42747bddcafd6c7df9db5f34f003c.svg) [@system](https://discourse.openehr.org/u/system)
#### Post date: [26 October 2007 08:12 UTC](https://discourse.openehr.org/t/getting-the-concept-name/14691/3 "2007-10-26T08:12:32Z")

</div>

Hi Sebastian,

A little better code I think:

---

<div class="post-metadata">

### Author: ![sebastian.garde](https://discourse.openehr.org/user_avatar/discourse.openehr.org/sebastian.garde/32/3070_2.png) [@sebastian.garde](https://discourse.openehr.org/u/sebastian.garde)
#### Post date: [29 October 2007 02:28 UTC](https://discourse.openehr.org/t/getting-the-concept-name/14691/4 "2007-10-29T02:28:54Z")

</div>

Hi Rong and Shinji,

Thanks for the help.

I implemented it as suggested and added the methods to the Parser

Cheers

Sebastian
