Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added geom:kernel_type validation rule #807

Merged
merged 3 commits into from
Aug 23, 2024

Conversation

jshughes
Copy link
Collaborator

@jshughes jshughes commented Aug 15, 2024

Added a validation rule for geom:kernel_type as a fix for the issue: GEOM LDD schematron rules are not executing as expected <kernel_type> validation #797

🗒️ Summary

Added the geom:kernel_type validation rule to the common dictionary so that it is available for writing to the geom schematron file during LDDTool processing of the Geo Ingest_LDD. The rule is:

sch:pattern
<sch:rule context="geom:SPICE_Kernel_Identification/geom:kernel_type">
<sch:assert test=". = ('CK', 'DBK', 'DSK', 'EK', 'FK', 'IK', 'LSK', 'MK', 'PCK', 'SCLK', 'SPK')">
<title>geom:SPICE_Kernel_Identification/geom:kernel_type/kernel_type</title>
The attribute geom:SPICE_Kernel_Identification/geom:kernel_type must be equal to one of the following values 'CK', 'DBK', 'DSK', 'EK', 'FK', 'IK', 'LSK', 'MK', 'PCK', 'SCLK', 'SPK'.</sch:assert>
</sch:rule>
</sch:pattern>

This issue was caused by a failure to expose attributes in the Common schema that are referenced in Ingest_LDD files. The references are formulated like pds., for example pds:kernel_type, pds:name, pds:comment, etc. The attribute pds:kernel_type is the only attribute that is enumerated.

There are several fixes to the problem, each with its own impact.

  1. Simply add the rule to check the geom:kernel_type. This only solves the problem for kernel_type.

  2. Expose the referenced attributes in the common schema. This was the original intent from V1.0 were it was suggested to expose all common attributes. The DDWG voted not to expose all the attributes but to request them as needed.
    The expected result is that the geom schema references the attributes in the common schema using "ref:" instead of defining them locally.
    The current impact is a significant set of "cosmetic" differences in the geom schema file, for example:

     	         <xs:element ref="pds:comment" minOccurs="0" maxOccurs="1"> </xs:element>
     	         		-versus-
     	         <xs:element name="comment" type="pds:comment" minOccurs="0" maxOccurs="1"> </xs:element>
     	         
     	  This occurs over 20 times in the current geom LDD.
    
  3. Add a validation routine to check that all referenced pds: attributes are exposed.
    The impact here is that if the common attributes are not exposed then warning messages are written to the log file. Again, over 20 messages would be written.

As a path forward and to minimize surprise, this pull request only implements option 1. The plan is to submit an SCR for DDWG discussion to determine whether option 2 and/or 3 should be considered. It seems reasonable to at least implement option 3.

⚙️ Test Data and/or Report

The test files are attached below. The schema locations will need to be updated for the testing environment. The previous versions of the .xsd and .sch files are provided for diff checking.

Resolves #797 #799

Try3_Option_1.zip

Copy link
Member

@jordanpadams jordanpadams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jshughes I noticed we have both of these rules output, is that expected?

  <sch:pattern>
    <sch:rule context="geom:SPICE_Kernel_Identification/geom:kernel_type">
      <sch:assert test=". = ('CK', 'DBK', 'DSK', 'EK', 'FK', 'IK', 'LSK', 'MK', 'PCK', 'SCLK', 'SPK')">
        <title>geom:SPICE_Kernel_Identification/geom:kernel_type/kernel_type</title>
        The attribute geom:SPICE_Kernel_Identification/geom:kernel_type must be equal to one of the following values 'CK', 'DBK', 'DSK', 'EK', 'FK', 'IK', 'LSK', 'MK', 'PCK', 'SCLK', 'SPK'.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <!-- ... -->
  <sch:pattern>
    <sch:rule context="geom:SPICE_Kernel_Identification/pds:kernel_type">
      <sch:assert test=". = ('CK', 'DBK', 'DSK', 'EK', 'FK', 'IK', 'LSK', 'MK', 'PCK', 'SCLK', 'SPK')">
        <title>geom:SPICE_Kernel_Identification/pds:kernel_type/pds:kernel_type</title>
        The attribute geom:SPICE_Kernel_Identification/pds:kernel_type must be equal to one of the following values 'CK', 'DBK', 'DSK', 'EK', 'FK', 'IK', 'LSK', 'MK', 'PCK', 'SCLK', 'SPK'.</sch:assert>
    </sch:rule>
  </sch:pattern>

@jshughes
Copy link
Collaborator Author

jshughes commented Aug 23, 2024

The pds:kernel_type rule is automatically generated since pds.kernel_type is referenced in the Ingest_LDD. The plan is to add code to cull the unused rule(s), if necessary, after the DDWG resolves the issues in (https://github.com/NASA-PDS/PDS4-CCB/issues/44)

@jordanpadams jordanpadams merged commit 910a2ae into main Aug 23, 2024
3 checks passed
@jordanpadams jordanpadams deleted the 240814_Add_geom_kernel_type_validation_rule branch August 23, 2024 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GEOM LDD schematron rules are not executing as expected <kernel_type> validation
2 participants