Skip to main content

Python wrapper for knowledge graph construction tools

Project description

kglab

The kglab library provides a simple to use abstraction layer in Python for building knowledge graphs. For several KG projects, we kept reusing a similar working set of libraries:

Background

Each of those libraries provides a useful piece of the pizzle when you need to leverage knowledge representation, graph algorithms, entity linking, interactive visualization, metadata queries, axioms, etc. However, some of them are relatively low-level (e.g., rdflib) or perhaps not maintained as much (e.g., skosify) and there are challenges integrating them. Challenges we kept having to reinvent work-arounds to resolve.

There are general operations that one must perform on knowledge graphs:

  • building triples
  • quality assurance (e.g., axioms)
  • managing a mix of namespaces
  • serialization to/from multiple formats
  • interactive visualization
  • queries
  • graph algorithms
  • inference, transitivity, etc.
  • embedding
  • other ML integrations

The kglab library provides a reasonably "Pythonic" abstraction layer for these operations on KGs. These class definitions can be subclassed and extended to handle more specific needs. Meanwhile, we're also extending some of the key components with distributed versions, based on ray for better use of horizontal scale-out and parallelization.

NB: this repo is UNDER CONSTRUCTION and will undergo much iteration prior to the "KG 101" tutorial at https://www.knowledgeconnexions.world/talks/kg-101/

See wiki for further details.

Installation

Prerequisites:

To install from PyPi:

pip install kglab

If you work directly from this Git repo, be sure to install the dependencies as well:

pip install -r requirements.txt

Tutorial Outline

  1. Building a graph in RDF using rdflib
  • ex01_0.ipynb
    • examine the dataset
  • ex01_1.ipynb
    • construct a graph from RDF triples
    • using multiple namespaces
    • proper handling of literals
    • seralization to strings and files using Turtle and JSON-LD
  1. Leveraging the kglab abstraction layer
  • ex01_2.ipynb
    • construct and serialize the same graph using kglab
  1. Interactive graph visualization with pyvis

Production Use Cases

  • Derwen and its client projects

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

kglab-0.1.1.tar.gz (6.6 kB view hashes)

Uploaded Source

Built Distribution

kglab-0.1.1-py3-none-any.whl (7.3 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