Closed bulricht closed 1 year ago
To indicate that the crate follows a certain profile, add an entry to the root dataset's conformsTo
:
from rocrate.rocrate import ROCrate
from rocrate.model.contextentity import ContextEntity
PC_PROFILE_ID = "https://w3id.org/ro/wfrun/process/0.1"
pc_profile = crate.add(ContextEntity(crate, PC_PROFILE_ID, properties={
"@type": "CreativeWork",
"name": "Process Run Crate",
"version": "0.1"
}))
crate.root_dataset["conformsTo"] = pc_profile
Ok, good to see how that works. I've come up with something similar now:
from rocrate.rocrate import ROCrate
from rocrate.model.contextentity import ContextEntity
crate = ROCrate()
profile = crate.add(
ContextEntity(
crate,
identifier="<my_profile_uri>",
properties={
"@type": "CreativeWork",
"name": "<my_profile_name>",
"version": "0.1.0"
},
)
)
crate.metadata["conformsTo"] = [
{"@id": crate.metadata["conformsTo"]},
profile
]
crate.write(".")
Shouldn't the profile go into the metadata
instead of the root_dataset
? cfr. https://github.com/ResearchObject/ro-crate/blob/master/docs/1.2-DRAFT/profiles.md
Shouldn't the profile go into the
metadata
instead of theroot_dataset
?
I's recently been agreed to move them to the root dataset, except for the main RO-Crate spec itself, which stays in the metadata descriptor. However, the pull request hasn't been merged yet: https://github.com/ResearchObject/ro-crate/pull/229. See the Process Run Crate example, which is already adhering to the new convention.
Ok, thanks!
Hi, I'm looking for a way to add a custom profile to an ro-crate. Something like
crate.conforms_to("<my_profile_uri>")
. Is something like that under development somewhere? Otherwise I could raise a PR with my local edits.Thanks!