Skip to main content

TopicDB is a topic map-based graph library (using PostgreSQL for persistence).

Project description

TopicDB is a topic map-based graph library (using PostgreSQL for persistence).

For a more in-depth introduction to topic maps, I recommend reading the excellent introductory article on topic maps over at MSDN: An Introduction to Topic Maps. With that being said, although TopicDB is inspired by the topic maps paradigm, it is not (and never will be) an implementation of the ISO/IEC 13250 Topic Maps data model standard.

TopicDB is intended to be used by other Python applications and does not provide its own user interface to the API. Contextualise, currently in active development, will provide a complete web-based user interface for TopicDB.


I build (story) worlds and knowledge management systems. TopicDB plays a crucial role in both those endeavours.

Feature Support

  • Pending


TopicDB officially supports Python 3.6–3.7. To install TopicDB, simply:

$ pip install topic-db

After having installed the TopicDB library itself, you would have to separately install and configure the database. Brief instructions on how to do so are provided, here: Setting up the TopicDB database. You need to ensure that the database username, password and database name match with the settings.ini file in the project’s root folder.

Install the Development Version

If you have Git installed on your system, it is possible to install the development version of TopicDB.

Before installing the development version, you may need to uninstall the standard version of TopicDB using pip:

$ pip uninstall topic-db

Then do:

$ git clone
$ cd topic-db
$ pip install -e .

The pip install -e . command allows you to follow the development branch as it changes by creating links in the right places and installing the command line scripts to the appropriate locations.

Then, if you want to update TopicDB at any time, in the same directory do:

$ git pull


To get a better understanding of how to use TopicDB, check out the tutorial, here: TopicDB Tutorial (work-in-progress).


Documentation will be available soon.

How to Contribute

  1. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug.
  2. Fork the repository on GitHub to start making your changes to the master branch (or branch off of it).
  3. Write a test which shows that the bug was fixed or that the feature works as expected.
  4. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS.

Release History

0.8.0 (2019-04-07)


  • Extended functionality in relation to the management of the top-level topic map objects. This resulted in changes in both the TopicMap and TopicStore classes, respectively.
  • Refactored and cleaned-up the definition of the database schema (including a change in the naming convention of field names).
  • Added several convenience methods to the TopicStore class for the purpose of updating occurrences and attributes.
  • Added static typing annotations (Mypy) for the majority of classes.
  • Updated dependencies (to latest versions).

0.7.1 (2017-06-16)


  • Refactored code base (specifically, the unit tests) to use the topic store as a context manager.
  • Updated pytest dependency (to latest version).


  • Fixed a context manager-related bug (in the TopicStore class).

0.7.0 (2017-06-15)


  • Various (API) improvements and fixes throughout the codebase (specifically, the TopicStore class) resulting in the bump of the project’s development status (now Beta).

0.6.0 (2017-03-04)


  • Moved away from SQLite to PostgreSQL as the persistence store.
  • Moved away from the ‘command’ pattern to the ‘repository’ pattern.

0.5.0 (2017-01-15)


  • Refactored Get* command classes (i.e., instance_of, scope, and language parameters) for the purposes of consistency and flexibility.
  • Removed hard-code maximum-depth in GetTopicsHierarchy command class.
  • Renamed several command classes to more accurately reflect their purpose.
  • Refactored code to ensure better compliance with PEP 8 (Style Guide for Python Code).


  • Fixed several command classes with regards to not closing SQLite cursor objects.

0.4.0 (2017-01-08)


  • Renamed GetAssociations command class to GetTopicAssociations.
  • Refactored topic map-related commands and models, including changes to the topic map definition (SQL).
  • Renamed several (important) variables for the purpose of improving clarity and consistency.

0.3.0 (2016-12-30)


  • Added functionality to delete associations (i.e., DeleteAssociation command class).

0.2.0 (2016-12-28)


  • Provided OntologyMode (either STRICT or LENIENT).
  • Sanitized backing store (SQLite) indexes.

0.1.1 (2016-12-26)


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for topic-db, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size topic_db-1.0.0-py3-none-any.whl (24.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size topic-db-1.0.0.tar.gz (16.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page