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

Evaluate ro-crate support #3

Open
joshmoore opened this issue Feb 10, 2023 · 0 comments
Open

Evaluate ro-crate support #3

joshmoore opened this issue Feb 10, 2023 · 0 comments

Comments

@joshmoore
Copy link
Member

joshmoore commented Feb 10, 2023

Thinking again about @jburel's comments which I likely just misunderstood, I could see having ro-crate a input format. (That might suggest using https://ome.github.io/ome-zarr-catalog?rocrate=.... but that's likely getting ahead of ourselves.

This code:
from rocrate.rocrate import ROCrate
from rocrate.model.person import Person

crate = ROCrate()


owner = "https://orcid.org/0000-0000-0000-0000"
owner = crate.add(Person(crate, owner, properties={
    "name": "Alice Doe",
    "affiliation": "University of Flatland"
}))
zarr = crate.add_file(
    "https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0048A/9846151.zarr/",
    properties={
        "name": "test",
        "encodingFormat": "x-zarr"  # TBD
        # see: https://github.com/zarr-developers/zarr-specs/issues/123
})
zarr["author"] = owner
crate.write("example")

using the python library produces

this ro-crate
{
    "@context": "https://w3id.org/ro/crate/1.1/context",
    "@graph": [
        {
            "@id": "./",
            "@type": "Dataset",
            "datePublished": "2023-02-10T20:18:48+00:00",
            "hasPart": [
                {
                    "@id": "https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0048A/9846151.zarr/"
                }
            ]
        },
        {
            "@id": "ro-crate-metadata.json",
            "@type": "CreativeWork",
            "about": {
                "@id": "./"
            },
            "conformsTo": {
                "@id": "https://w3id.org/ro/crate/1.1"
            }
        },
        {
            "@id": "https://orcid.org/0000-0000-0000-0000",
            "@type": "Person",
            "affiliation": "University of Flatland",
            "name": "Alice Doe"
        },
        {
            "@id": "https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0048A/9846151.zarr/",
            "@type": "File",
            "author": {
                "@id": "https://orcid.org/0000-0000-0000-0000"
            },
            "encodingFormat": "x-zarr",
            "name": "test"
        }
    ]
}

(albeit in a subdirectory). The primary downside I see to the format would be that raw calling code would need to loop through all keys and check for the right type. That may be sufficiently handled, though, by there being a library: https://www.npmjs.com/package/ro-crate

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

No branches or pull requests

1 participant