# Transitions_valid invariant of STATE class **Category:** [Reference Implementation: Java (archive)](https://discourse.openehr.org/c/reference-implementation-java-archive/154) **Created:** 2006-07-06 15:22 UTC **Views:** 9 **Replies:** 4 **URL:** https://discourse.openehr.org/t/transitions-valid-invariant-of-state-class/12126 --- ## Post #1 by @rong.chen 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 --- ## Post #2 by @thomas.beale 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?? >   yes \- that is what it should read\.\.\.\.thanks for the fix\.\.\.\. \- thomas --- ## Post #3 by @thomas.beale 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 --- ## Post #4 by @rong.chen Thomas Beale wrote: > 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\. 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 --- ## Post #5 by @thomas.beale 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\. >   thanks \- fixed \- thomas --- **Canonical:** https://discourse.openehr.org/t/transitions-valid-invariant-of-state-class/12126 **Original content:** https://discourse.openehr.org/t/transitions-valid-invariant-of-state-class/12126