Skip to main content

toposkg-lib

A Python library for Knowledge Graph customization and expansion.

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 contain main functions 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.

Metadata

Release files for toposkg 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for toposkg 0.3.2
File Size Uploaded
toposkg-0.3.2.tar.gz 65.5 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for toposkg 0.3.2
File Interpreter ABI Platform
toposkg-0.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 131.0 MB

Release files / toposkg-0.3.2.tar.gz

Download URL toposkg-0.3.2.tar.gz
Size 65.5 MB
Tags Source
SHA-256 checksum
How to use checksums
aa79a176686961336e2d9e6ab59d974b8340ca4f5c41b24d4fd68887c5d4f8e2
BLAKE2b-256 checksum
How to use checksums
c1cc2812792d3407a9166766d91752c09393e6c7b6649b45a715295edf0719a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.18

Release files / toposkg-0.3.2-py3-none-any.whl

Download URL toposkg-0.3.2-py3-none-any.whl
Size 65.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
11ccf6122f0b5de052709dafd3e964cb51468f536d1b6084308891037ddbfe9c
BLAKE2b-256 checksum
How to use checksums
2c44c312b34e79824bd60efd3892c3d650f9e073bcb301d428fa559956ded7df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.18

Release history Release notifications | RSS feed

This release

0.3.2 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page