Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 isro-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
isro-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 isro-crate-metadata.json[ld]
. If there are no candidates, it raises aKeyError
; 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 notCreativeWork
). If there's still more than one candidate, it issues a warning and picks one using a heuristic.