A lightweight Python script to convert PROV-JSON documents to PROV-JSONLD format according to the W3C PROV-JSONLD specification.
Report Bug
·
Request Feature
For the ld2viz command, the library requires the GraphViz suite. For everything to correctly work, this module has to be installed.
We reference both the installation section on their docs, as well as the main ways to install it.
sudo apt install graphviz# Installing Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install graphvizInstallers are at the Download page of GraphViz.
pip install prov2ldpython -m prov2ld input.json output.jsonld
# Basic example from the PROV-PRIMER
python -m prov2ld example/test_comprehensive.json example/test_comprehensive.jsonldpython -m ld2viz input.jsonld output.png
# Or:
python -m prov2ld example/test_comprehensive.jsonld example/test_comprehensive.png{
"prefix": {
"ex": "http://example.org/",
"prov": "http://www.w3.org/ns/prov#"
},
"entity": {
"ex:e1": {}
},
"activity": {
"ex:a1": {}
},
"wasGeneratedBy": {
"_:gen1": {
"prov:entity": "ex:e1",
"prov:activity": "ex:a1"
}
}
}{
"@context": [
{
"ex": "http://example.org/",
"prov": "http://www.w3.org/ns/prov#"
},
"https://openprovenance.org/prov-jsonld/context.json"
],
"@graph": [
{
"@type": "prov:Entity",
"@id": "ex:e1"
},
{
"@type": "prov:Activity",
"@id": "ex:a1"
},
{
"@type": "prov:Generation",
"@id": "_:gen1",
"entity": "ex:e1",
"activity": "ex:a1"
}
]
}- Entities (
prov:Entity) - Activities (
prov:Activity) - Agents (
prov:Agent)
- Generation (
prov:Generation) -wasGeneratedBy - Usage (
prov:Usage) -used - Communication (
prov:Communication) -wasInformedBy - Start (
prov:Start) -wasStartedBy - End (
prov:End) -wasEndedBy - Invalidation (
prov:Invalidation) -wasInvalidatedBy - Derivation (
prov:Derivation) -wasDerivedFrom - Attribution (
prov:Attribution) -wasAttributedTo - Association (
prov:Association) -wasAssociatedWith - Delegation (
prov:Delegation) -actedOnBehalfOf - Influence (
prov:Influence) -wasInfluencedBy - Specialization (
provext:Specialization) -specializationOf - Alternate (
provext:Alternate) -alternateOf - Membership (
provext:Membership) -hadMember
- Custom attributes with namespaces
- Typed values
- Language-tagged strings
- Time attributes (startTime, endTime, time)
- PROV bundles
- Roles, types, labels, and locations
This converter implements the PROV-JSONLD specification from: Moreau, L., & Huynh, T. D. (2021). The PROV-JSONLD Serialization
For questions about PROV itself, see:
- PROV Overview
- PROV-DM Specification
- PROV-O Ontology
- PROV-JSON Submission
- JSON-LD 1.1 Specification
- PROV-JSONLD Context
Contributions are welcome! Please feel free to submit issues or pull requests.