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

validate passes geom:kernel_type when pds:kernel_type is required #1025

Closed
rchenatjpl opened this issue Oct 9, 2024 · 2 comments
Closed
Assignees
Labels
bug Something isn't working invalid This doesn't seem right needs:triage

Comments

@rchenatjpl
Copy link
Contributor

rchenatjpl commented Oct 9, 2024

Checked for duplicates

No - I haven't checked

🐛 Describe the bug

This is a by-product of testing IM#797. lddtool now creates a GEOM dict that has

  <xs:complexType name="SPICE_Kernel_Identification">
    <xs:sequence>
      <xs:element name="kernel_type" type="pds:kernel_type" minOccurs="0" maxOccurs="1"> </xs:element>

Notice pds:kernel_type, not geom:kernel_type. Validate passes the attached u5.xml despite:

                    <geom:SPICE_Kernel_Identification>
                        <geom:kernel_type>SPK</geom:kernel_type>

🕵️ Expected behavior

I expected validate to WARN or ERR for input file u5.xml's geom:kernel_type

📜 To Reproduce

  1. % validate -x PDS4_PDS_1M00.xsd PDS4_GEOM_1M00_1970.xsd -S PDS4_PDS_1M00.sch PDS4_GEOM_1M00_1970.sch -t u5.xml
    PDS Validate Tool Report
    Configuration:
    Version 3.6.0-SNAPSHOT
    Date 2024-10-09T17:39:33Z
    Parameters:
    Targets [file:/Users/rchen/Desktop/797/u5.xml]
    User Specified Schemas [file:/Users/rchen/Desktop/797/PDS4_PDS_1M00.xsd, file:/Users/rchen/Desktop/797/PDS4_GEOM_1M00_1970.xsd]
    User Specified Schematrons [file:/Users/rchen/Desktop/797/PDS4_PDS_1M00.sch, file:/Users/rchen/Desktop/797/PDS4_GEOM_1M00_1970.sch]
    Severity Level WARNING
    Recurse Directories true
    File Filters Used [*.xml, *.XML]
    Data Content Validation on
    Product Level Validation on
    Max Errors 100000
    Registered Contexts File /Users/rchen/PDS4tools/validate/resources/registered_context_products.json
    Product Level Validation Results
    PASS: file:/Users/rchen/Desktop/797/u5.xml
    1 product validation(s) completed
    Summary:
    1 product(s)
    0 error(s)
    0 warning(s)
    Product Validation Summary:
    1 product(s) passed
    0 product(s) failed
    0 product(s) skipped
    1 product(s) total
    Referential Integrity Check Summary:
    0 check(s) passed
    0 check(s) failed
    0 check(s) skipped
    0 check(s) total
    End of Report
    Completed execution in 2151 ms
    ...

🖥 Environment Info

  • Version of this software [e.g. vX.Y.Z]
  • Operating System: [e.g. MacOSX with Docker Desktop vX.Y]
    ...

📚 Version of Software Used

No response

🩺 Test Data / Additional context

797.zip

🦄 Related requirements

🦄 #xyz

⚙️ Engineering Details

No response

🎉 Integration & Test

No response

@al-niessner
Copy link
Contributor

@jordanpadams

This problem is beyond validate so need guidance. Using xmllint the schema and schematron fail as expected (failure is from schema not schematron):

$ xmllint --noout --schema PDS4_GEOM_1M00_1970.xsd --schema PDS4_PDS_1M00.xsd --schematron PDS4_GEOM_1M00_1970.sch --schematron PDS4_PDS_1M00.sch u5.xml 
u5.xml validation generated an internal error
u5.xml:84: element Geometry: Schemas validity error : Element '{http://pds.nasa.gov/pds4/geom/v1}Geometry': No matching global element declaration available, but demanded by the strict wildcard.
u5.xml fails to validate

Modified schema and schematron to verify that we are using the ones provided by the user, and it appears as we are. For the schematron, the check is pretty simple because I can add a comment to it and see it easily in the code. The schema is trickier but followed it via the debugger up to having the schema validation check it and it appears to be the one supplied via the command line (object ids remain constant). If I got it right, it means that this is deficiency in apache.xerces code doing the work. We are at the latest version of apache.xerces which was last updated in 2022.

This is a general weakness for validate. How do you want to approach it? I am leaning toward - but cannot say with any certainty that it can be done - using xmllint in the background and if it fails and we do not then give a general warning/error that xmllint was unhappy but the java libraries we use are not sophisticated enough to detect these errors. Lets the user know there is a failure and how to find/isolate it but keeps us from going down the rabbit hole to play with the queen of hearts. Bad part, user has to install xmllint on their platform.

@jordanpadams
Copy link
Member

@al-niessner you can ignore this issue.

@rchenatjpl see NASA-PDS/pds4-information-model#797. This was an IM bug, not a validate bug

@jordanpadams jordanpadams added the invalid This doesn't seem right label Oct 18, 2024
@github-project-automation github-project-automation bot moved this from ToDo to 🏁 Done in EN Portfolio Backlog Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working invalid This doesn't seem right needs:triage
Projects
Status: 🏁 Done
Development

No branches or pull requests

3 participants