Skip to content

Conversation

@elichad
Copy link

@elichad elichad commented Dec 8, 2025

# Rule sh:severity
1 ro-crate-metadata.json MUST conform to RO-Crate 1.2 or a later minor version. sh:Violation
2 @context MUST be "https://w3id.org/ro/crate/1.2-DRAFT/context" (i) sh:Violation

(i) expanded to support 1.2-DRAFT, 1.2, or later minor version, to align with the other rule.

Adds a few example crates with variations on the @context, because this can't be modified with SPARQL.

Includes a workaround for crs4#126 (which means the conformsTo check in the 1.1 profile is unskippable) - by disabling reporting of inherited profile checks when checking the valid 5s crates. I think this is ok as we really only need to test that the five-safes-crates profile is working, not the inherited ones. no longer applicable

Also deactivates the conformsTo check in the 1.1 profile so it doesn't interfere.

@elichad
Copy link
Author

elichad commented Dec 9, 2025

Will update to deactivate the troublesome shapes with sh:deactivated (as in https://book.validatingrdf.com/bookHtml011.html#sec134 )

@elichad
Copy link
Author

elichad commented Dec 9, 2025

Done, ready for review

except Exception as e:
if logger.isEnabledFor(logging.DEBUG):
logger.exception(e)
return True

Choose a reason for hiding this comment

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

Do we want to pass the validation if there is an issue with the metadata. What I mean is that we can't tell if the exception is:

  1. from an issue with the libraries / code,
  2. or the metadata file,

e.g. if the validated file has an issue such that as_dict fails, the validation might still pass

Copy link
Author

@elichad elichad Dec 10, 2025

Choose a reason for hiding this comment

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

The base profile has a few checks for this sort of thing - valid JSON-LD, flattened & compacted, has a @graph, etc. If as_dict fails, it'll trigger one of those. See https://github.com/crs4/rocrate-validator/blob/dfe0136517196802b0a976e54da3f84a572780b6/rocrate_validator/profiles/ro-crate/must/0_file_descriptor_format.py#L64



@requirement(name="RO-Crate context version")
class FileDescriptorExistence(PyFunctionCheck):

Choose a reason for hiding this comment

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

Super minor issue but this isn't really the purpose of the class / method below - could be renamed more appropriately :-) e..g. ROCrateContextVersion

Copy link
Author

Choose a reason for hiding this comment

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

ah my lazy copy-pasting has caught me out :)

Copy link
Author

Choose a reason for hiding this comment

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

fixed

"""
try:
json_dict = context.ro_crate.metadata.as_dict()
context_value = json_dict["@context"]

Choose a reason for hiding this comment

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

I'd maybe add a if not context_value check for safety here if context is missing, None or empty :-) and add an issue

Copy link
Author

Choose a reason for hiding this comment

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

@elichad elichad merged commit b190409 into develop Dec 10, 2025
4 checks passed
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.

3 participants