Skip to content

iai-group/pkg-api

Repository files navigation

PKG API: A Tool for Personal Knowledge Graph Management

Code style: black Coverage Badge Python version

The PKG API is a tool for managing personal knowledge graphs (PKGs). It provides a simple solution for end users and service providers to administrate and interact with the users' PKGs through natural language statements and simple web forms. The representation of a statement inside the PKG is defined by the PKG vocabulary. Within the API, two key modules are present: one for processing natural language statements (NL2PKG), and another for generating and executing SPARQL queries against the PKG (PKG connector).

The PKG API is served as a RESTful API and we provide a user interface, PKG Client, that allows users to manage their PKG online.

Overview

PKG API

NL2PKG

This module is responsible for processing natural language statements. The processing is divided into two steps: (1) natural language understanding handled by annotators and (2) entity_linking.

Available annotators and entity linkers:

PKG connector

The PKG connector is responsible for executing SPARQL queries against the PKG. Utilities functions are responsible for generating SPARQL queries based on the intent of the user. For example, if a user wants to add a statement to the PKG, a tailored INSERT query is generated.

Server

The backend server is a Flask server. It is responsible for connecting the users and service providers to PKGs.

Starting the server

Before starting the server, make sure that the requirements are installed and that CORS is disabled in your web browser.

To start the server, run the following command:

flask --app pkg_api/server run --debug

Note the --debug flag is optional, but it is recommended to use it during development.

By default, the server will run locally on port 5000. In case you want to run the server on a different port, you can specify the port using the --port flag.

PKG Client

The user interface is a React application that communicates with the server to manage the PKG. More details on how to run PKG Client can be found here.

⚠️ Note that you need to update PKG_API_BASE_URL in the configuration in case the server is not running on the default port.

Demo

PKG_API_demo.mov

The code for the demo is available in this branch.

Conventions

We follow the IAI Python Style Guide.

Publication

If you use the PKG API, please cite the following paper:

@misc{Bernard:2024:arXiv,
 title        = {PKG API: A Tool for Personal Knowledge Graph Management},
 author       = {Nolwenn Bernard and Ivica Kostric and Weronika Łajewska and Krisztian Balog and Petra Galuščáková and Vinay Setty and Martin G. Skjæveland},
 year         = 2024,
 eprint       = {2402.07540},
 archiveprefix = {arXiv},
 primaryclass = {cs.HC}
}

Contributors

PKG API is developed and maintained by the IAI group at the University of Stavanger.