openehr-lang 0.0.128

openEHR LANG BMM/P_BMM object model, generated from BMM: generations v1_0 (LANG 1.0.0) and v1_1 (LANG 1.1.0, current; the stable BMM v2.x unit beside the paused BMM3 unit), plus hand-written ODIN/BEL/EL readers
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
// SPDX-FileCopyrightText: Cadasto B.V.
// SPDX-FileCopyrightText: openEHR Foundation
// SPDX-License-Identifier: Apache-2.0

//! The model validity checker over a resolved `P_BMM_SCHEMA` and the v2.x
//! `BMM_MODEL` materialised from it.
//!
//! `LANG/docs/bmm3/master05-core-model.adoc` §Packages states the two rules
//! this pass enforces: "A model validity checker ensures that every class is
//! contained within exactly one package", and — because package paths "are not
//! used as namespaces as in UML" — "all classes in a BMM model should be
//! uniquely named".
//!
//! The pass COLLECTS: it returns every finding rather than stopping at the
//! first, because a validity report is only useful whole. It is distinct from
//! the typed refusals of
//! [`crate::v1_1::bmm_persistence::error::PBmmReadError`], which stay fail-fast
//! because each of them names a condition under which no `BMM_*` object can be
//! constructed at all.

use std::collections::BTreeMap;
use std::fmt;

use crate::v1_1::bmm::core::bmm_class::BmmClass;
use crate::v1_1::bmm::core::bmm_model::BmmModel;
use crate::v1_1::bmm::core::bmm_property::BmmProperty;
use crate::v1_1::bmm::core::bmm_type::BmmType;
use crate::v1_1::bmm_persistence::create_model::qualify;
use crate::v1_1::bmm_persistence::p_bmm_class::PBmmClass;
use crate::v1_1::bmm_persistence::p_bmm_package::PBmmPackage;
use crate::v1_1::bmm_persistence::p_bmm_schema::PBmmSchema;

/// One violation of BMM model validity found by [`validate_schema`].
///
/// Every variant is a discriminant a caller can branch on; the display text is
/// never a decision input.
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum PBmmValidityFinding {
    /// A class is not contained within exactly one package — "A model validity
    /// checker ensures that every class is contained within exactly one
    /// package" (`LANG/docs/bmm3/master05-core-model.adoc` §Packages).
    ///
    /// In practice this reports the DUPLICATE direction: a class listed in no
    /// package cannot be materialised at all, so it is already the fail-fast
    /// [`crate::v1_1::bmm_persistence::error::PBmmReadError::ClassNotInAnyPackage`].
    ClassNotInExactlyOnePackage {
        /// The class's name as the schema defines it.
        class: String,
        /// The package path of each listing, in schema order.
        packages: Vec<String>,
    },

    /// Two or more class definitions share one name — "all classes in a BMM
    /// model should be uniquely named"
    /// (`LANG/docs/bmm3/master05-core-model.adoc` §Packages).
    ///
    /// Names are compared case-insensitively, since "it is assumed that
    /// case-insensitive matching is used … the class name `"Hashable"` refers
    /// to the same class as `"HASHABLE"`" (same file, §Naming Convention).
    ClassNameNotUnique {
        /// The colliding definitions' names as written, in schema order.
        definitions: Vec<String>,
    },

    /// A persisted assertion string could not be materialised as a
    /// `BMM_ASSERTION`, so the class or routine carries it nowhere.
    ///
    /// v3 requires class invariants and routine pre-/post-conditions as
    /// `BMM_ASSERTION` (`LANG/docs/bmm3/master10-expressions.adoc` §Usage in
    /// BMM Models) whose `expression` is a `1..1` `EL_BOOLEAN_EXPRESSION`
    /// (`…bmm3.bmm_assertion.adoc` §Attributes), while P_BMM persists an
    /// opaque expression string (`…bmm_persistence.p_bmm_class.adoc`
    /// §Attributes). A string that is not EL, or whose names do not resolve,
    /// is reported here rather than refusing the schema.
    AssertionNotMaterialised {
        /// The class the assertion belongs to.
        class: String,
        /// The owning routine, for a pre-/post-condition.
        routine: Option<String>,
        /// Which assertion position the string was persisted in.
        kind: AssertionKind,
        /// The assertion's tag, as persisted.
        tag: String,
        /// The persisted expression string, verbatim.
        expression: String,
        /// The parse or resolution failure, as reported by
        /// [`crate::v1_1::el::ElError`].
        reason: String,
    },

    /// A persisted constant states no value, so the class carries it nowhere.
    ///
    /// `P_BMM_CONSTANT.value` is `0..1` — "The literal value of this constant,
    /// in its persisted (serialised) form"
    /// (`org.openehr.lang.bmm_persistence.p_bmm_constant.adoc` §Attributes) —
    /// while the v3 destination is a `1..1` `BMM_CONSTANT.generator`
    /// (`org.openehr.lang.bmm3.bmm_constant.adoc` §Attributes) over a
    /// `BMM_LITERAL_VALUE` whose `value_literal` is a `1..1` "serial
    /// representation of the value"
    /// (`org.openehr.lang.bmm3.bmm_literal_value.adoc` §Attributes). Stating no
    /// value is legal P_BMM — openEHR's own published LANG schemas do it for
    /// `BMM_DEFINITIONS.Bmm_internal_version` — so it is reported here rather
    /// than refusing the schema, and no empty serial form is invented.
    ConstantNotMaterialised {
        /// The class the constant belongs to.
        class: String,
        /// The constant's name, as persisted.
        constant: String,
    },

    /// A class redefines an inherited property with a type that does not
    /// conform to the overridden property's type.
    ///
    /// NOTE: no openEHR spec governs this — our own design/extension; the
    /// released text leaves redefinition conformance open
    /// (`LANG/docs/bmm3/master13-model_semantics.adoc` §Inheritance and
    /// Invariants, Pre-conditions and Post-conditions is `TBD`).
    OverriddenPropertyNonConformance {
        /// The redefining class's name.
        class: String,
        /// The redefined property's name.
        property: String,
        /// The nearest ancestor declaring the overridden property.
        ancestor: String,
        /// The redefined property's type name.
        redefined_type: String,
        /// The overridden property's type name.
        overridden_type: String,
    },
}

