Giter Site home page Giter Site logo

kleio's Introduction

Kleio

Build Status License Latest Release Downloads

A python library for W3C Provenance Data Model supporting PROV-O.

Kleio is free software released under the MIT license.

Features

  • An implementation of the W3C PROV Data Model in Python
  • Supports serialization and deserialization as PROV-O in RDF/XML, Turtle, TriG, N3, NTriples, and JSON-LD formats
  • Supports provenance-of-provenance (PROV bundles) via named graphs
  • Built using RDFlib

Getting Started

Kleio can be installed from PyPI using the pip installer:

$ pip install kleio

From kleio use the prov module to generate PROV records and output PROV-O.

from kleio import prov

prov.ns("test", "http://tw.rpi.edu/ns/test#")

entity = prov.Entity("test:entity")
entity.set_label("example entity")

activity = prov.Activity("test:activity")
activity.set_label("example activity")

entity.set_was_generated_by(activity)
print(prov.serialize(format="turtle"))

output:

@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix test: <http://tw.rpi.edu/ns/test#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<test:activity> a prov:Activity ;
    rdfs:label "example activity" ;
    prov:generated <test:entity> ;
    prov:influenced <test:entity> .

<test:entity> a prov:Entity ;
    rdfs:label "example entity" ;
    prov:wasGeneratedBy <test:activity> ;
    prov:wasInfluencedBy <test:activity> .

Kleio can also be used to load and update existing PROV-O records.

from kleio import prov

# load the existing PROV-O graph
prov.graph.load("load-example.ttl", format="turtle")

# get a reference to the existing entity with id="test:entity"
entity = prov.Entity("test:entity")

# ... update entity ...

Support

More information is available on the project webpage:

https://github.com/tetherless-world/kleio

Continuous integration status details available from Travis CI:

https://travis-ci.org/tetherless-world/kleio

The documentation can be built by doing:

$ python setup.py build_sphinx

And is also available from ReadTheDocs:

http://kleio.readthedocs.org/en/latest

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.