# Is originalAuthor required?

**URL:** <https://discourse.openehr.org/t/is-originalauthor-required/14840>\
**Category:** Reference Implementation: Java (archive)\
**Created:** [5 November 2008 14:59 UTC](https://discourse.openehr.org/t/is-originalauthor-required/14840 "2008-11-05T14:59:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adam\_Flinton](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/a/b782af/32.png) [@Adam\_Flinton](https://discourse.openehr.org/u/Adam_Flinton)\
**Post date:** [5 November 2008 14:59 UTC](https://discourse.openehr.org/t/is-originalauthor-required/14840/1 "2008-11-05T14:59:36Z")

</div>

Dear All,

Running the Java ADL \> XML & I get a fair few errors of the type:

Error Class: java.lang.IllegalArgumentException Message: null or empty  
originalAuthor

Is originalAuthor a required structure?

If so then the Ocean ADL \> XML is not picking that up.  
If not then could the Java code be amended to not error if it is not  
present.

TIA

Adam

---

<div class="post-metadata">

**Author:** ![Heath\_Frankel3](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/h/e19b73/32.png) [@Heath\_Frankel3](https://discourse.openehr.org/u/Heath_Frankel3)\
**Post date:** [6 November 2008 01:10 UTC](https://discourse.openehr.org/t/is-originalauthor-required/14840/2 "2008-11-06T01:10:11Z")

</div>

Hi Adam,  
Can you provide details of the offending archetype?

Looking at the AOM, the originalAuthor is a required attribute and this is  
reflected in the Resource.xsd. However apart from the list being non-empty,  
I see no other invariant to that states that the value of the originalAuthor  
item cannot be an empty string.

Therefore I would suggest that the Java IllegalArgumentException "null or  
empty originalAuthor" is too tight. A "not null" invariant seems  
reasonable.

However, not being a member of the java implementation I will leave that to  
them to decide what to do here.

If there is an issue with the Ocean XML output please feel free to contact  
me directly.

Heath

---

<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:** [7 November 2008 12:33 UTC](https://discourse.openehr.org/t/is-originalauthor-required/14840/3 "2008-11-07T12:33:59Z")

</div>

Hi Adam, Heath

The attribute in question, original\_author is an attribute of Class RESOURCE\_DESCRIPTION from rm.common.resource package. According to the specs (common\_im.pdf), the type is Hash\<String,String\> NOT a string and the invariant on it is “Original\_author\_valid: original\_author /= Void and then not original\_author.is\_empty”.

The Java implementation (see below) of this invariant is, I believe, faithful interpretation of the specs.

if (originalAuthor == null || originalAuthor.size() == 0 ) {  
throw new IllegalArgumentException(“null or empty originalAuthor”);  
}

The thing I am not sure here is the XML schema. If the schema is not compliant with the RM specs, perhaps the schema should be updated so the parsing code generated from schema can catch errors like this, thoughts?

Cheers,  
Rong

---

<div class="post-metadata">

**Author:** ![Heath\_Frankel3](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/h/e19b73/32.png) [@Heath\_Frankel3](https://discourse.openehr.org/u/Heath_Frankel3)\
**Post date:** [8 November 2008 10:53 UTC](https://discourse.openehr.org/t/is-originalauthor-required/14840/4 "2008-11-08T10:53:23Z")

</div>

Rong,

Thanks for the clarification, I was assuming the error was coming from the value of the hashtable rather than hashtable itself.

The XML schema contains the following:

\<xs:element name=“original\_author” type=“StringDictionaryItem” maxOccurs=“unbounded”/\>

This seems to reflect the spec (i.e 1..\*).

It may be possible that the Ocean parser is not currently validating against the schema but I would be interested to see the archetype causing this issue to test this.

Heath

---

<div class="post-metadata">

**Author:** ![Adam\_Flinton](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/a/b782af/32.png) [@Adam\_Flinton](https://discourse.openehr.org/u/Adam_Flinton)\
**Post date:** [10 November 2008 09:36 UTC](https://discourse.openehr.org/t/is-originalauthor-required/14840/5 "2008-11-10T09:36:59Z")

</div>

Rong Chen wrote:

> Hi Adam, Heath
> 
> The attribute in question, original\_author is an attribute of Class  
> RESOURCE\_DESCRIPTION from rm.common.resource package. According to the  
> specs (common\_im.pdf), the type is Hash\<String,String\> NOT a string  
> and the invariant on it is "Original\_author\_valid: original\_author /=  
> Void and then not original\_author.is\_empty".
> 
> The Java implementation (see below) of this invariant is, I believe,  
> faithful interpretation of the specs.
> 
> &nbsp;&nbsp;&nbsp;&nbsp;if (originalAuthor == null || originalAuthor.size() == 0 ) {  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw new IllegalArgumentException("null or empty  
> originalAuthor");  
> &nbsp;&nbsp;&nbsp;&nbsp;}
> 
> The thing I am not sure here is the XML schema. If the schema is not  
> compliant with the RM specs, perhaps the schema should be updated so  
> the parsing code generated from schema can catch errors like this,  
> thoughts?

Any idea then which is right?

I can chuck you our ADL \> XML ant task so you can look at all the  
various errors against a given set of our ADL held on the openEHR svn.

Adam

---

<div class="post-metadata">

**Author:** ![Heath\_Frankel3](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/h/e19b73/32.png) [@Heath\_Frankel3](https://discourse.openehr.org/u/Heath_Frankel3)\
**Post date:** [12 November 2008 14:18 UTC](https://discourse.openehr.org/t/is-originalauthor-required/14840/6 "2008-11-12T14:18:47Z")

</div>

Adam,  
As previously requested, provide us an example (one will do) of an archetype  
failing, we can then work out why.

Heath
