Skip to main content

A simple abstraction layer in Python for building knowledge graphs

Project description

kglab

DOI Licence Repo size GitHub commit activity Checked with mypy security: bandit Language grade: Python CI downloads sponsor

Welcome to graph data science: https://derwen.ai/docs/kgl/

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

SPECIAL REQUEST:
Which features would you like in an open source Python library for building knowledge graphs?
Please add your suggestions through this survey:
https://forms.gle/FMHgtmxHYWocprMn6
This will help us prioritize the kglab roadmap.

Reviews

@kaaloo:

"Feels like it's a Hugging Face for graphs! 🤯"

Getting Started

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

To install from PyPi:

python3 -m pip install kglab

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

python3 -m pip install -r requirements.txt

Alternatively, to install dependencies using conda:

conda env create -f environment.yml
conda activate kglab

Then to run some simple uses of this library:

import kglab

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

# load RDF from a URL
kg.load_rdf("http://bigasterisk.com/foaf.rdf", format="xml")

# measure the graph
measure = kglab.Measure()
measure.measure_graph(kg)

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()
print(ttl)

See the tutorial notebooks in the examples subdirectory for sample code and patterns to use in integrating kglab with other graph libraries in Python: https://derwen.ai/docs/kgl/tutorial/

WARNING when installing in an existing environment:
Installing a new package in an existing environment may reveal
or create version conflicts. See the kglab requirements
in requirements.txt before you do. For example, there are
known version conflicts regarding NumPy (>= 1.19.4) and TensorFlow 2+ (~-1.19.2)

Contributing Code

We welcome people getting involved as contributors to this open source project!

For detailed instructions please see: CONTRIBUTING.md

Build Instructions Note: unless you are contributing code and updates, in most use cases won't need to build this package locally.

Instead, simply install from PyPi or use Conda.

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

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'll try to minimize breaking changes. We'll also be sure to provide careful notes.

See: changelog.txt

illustration of a knowledge graph, plus laboratory glassware

License and Copyright

Source code for kglab plus its logo, documentation, and examples have an MIT license which is succinct and simplifies use in commercial applications.

All materials herein are Copyright © 2020-2021 Derwen, Inc.

Attribution

Please use the following BibTeX entry for citing kglab if you use it in your research or software. Citations are helpful for the continued development and maintenance of this library.

@software{kglab,
  author = {Paco Nathan},
  title = {{kglab: a simple abstraction layer in Python for building knowledge graphs}},
  year = 2020,
  publisher = {Derwen},
  doi = {10.5281/zenodo.4717287},
  url = {https://github.com/DerwenAI/kglab}
}

Kudos

Many thanks to our open source sponsors; and to our contributors: @ceteri, @dvsrepo, @Ankush-Chander, @louisguitton, @tomaarsen, @Mec-iS, @fils, @gauravjaglan, @pebbie, @CatChenal, @jake-aft, @dmoore247, plus general support from Derwen, Inc.; the Knowledge Graph Conference and Connected Data World; plus an even larger scope of use cases represented by their communities; Kubuntu Focus, the RAPIDS team @ NVIDIA, Gradient Flow, and Manning Publications.

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.4.2.tar.gz (39.2 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.4.2-py3-none-any.whl (39.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kglab-0.4.2.tar.gz
  • Upload date:
  • Size: 39.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.4

File hashes

Hashes for kglab-0.4.2.tar.gz
Algorithm Hash digest
SHA256 ef71f36c93f5519c206ea2d9637738cf1432a9f80079f890d5cf232638f7c2a6
MD5 f986bb60cd5bc56b72cc9f1f9c26d366
BLAKE2b-256 20e24064fc18876b02a0323186695a049794edd51e0d5b7432f29aa1272c5ebe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kglab-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 39.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.4

File hashes

Hashes for kglab-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2d0cb9ed8a67ae5a0d57a291083278942e1aa55fa94b88c9ff907e02015dce66
MD5 4002a392c8c0513c15f8e94325c6bc76
BLAKE2b-256 affd00f40e9fdec729d83477c07db679550c1b26ba530744ad63c118dab276df

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