Skip to content

Conversation

@douglowe
Copy link

This PR modifies the central do_entity_test function so that, when required, the RO-Crate will be loaded into an RDF Graph, and will be modified using a function supplied by the testing function.

The load_graph_and_preserve_relative_ids function is required because rdflib will change the root path when the graph is loaded, using the local file path if no other path is supplied. So this function replaces the new path with the load ./ root path.

I've not used SPARQL strings for these tests because (a) I don't understand SPARQL, and (b) ChatGPT was kind enough to supply some example python code instead which did the same work. I'm open to adapting this to accept SPARQL if it's felt this would be cleaner though.

@douglowe douglowe linked an issue Oct 21, 2025 that may be closed by this pull request
@douglowe douglowe self-assigned this Oct 21, 2025
if isinstance(obj, dict):
if "@id" in obj:
idv = obj["@id"]
if isinstance(idv, str) and (idv.startswith("./") or idv.startswith("../") or idv.startswith("#")):
Copy link

@elichad elichad Oct 21, 2025

Choose a reason for hiding this comment

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

This also needs to catch ids like data.csv (relative URIs which may not have ./ or / at the beginning)

Also there should not be ids beginning with ../ - this is forbidden in RO-Crate

Copy link

@elichad elichad Oct 22, 2025

Choose a reason for hiding this comment

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

Blank node: e.g. _:alice
Relative path: e.g. outputs/data.csv or data.csv or either of those with ./ or / at the start...
Local identifiers: #alice or alice

@elichad
Copy link

elichad commented Oct 22, 2025

We agreed on a Teams call that this is good enough to merge - the outstanding comments (#23 (comment),
#23 (comment)) still need attention but most tests will not be affected by them

@douglowe douglowe requested a review from elichad October 22, 2025 14:00
Co-authored-by: Eli Chadwick <eli.chadwick@manchester.ac.uk>
Copy link

@elichad elichad left a comment

Choose a reason for hiding this comment

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

LGTM, just need to appease the linter now

@douglowe
Copy link
Author

I've created a new issue for catching a wider range of relative URI's - so merging this PR into dev now.

@douglowe douglowe merged commit cce4652 into develop Oct 22, 2025
4 checks passed
elichad added a commit to nfdi4plants/rocrate-validator that referenced this pull request Nov 5, 2025
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.

Cleaner test inputs for RO-Crate Validator

3 participants