Skip to main content

Python library for interacting with the OriginTrail Decentralized Knowledge Graph

Project description



Python SDK Banner

dkg.py

Python SDK for interacting with the OriginTrail Decentralized Knowledge Graph
OriginTrail Docs · View Demo · Report Bug · Request Feature


Disclaimer: Beta Version

Welcome to the beta version of our client! This software is currently in the beta testing phase, which means it is not the final release version. As a beta version, it may still contain bugs, undergo frequent updates, and have limited features. Important Points to Note:

Use at Your Own Risk: While we have made efforts to ensure the stability and reliability of the beta version, there is a possibility of encountering unexpected issues. Please use this software at your own risk.

Limited Support: As this is a beta release, our support resources may be focused on addressing critical bugs and gathering feedback from users. Therefore, support for beta versions may be limited compared to our stable releases.

Feedback Appreciated: Your feedback is invaluable to us. If you encounter any issues, have suggestions, or want to share your experiences with the beta version, please let us know. Your feedback will help us improve the software for the final release.

Not for Production Use: The beta version is intended for testing and evaluation purposes only. It is not recommended for use in a production environment where stability and reliability are crucial.


Table of Contents
  1. 📚 About The Project
  2. 🚀 Getting Started
  3. 📜 Roadmap
  4. 📄 License
  5. 🤝 Contributing
  6. ❤️ Contributors
  7. 🌟 Acknowledgements
  8. 📰 Social Media


📚 About The Project

What is a Decentralized Knowledge Graph?


Knowledge Asset

There are many available definitions of a knowledge graph, therefore we will present a simplified one focused on usability, rather than completeness. The purpose of this introduction is not to be a comprehensive guide for knowledge graphs, however it aims to get you started with the basics.

A Knowledge Graph (KG) is a complex structure that maps the connections and relationships among various entities - be they physical, digital, event-based, or conceptual. Commonly represented as semantic networks, these graphs are leveraged by major corporations such as Amazon, Google, Uber, and IBM for a wide array of applications, including search, data integration, knowledge reasoning, recommendation engines, analytics, and diverse facets of machine learning and artificial intelligence.

Key characteristics of knowledge graphs include:

  • Prioritization of data connections, treating them as "first-class citizens" within the realm of linked data.
  • Designed to accommodate data from diverse sources, supporting a variety of formats.
  • Their data models are flexible and easily extendable, ready to adapt to the evolving nature of data and its relationships.

While knowledge graphs are typically deployed within the boundaries of a single organization to capture knowledge from various internal and external sources, we conceptualize them more broadly. We define the Decentralized Knowledge Graph (DKG) as a global, open data structure comprised of interlinked knowledge assets, benefiting both organizations and individuals.

Unique attributes of the DKG are:

  • Empowerment of decentralized applications (Dapps) with search, integration, analytics, AI, and ML capabilities across a wide range of data sources, including blockchains, IPFS, enterprise systems, web services, and personal devices.
  • Elimination of the need for a central authority by leveraging decentralized infrastructure.
  • Facilitation of permissionless operations within the public network.
  • Utilization of decentralized identity and Verifiable Credentials for access control, enabling references to private data.

This expansive approach enhances accessibility and flexibility, positioning the DKG as a powerful tool in the evolving digital landscape.

The OriginTrail DKG Architecture


The OriginTrail tech stack is tailored to enable the discoverability, verifiability, and connectivity of physical and digital assets in a coherent Web3 data ecosystem. It meets two fundamental requirements for such an infrastructure:

  • Ensuring trust via decentralized consensus.
  • Utilizing semantic, verifiable asset data to represent complex real-world relationships and characteristics.

OriginTrail achieves this by incorporating two distinct types of technology into two network layers - Blockchains (trust networks) and Knowledge Graphs (semantic data networks).

DKG Architecture

The DKG layer (Layer 2) consists of multiple sub-layers:

  • Consensus layer: Implements interfaces to several blockchains hosting trusted smart contracts used to manage relations between the nodes and implement trustless protocols.
  • Network layer: A peer-to-peer swarm of DKG nodes hosted by individuals and organizations.
  • Data layer: Hosting the knowledge graph data, distributed across the network in separate instances of graph databases.
  • Service layer: Implements various core & extended services like authentication, standard interfaces, and data pipelines.
  • Application layer: Includes Dapps and traditional applications that utilize the OriginTrail DKG as part of their data flows.
