prov2ld
A lightweight Python script to convert PROV-JSON documents to PROV-JSONLD format according to the W3C PROV-JSONLD specification.
Report Bug
·
Request Feature
Requirements
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.
Linux
sudo apt install graphviz
MacOS
# Installing Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install graphviz
Windows
Installers are at the Download page of GraphViz.
Installation
pip install prov2ld
Basic Usage
1. Convert a file to Prov-JSONLD
python -m prov2ld input.json output.jsonld
# Basic example from the PROV-PRIMER
python -m prov2ld example/test_comprehensive.json example/test_comprehensive.jsonld
2. Convert Prov-JSONLD to Graph Visualization
python -m ld2viz input.jsonld output.png
# Or:
python -m prov2ld example/test_comprehensive.jsonld example/test_comprehensive.png
What Gets Converted?
Input (PROV-JSON)
{
"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"
}
}
}
Output (PROV-JSONLD)
{
"@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"
}
]
}
PROV Elements Supported
Core Elements
- Entities (
prov:Entity) - Activities (
prov:Activity) - Agents (
prov:Agent)
Relations
- 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
Additional Features
- Custom attributes with namespaces
- Typed values
- Language-tagged strings
- Time attributes (startTime, endTime, time)
- PROV bundles
- Roles, types, labels, and locations
Support
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
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
Metadata
Release files for prov2ld 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| prov2ld-0.0.2.tar.gz | 21.0 kB | Without provenance | Details for prov2ld-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| prov2ld-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for prov2ld-0.0.2-py3-none-any.whl |
Total release size: 42.9 kB
Release files / prov2ld-0.0.2.tar.gz
| Download URL | prov2ld-0.0.2.tar.gz |
|---|---|
| Size | 21.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b1e76948ba9c5050756696d1eb5d5a0182f372a7a5878c9b0cc33ce91f5d99ba
|
|
BLAKE2b-256 checksum How to use checksums |
f952c5b8a03251418ff8b5b32ca897ad784a2ca25fd1dc48b1bbd0c95bf66dfc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / prov2ld-0.0.2-py3-none-any.whl
| Download URL | prov2ld-0.0.2-py3-none-any.whl |
|---|---|
| Size | 21.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9a203ae6a77d192ffb36eca85c3eb8e6946f97392aaf740d40ef9cee6052950f
|
|
BLAKE2b-256 checksum How to use checksums |
a6d0041d81f250799876b03648e711ac0dd297b4a0f05e4a63cee01d5caf65e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Security for prov2ld 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.