# Different types for TRANSLATION\_DETAILS.language in XSD and BMM for OPT 1.4

**URL:** https://discourse.openehr.org/t/different-types-for-translation-details-language-in-xsd-and-bmm-for-opt-1-4/2003
**Category:** ADL
**Tags:** template
**Created:** [29 October 2021 08:39 UTC](https://discourse.openehr.org/t/different-types-for-translation-details-language-in-xsd-and-bmm-for-opt-1-4/2003 "2021-10-29T08:39:25Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![borut.jures](https://discourse.openehr.org/user_avatar/discourse.openehr.org/borut.jures/32/1391_2.png) [@borut.jures](https://discourse.openehr.org/u/borut.jures)
#### Post date: [29 October 2021 08:39 UTC](https://discourse.openehr.org/t/different-types-for-translation-details-language-in-xsd-and-bmm-for-opt-1-4/2003/1 "2021-10-29T08:39:25Z")

</div>

[XML Schemas for OPT 1.4](https://specifications.openehr.org/releases/ITS-XML/latest/components/AM/Release-1.4/) specify TRANSLATION\_DETAILS in the [Resource.xsd](https://specifications.openehr.org/releases/ITS-XML/latest/components/AM/Release-1.4/Resource.xsd).

TRANSLATION\_DETAILS.language is specified as type CODE\_PHRASE in XSD but it has type TERMINOLOGY\_CODE in [openehr\_base\_110.bmm](https://github.com/openEHR/specifications-ITS-BMM/blob/b935315e4152a7297ad383b7dcb1aa3694c51862/components/BASE/Release-1.1.0/openehr_base_110.bmm#L621).

May I ask for guidance on which one is correct or if I’m missing something?

```auto
<xs:complexType name="TRANSLATION_DETAILS">
<xs:sequence>
  <xs:element name="language" type="CODE_PHRASE"/>
  <xs:element name="author" type="StringDictionaryItem" minOccurs="1" maxOccurs="unbounded"/>
  <xs:element name="accreditation" type="xs:string" minOccurs="0"/>
  <xs:element name="other_details" type="StringDictionaryItem" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>

```

```auto
["TRANSLATION_DETAILS"] = <
	name = <"TRANSLATION_DETAILS">
	ancestors = <"Any", ...>
	properties = <
		["language"] = (P_BMM_SINGLE_PROPERTY) <
			name = <"language">
			type = <"Terminology_code">
			is_mandatory = <True>
		>

```

---

<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: [29 October 2021 08:52 UTC](https://discourse.openehr.org/t/different-types-for-translation-details-language-in-xsd-and-bmm-for-opt-1-4/2003/2 "2021-10-29T08:52:08Z")

</div>

The BMM [openehr\_base\_110.bmm](https://github.com/openEHR/specifications-ITS-BMM/blob/b935315e4152a7297ad383b7dcb1aa3694c51862/components/BASE/Release-1.1.0/openehr_base_110.bmm#L621) is significantly more recent than the OPT 1.4 XSD. AFAIK, the XSD is is the currently use and correct way to process OPT 1.4 XML.

Semantically, there is no change in the use of Terminology\_code, it does the same thing as CODE\_PHRASE, but is not buried inside the Reference Model. Outside of the RM, Terminology\_code is now used to represent a terminology code.

We refactored what is now the [Resource Model]([https://We](https://We) refactored) from an [earlier version of the RM COmmon IM spec](https://specifications.openehr.org/releases/RM/Release-1.0.3/common.html#_resource_package); you will see the newer Resource Model has extra fields etc.

It’s a bit annoying, especially when you come along afterward, so hopefully this helps a bit.

---

<div class="post-metadata">

### Author: ![borut.jures](https://discourse.openehr.org/user_avatar/discourse.openehr.org/borut.jures/32/1391_2.png) [@borut.jures](https://discourse.openehr.org/u/borut.jures)
#### Post date: [29 October 2021 08:55 UTC](https://discourse.openehr.org/t/different-types-for-translation-details-language-in-xsd-and-bmm-for-opt-1-4/2003/3 "2021-10-29T08:55:51Z")

</div>

Once you publish a question you “see” things that before went unseen 😳

I’ve noticed that Resource.xsd is using old RM release: `RM/Release-1.0.2/BaseTypes.xsd`

Actually the whole Resource.xsd is published as Release 1.4 but the file’s first line is `<!-- openEHR Release 1.0.2 Resource XML schema -->`.

In the RM release 1.0.2 the “language” is specified as CODE\_PHRASE.

```auto
["TRANSLATION_DETAILS"] = <
  name = <"TRANSLATION_DETAILS">
  ancestors = <"Any", ...>
  properties = <
    ["language"] = (P_BMM_SINGLE_PROPERTY) <
      name = <"language">
      type = <"CODE_PHRASE">
      is_mandatory = <True>

```

---

<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: [29 October 2021 09:01 UTC](https://discourse.openehr.org/t/different-types-for-translation-details-language-in-xsd-and-bmm-for-opt-1-4/2003/4 "2021-10-29T09:01:10Z")

</div>

I’m afraid things in XSD-land might not exactly match the source specs, in terms of file-naming, etc, but as they are in constant use, I think they most likely correct; the problem is that if you come along without knowing the (hidden) history, it’s hard to magically know what gets used where. @sebastian.iancu did much of the work on cleaning up XSDs and could probably elaborate.

On the plus side, if you are looking to construct a new system or application based on openEHR, just use the latest published release of everything i.e. RM 1.1.0 and so on; don’t use any previous releases. Things should work fine if you do that. If you still find XSD (or BMM or any other) errors, please report them, either here, if you are not sure, or if you are sure of a problem, you can create an official PR (Problem Report) [here on Jira](https://openehr.atlassian.net/jira/software/c/projects/SPECPR/issues/).

---

<div class="post-metadata">

### Author: ![borut.jures](https://discourse.openehr.org/user_avatar/discourse.openehr.org/borut.jures/32/1391_2.png) [@borut.jures](https://discourse.openehr.org/u/borut.jures)
#### Post date: [29 October 2021 09:01 UTC](https://discourse.openehr.org/t/different-types-for-translation-details-language-in-xsd-and-bmm-for-opt-1-4/2003/5 "2021-10-29T09:01:18Z")

</div>

Thank you for the explanation @thomas.beale. That was super quick 😅

I’ll implement the “language” element as type TERMINOLOGY\_CODE in OPT 1.4 files. I guess the published Reference.xsd wasn’t re-generated and still refers to the old release.

---

<div class="post-metadata">

### Author: ![borut.jures](https://discourse.openehr.org/user_avatar/discourse.openehr.org/borut.jures/32/1391_2.png) [@borut.jures](https://discourse.openehr.org/u/borut.jures)
#### Post date: [29 October 2021 11:11 UTC](https://discourse.openehr.org/t/different-types-for-translation-details-language-in-xsd-and-bmm-for-opt-1-4/2003/6 "2021-10-29T11:11:16Z")

</div>

It is an adventure working with openEHR as a newcomer 😅

CKMs export OPT files in the “original” release 1.0.2 format. I checked [Clinical Knowledge Manager](https://ckm.openehr.org/ckm/) and [Clinical Knowledge Manager](https://ckm.highmed.org/ckm/).

Archie uses its ADL14Converter to convert templates to AOM release 2.0.6.

I’ll need to write a similar converter since I’m using Archie’s “openEHR\_aom\_206.bmm” to generate my AOM.

I guess CKMs still produce OPTs in a very old release 1.0.2 and tools are converting them to OPT2 for using them with a newer AOM2?

It would be so much easier if CKMs produced OPT2 🤔

But hey, I have a whole weekend to write OPT to AOM2 converter 🙃

---

<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: [29 October 2021 12:11 UTC](https://discourse.openehr.org/t/different-types-for-translation-details-language-in-xsd-and-bmm-for-opt-1-4/2003/7 "2021-10-29T12:11:25Z")

</div>

> [@borut.jures](#):
>
> It would be so much easier if CKMs produced OPT2

That should be achievable from Archie, either from within CKM or in a local build.

It can also be generated from the [ADL WB tool](https://openehr.github.io/adl-tools/adl_workbench_guide.html).

I can even run it locally on the latest copy of CKM and generate a full set of OPT2 files if you like.

---

<div class="post-metadata">

### Author: ![sebastian.garde](https://discourse.openehr.org/user_avatar/discourse.openehr.org/sebastian.garde/32/3070_2.png) [@sebastian.garde](https://discourse.openehr.org/u/sebastian.garde)
#### Post date: [29 October 2021 12:36 UTC](https://discourse.openehr.org/t/different-types-for-translation-details-language-in-xsd-and-bmm-for-opt-1-4/2003/8 "2021-10-29T12:36:32Z")

</div>

@pieterbos has written an (as far as I know still experimental) OPT1.4 to OPT2 converter which sounds what you may want to have a look at. Something we’ll add to CKM as well in due course (but certainly not over the weekend)

> <https://github.com/openEHR/archie/pull/261>
>
> Parses an OPT 1.4 and converts it to an ADL 2 Template.
> 
> status:
> \- \[x\] Parses… an OPT1.4
> \- \[x\] Converts it to OPT2 model, with 1.4 node ids/conventions
> \- \[x\] Converts it to ADL 2 Template, with ADL 2 node ids/conventions
> \- \[x\] Basic tests
> \- \[x\] Converts default values for some data value types
> \- Converts all default value types
> - This is very easy to do once we added a namespace to the Archie XML binding, and all of the types actually in use work, so probably for a later pull request.
> \- \[x\] converts the ontology in the OPT, not in C\_ARCHETYPE\_ROOT (multiple language support, it seems?)
> - if C\_ARCHETYPE\_ROOT and ontology both define a constraint, which should have preference? now the ontology has priority
> \- \[x\] Handles component ontologies (seems they can contain other languages than in the C\_ARCHETYPE\_ROOT)
> - if C\_ARCHETYPE\_ROOT and ontology both define a constraint, which should have preference? now the ontology has priority
> - \[x\] handle constraint\_definitions if this is ever used
> - \[x\] handle constraint\_bindings if this is ever used
> \- \[x\] Converts annotations
> \- \[\] remove hack for \`\[openehr-EHR-COMPOSITION.report.v1\]/content..\` path form?
> \- \[x\] 'and name='.....\]' path constraints implemented. 
> - \[\] Add test to verify they also work?
> \- \[x\] check that terminology items for C\_ARCHETYPE\_ROOTs with archteype id are converted to id code.
> \- \[\] Converts all the possibilities in \`\<constraints\>\`, which seem to be complex object overlays? Or if not necessary perhaps?
> - \[x\] default valus
> - \[x\] occurrences
> - \[x\] rm\_visibility, including aliases
> - \[x\] refactor path lookup for RM objects AND AOM to support archetype ref + name lookup. BREAKING CHANGES!!!
> - \[x\] migrate paths in annotations and visibility from archetype ref + name =\> unique id-code?
> - \[\] C\_ATTRIBUTES constraints
> - \[\] RM\_TYPE\_NAME? can this change, or just for lookup?
> 
> \## Breaking changes
> 
> \- Path parsing and RM Path queries lookup rewritten wit a proper predicate system to implement and name/value= lookup. This should not break things, but potentially can, especially if manually constructing pathSegments and finding from there.
> \- old RMPathQuery.find() deprecated. It has way too many quirks and should be replaced with findList() and work from those results. However, that will be a breaking change!

Can the ADL Workbench generate OPT1.4 to OPT2 already, @thomas.beale (and not “only” convert adl1.4 to adl2 / opt2. The oets may be the remaining challenge?

What may be even more interesting is an OPT2 → OPT1.4 conversion, because quite likely most openEHR vendors will have to rely on OPT1.4 for a while.

---

<div class="post-metadata">

### Author: ![borut.jures](https://discourse.openehr.org/user_avatar/discourse.openehr.org/borut.jures/32/1391_2.png) [@borut.jures](https://discourse.openehr.org/u/borut.jures)
#### Post date: [29 October 2021 12:46 UTC](https://discourse.openehr.org/t/different-types-for-translation-details-language-in-xsd-and-bmm-for-opt-1-4/2003/9 "2021-10-29T12:46:15Z")

</div>

> [@thomas.beale](#):
>
> It can also be generated from the [ADL WB tool](https://openehr.github.io/adl-tools/adl_workbench_guide.html).
> 
> I can even run it locally on the latest copy of CKM and generate a full set of OPT2 files if you like.

I used public CKMs to download few OPTs for testing.

Thank you for offered help in generating OPT2 files but I don’t want to take your time.  
…unless you have few of them ready on your disk 😊 🙏  
That would speed let me write OPT2 to AOM2 converter over the weekend and skip the OPT14.

---

<div class="post-metadata">

### Author: ![borut.jures](https://discourse.openehr.org/user_avatar/discourse.openehr.org/borut.jures/32/1391_2.png) [@borut.jures](https://discourse.openehr.org/u/borut.jures)
#### Post date: [29 October 2021 12:48 UTC](https://discourse.openehr.org/t/different-types-for-translation-details-language-in-xsd-and-bmm-for-opt-1-4/2003/10 "2021-10-29T12:48:29Z")

</div>

> [@sebastian.garde](#):
>
> Something we’ll add to CKM as well in due course

Thank you for the explanation @sebastian.garde.

I’ll take a risk and skip support for OPT14 then. Eventualy CKMs will export OPT2 or users will be able to convert them with one of the tools.

---

<div class="post-metadata">

### Author: ![pieterbos](https://discourse.openehr.org/user_avatar/discourse.openehr.org/pieterbos/32/512_2.png) [@pieterbos](https://discourse.openehr.org/u/pieterbos)
#### Post date: [29 October 2021 13:00 UTC](https://discourse.openehr.org/t/different-types-for-translation-details-language-in-xsd-and-bmm-for-opt-1-4/2003/11 "2021-10-29T13:00:47Z")

</div>

Welcome to the club of people who support ADL 2 natively! We’re still a small group unfortunately, but support to migrate is growing fast.

The OPT 1.4 → OPT 2 converter in Archie is feature complete, but has only had limited testing. It will work for at least some OPTs, and may give problems for others. Any issues found should be easy to fix. If you try it, please do report your results, including any issues you find, so the converter can be improved.

OPT2 is already fully AOM2, so I am not sure what you mean with ‘opt2 to aom 2 converter’. Converting OPT 1.4 to OPT 2 is quite a lot of work to get right, just directly importing the OPT 1.4 data into AOM 2 is much less work. The Archie branch that Sebastian pointed to contains the code for both processes.

---

<div class="post-metadata">

### Author: ![borut.jures](https://discourse.openehr.org/user_avatar/discourse.openehr.org/borut.jures/32/1391_2.png) [@borut.jures](https://discourse.openehr.org/u/borut.jures)
#### Post date: [29 October 2021 13:48 UTC](https://discourse.openehr.org/t/different-types-for-translation-details-language-in-xsd-and-bmm-for-opt-1-4/2003/12 "2021-10-29T13:48:36Z")

</div>

Thank you @pieterbos for the OPT 1.4 to OPT 2 converter!

On my first review I saw a DEVELOPMENT status for OPT2 so I picked OPT 1.4 instead. I’m happy to join the ADL 2 club (now that I learned the OPT 1.4 is using the “original” RM release).

Everything else is already AOM 2 in my little project.

> [@pieterbos](#):
>
> I am not sure what you mean with ‘opt2 to aom 2 converter’.

Its the part where I read the OPT(2) file and “convert” it to AOM classes in-memory.

---

<div class="post-metadata">

### Author: ![borut.jures](https://discourse.openehr.org/user_avatar/discourse.openehr.org/borut.jures/32/1391_2.png) [@borut.jures](https://discourse.openehr.org/u/borut.jures)
#### Post date: [29 October 2021 14:22 UTC](https://discourse.openehr.org/t/different-types-for-translation-details-language-in-xsd-and-bmm-for-opt-1-4/2003/13 "2021-10-29T14:22:37Z")

</div>

Thank you for all the links and information to everybody.

I’ve (re)read OPT2 specifications and I could skip the “convert” part if I used OPT2 in JSON format (.optj). I could generate the serialize/deserialize code for the AOM2 classes from the AOM2 BMM. This would let me deserialize directly from the .optj file to the AOM2 in-memory classes. Zero code to maintain thanks to the BMM!

I’m reading through the “ADL Workbench (AWB) User Guide” to see how to create a few sample .optj files.  
(if somebody has done this before and has these files, please send/upload them)

---

<div class="post-metadata">

### Author: ![borut.jures](https://discourse.openehr.org/user_avatar/discourse.openehr.org/borut.jures/32/1391_2.png) [@borut.jures](https://discourse.openehr.org/u/borut.jures)
#### Post date: [29 October 2021 17:55 UTC](https://discourse.openehr.org/t/different-types-for-translation-details-language-in-xsd-and-bmm-for-opt-1-4/2003/14 "2021-10-29T17:55:03Z")

</div>

I went ahead and installed ADL Workbench on my Mac. That was an experience 😅

If somebody tries doing the same:

- Don’t install in the Documents folder.
- Don’t skip the line “Then clone the iso8601 and error\_message libraries into a directory such as …/EiffelHub/:” =\> create the EiffelHub directory before executing the last two “git clone” commands.

I was able to compile AWB but received 8 errors (they are actually only 1 error):

```auto
1 VCCH(1) Class has deferred feature(s), but is not declared as deferred. Check deferred feature yymax_symbol_equiv_class from class YY_SCANNER_SKELETON. ADL_14_2_REWRITER.yymax_symbol_equiv_class (adl_components)
...
CADL_14_SCANNER.yymax_symbol_equiv_class (adl_components)
ADL_14_SCANNER.yymax_symbol_equiv_class (adl_components)
BMM_TYPE_NAME_SCANNER.yymax_symbol_equiv_class (eomf_bmm)
OG_PATH_SCANNER.yymax_symbol_equiv_class (eomf_object_graph)
ODIN_SCANNER.yymax_symbol_equiv_class (eomf_odin)
ADL_2_SCANNER.yymax_symbol_equiv_class (adl_components)
CADL_2_SCANNER.yymax_symbol_equiv_class (adl_components)

```

I was brave enough to try to fix them. My first experience with Eiffel. No, I wasn’t successful.

Next, I installed the provided AWB EXE file on my Windows computer. I was able to open a template and save it as a .JSON file. It says it is an operational template but doesn’t use the .OPTJ extension as in OPT2 specifications. Well, it is good enough for me even with the .json.

I guess a can now generate serialize/deserialize support to the AOM2 classes. It will save me a lot of coding now and it will be future proof when specifications change.

It was a good day. Thank you to everybody who took the time to help 👋

---

<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: [29 October 2021 18:06 UTC](https://discourse.openehr.org/t/different-types-for-translation-details-language-in-xsd-and-bmm-for-opt-1-4/2003/15 "2021-10-29T18:06:02Z")

</div>

I have to say, as the author of AWB, but who uses Windows and Linux, it works on both of those platforms, but to get it working on the Mac, which we did manage in the past, was very difficult, partly due to difficulty of getting GTK2 installed. Anyway, I might have saved you the trouble if I had known you were going to try that platform 😉

I will however check the state of the source build; not many people do that, so it may be out of date with respect to the compiler version you probably installed (can you let me know which compiler version it was?).

Sorry for the annoyance - I’ll try to improve things there.

---

<div class="post-metadata">

### Author: ![borut.jures](https://discourse.openehr.org/user_avatar/discourse.openehr.org/borut.jures/32/1391_2.png) [@borut.jures](https://discourse.openehr.org/u/borut.jures)
#### Post date: [29 October 2021 18:28 UTC](https://discourse.openehr.org/t/different-types-for-translation-details-language-in-xsd-and-bmm-for-opt-1-4/2003/16 "2021-10-29T18:28:42Z")

</div>

Don’t worry about the Mac. Windows and Linux is enough. I guess there are more important things on your ToDo list than making AWB run on a Mac for one person 😊

I installed the Eiffel Studio successfully. The source build worked. Based on the compiler errors I thought that the deferred feature `yymax_symbol_equiv_class` was added to these classes and they were somehow not in sync with the change.

But it was the first time I saw an Eiffel code so I’m probably completely wrong here 😅

I already deleted Eiffel Studio so I don’t know which compiler version was used. I guess the latest since I installed everything following the instructions from their site.
