Skip to content

DLR-SC/prov2bigchaindb

Repository files navigation

PROV 2 BigchainDB

Introduction

PyPI version Documentation Status Build Status Coverage Status Updates

This python module provides three different clients to store W3C-PROV documents into a federation of BigchainDB nodes. All clients are implemented with respect to the proposed concepts from the masters thesis Trustworthy Provenance Recording using a blockchain-like database.

See full documentation at: prov2bigchaindb.readthedocs.io

Software Requirements

  • Python 3.5 or Python 3.6
  • Python development libraries
  • GCC and Make
  • A local rethinkdb server

Installation

PyPi

Install it by running:

pip install prov2bigchaindb

You can view prov2bigchaindb on PyPi's package index

Source

# Clone project
git clone [email protected]:DLR-SC/prov2bigchaindb.git
cd prov2bigchaindb

# Setup virtual environment
python -m venv env
source env/bin/activate

# Install dependencies and package into virtual enviroment
make setup

Usage

DocumentConceptClient

from prov2bigchaindb.tests.core import setup_test_files
from prov2bigchaindb.core import utils, clients

test_prov_files = setup_test_files()
prov_document = utils.to_prov_document(content=test_prov_files["simple2"])
doc_client = clients.DocumentConceptClient(account_id="ID", host="127.0.0.1", port=9984)

# Store a document
tx_id = doc_client.save_document(prov_document)

# Retrieve a document
doc = doc_client.get_document(tx_id)

GraphConceptClient

from prov2bigchaindb.tests.core import setup_test_files
from prov2bigchaindb.core import utils, clients

test_prov_files = setup_test_files()
prov_document = utils.to_prov_document(content=test_prov_files["simple2"])
graph_client = clients.GraphConceptClient(host="127.0.0.1", port=9984)

# Store a document
tx_ids = graph_client.save_document(prov_document)

# Retrieve a document
doc = graph_client.get_document(tx_ids)

RoleConceptClient

from prov2bigchaindb.tests.core import setup_test_files
from prov2bigchaindb.core import utils, clients

test_prov_files = setup_test_files()
prov_document = utils.to_prov_document(content=test_prov_files["simple2"])
role_client = clients.RoleConceptClient(host="127.0.0.1", port=9984)

# Store a document
tx_ids = role_client.save_document(prov_document)

# Retrieve a document
doc = role_client.get_document(tx_ids)

License

See LICENSE file