NASA-PDS / pds4-information-model

The software tools and data necessary for generating the Information Model including PDS4 ontology, data, and information model.
https://nasa-pds.github.io/pds4-information-model/
Other
9 stars 6 forks source link

lddtool does not generate the correct closing tag for rule_type = Report #667

Closed msbentley closed 9 months ago

msbentley commented 10 months ago

Checked for duplicates

Yes - I've already checked

πŸ› Describe the bug

When including a rule_type of Report in an ingest file, the output Schematron is invalid because the opening tag is but the closing tag is </sch:assert>.

πŸ•΅οΈ Expected behavior

I expected LDDTool to use both opening and closing tags for a given rule with report or assert, as appropriate.

πŸ“œ To Reproduce

Create a rule with rule_type report, e.g.

    <DD_Rule>    
        <local_identifier>label_file_version</local_identifier>
        <rule_context>/pds:Product_Observational/pds:Identification_Area</rule_context>
        <rule_assign>name="file-name" value="replace(tokenize(document-uri(/), '/')[last()],'\.[^.]+$','')"</rule_assign>

        <DD_Rule_Statement>
            <rule_type>Report</rule_type>
            <rule_test>
                contains($file-name, '__')
            </rule_test>
            <rule_message>
                Label filename (&lt;sch:value-of select="$file-name"/&gt;) must contain the version ID in the format __[major]_[minor].xml|lblx, and no "__" detected here
            </rule_message>
            <rule_description>Look for double-underscore</rule_description>
        </DD_Rule_Statement>

Inspect the generated schematron and note:

  <sch:pattern>
    <sch:rule context="/pds:Product_Observational/pds:Identification_Area">
      <sch:let name="file-name" value="replace(tokenize(document-uri(/), '/')[last()],'\.[^.]+$','')"/>
      <sch:report test="
                contains($file-name, '__')
            ">
       <title>/pds:Product_Observational/pds:Identification_Area/Rule</title>

                Label filename (<sch:value-of select="$file-name"/>) must contain the version ID in the format __[major]_[minor].xml|lblx, and no "__" detected here
            </sch:assert>

which is invalid since the closing report tag should is missing (instead it's assert).

πŸ–₯ Environment Info

πŸ“š Version of Software Used

14.2.4

🩺 Test Data / Additional context

No response

πŸ¦„ Related requirements

πŸ¦„ #xyz

βš™οΈ Engineering Details

No response