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

Support detached crates #119

Merged
merged 8 commits into from
May 13, 2022
Merged

Support detached crates #119

merged 8 commits into from
May 13, 2022

Conversation

simleo
Copy link
Collaborator

@simleo simleo commented Apr 6, 2022

Fixes #34.

See ResearchObject/ro-crate#189, but note that the current spec already allows a root data entity id other than ./ (see #34).

Changes the find_root_entity_id method to support the general case where the metadata descriptor @id is an absolute URIs whose last path segment is ro-crate-metadata.json[ld]. Despite being able to handle a more general situation, the new implementation is actually much simpler and more efficient in the "standard" case of an attached RO-Crate, where the metadata descriptor @id is ro-crate-metadata.json[ld]: in this case, the search ends with an O(1) lookup on the existing entity map. If this fails, it looks for candidate URIs whose last path segment is ro-crate-metadata.json[ld]. If there are no candidates, it raises a KeyError; if there's only one candidate, it's selected as the metadata entity; if there's more than one, it tries to filter out those that don't satisfy all constraints (e.g., type is not CreativeWork). If there's still more than one candidate, it issues a warning and picks one using a heuristic.

@simleo
Copy link
Collaborator Author

simleo commented May 13, 2022

Discussed at yesterday's RO-Crate meeting: agreed to issue a warning before trying to make a choice with a heuristic when there is more than one good candidate.

@simleo simleo merged commit 9c01065 into master May 13, 2022
@simleo simleo deleted the detached_crate branch May 13, 2022 14:48
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.

Support for non-slash root data entity
1 participant