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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kglab-0.1.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file kglab-0.1.1.tar.gz.

File metadata

  • Download URL: kglab-0.1.1.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.4

File hashes

Hashes for kglab-0.1.1.tar.gz
Algorithm Hash digest
SHA256 563070977f75adc668098163f0cc690f502ed600d1d29d16b7f6443e2337e97c
MD5 b45a8a75c3c0571b59cf5e136cb26def
BLAKE2b-256 470cd38c9bb4b2f65a3d21964abe9c609959d94350a16f5e0d567f98efa4093b

See more details on using hashes here.

File details

Details for the file kglab-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: kglab-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.4

File hashes

Hashes for kglab-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 55389ecdbc5579cb2d71fd40ae59f86c336777beddd56d656869cd9bf6526c21
MD5 217940bd00132ef8ddb756885c76b258
BLAKE2b-256 e120c51c61a09ccc5415d28e2e728284bddf859e3b574084f65c155e1d2c2f99

See more details on using hashes here.

Supported by

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