# RM invariants in a computable form **Category:** [RM](https://discourse.openehr.org/c/rm/42) **Created:** 2022-01-10 08:12 UTC **Views:** 449 **Replies:** 1 **URL:** https://discourse.openehr.org/t/rm-invariants-in-a-computable-form/2250 --- ## Post #1 by @borut.jures In another post Erik noticed a "validate()" method in an OPT model class. [quote="erik.sundvall, post:7, topic:2144"] So does the superclass `Element`(or some other ancestor) contain a validator algorithm that makes use of the Constraints? [/quote] The idea is to generate validation rules for OPT elements. There are 3 levels: 1. Using generated constraints to validate that the OPT fields are in accordance with the constraints. Each OPT model class will implement a validate() method to validate its data. It will also call a validate() method of its ancestor (in case of RM classes - see #3 below): ![Screenshot 2022-01-08 at 08.48.19|690x286, 75%](upload://9EV70H4M4PXUicqaKnK1nosQ1Dt.png) 2. Using the "rules" section in the OPT. The rules are in a computable form. They operate on an entire OPT. 3. Using the "invariants" for the RM classes. These invariants are not yet in a computable form. @thomas.beale Could the "invariants" use the same EL as the "rules" section in the OPT? --- ## Post #2 by @thomas.beale [quote="borut.jures, post:1, topic:2250"] @thomas.beale Could the “invariants” use the same EL as the “rules” section in the OPT? [/quote] THis is certainly the idea - the intention is unify all 'expression languages' used in openEHR (whether that quite works out for AQL is another question...) --- **Canonical:** https://discourse.openehr.org/t/rm-invariants-in-a-computable-form/2250 **Original content:** https://discourse.openehr.org/t/rm-invariants-in-a-computable-form/2250