ResearchObject / ro-crate-py

Python library for RO-Crate
https://pypi.org/project/rocrate/
Apache License 2.0
46 stars 23 forks source link

Add method to include additional contexts at the top level #160

Closed jmfernandez closed 11 months ago

jmfernandez commented 1 year ago

Right now, it is possible to add additional terms from other contexts to the top level contexts through the attached Metadata instance, using the extra_terms dictionary:

a_crate = ROCrate(gen_preview=False)
a_crate.metadata.extra_terms.update(
    {
        "sha256": "https://w3id.org/ro/terms/workflow-run#sha256"
    }
)

which leads to

{
    "@context": [
        "https://w3id.org/ro/crate/1.1/context",
        {
            "sha256": "https://w3id.org/ro/terms/workflow-run#sha256"
        }
    ],
    "@graph": [

but there is no method nor provision in the current implementation to add additional contexts, in order to get something like:

{
    "@context": [
        "https://w3id.org/ro/crate/1.1/context",
        "https://w3id.org/ro/terms/workflow-run"
    ],
    "@graph": [

Could you add such method, please?

jmfernandez commented 11 months ago

Thanks!