Stream: conformance
Topic: slices and cardinality
Jens Villadsen (Nov 29 2017 at 13:17):
question to the professors: If I have a profiled Observation and I slice the Observation.component to have eg. 2 slices what does it then mean to set cardinality to 1..1 on Observation.component. Does it mean that both slices should be present or does it mean that only one of the slices should be present. Bonus question nr. 1: What if cardinality on my slices is 0..0. Is it then a valid profile if it is close-ended?
Lloyd McKenzie (Nov 29 2017 at 16:40):
If you have multiple slices and the slicing Observation.component is 1..1 it means that exactly one of the slices must be satisfied. A cardinality of 0..0 on a slice would be a way of enforcing "can't have anything that looks like this one". I've never seen that done, but in theory it should work. If you set things up where an element is mandatory and is sliced and closed and the slices defined don't allow the cardinality to be satisfied, then you've just created a profile that can't be satisfied. (There's numerous creative ways of doing that, typically with invariants.)
Jens Villadsen (Dec 02 2017 at 21:41):
As expected (on the first part of the question) - however some of the implemented validators tend to have another interpretation
Lloyd McKenzie (Dec 03 2017 at 01:38):
Which validators?
Lloyd McKenzie (Dec 03 2017 at 01:38):
And what are they doing?
Jens Villadsen (Dec 03 2017 at 23:20):
Back to the first question - so for instance this profile: https://simplifier.net/eSundhed2017Hackatho/DAS28Observation - Observation.component is set to 4..4. This profile also has 4 slices. From what I can understand from you, that would mean that at least one of the slices should be satisfied - and that should be the case 4 times. It could mean that one of the slices would be represented four times or one slice once, and then another slice three times, Is that correct?
Lloyd McKenzie (Dec 04 2017 at 00:13):
If the slicing is closed, then there must be exactly 4 repetitions and each of those repetitions must satisfy one of the 4 slices - whether that's one for each slice, all satisfying a single slice, 2 of one and 1 each of two others or any other combination doesn't matter.
Jens Villadsen (Dec 04 2017 at 08:30):
In this particular case (https://simplifier.net/eSundhed2017Hackatho/DAS28Observation) - the slice is open-ended. What I actually would like to express is that a resource MUST express all four slices, more are welcome (hence, no need to be closed-ended) but all four should be present. So would a 4..* on Observation.component and 1..1 on each slice do the job?
Jens Villadsen (Dec 04 2017 at 08:49):
Note the specific profile is just mentioned as an example
Lloyd McKenzie (Dec 04 2017 at 14:22):
Setting minOccurs on each slice will trigger an error if you don't have at least one matching repetition for that slice. No need to do the 4..*, though doing so can make things a bit clearer.
Michel Rutten (Dec 04 2017 at 14:28):
@Jens Villadsen, for a resource instance to validate against a profile, the instance should conform to all constraints specified by the profile. For slices, this implies that the validator will verify constraints on the slice entry as well as on the individual slices. So e.g. if the slice entry is mandatory (1...1) and all slices are optional (0...1), then a conforming instance should specify exactly one valid option.
And yes, this also implies that you can author a (valid) profile with conflicting constraints to which no resource instance can ever match. Just like you can create a valid SQL statement that always returns 0 rows (SELECT ... WHERE 1=0). For example, slice entry 1...1 with two concrete mandatory slices (1...1).
Jens Villadsen (Dec 04 2017 at 18:51):
@Lloyd McKenzie & @Michel Rutten thx guys
Last updated: Apr 12 2022 at 19:14 UTC