I prefer writing the specifications in a DSL like BMM and then generate diagrams from it. And not only diagrams but as much of the applications as possible as well.
Edit: Don’t forget about the new features like the Expression language. I don’t see how UML/OpenAPI would be used for that.
I started doing one manually - main difference from generated is that the manual one doesn’t include the included classes, whereas the generated one (at least the copy I took yesterday) contains defs of a lot of includes. This I assume is because the generator tries to build a standalone BMM file, which could make sense in some situations. But for the ITS-BMM, we can just re-use BMMs from other BMMs in the normal way.
The other difference is that there is no official BMM (or UML) meta-model of the expressions yet, so this would be a bit made up.
Anyway, I should have a working BMM for AOM 2.0.6 in a couple of days. Might be useful as a reference to the generated one - including the generator I will eventually write based on the current UML extractor.
I’d have to have a look at its semantics, but every similar formalism (including Eclipse Xcore) I have looked at except OMG IDL, is unable to represent generic types properly, generics through inheritance, and usually doesn’t distinguish types from classes properly. Lambdas are often not first class citizens either. However, Xcore syntax is the kind of syntax we should be aiming for I think. Another reference is SysML2, which is under construction.
@NeoEHR In the expression language, it’s very possible that Archie has different implementation classes than the standard - the ones in the standard were changed a couple of times after we had implemented it already. It is possible to make a (configurable) custom json mapping to match the standard in Archie, but that is not done. All the other things of the model should match 100%.
You may want to use the Archie generated BMM if you want to parse the expression language model expressed in JSON.
@thomas.beale The single BMM file is just because I did not want to spend any effort in writing the code to create several BMM files for just the AOM - it did not add anything for me.
Indeed - I was thinking about the design of the UML → BMM extractor, and creating separated files is quite a lot of work, so perfectly comprehensible. BTW I found various errors, which you are probably already fixing, anyway, they’re typical things that occur in these kinds of converters as you work out the details. Specifically:
all (?) properties seem to have is_mandatory set on them
cardinality only needed when it is something other than 0..*
the old form of list <xxx, ...> used for ‘ancestors’ not needed, can just be <xxx>
Boolean properties have ‘is_’ missing in the name (see below ex.)
the converter currently outputs a complex type structure for ?all P_BMM_SINGLE_PROPERTYs
correct form:
["is_enumerated_type_constraint"] = (P_BMM_SINGLE_PROPERTY) <
name = <"is_enumerated_type_constraint">
type = <"Boolean">
>
Currently generated:
["enumerated_type_constraint"] = (P_BMM_SINGLE_PROPERTY) <
name = <"enumerated_type_constraint">
type_def = <
type = <"BOOLEAN">
>
is_mandatory = <True>
>
There might have been a couple more, but if the above are fixed, the generator will be 97% there.
Yes, that is correct; you will see that there as well. It contains the correct version of the (old) Expression model. It’s not quite complete yet, a bit more to do on it.
The next versions will include openehr_base_1.1.0 and openehr_expression_1.0.4.
I’ll get the AM 2.2.0 and 2.3.0 BMMs up fairly soon.
Note that none of them use RM directly; ADL/AOMs is independent of RM, AOM1.4 had a small dependence on RM types, which I think you probably don’t care about.
Note that this converter is mainly for a limited purpose - just generate something that works, not generating something that’s an optimal hand-coded BMM file. From that perspective:
Hmm, looks like the AOM implementation in Archie is not annotated with @Nullable, unlike the RM. I’ll try to see if I can do this.
From the above perspective, very low priority, but also easy, so I will check if it is.
The , … indicates it is a list, which makes the BMM much easier to convert to correct JSON/YAML and to process with existing tools. Archie can parse the other form just fine, but it will be annoying for anyone else. This is not just the BMM, but the generic ODIN generation of Archie that does this for any single element list. So not sure if I should fix this at all.
Ah, that I will look into. Can be tricky, I hope they do not appear like this in the JSON serialization as well, because then it will be more tricky to fix (will probably need a new configuration parameter to make it backwards compatible on demand, and parse both alternatives?)
if easy to fix I will add it, but otherwise the meaning of the output is exactly the same, so will not matter much.
There are more problems in the generated BMM: for example constraint is not in C_PRIMITIVE_OBJECT. Neither is assumed_value. They are in the subclasses. This is because this is actually a BMM generated from a java implementation of the AOM, where some of these things have to be different to work. That might actually help in code generation, by the way.
TEMPLATE.overlays in the spec, archie as templateOverlays (so template_overlays in BMM). Looks like a mistake on my side in 2016.
C_TEMPORAL. pattern_constraint in spec, patterned_constraint in archie (probably mistake on my side?)
in the spec, several C_PRIMITIVE_OBJECT subclasses have default_value is mandatory. I do not think it should.
in the spec, C_TERMINOLOGY_CODE.constraint is mandatory. Should it be?
the class RESOURCE_ANNOTATIONS cannot be found in the specifications
in base BMM, resource_description.details is mandatory, in the specification, it is not.
Ok, fixed some things, and generated the BMM for AOM 2.3.0. Changes:
the changes in AOM 2.3.0 (obviously ), such as rm_overlay and constraint binding strength
fixed the STRING and BOOLEAN type so it is now String and Boolean
cardinality no longer present for lists if >=0
All optional fields should no longer appear as mandatory
it now outputs type= instead of type_def= for simple properties
Issues remaining:
Archie outputs in both JSON and this BMM boolean fields in the AOM without the is_prefix.
It still contains some (but not all) classes also present in base
Both are fixable, but will take more time to properly fix, and in the first case will mean some work to ensure backwards compatibility of the JSON output is guaranteed, probably with some extra configuration.
See the specifications-ITS_REPO now; contains various fixes in both BASE and AM BMMs; also contains a AM 2.1.0 and 2.2.0 BMM. Compiling in ADL Workbench. 2.3.0 coming tomorrow.