-
Notifications
You must be signed in to change notification settings - Fork 0
18 cleaner test inputs for ro crate validator #23
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
18 cleaner test inputs for ro crate validator #23
Conversation
| if isinstance(obj, dict): | ||
| if "@id" in obj: | ||
| idv = obj["@id"] | ||
| if isinstance(idv, str) and (idv.startswith("./") or idv.startswith("../") or idv.startswith("#")): |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
|
We agreed on a Teams call that this is good enough to merge - the outstanding comments (#23 (comment), |
Co-authored-by: Eli Chadwick <eli.chadwick@manchester.ac.uk>
elichad
left a comment
There was a problem hiding this 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
|
I've created a new issue for catching a wider range of relative URI's - so merging this PR into dev now. |
This PR modifies the central
do_entity_testfunction 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_idsfunction 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.