/// Which assertion position a persisted expression string was declared in.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum AssertionKind {
    /// `P_BMM_CLASS.invariants` — a class invariant.
    Invariant,
    /// `P_BMM_FUNCTION.pre_conditions` — a routine pre-condition.
    PreCondition,
    /// `P_BMM_FUNCTION.post_conditions` — a routine post-condition.
    PostCondition,
}

impl fmt::Display for AssertionKind {
    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
        let text = match self {
            Self::Invariant => "invariant",
            Self::PreCondition => "pre-condition",
            Self::PostCondition => "post-condition",
        };
        formatter.write_str(text)
    }
}

impl fmt::Display for PBmmValidityFinding {
    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            Self::ClassNotInExactlyOnePackage { class, packages } => write!(
                formatter,
                "class `{class}` is contained within {} package listing(s) ({}); \
                 a class must be contained within exactly one package",
                packages.len(),
                packages.join(", ")
            ),
            Self::ClassNameNotUnique { definitions } => write!(
                formatter,
                "{} class definitions share one name ({}); \
                 all classes in a BMM model must be uniquely named",
                definitions.len(),
                definitions.join(", ")
            ),
            Self::AssertionNotMaterialised {
                class,
                routine,
                kind,
                tag,
                expression,
                reason,
            } => {
                let owner = routine.as_ref().map_or_else(
                    || format!("class `{class}`"),
                    |routine| format!("class `{class}` routine `{routine}`"),
                );
                write!(
                    formatter,
                    "{owner} {kind} `{tag}` ({expression:?}) is not materialisable                      as a BMM_ASSERTION: {reason}"
                )
            }
            Self::ConstantNotMaterialised { class, constant } => write!(
                formatter,
                "class `{class}` constant `{constant}` states no value, so it is not \
                 materialisable as a BMM_CONSTANT"
            ),
            Self::OverriddenPropertyNonConformance {
                class,
                property,
                ancestor,
                redefined_type,
                overridden_type,
            } => write!(
                formatter,
                "class `{class}` redefines property `{property}` as `{redefined_type}`, \
                 which does not conform to `{overridden_type}` as declared by `{ancestor}`"
            ),
        }
    }
}

