# Transitions\_valid invariant of STATE class

**URL:** https://discourse.openehr.org/t/transitions-valid-invariant-of-state-class/12126
**Category:** Reference Implementation: Java (archive)
**Created:** [6 July 2006 15:22 UTC](https://discourse.openehr.org/t/transitions-valid-invariant-of-state-class/12126 "2006-07-06T15:22:22Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![rong.chen](https://discourse.openehr.org/user_avatar/discourse.openehr.org/rong.chen/32/515_2.png) [@rong.chen](https://discourse.openehr.org/u/rong.chen)
#### Post date: [6 July 2006 15:22 UTC](https://discourse.openehr.org/t/transitions-valid-invariant-of-state-class/12126/1 "2006-07-06T15:22:22Z")

</div>

Hi Thomas,

I am implementing Date\_types.basic package and trying to create a test  
C\_DV\_STATE with the medication order sample on p11 of openEHR Archetype  
Profile document, rev1.0.

What I found is it is not possible to create the last state 'COMPLETED'  
if the invariant of STATE class "Transitions\_valid: transitions /= Void  
and then not transitions.is\_empty" is in place. Since it is the end  
state, there is no more transition for that state. Should the invariant  
be changed to "Transitions\_valid: transitions /= Void \*implies\* not  
transitions.is\_empty"? Or I misunderstood something??

Regards,  
Rong

---

<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: [7 July 2006 17:23 UTC](https://discourse.openehr.org/t/transitions-valid-invariant-of-state-class/12126/2 "2006-07-07T17:23:50Z")

</div>

Rong Chen wrote:

> Hi Thomas,
> 
> I am implementing Date\_types.basic package and trying to create a test  
> C\_DV\_STATE with the medication order sample on p11 of openEHR Archetype  
> Profile document, rev1.0.
> 
> What I found is it is not possible to create the last state 'COMPLETED'  
> if the invariant of STATE class "Transitions\_valid: transitions /= Void  
> and then not transitions.is\_empty" is in place. Since it is the end  
> state, there is no more transition for that state. Should the invariant  
> be changed to "Transitions\_valid: transitions /= Void \*implies\* not  
> transitions.is\_empty"? Or I misunderstood something??  
> &nbsp;&nbsp;

yes - that is what it should read....thanks for the fix....

- thomas

---

<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: [7 July 2006 17:28 UTC](https://discourse.openehr.org/t/transitions-valid-invariant-of-state-class/12126/3 "2006-07-07T17:28:12Z")

</div>

Rong Chen wrote:

> Hi Thomas,
> 
> I am implementing Date\_types.basic package and trying to create a test  
> C\_DV\_STATE with the medication order sample on p11 of openEHR Archetype  
> Profile document, rev1.0.
> 
> What I found is it is not possible to create the last state 'COMPLETED'  
> if the invariant of STATE class "Transitions\_valid: transitions /= Void  
> and then not transitions.is\_empty" is in place. Since it is the end  
> state, there is no more transition for that state. Should the invariant  
> be changed to "Transitions\_valid: transitions /= Void \*implies\* not  
> transitions.is\_empty"? Or I misunderstood something??

actually, a better model would be to have an abstract class STATE, and  
two concrete classes: TERMINAL\_STATE and NON\_TERMINAL\_STATE. Then the  
model falls out cleanly. Or we can remain with the current model and  
change "transitions" to being 0..\* and change the invariant to allow this.

- thomas

---

<div class="post-metadata">

### Author: ![rong.chen](https://discourse.openehr.org/user_avatar/discourse.openehr.org/rong.chen/32/515_2.png) [@rong.chen](https://discourse.openehr.org/u/rong.chen)
#### Post date: [8 July 2006 22:31 UTC](https://discourse.openehr.org/t/transitions-valid-invariant-of-state-class/12126/4 "2006-07-08T22:31:15Z")

</div>

Thomas Beale wrote:

> Rong Chen wrote:  
> &nbsp;&nbsp;
> 
> > Hi Thomas,
> > 
> > I am implementing Date\_types.basic package and trying to create a test  
> > C\_DV\_STATE with the medication order sample on p11 of openEHR Archetype  
> > Profile document, rev1.0.
> > 
> > What I found is it is not possible to create the last state 'COMPLETED'  
> > if the invariant of STATE class "Transitions\_valid: transitions /= Void  
> > and then not transitions.is\_empty" is in place. Since it is the end  
> > state, there is no more transition for that state. Should the invariant  
> > be changed to "Transitions\_valid: transitions /= Void \*implies\* not  
> > transitions.is\_empty"? Or I misunderstood something??
> 
> actually, a better model would be to have an abstract class STATE, and  
> two concrete classes: TERMINAL\_STATE and NON\_TERMINAL\_STATE. Then the  
> model falls out cleanly. Or we can remain with the current model and  
> change "transitions" to being 0..\* and change the invariant to allow this.

The specification looks much better now. Thanks for the quick update!  
There is a minor detail though, both classes inherit STATE now (as shown  
in the UML), but it's not clear in the class description.

Cheers,  
Rong

---

<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: [9 July 2006 09:38 UTC](https://discourse.openehr.org/t/transitions-valid-invariant-of-state-class/12126/5 "2006-07-09T09:38:58Z")

</div>

Rong Chen wrote:

> The specification looks much better now. Thanks for the quick update!  
> There is a minor detail though, both classes inherit STATE now (as shown  
> in the UML), but it's not clear in the class description.  
> &nbsp;&nbsp;

thanks - fixed

- thomas
