# VERSIONED\_OBJECT\<T\> uid question

**URL:** https://discourse.openehr.org/t/versioned-object-t-uid-question/14812
**Category:** Implementers (archive)
**Created:** [10 September 2008 01:49 UTC](https://discourse.openehr.org/t/versioned-object-t-uid-question/14812 "2008-09-10T01:49:30Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Andrew\_Patterson](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/a/76d3ee/32.png) [@Andrew\_Patterson](https://discourse.openehr.org/u/Andrew_Patterson)
#### Post date: [10 September 2008 01:49 UTC](https://discourse.openehr.org/t/versioned-object-t-uid-question/14812/1 "2008-09-10T01:49:30Z")

</div>

Hi all,

I am implementing some of the versioned document  
semantics and have a quick query.

VERSIONED\_OBJECT\<T\> has a 'uid' attribute  
that is meant to represent a unique identifier  
for all versions of this object - so kind of like  
the master identifier for this document set.  
It is of type HIER\_OBJECT\_ID

VERSION\<T\> is a particular instance of a  
document version - so many VERSION\<T\>  
documents may be part of one overall  
VERSIONED\_OBJECT (amendments etc).  
It also has a 'uid' attribute of type  
OBJECT\_VERSION\_ID.

A OBJECT\_VERSION\_ID consists of  
object\_id, version\_tree\_id and creating\_system\_id.  
Section 6.3.3 says that the object\_id  
part is a copy of the uid attribute of  
VERSIONED\_OBJECT. However, this doesn't  
really work because VERSIONED\_OBJECT has  
a uid which is a HIER\_OBJECT\_ID (could be in the form  
1.23.4.5.6.4::abcd), whereas object\_id can only  
be a plan UID (i.e. 1.23.4.5.6.4).

Andrew

---

<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: [10 September 2008 08:35 UTC](https://discourse.openehr.org/t/versioned-object-t-uid-question/14812/2 "2008-09-10T08:35:22Z")

</div>

> Hi all,
> 
> I am implementing some of the versioned document  
> semantics and have a quick query.
> 
> VERSIONED\_OBJECT has a ‘uid’ attribute  
> that is meant to represent a unique identifier  
> for all versions of this object - so kind of like  
> the master identifier for this document set.  
> It is of type HIER\_OBJECT\_ID
> 
> VERSION is a particular instance of a  
> document version - so many VERSION  
> documents may be part of one overall  
> VERSIONED\_OBJECT (amendments etc).  
> It also has a ‘uid’ attribute of type  
> OBJECT\_VERSION\_ID.
> 
> A OBJECT\_VERSION\_ID consists of  
> object\_id, version\_tree\_id and creating\_system\_id.  
> Section 6.3.3 says that the object\_id  
> part is a copy of the uid attribute of  
> VERSIONED\_OBJECT. However, this doesn’t  
> really work because VERSIONED\_OBJECT has  
> a uid which is a HIER\_OBJECT\_ID (could be in the form  
> 1.23.4.5.6.4::abcd), whereas object\_id can only  
> be a plan UID (i.e. 1.23.4.5.6.4).

Hi Andrew,

I agree with your analysis. The optional extension part of the HIER\_OBJECT\_ID will get lost through the owner\_id function on VERSION thus breaking the invariant on owner\_id\_valid. However the issue will not reveal itself if the UID from the first version is used to create VERSIONED\_OBJECT.uid since a plain UID can be used to create a perfect HIER\_OBJECT\_ID without an extension value.

Two possible solutions to this issue:

1. Change the type of object\_id attribute of OBJECT\_VERSION\_ID from UID to HIER\_OBJECT\_ID (probably the easiest thing to do)  
or
2. Use plain UID instead of HIER\_OBJECT\_ID for uid attribute of VERSIONED\_OBJECT (this really depends on why we need extension value for VERSIONED\_OBJECT.uid, does anyone have any good examples?)

I created a JIRA issue for this, [http://www.openehr.org/issues/browse/SPEC-278](http://www.openehr.org/issues/browse/SPEC-278)

Cheers,  
Rong

---

<div class="post-metadata">

### Author: ![Andrew\_Patterson](https://discourse.openehr.org/letter_avatar_proxy/v4/letter/a/76d3ee/32.png) [@Andrew\_Patterson](https://discourse.openehr.org/u/Andrew_Patterson)
#### Post date: [10 September 2008 08:52 UTC](https://discourse.openehr.org/t/versioned-object-t-uid-question/14812/3 "2008-09-10T08:52:53Z")

</div>

> I agree with your analysis. The optional extension part of the  
> HIER\_OBJECT\_ID will get lost through the owner\_id function on VERSION thus  
> breaking the invariant on owner\_id\_valid. However the issue will not reveal  
> itself if the UID from the first version is used to create  
> VERSIONED\_OBJECT.uid since a plain UID can be used to create a perfect  
> HIER\_OBJECT\_ID without an extension value.

Agreed - I think the problem will not manifest itself because  
the VERSIONED\_OBJECT uid will be derived from  
the object\_id of the first version committed into the system  
(I can't really think of any other way a VERSIONED\_OBJECT  
would be created?)

Andrew

---

<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: [10 September 2008 10:42 UTC](https://discourse.openehr.org/t/versioned-object-t-uid-question/14812/4 "2008-09-10T10:42:35Z")

</div>

Andrew and Rong,

We only use GUIDs (UUID) for HIER\_OBJECT\_Ids hence have not had any issues. We have also accepted instances using OIDs without an extension with no problems. I would not see why a GUID would have an extension nor do I see an extension being used with a INTERNET\_ID. So I guess it is only in the case of OIDs that might be tempting to use an extension.

Regarding Rong’s suggested solutions, I have no problem with solution 1. Solution 2 will cause a significant change to the XML schema as the UID will now need to be a serializable type (i.e. a new complex type for UID will need to be added to the schema) so that it can be used in X\_VERSIONED\_OBJECT (Extract.xsd) assuming it follows a similar signature to VERSIONED\_OBJECT as it currently does.

Heath

---

<div class="post-metadata">

### Author: ![thomas.beale](https://discourse.openehr.org/user_avatar/discourse.openehr.org/thomas.beale/32/35_2.png) [@thomas.beale](https://discourse.openehr.org/u/thomas.beale)
#### Post date: [14 September 2008 11:57 UTC](https://discourse.openehr.org/t/versioned-object-t-uid-question/14812/5 "2008-09-14T11:57:08Z")

</div>

Rong Chen wrote:

> > Hi all,
> > 
> > I am implementing some of the versioned document  
> > semantics and have a quick query.
> > 
> > VERSIONED\_OBJECT has a ‘uid’ attribute  
> > that is meant to represent a unique identifier  
> > for all versions of this object - so kind of like  
> > the master identifier for this document set.  
> > It is of type HIER\_OBJECT\_ID
> > 
> > VERSION is a particular instance of a  
> > document version - so many VERSION  
> > documents may be part of one overall  
> > VERSIONED\_OBJECT (amendments etc).  
> > It also has a ‘uid’ attribute of type  
> > OBJECT\_VERSION\_ID.
> > 
> > A OBJECT\_VERSION\_ID consists of  
> > object\_id, version\_tree\_id and creating\_system\_id.  
> > Section 6.3.3 says that the object\_id  
> > part is a copy of the uid attribute of  
> > VERSIONED\_OBJECT. However, this doesn’t  
> > really work because VERSIONED\_OBJECT has  
> > a uid which is a HIER\_OBJECT\_ID (could be in the form  
> > 1.23.4.5.6.4::abcd), whereas object\_id can only  
> > be a plan UID (i.e. 1.23.4.5.6.4).
> 
> Hi Andrew,
> 
> I agree with your analysis. The optional extension part of the HIER\_OBJECT\_ID will get lost through the owner\_id function on VERSION thus breaking the invariant on owner\_id\_valid. However the issue will not reveal itself if the UID from the first version is used to create VERSIONED\_OBJECT.uid since a plain UID can be used to create a perfect HIER\_OBJECT\_ID without an extension value.
> 
> Two possible solutions to this issue:
> 
> 1. Change the type of object\_id attribute of OBJECT\_VERSION\_ID from UID to HIER\_OBJECT\_ID (probably the easiest thing to do)  
> or

the problem with this is that OBJECT\_VERSION\_ID is a subtype of UID\_BASED\_ID, and its extension (function inherited from the latter) should evaluate to the version\_tree\_id + creating\_system\_id parts; and the root (also an inherited function) should evaluate to a pure UID (OID, GUID etc).

> 1. Use plain UID instead of HIER\_OBJECT\_ID for uid attribute of VERSIONED\_OBJECT (this really depends on why we need extension value for VERSIONED\_OBJECT.uid, does anyone have any good examples?)

logically this would make more sense. I will have to search into the older CRs to see why we used HIER\_OBJECT\_ID instead of UID - I have a feeling this was changed in the past. I think it is linke to why we have UID\_BASED\_ID as the type of LOCATABLE.uid rather than just UID.

Heath - the schema problem you are talking about - would this affect any existing data except in openEHR Extracts (which is draft, and only we have implemented)?

- thomas

---

<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: [15 September 2008 02:46 UTC](https://discourse.openehr.org/t/versioned-object-t-uid-question/14812/6 "2008-09-15T02:46:36Z")

</div>

Tom,

The VERSIONED\_OBJECT class does not exist in the openEHR XML schema as it is a functional class. Therefore it only affects X\_VERSIONED\_OBJECT in the draft Extract.xsd.

Heath

---

<div class="post-metadata">

### Author: ![thomas.beale](https://discourse.openehr.org/user_avatar/discourse.openehr.org/thomas.beale/32/35_2.png) [@thomas.beale](https://discourse.openehr.org/u/thomas.beale)
#### Post date: [15 September 2008 07:32 UTC](https://discourse.openehr.org/t/versioned-object-t-uid-question/14812/7 "2008-09-15T07:32:56Z")

</div>

Heath Frankel wrote:

> Tom,
> 
> The VERSIONED\_OBJECT\<T\> class does not exist in the openEHR XML schema  
> as it is a functional class. Therefore it only affects  
> X\_VERSIONED\_OBJECT\<T\> in the draft Extract.xsd.

\*ok....that's what I thought.

- thomas
