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, leveraging Pandas, NetworkX, RAPIDS, RDFLib, Morph-KGC, pythonPSL, and many more.
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.
"Feels like it's a Hugging Face for graphs! 🤯"
See the "Getting Started" section of the online documentation.
kglab
as a library for your Python projectWe recommend installing from PyPi or conda:
pip
python3 -m pip install kglab
pipenv
pipenv install kglab
conda
conda env create -n kglab
conda activate kglab
pip install kglab
If you work directly from this Git repo, be sure to install the dependencies:
python3 -m pip install -U pip wheel
python3 -m pip install -r requirements.txt
pipenv install --dev
Alternatively, to install dependencies using conda
:
conda env create -f environment.yml --force
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
inrequirements.txt
before you do. For example, there are
known version conflicts regarding NumPy (>= 1.19.4) and TensorFlow 2+ (~-1.19.2)
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](https://github.com/DerwenAI/kglab/blob/main/changelog.txt)
<img alt="illustration of a knowledge graph, plus laboratory glassware" src="https://raw.githubusercontent.com/DerwenAI/kglab/main/docs/assets/logo.png" width="231" />
Many thanks to our open source sponsors; and to our contributors: @ceteri, @dvsrepo, @Ankush-Chander, @louisguitton, @tomaarsen, @Mec-iS, @jake-aft, @Tpt, @ArenasGuerreroJulian, @fils, @cutterkom, @RishiKumarRay, @gauravjaglan, @pebbie, @CatChenal, @jorisSchaller, @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.
<img alt="kglab contributors" src="https://contributors-img.web.app/image?repo=derwenai/kglab" />