text about different between 'protocol' and '/protocol' is hard to understand and inconsistent with other examples

Description

paragraph 9.4.1 in the ADL2-spec lists a text about the difference between 'protocol' and '/protocol' in ADL2:

"Note that in the above, the '/' is used to denote '/protocol' as a differential path. Without the slash, the 'protocol' attribute would be considered to be trying to constrain a hitherto unconstrained attribute called 'protocol', rather than redefine a constraint already present in a parent archetype."

I tried showing it to colleagues to see if they would understand the difference. None did. I can also not see how the flattener should treat it any differently, except by raising some validation messages in one case and not in the other.

It also seems to be inconsistent with other examples, for example in 9.5.2. Occurrences Redefinition and Exclusion, it redefines value to set occurrences to {0} without using a / before value.

So how should this be treated?

Environment

None

Activity

Show:
Thomas Beale
October 4, 2017, 3:03 PM

It's a subtle difference to be sure. However it is different. A differential path means it is trying to overlay on an existing attribute; in that case, you need to retain the original attribute cardinality and existence. If it's a non-differential path, you can just copy the overlay in.

Code reference: https://github.com/openEHR/adl-tools/blob/master/components/adl_compiler/src/comparator/archetype_flattener.e#L217

Pieter Bos
October 6, 2017, 9:47 AM

I don't think I understand. I checked the code, but I find it quite hard to understand what exactly happens here. So I input the example archetypes in ADL workbench. I do not see a difference in output when i use 'protocol matches' instead of '/protocol matches'

I did find a segmentation error whenever I type '/protocol existence matches {1}' without a further matches block in the ADL workbench. I'll attach the ADL-files soon and the console log. The same error happens with 'protocol existence matches {1}'. It disappears when I type '/protocol existence matches {0}' or when i add one or more children to the /protocol C_Attribute. So '/protocol existence matches {1} matches {....}' parses and flattens.

Also when I add the constraint '/protocol existence matches {0}' in the child archetype and look at the serialized ADL output of the workbench (both flat and non-flat), it outputs '/protocol existence matches {0} matches {}', which is not valid ADL2.

So, apart from the errors in the workbench, what should it actually do and is there an example of both types of input where either the flat ADL is different, or the child archetype does not validate?

Thomas Beale
October 6, 2017, 10:39 AM

Can you report the segmentation error on the AWBPR project - https://openehr.atlassian.net/projects/AWBPR/issues
thanks.
I'll need to check the current test archetypes and possibly add some new ones, if I have not got the above situation already covered.

Pieter Bos
October 6, 2017, 1:22 PM

I reported the workbench issues plus ADL source files in and AWBPR-69. I experimented a bit with the ADL workbench and paths with or without a '/'. I found two cases in where it's handled differently - one reported a validation error and one a segmentation error. Both seem to be related to a problem in the differential path lookup in the ADL workbench - it could be the same problem. I reported them as and AWBPR-71.

Reporter

Pieter Bos

Labels

None

Components

Priority

Minor
Configure