A Python interface to the ToposKG knowledge graph generation pipeline.
Project description
toposkg-lib
Overview
toposkg-lib is a Python library developed as part of the Topos framework. It provides easy access to powerful functionality for customizing and extending ToposKG but is also compatible with arbitrary source files.
Highlights
- Powerful features. Customize and expand ToposKG using powerful tools for geospatial interlinking, toponym translation and entity linking.
- Ease of use. toposkg-lib is designed around a simple builder pattern, simplifying the process of generating your Knowledge Graph.
- Natural Language Interface. toposkg-lib can be used with a textual interface, powered by LLM function calling.
- Active development. toposkg-lib will keep getting updates as we work on our projects.
Repository contents
examples/: Additional data, used in examples.notebooks/: Jupyter Notebooks that showcase the functionality of the library.toposkg/: The source code. Some files containmainfunctions that also include examples of use.
Getting Started
pip
We recommend using toposkg-lib through pip.
pip install toposkg
If you want to include the translation functionality.
pip install toposkg[tl]
If you want to include the function calling functionality.
pip install toposkg[fc]
We recommend that you install this custom version of RDF-lib before using toposkg-lib.
pip install git+https://github.com/SKefalidis/rdflib-speed@main
Otherwise you can use the original rdflib.
Simple example
from toposkg.toposkg_lib_core import KnowledgeGraphBlueprintBuilder, KnowledgeGraphSourcesManager
# Create a KnowledgeGraphSourcesManager object to load the available data sources and their metadata
sources_manager = KnowledgeGraphSourcesManager(['PATH_TO_YOUR_SOURCES'])
# See the available data sources
sources_manager.print_available_data_sources()
# Create a KnowledgeGraphBlueprintBuilder object to build the knowledge graph blueprint
builder = KnowledgeGraphBlueprintBuilder()
builder.set_name("ToposKG.nt")
builder.set_output_dir("/home/example/")
builder.add_source_path("PATH_TO_KG_SOURCE_1") # relative or absolute path
builder.add_source_path("PATH_TO_KG_SOURCE_2")
# Use the blueprint to construct the knowledge graph
blueprint = builder.build()
blueprint.construct()
Advanced Examples
Explore advanced functionality with our interactive Google Colab notebooks:
A fast introduction to the capabilities of toposkg-lib.
Our LLM-based chatbot that utilizes toposkg-lib, in action.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file toposkg-0.2.1.tar.gz.
File metadata
- Download URL: toposkg-0.2.1.tar.gz
- Upload date:
- Size: 65.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6e68d636a4810cab6f0883330d1107b69dbdc6e8e428bd2bdc50b0fc7168bd8
|
|
| MD5 |
9ec2bb6d70d62f1068c4395dde5b1da4
|
|
| BLAKE2b-256 |
8b935feb104a353bcf1caa8a14c33e0c7d14bc3f7b22daac4f725b83603c07f9
|
File details
Details for the file toposkg-0.2.1-py3-none-any.whl.
File metadata
- Download URL: toposkg-0.2.1-py3-none-any.whl
- Upload date:
- Size: 65.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87d393fbb9df641c3f8ae414325b52eeeb86bc55b7c55bd7f87f3e0a4f232e7f
|
|
| MD5 |
7f6f5ffda8206e0501c4eaacb281eebf
|
|
| BLAKE2b-256 |
eb8d0c1573ecd65407986a258f073d993962a01aac4e437571059ab1c74de17d
|