Skip to content

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

Open
faizollah wants to merge 3 commits into
mainfrom
13-improve-rocrate-usage
Open

faizollah wants to merge 3 commits 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

faizollah and others added 3 commits September 7, 2026 13:59
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.
Root conformsTo now lists the Process Run Crate profile alongside the FL
profile, with a Profile contextual entity for each as RO-Crate 1.2 requires.

Validating with rocrate-validator surfaced several defects, all fixed:
timestamps carried sub-second precision that failed ISO 8601 checks, the
model file had no encodingFormat, File entities had no contentSize, and
SoftwareApplication entities for the strategy and for dependencies outside
the known-frameworks map had no url. Version is now recorded as version
rather than softwareVersion, which the RO-Crate 1.2 profile requires.

The crate validates against ro-crate-1.2 at REQUIRED severity with no
issues. The example crate is regenerated to match.
Declare conformance to Process Run Crate and fix validation issues

@stain stain left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

suggest fixing the perma-ids

],
"conformsTo": [
{
"@id": "https://esciencelab.org.uk/federated-learning-ro-crate-profile/federated-learning-profile.html"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We need a permalink for this, it is not good to use an unversioned HTML page as a Profile, for instance we would then need to use <link> signposting in the HTML to upgrade it to a Profile Crate.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

what would you recommend for the permalink? presumably something under w3id/ro -
https://w3id.org/ro/fl-crate ?

I anticipated that the original version of the profile would need changes during flwrCrate implementation but it's been okay! so we probably can freeze the version now as 0.1

},
"license": [
{
"@id": "https://spdx.org/licenses/MIT.html"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

SPDX identifiers should not have .html but should match the identifiers in their RDF serialisations https://github.com/spdx/license-list-data e.g. https://github.com/spdx/license-list-data/blob/main/jsonld/MIT.jsonld defines http://spdx.org/licenses/MIT (note http and no .html)

"https://esciencelab.org.uk/federated-learning-ro-crate-profile/"
"federated-learning-profile.html"
)
PROCESS_RUN_CRATE = "https://w3id.org/ro/wfrun/process/0.5"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

https://w3id.org/ro/wfrun/process/0.6 has now been released, based on RO-Crate 1.3 but otherwise not changed.

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

3 participants