The kglab library provides a simple abstraction layer in Python for building knowledge graphs.

Getting Started

See the "Getting Started"
section of the online documentation.

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

Then to use the library with some simple use cases:

import kglab

# create a KnowledgeGraph object
kg = kglab.KnowledgeGraph()

# load RDF from a URL
kg.load_rdf("", format="xml")

# measure the graph
measure = kglab.Measure()

print("edges: {}\n".format(measure.get_edge_count()))
print("nodes: {}\n".format(measure.get_node_count()))

# serialize as a string in "Turtle" TTL format
ttl = kg.save_rdf_text()

See the tutorial notebooks in the examples subdirectory for
sample code and patterns to use in integrating kglab with other
graph libraries in Python:

Semantic Versioning

Before kglab reaches release v1.0.0 the types and classes may
undergo substantial changes and the project is not guaranteed to have
a consistent API.
Even so, we will try to minimize breaking changes and make careful
notes in the changelog.txt file.

Build Instructions

Note: most use cases won't need to build this package locally.
Instead, simply install from
or Conda.

To set up the build environment locally, see the
"Build Instructions"
section of the online documentation.

illustration of a knowledge graph, plus laboratory glassware