# TypeDB

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/TypeDB
> Markdown URL: https://mediated.wiki/source/TypeDB.md
> Source: https://en.wikipedia.org/wiki/TypeDB
> Source revision: 1329382606
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

**TypeDB** is an [open-source](/source/Open-source_software), [distributed](/source/Distributed_database) [database management system](/source/Database_management_system) that relies on a user-defined [type system](/source/Type_system) to model, manage, and query data.

## Overview

The [data model](/source/Data_model) of TypeDB is based on primitives from [conceptual data modeling](/source/Conceptual_data_model), which are implemented in a [type system](/source/Type_system) (*see [§ Data and query model](#Data_and_query_model)*). The type system can be extended with user-defined [types](/source/Type_system), type [dependencies](/source/Dependent_type), and [subtyping](/source/Subtyping), which together act as a [database schema](/source/Database_schema). The model has been [mathematically defined](/source/Formal_specification) under the name *polymorphic entity-relation-attribute model*.[3]

To specify schemas and to [create, modify, and extract](/source/CRUD) data from the TypeDB database, programmers use the query language *TypeQL*. The language is noteworthy for its intended resemblance to natural language, following a [subject–verb–object](/source/Subject%E2%80%93verb%E2%80%93object) statement structure for a fixed set of "key verbs" (*see [§ Examples](#Examples)*).

## History

TypeDB has roots in the [knowledge representation](/source/Knowledge_representation) system Grakn (a [portmanteau](/source/Portmanteau) of the words "graph" and "knowledge"), which was initially developed at the [University of Cambridge Computer Science Department](/source/Department_of_Computer_Science_and_Technology,_University_of_Cambridge).[4] Grakn was commercialized in 2017, and development was taken over by Grakn Labs Ltd.[4] Later that year, Grakn was awarded the "Product of the Year" award by the University of Cambridge Computer Science Department.[5]

In 2021, the first version of TypeDB was built from Grakn with the intention of creating a general-purpose [database](/source/Database).[6] The query language of Grakn, Graql, was incorporated into TypeDB's query language, TypeQL, at the same time.

TypeDB Cloud, the [database-as-a-service](/source/Data_as_a_service) edition of TypeDB, was first launched at the end of 2023.[7]

In December 2024, TypeDB 3.0[8] was released, with a full rewrite of the original Java-based database to Rust and significant enhancements in TypeQL.

### Grakn version history

The initial version of Grakn, version 0.1.1, was released on September 15, 2016.[9]

Grakn 1.0.0 was released on December 14, 2017.[10]

Grakn 2.0.0 was released on April 1, 2021.[11]

### TypeDB version history

TypeDB 2.1.0, the first public version of TypeDB, was released on May 20, 2021.[6]

TypeDB 3.0.0, the first version of TypeDB 3, was released on December 20, 2024.[8]

## Features

TypeDB is offered in two editions: an [open-source](/source/Open_source) edition, called *TypeDB Community Edition*, and a [proprietary](/source/Proprietary_software) edition, called *TypeDB Cloud*, which provides additional [cloud-based](/source/Cloud-based) management features.

TypeDB features a [NoSQL](/source/NoSQL) data and querying model, which aims to introduce ideas from [type systems](/source/Type_systems) and [functional programming](/source/Functional_programming) to database management.[12]

### Database architecture

General database features include the following.

- [ACID](/source/ACID)-compliance[2]
- [Static type-checking](/source/Static_type-checking) of queries[2]
- [Graphical user interface](/source/Graphical_user_interface) (*TypeDB Studio*)[2]
- [Storage engine](/source/Storage_engine) based on [RocksDB](/source/RocksDB)[13]
- [Synchronous replication](/source/Synchronous_replication) through [RAFT](/source/Raft_(algorithm)) for scalability[2]
- [TLS](/source/Transport_Layer_Security) support
- [Unicode](/source/Unicode) support

### Data and query model

TypeDB's data and query model differs from traditional [relational database management systems](/source/Relational_database_management_systems) in the following points.

- Instead of tables and columns, TypeDB employs types, subtypings between types, and type dependencies to describe the database schema. It is argued that this may facilitate schema extensions and [normalization](/source/Database_normalization), and may help clarify [data dependencies](/source/Functional_dependency).[14]
- Instead of formulating queries with [algebraic operators](/source/Relational_algebra) as in [SQL](/source/SQL), TypeQL queries are sequences of statements that represent [composite types](/source/Algebraic_data_type). It is argued that this yields a “more [declarative](/source/Declarative_programming)” querying style (*see [§ Examples](#Examples)*).[15]
- TypeDB provides support for [Datalog](/source/Datalog)-like functions (based on the [correspondence](/source/Propositions_as_Types) of [logical implication](/source/Material_conditional) to [function types](/source/Function_types)), which can be defined recursively. This can have advantages for [graph data](/source/Graph_database) workloads, as most [graph algorithms](/source/Graph_algorithms) are formulated recursively.[16]
- TypeDB's data model, based on subtyping and type dependencies, is aimed at modeling a variety of data structures. This subsumes relational data, structured [tree-like](/source/Document_database) data, structured [graph-like](/source/Graph_database) data, data with [inheritance](/source/Inheritance), and [hypergraph](/source/Hypergraph)-like data.[17][18]

### Limitations

By relying on a non-standard data and query model, TypeDB (at present) has no support for the integration of established [relational](/source/Relational_model) or [column-oriented](/source/Column-oriented_database) database standards, file formats (such as [CSV](/source/Comma-separated_values), [Parquet](/source/Apache_Parquet)), or the query language [SQL](/source/SQL). Moreover, TypeDB has no direct facility for working with [unstructured data](/source/Unstructured_data) or [vector data](/source/Vector_database).

## Query language

TypeQL, the query language of TypeDB, acts both as [data definition](/source/Data_definition_language) and [data manipulation language](/source/Data_manipulation_language).

The query language builds on well-known ideas from [conceptual modeling](/source/Conceptual_data_model), referring to independent types holding objects as *entity* types, dependent types holding objects as *relation* types, and types holding values as *attribute* types.[19] The language is composed of *query clauses* comprising *statements*. Statements, especially for data manipulation, usually follow a [subject–verb–object](/source/Subject%E2%80%93verb%E2%80%93object) structure.

The formal specification of the query language was presented at [ACM PODS 2024](/source/Symposium_on_Principles_of_Database_Systems), where it received the "Best Newcomer" Award.[20]

### Examples

The following (incomplete) query creates a type schema using a define query clause.

define
  entity person,
    owns name @card(1),
    plays booking:passenger;
  relation booking,
    relates passenger,
    relates flight,
    owns booking_date;
  attribute name,
    value string;
  ...

The following query retrieves objects and values from the database that match the pattern given in the match clause.[21]

match
  $j isa person, has name $n;
  $n contains "Jane";
  $b isa booking,
    links (passenger: $j, flight: $f);
    has booking_date >= 2024-01-01;
  $f has flight_time < 120;
  $f links (destination: $c);
  $c has name "Santiago de Chile";

## Licensing

The open-source edition of TypeDB is published under the [Mozilla Public License](/source/Mozilla_Public_License).[13]

## References

1. ["Releases · typedb/typedb"](https://github.com/typedb/typedb/releases). *GitHub*

1. ["TypeDB System Properties"](https://db-engines.com/en/system/TypeDB). *DB Engines*

1. Dorn & Pribadi 2024

1. ["TypeDB"](https://dbdb.io/db/typedb). *Database of Databases*. 30 July 2024.

1. ["Hall of Fame"](https://www.cst.cam.ac.uk/ring/awards). *Department of Computer Science and Technology*. 23 January 2018.

1. ["TypeDB 2.1.0"](https://github.com/typedb/typedb/releases/tag/2.1.0). *Github*

1. ["New Foundations for Building with TypeDB"](https://typedb.com/blog/new-foundations-for-building-with-typedb). *TypeDB Blog*. 27 March 2024.

1. ["TypeDB 3.0.0"](https://github.com/typedb/typedb/releases/tag/3.0.0). *Github*

1. ["Grakn 0.1.1"](https://github.com/typedb/typedb/releases/tag/0.1.1). *Github*

1. ["Grakn 1.0.0"](https://github.com/typedb/typedb/releases/tag/1.0.0). *Github*

1. ["Grakn 2.0.0"](https://github.com/typedb/typedb/releases/tag/2.0.0). *Github*

1. ["Functional Database Programming Paradigm"](https://master.typedb.com/fundamentals#functional-database-programming). *TypeDB*

1. ["TypeDB Github"](https://github.com/typedb/typedb). *GitHub*. June 2024.

1. Dorn & Pribadi 2024, §1.7

1. Dorn & Pribadi 2024, §1.5

1. Dorn & Pribadi 2024, §3.2

1. Sijs & Fletcher, 2022

1. Dorn & Pribadi 2024, App. A

1. ["TypeDB Lecture Course"](https://typedb.com/docs/learn/9-modeling-schemas/9.1-the-pera-model). *TypeDB*. June 2024.

1. ["PODS Awards"](https://2024.sigmod.org/pods_awards.shtml). *ACM SIGMOD/PODS*. June 2024.

1. Dorn, Christoph & Pribadi, Haikal (June 2024). ["TypeQL: A Type-Theoretic & Polymorphic Query Language"](https://dl.acm.org/doi/suppl/10.1145/3651611/suppl_file/TypeQL_PODS_2024.mp4). *Proceedings of the ACM on Management of Data*. **2** (2): 1–27. [doi:10.1145/3651611](https://doi.org/10.1145/3651611)

## Bibliography

- Dorn, Christoph & Pribadi, Haikal (2024), "TypeQL: A Type-Theoretic & Polymorphic Query Language", *Proceedings of the ACM on Management of Data*. **2** (2): 1–27, New York, NY, USA: Association for Computing Machinery, [doi:10.1145/3651611](https://doi.org/10.1145/3651611)

- Sijs, Joris & Fletcher, James (2022), ["On a hypergraph structuring semantic information for robots navigating and conducting their task in real-world, indoor environments"](http://resolver.tudelft.nl/uuid:31edb3d1-f849-41d2-b1c3-a865434680e2), *2022 26th International Conference on Methods and Models in Automation and Robotics (MMAR)*, IEEE, pp. 430–435, [doi:10.1109/MMAR55195.2022.9874265](https://doi.org/10.1109/MMAR55195.2022.9874265). ISBN 978-1-6654-6858-9

---
Adapted from the Wikipedia article [TypeDB](https://en.wikipedia.org/wiki/TypeDB) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/TypeDB?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