DKG Architecture

Further, the architecture differentiates between the public, replicated knowledge graph shared by all network nodes according to the protocol, and private graphs hosted separately by each of the networked nodes.

The OriginTrail DKG - combining blockchain and knowledge graph technologies - forms the backbone of the new, trusted Web3 data ecosystem. If you're a developer, you can use it to create, maintain, and use Knowledge Assets across Web3 applications, implementing standardized technologies like GS1 EPCIS, RDF/SPARQL, JSON-LD, and other W3C and GS1 standards right out of the box.

What is a Knowledge Asset?


Knowledge Asset

Knowledge Asset is the new, AI‑ready resource for the Internet

Knowledge Assets are verifiable containers of structured knowledge that live on the OriginTrail DKG and provide:

  • Discoverability - UAL is the new URL. Consider Uniform Asset Locators (UALs) a kind of URL that identify a piece of knowledge and make it easy to find and connect with other Knowledge Assets.
  • Ownership - NFTs enable ownership. Each Knowledge Asset is created with an NFT token that enables trusted ownership and verifiability of your knowledge.
  • Verifiability - On-chain information trail. The blockchain tech increases trust, security, transparency, and the traceability of information.

Discover Knowledge Assets with the DKG Explorer:

Knowledge Assets Graph 1
Supply Chains
Knowledge Assets Graph 2
Construction
Knowledge Assets Graph 3
Life sciences and healthcare
Knowledge Assets Graph 3
Metaverse

(back to top)


🚀 Getting Started


Prerequisites

  • python >=3.11
  • poetry >=1.5.1


Installation

Create virtual environment (you can choose any existing folder this command will create configurations and virtual env for python):

python3 -m venv /path/to/folder

Inside of previously generated folder you will find activate script in bin folder and run it:

source /path/to/folder/bin/activate

Install dependencies:

poetry install

Now you can run a demo example file:

python3 examples/demo.py

(back to top)

📜 Roadmap

This roadmap outlines the goals for the first major release of the dkg.py. Each section represents a stage in the development process and the features we plan to implement.

1️⃣ Pre-development Phase

  • Requirement Analysis and Planning

    • Define the project's scope
    • Identify the core functionalities
  • Design

    • Plan the library's architecture
    • Establish coding standards
  • Setup Development Environment

    • Setup development, testing and production environments
    • Add pytest config
    • Add mypy config
    • Add tox config ?
    • Setup Continuous Integration (CI) and Continuous Deployment (CD) pipeline

2️⃣ Development Phase

Feature Status Tests coverage
Create 🟩 Completed
Transfer 🟩 Completed
Update 🟩 Completed
Wait for finalization 🟥 Not Started
Cancel update 🟩 Completed
Burn 🟩 Completed
Get 🟩 Completed
Query 🟩 Completed
Extend storing period 🟩 Completed
Add tokens 🟩 Completed
Add update tokens 🟩 Completed
Get owner 🟩 Completed
Experimental 🟥 Not Started

3️⃣ Documentation Phase

  • Write comprehensive documentation
  • Provide examples and use-cases
  • Review and finalize documentation

4️⃣ Pre-release Phase

  • Beta Release

    • Release a beta version for testing
    • Gather and address feedback
  • Bug Fixes

    • Identify and fix bugs
  • Final Testing and QA

    • Perform comprehensive testing
    • Ensure the library meets quality standards

5️⃣ Release

  • Merge the first version into the main branch
  • Release the v1.0.0 of the dkg.py library

6️⃣ Post-release

  • Monitor for any issues
  • Plan for next versions based on user feedback and usage

Note: This roadmap is subject to changes. Each step will be accompanied by appropriate documentation, testing and code review to maintain the quality of the library.


(back to top)

📄 License

Distributed under the Apache-2.0 License. See LICENSE file for more information.


(back to top)

🤝 Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

❤️ Thanks to all Contributors!


(back to top)

🌟 Acknowledgements


(back to top)

📰 Social Media



Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dkg-0.1.0b1.tar.gz (44.6 kB view hashes)

Uploaded Source

Built Distribution

dkg-0.1.0b1-py3-none-any.whl (72.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page