/// Checks `schema` and the `model` materialised from it for BMM model
/// validity, returning every finding.
///
/// Both forms are needed and neither is redundant: a duplicate package listing
/// and a case-variant name collision are visible only in the PERSISTED schema
/// (`BMM_CLASS.package` is `1..1` and `BMM_MODEL.class_definitions` is a
/// name-keyed map, so both collapse on materialisation), while property
/// conformance needs the model's resolved type graph
/// ([`BmmModel::type_conforms_to`]).
///
/// `model` must be the model
/// [`crate::v1_1::bmm_persistence::create_model::create_bmm_model`] produced from
/// `schema`; the findings are otherwise about two unrelated artefacts.
///
/// # Examples
/// ```
/// use openehr_lang::v1_1::bmm_persistence::create_model::create_bmm_model;
/// use openehr_lang::v1_1::bmm_persistence::reader::read_schema;
/// use openehr_lang::v1_1::bmm_persistence::validate::validate_schema;
///
/// let src = r#"
///     bmm_version = <"2.4">
///     rm_publisher = <"openehr">
///     schema_name = <"tiny">
///     rm_release = <"1.0.2">
///     packages = <
///         ["org.openehr.tiny"] = <
///             name = <"org.openehr.tiny">
///             classes = <"Any">
///         >
///     >
///     class_definitions = <
///         ["Any"] = < name = <"Any"> >
///     >
/// "#;
/// let schema = read_schema(src)?;
/// let model = create_bmm_model(&schema)?;
/// assert!(validate_schema(&schema, &model).is_empty());
/// # Ok::<(), openehr_lang::v1_1::bmm_persistence::error::PBmmReadError>(())
/// ```
#[must_use]
pub fn validate_schema(schema: &PBmmSchema, model: &BmmModel) -> Vec<PBmmValidityFinding> {
    let mut findings = Vec::new();
    check_package_containment(schema, &mut findings);
    check_class_name_uniqueness(schema, &mut findings);
    check_overridden_property_conformance(model, &mut findings);
    findings
}

/// Every class the schema defines, primitive types first, in schema order.
///
/// One name means one class regardless of which list holds it —
/// `LANG/docs/bmm_persistence/master04-syntax.adoc` §Classes for Primitive
/// Types: primitive types "are just normal class definitions within a
/// `primitive_types` block … otherwise are processed in the same way as types
/// defined in the main `class_definitions` group".
///
/// Both lists are keyed by class name, so schema order is recovered from
/// `P_BMM_CLASS.uid`, which the reader numbers in document order.
fn schema_classes(schema: &PBmmSchema) -> impl Iterator<Item = &PBmmClass> {
    in_document_order(schema.primitive_types.as_ref())
        .into_iter()
        .chain(in_document_order(schema.class_definitions.as_ref()))
}

/// The classes of one keyed class list, ordered by `uid`.
fn in_document_order(list: Option<&BTreeMap<String, PBmmClass>>) -> Vec<&PBmmClass> {
    let mut classes: Vec<&PBmmClass> = list.into_iter().flat_map(BTreeMap::values).collect();
    classes.sort_by_key(|class| class.uid());
    classes
}

/// Reports every class not contained within exactly one package.
fn check_package_containment(schema: &PBmmSchema, findings: &mut Vec<PBmmValidityFinding>) {
    let mut listings: BTreeMap<String, Vec<String>> = BTreeMap::new();
    collect_class_listings(&schema.packages, "", &mut listings);
    for class in schema_classes(schema) {
        let packages = listings
            .get(&class.name().to_uppercase())
            .cloned()
            .unwrap_or_default();
        if packages.len() != 1 {
            findings.push(PBmmValidityFinding::ClassNotInExactlyOnePackage {
                class: class.name().to_owned(),
                packages,
            });
        }
    }
}

/// Records the package path of every class listing in the package tree.
///
/// Keys fold to upper case, matching the case-insensitive class-name matching
/// of `LANG/docs/bmm3/master05-core-model.adoc` §Naming Convention.
fn collect_class_listings(
    packages: &BTreeMap<String, PBmmPackage>,
    prefix: &str,
    out: &mut BTreeMap<String, Vec<String>>,
) {
    for package in packages.values() {
        let path = qualify(prefix, &package.name);
        for class in package.classes.iter().flatten() {
            out.entry(class.to_uppercase())
                .or_default()
                .push(path.clone());
        }
        collect_class_listings(&package.packages, &path, out);
    }
}

/// Reports every set of class definitions sharing one case-insensitive name.
fn check_class_name_uniqueness(schema: &PBmmSchema, findings: &mut Vec<PBmmValidityFinding>) {
    let mut spellings: BTreeMap<String, Vec<&PBmmClass>> = BTreeMap::new();
    for class in schema_classes(schema) {
        spellings
            .entry(class.name().to_uppercase())
            .or_default()
            .push(class);
    }
    for classes in spellings.into_values() {
        let definitions: Vec<String> = classes.iter().map(|c| c.name().to_owned()).collect();
        if definitions.len() > 1 {
            findings.push(PBmmValidityFinding::ClassNameNotUnique { definitions });
        }
    }
}

