# of DD_Rule_Statements w/in a DD_Rule

I was mapping backwards from this legacy Schematron file to LDD and was wondering, is there best practice/guidance for having multiple DD_Rule_Statements within a DD_Rule? The Schematron file has more than one assertion per Rule, so based on the below schema, my assumption is that repeating multiple DD_Rule_Statements within a DD_Rule would be fine (instead of creating a whole new DD_Rule with more enumerations of the same attribute/class to accommodate the second statement). Is this doable?Schema_DD_Rule

That should be fine, if the context is the same. For example I have something similar:


    <DD_Rule>
        <local_identifier>mixs_rules</local_identifier>
        <rule_context>/pds:Product_Observational/pds:Observation_Area[pds:Observing_System/pds:Observing_System_Component/pds:name = 'MIXS']</rule_context>
        
        <DD_Rule_Statement>
            <rule_type>Assert</rule_type>
            <rule_test>pds:Observing_System/pds:Observing_System_Component/pds:Internal_Reference/pds:lid_reference = 'urn:esa:psa:context:instrument:mixs.mpo'</rule_test>
            <rule_message>The instrument context LID for MIXS must be: urn:esa:psa:context:instrument:mixs.mpo</rule_message>
            <rule_description>Test for instrument context reference</rule_description>
        </DD_Rule_Statement>
        
        <DD_Rule_Statement>
            <rule_type>Assert</rule_type>
            <rule_test>pds:Mission_Area/psa:Sub-Instrument/psa:identifier = ('MIXS-T', 'MIXS-C')</rule_test>
            <rule_message>Sub-instrument for MIXS must be MIXS-T or MIXS-C</rule_message>
            <rule_description>Test for MIXS sub-instruments</rule_description>
        </DD_Rule_Statement>
        
        <DD_Rule_Statement>
            <rule_type>Assert</rule_type>
            <rule_test>tokenize(parent::*/pds:Identification_Area/pds:logical_identifier,':')[4] = 'bc_mpo_mixs'</rule_test>
            <rule_message>MIXS bundles must have a bundle identifier bc_mpo_mixs</rule_message>
            <rule_description>
                This rule enforces bundle naming for Bepi
            </rule_description>
        </DD_Rule_Statement>
    </DD_Rule>

Note that here the last rule has to jump back to the parent class for the comparison - I could have also made a new rule with a separate context, but wanted to group these related checks together.

2 Likes

@msbentley Okay, awesome. Thanks so much for your detailed response/example. Really appreciate it!