As part of the SPLASH platform I am working on, I have new tools that allow a source code representation of any model, called BMML, i.e. BMM4 Language. It is called BMM4 because it is some way ahead of BMM3, which is that most recent development baseline in openEHR.
The site is here. See the home page for detailed explanations. The BMML source files may currently be found in this Github repo.
The openEHR models for RM, BASE, LANG and AM are included, and all have generated UML diagrams via the PlantUML pathway. These diagrams are of variable visual quality compared to the MagicDraw ones whose visual arrangement was manually done, but since they are generated, they are semantically guaranteed to be correct.
I’m providing this site mainly for those interested in model representation and publishing.
The new grammar is great and clean and it well suited for BMM, and I think it can even reduce a lot of the complexities that exist in the layer of persistence of bmm schemas.
For first, it is more human readable and easy to understand than JSON or ODIN objects. Moreover, with this grammar that already support all details found in BMM_{*} classes, it would be possible to just load the schemas directly into memory without the need of intermediate layer i.e P_BMM.
plus it now can open the door for using it as its own simple programming and language and maybe building its own runtime. specially with its own expression &statement language.
It currently fixes a lot of issues that are in the original .bmm just by that clean syntax, there are some missing function paramters though, like in Interval and Container, if I may assume:
for the Container case: those functions have to do more with agents as parameters. It is still not supported in the BMML antlr4 grammars. So it might be added later.
Interval case: is it due to the parameters being generic, like has(e:T) or intersects(other: Interval<T>), or is it maybe a generation bug?
Other observation is the naming of generic parameters of Container<T> later it is inherited by Map<K, V> and the V is substited with T, in BMMv3 it was stated that in such inheritance should have same name generic paramter. so will that rule be removed in SPLASH?
Just to reduce risk of confusion, this is currently a community/private suggestion of how to represent openEHR, a bit like NeoEHR provided alternative ways of browsing the openEHR UML based on the open specifications.
The official specification is as usual found at: https://specifications.openehr.org/ and some (partly parallell) work has been done regarding converting parts of that site to Antora too.
P.s. @thomas.beale perhaps you could give the short version (a link or just 2-5 sentences) of why BMM was invented in the first place. I believe open UML dialects at the time (and perhaps still) could not express the details wanted.
@thomas.beale when UML diagrams (like the one below) are extensive it is hard for end user to find a way to zoom in or bring into some kind of fullpage view. Also, beginners may misunderstand that “flat” in the tabs means including all things flattened from the inheritance tree, not sure how to solve, perhaps at least “flattened” helps a bit to not confuse it with openEHR’s simplified FLAT JSON format.
Exactly - this is some R&D work that I am reporting to obtain community reaction. All the normative releases are on the https://specifications.openehr.org site.
Why BMM (originally):
we had no way to computably represent our own models outside of XMI.
XMI is/was a) unreadable XML for all practical purposes (it is full of UUIDs for one thing); b) not properly standardised (up to 9 different variants at one time - UML tools just couldn’t work with it)
UML and XMI cannot represent generic types properly. This has become more important in recent years, as languages like Java, C#, Kotlin etc have greatly increased the use and power of generic typing.
UML (and XMI) cannot represent lambdas or any other functional construct, yet these are also used ubiquitously these days
Although UML / XMI could theoretically represent expressions (OCL) which we use for pre-, post-conditions and invariants, tools didn’t implement it, and it is not in wide use.
we didn’t want to be tied to UML tools as the primary representation of models.
The official version of BMM does a fair bit of this, and is reasonably human readable, as well as fully computable. But it was limited to the properties view of classes. A more recent JSON representation now represents (as strings, I think, I have not checked) functions, invariants and pre- and post-conditions.
there is a full expression language, using standard grammar constructs that you would find in most programming languages - this is fully parsed into a complete AST, and will be machine evaluable, just like in Typescript or Java (when I build the evaluator). This allows us to write code, i.e. algorithms - in AOM2, there are a lot of small algorithms specifying conformance etc (see below for example);
there are also complex expressions like decision tables;
beyond expressions, there are statements - allowing both programming in BMML, but also a much better representation of rules within archetypes;
full representation of lambdas (e.g. my_list.for_all (v -> v.is_valid)), signatures (e.g. (String) -> Boolean), also symbolic representations of universal and existential quantification (e.g. folders_valid: ∃folders ⇒ ∀ f:folders ¦ f.type.is_equal("VERSIONED_FOLDER"))
|
| True if the cardinality of this node conforms to other.cardinality, if it exists
|
func cardinality_conforms_to (other: C_ATTRIBUTE): Boolean
do
Result := (∃cardinality ∧ ∃other.cardinality) ?
other.cardinality.contains (cardinality) : True;
;
Yes, this is a problem I have not solved - it.s not as easy as it should be within the Antora system. However, on Firefox, you can do right click -> This Frame -> Show only this frame. I don’t see any equivalent to that in Chrome.
Good point, I forgot we are using the word ‘flat’ to mean something else. I might see if I can add some hover help and question mark icons or similar… or just put ‘flattened’, although I prefer to have short words…
That is exactly the logic I am currently trying to implement, I am even trying to use it in the deserialisation itself (i.e from JSON).
my strategy is as following:
1- BMML loader that loads the file to an in memory BMM (implemented in C++, because it provide both classic OOP and also low level language).
2- model analysis: create a lower representation for how each class memory layout should, and also build a dispatcher for all features functions and properties as setter and getters to support polymorphic dispatch in setters when there’s type narrowing when overriding.
3- execution: evaluator or interpreter can be used to run anything, e.g object serialization: can take any object with _type property, create instance, and then evaluate assertions (of invariants) and inside it you can also dispatch functions. Similar thing with ADL.
So I have BMM-to-native binding layer and I can implement more complex logic in C++. I think that overall such strategy would allow more flexibilty for extending openehr classes in the future. and even more unification of tooling currently used.
I am not going to lie, it is not so easy because it is like basically building a small runtime, but i think it worth exploring. That is why I think that the idea of BMM would take the spec and expand it into a full-blown ecosystem.
While experimenting with parsing bmml files it. there are some functions that cause problems in the process that take arguments as lamdas/agents, for example in AM there’s a function called
or even in Container class like has and for_all…etc. the reason for this bug is that there’s no support for lambdas/agent in the grammars in bmml parser or El parser.
Mohammed - I did not remember you were using those grammars - they are out of date. I copied in the current grammars for BMML, everything compiles. That should help.