/// Reports every redefined property whose type does not conform to the
/// overridden one.
///
/// A class's own `properties` are the "differential" set — the features it
/// "introduces with respect to its inheritance parent(s)"
/// (`LANG/docs/bmm3/master08-core-features.adoc` §Differential and Flat Form)
/// — so a name that also resolves on an ancestor is a redefinition.
fn check_overridden_property_conformance(
    model: &BmmModel,
    findings: &mut Vec<PBmmValidityFinding>,
) {
    for class in model.class_definitions.iter().flatten().map(|(_, c)| c) {
        for property in class.properties().into_iter().flatten().map(|(_, p)| p) {
            let Some((ancestor, overridden)) = nearest_overridden(model, class, property.name())
            else {
                continue;
            };
            let redefined_type = property.type_name();
            let overridden_type = overridden.type_name();
            if !model.type_conforms_to(&redefined_type, &overridden_type) {
                findings.push(PBmmValidityFinding::OverriddenPropertyNonConformance {
                    class: class.name().to_owned(),
                    property: property.name().to_owned(),
                    ancestor,
                    redefined_type,
                    overridden_type,
                });
            }
        }
    }
}

/// The nearest ancestor of `class` that declares `property` itself, with that
/// declaration.
///
/// `BMM_MODEL.all_ancestor_classes` walks breadth-first from the class, so the
/// first hit is the nearest declaring ancestor.
fn nearest_overridden<'a>(
    model: &'a BmmModel,
    class: &BmmClass,
    property: &str,
) -> Option<(String, &'a BmmProperty<BmmType>)> {
    model
        .all_ancestor_classes(class.name())
        .into_iter()
        .find_map(|ancestor| {
            let declared = model
                .class_definition(&ancestor)?
                .properties()?
                .values()
                .find(|candidate| candidate.name() == property)?;
            Some((ancestor, declared))
        })
}

