Skip to content

Improve utilisation of ro-crate-py features - #22

Open
faizollah wants to merge 1 commit into
mainfrom
13-improve-rocrate-usage
Open

Improve utilisation of ro-crate-py features#22
faizollah wants to merge 1 commit into
mainfrom
13-improve-rocrate-usage

Conversation

@faizollah

@faizollah faizollah commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Addresses all three suggestions in the issue.

  1. Person helper_person() now builds rocrate.model.Person instead of a ContextEntity with a hand-written "@type": "Person".

  2. append_to — root and entity properties (conformsTo, license, author, mentions, additionalProperty) are linked with append_to rather than direct assignment, so existing values are preserved. The instrument/object/result/metric lists now collect entities directly instead of hand-built {"@id": ...} dicts — the library converts them to references.

  3. add_action — the #fl-run CreateAction is built with crate.add_action(...), which sets the @type and takes instrument/object/result as arguments (its own empty-value guards replace the manual if checks).

Closes #13

Replace hand-built JSON-LD references with the library's own APIs:
- add people via rocrate.model.Person instead of a ContextEntity with a
  manual @type
- link root and entity properties with append_to, which preserves existing
  values instead of overwriting them
- build the CreateAction with crate.add_action, which sets the @type and
  takes instrument/object/result directly

Root author, conformsTo and license are now arrays rather than single
values, which is valid JSON-LD and is what append_to produces; three test
assertions and the committed example crate are updated to match.
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.

Improve utilisation of ro-crate-py (rocrate) features

1 participant