#[cfg(test)]
mod tests {
    #![expect(
        clippy::panic_in_result_fn,
        reason = "the Book ch11 test shape: `?` propagates the read/model plumbing while the assertions ARE the test — an assertion panic is how these tests fail"
    )]
    use crate::v1_1::bmm_persistence::create_model::create_bmm_model;
    use crate::v1_1::bmm_persistence::error::PBmmReadError;
    use crate::v1_1::bmm_persistence::reader::read_schema;
    use crate::v1_1::bmm_persistence::validate::PBmmValidityFinding;
    use crate::v1_1::bmm_persistence::validate::validate_schema;

    /// Reads `src` and validates the model materialised from it.
    fn findings(src: &str) -> Result<Vec<PBmmValidityFinding>, PBmmReadError> {
        let schema = read_schema(src)?;
        let model = create_bmm_model(&schema)?;
        Ok(validate_schema(&schema, &model))
    }

    /// A schema whose one package lists `ParentType1` twice — the shape of the
    /// vendored fixture
    /// `tests/vendor/bmm/…/persistence/validation/duplicate_class.bmm`.
    const DUPLICATE_LISTING: &str = r#"
        bmm_version = <"2.4">
        rm_publisher = <"openehr">
        schema_name = <"duplicate_listing">
        rm_release = <"1.0.2">
        packages = <
            ["ParentPackage"] = <
                name = <"ParentPackage">
                classes = <"ParentType1", "ParentType1", "Any">
            >
        >
        class_definitions = <
            ["ParentType1"] = < name = <"ParentType1"> >
            ["Any"] = < name = <"Any"> >
        >
    "#;

    /// Two class definitions differing only in case, each listed in its own
    /// package — the minimal §Packages line-31 violation.
    const CASE_VARIANT_NAMES: &str = r#"
        bmm_version = <"2.4">
        rm_publisher = <"openehr">
        schema_name = <"case_variant_names">
        rm_release = <"1.0.2">
        packages = <
            ["org.openehr.first"] = <
                name = <"org.openehr.first">
                classes = <"Hashable", "Any">
            >
            ["org.openehr.second"] = <
                name = <"org.openehr.second">
                classes = <"HASHABLE">
            >
        >
        class_definitions = <
            ["Hashable"] = < name = <"Hashable"> >
            ["HASHABLE"] = < name = <"HASHABLE"> >
            ["Any"] = < name = <"Any"> >
        >
    "#;

    /// A child redefining an inherited `String` property as a non-conformant
    /// type — the shape of the vendored fixture
    /// `tests/vendor/bmm/…/persistence/validation/overridden_property_non_conformance.bmm`.
    const NON_CONFORMANT_OVERRIDE: &str = r#"
        bmm_version = <"2.4">
        rm_publisher = <"openehr">
        schema_name = <"non_conformant_override">
        rm_release = <"1.0.2">
        packages = <
            ["ParentPackage"] = <
                name = <"ParentPackage">
                classes = <"ParentType1", "ChildType1", "String", "Any">
            >
        >
        class_definitions = <
            ["ParentType1"] = <
                name = <"ParentType1">
                properties = <
                    ["property_1"] = (P_BMM_SINGLE_PROPERTY) <
                        name = <"property_1">
                        type = <"String">
                    >
                >
            >
            ["ChildType1"] = <
                name = <"ChildType1">
                ancestors = <"ParentType1", ...>
                properties = <
                    ["property_1"] = (P_BMM_SINGLE_PROPERTY) <
                        name = <"property_1">
                        type = <"ParentType1">
                    >
                >
            >
            ["String"] = < name = <"String"> >
            ["Any"] = < name = <"Any"> >
        >
    "#;

    /// A child narrowing an inherited property to a descendant type — the
    /// conformant twin of [`NON_CONFORMANT_OVERRIDE`].
    const CONFORMANT_OVERRIDE: &str = r#"
        bmm_version = <"2.4">
        rm_publisher = <"openehr">
        schema_name = <"conformant_override">
        rm_release = <"1.0.2">
        packages = <
            ["ParentPackage"] = <
                name = <"ParentPackage">
                classes = <"ParentType1", "ChildType1", "String", "Coded_string", "Any">
            >
        >
        class_definitions = <
            ["ParentType1"] = <
                name = <"ParentType1">
                properties = <
                    ["property_1"] = (P_BMM_SINGLE_PROPERTY) <
                        name = <"property_1">
                        type = <"String">
                    >
                >
            >
            ["ChildType1"] = <
                name = <"ChildType1">
                ancestors = <"ParentType1", ...>
                properties = <
                    ["property_1"] = (P_BMM_SINGLE_PROPERTY) <
                        name = <"property_1">
                        type = <"Coded_string">
                    >
                >
            >
            ["String"] = < name = <"String"> >
            ["Coded_string"] = <
                name = <"Coded_string">
                ancestors = <"String", ...>
            >
            ["Any"] = < name = <"Any"> >
        >
    "#;

    #[test]
    fn a_class_listed_twice_in_one_package_is_not_in_exactly_one_package()
    -> Result<(), PBmmReadError> {
        assert_eq!(
            findings(DUPLICATE_LISTING)?,
            [PBmmValidityFinding::ClassNotInExactlyOnePackage {
                class: "ParentType1".to_owned(),
                packages: ["ParentPackage".to_owned(), "ParentPackage".to_owned()].to_vec(),
            }]
        );
        Ok(())
    }

    #[test]
    fn two_definitions_differing_only_in_case_are_one_name() -> Result<(), PBmmReadError> {
        // §Naming Convention: "the class name "Hashable" refers to the same
        // class as "HASHABLE"", so §Packages line 31's uniqueness rule bites.
        let observed = findings(CASE_VARIANT_NAMES)?;
        assert!(
            observed.contains(&PBmmValidityFinding::ClassNameNotUnique {
                definitions: ["Hashable".to_owned(), "HASHABLE".to_owned()].to_vec(),
            }),
            "expected a name-collision finding, got {observed:?}"
        );
        Ok(())
    }

    #[test]
    fn a_non_conformant_redefinition_is_reported() -> Result<(), PBmmReadError> {
        assert_eq!(
            findings(NON_CONFORMANT_OVERRIDE)?,
            [PBmmValidityFinding::OverriddenPropertyNonConformance {
                class: "ChildType1".to_owned(),
                property: "property_1".to_owned(),
                ancestor: "ParentType1".to_owned(),
                redefined_type: "ParentType1".to_owned(),
                overridden_type: "String".to_owned(),
            }]
        );
        Ok(())
    }

    #[test]
    fn a_conformant_narrowing_redefinition_is_clean() -> Result<(), PBmmReadError> {
        assert_eq!(findings(CONFORMANT_OVERRIDE)?, []);
        Ok(())
    }

    #[test]
    fn every_finding_names_its_subject() -> Result<(), PBmmReadError> {
        let rendered = findings(NON_CONFORMANT_OVERRIDE)?
            .iter()
            .map(ToString::to_string)
            .collect::<Vec<_>>()
            .join("; ");
        assert!(rendered.contains("ChildType1"), "{rendered}");
        assert!(rendered.contains("property_1"), "{rendered}");
        Ok(())
    }
}