A polymorphic database powered by types

TypeDB is a polymorphic database with a conceptual data model, a strong subtyping system, a symbolic reasoning engine, and a beautiful and elegant type-theoretic language: TypeQL.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23

match $user isa user,
    has full-name $name,
    has email $email;
# This returns all users of any type

match $user isa employee,
    has full-name $name,
    has email $email,
    has employee-id $id;
# This returns only users who are employees

match $user-type sub user;
$user isa $user-type,
    has full-name $name,
    has email $email;
# This returns all users and their type

Harness subtyping to trivially write polymorphic queries, returning data of multiple types by querying a common supertype. Queries are automatically resolved against the schema to retrieve all data matching the declared pattern. Variablize any part of your queries to return types and roles along with data. As new types are added to the schema, they are automatically included in the results of pre-existing queries against their supertype, so queries never have to be refactored.

Learn More

Solve object-relational mismatch entirely within the database

Object-relational mismatch has plagued engineers since OOP became dominant. Relational databases were never built to contend with object models and cannot model inheritance. Both document and graph databases struggle to represent data outside their niches, while multi-model databases do little to solve the fundamental mismatch problem. In all contemporary databases, the focus is on storage format rather than the abstract model itself. TypeDB is unique in implementing conceptual data models without forcing them into predefined structures.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23

insert

$john isa full-time-employee,
    has full-name "John Doe", 
    has primary-email "[email protected]",
    has email "[email protected]",
    has email "[email protected]",
    has employee-id 183;
$readme isa file, has path "/usr/johndoe/repos/typedb/readme.md";
$edit isa action, has name "edit file";
$kevin isa user, has email "[email protected]";

$perm (subject: $john, object: $readme, action: $edit) isa permission;
$rqst (target: $perm, requestee: $kevin) isa change-request, has requested-change "revoke";

TypeDB uses the Enhanced Entity-Relationship model with a declarative schema and static type checking. This allows the natural implementation of a type hierarchy, multivalued attributes, and n-ary and nested relations. Leverage OOP concepts like abstraction, inheritance, and polymorphism without warping the conceptual model. Normalization, null values, and reification are things of the past.

Extend your data model continuously without refactoring or migrations

Extending a database often involves lengthy migration processes in which queries and application code have to be refactored. This involves reconciling the disparate structures between datasets and constructing a new data model that captures the polymorphism, leading to breaking changes in your code. Migration to a new model obsoletes existing queries, introduces new fields to existing objects, and changes the type signature of query results. TypeDB’s polymorphism enables you to extend your model without refactoring queries, migrating data, or modifying code.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23

match
$user isa user, has email $email;
$rsrc isa! $resource-type, has id $id;
$resource-type sub resource;
$own (resource: $rsrc, owner: $user) isa resource-ownership;
get $email, $resource-type, $id;

TypeDB is a truly polymorphic database. Queries are written in a high-level declarative language and resolved against the schema at query-time. Variables implicitly match all valid types, so queries never have to be updated when new subtypes are added. Attributes and relations are always implemented in the same way, so cardinality changes never require a change to the underlying model. All this means that extensions to the data model are trivial, and don’t require refactors.

Avoid data redundancy and ensure data consistency in real-time

Resolving complex dependencies in data requires intricate combinations of query patterns that are computationally intensive to run. Precomputing data is often the only practical solution. This leads to stale, inconsistent, and incorrect data, creating problems when real-time, accurate data is critical. TypeDB’s symbolic rules infer new data at query time, eliminating delay in synchronization. This ensures real-time access to consistent data backed by a single source of truth, avoiding data redundancy.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23

define
rule transitive-team-membership:
    when {
        (team: $team-1, member: $team-2) isa team-membership;
        (team: $team-2, member: $member) isa team-membership;   
    } then {
        (team: $team-1, member: $member) isa team-membership;
    };

match
$user isa user, has email $email;
$team isa team, has name $name;
(team: $team, member: $user) isa team-membership;
get $email, $name;

TypeDB’s built-in reasoning engine allows rules to be defined in the schema and resolved at query time. Rules are constructed using first-order logic and define how new facts can be inferred from existing data. When a query is issued, matching rules are triggered using the most recent data available. This allows all computed data to be built on a single source of truth, ensuring accuracy and consistency without delay or redundancy.

Capture every real-world detail, simply and elegantly

The race is on. In order to continue innovating, applications need digital representations of the real world with far greater accuracy. However, the complexity of the data involved has exceeded what existing databases are capable of – until now.

Develop with state-of-the-art infrastructure, tools and APIs

Docker, or database-as-a-service in the cloud. A single node, or a cluster. The synchronous API, or the asynchronous one. A powerful CLI, or a beautiful IDE. Whichever you prefer, you’ll be up and running in minutes – and building something awesome.

Run fully managed databases in TypeDB Cloud, no ops needed

TypeDB Cloud lets you deploy secure, scalable and highly available databases on demand, for development or production. With project and team administration, it’s easy to manage and monitor multiple deployments across your organization.

Global deployment, cloud agnostic

Deploy in regions across AWS, Azure and GCP, with different databases in different cloud providers and geographies.

Scalability on demand, native clustering

Connect to clusters with topology-aware clients which can load balance requests across multiple replicas within a cluster.

Secure by default, roles and encryption

Rest easy knowing all databases are fully secured by default, with authentication as well as storage and network encryption.

Always available, automatic failover

Never lose access to data thanks to synchronous replication and replicas which will automatically failover if the primary fails.

Teams and projects, organizational governance

Create teams, members and projects to manage databases across the entire organization with ease.

Join a global community of pioneers who are making their visions a reality

The TypeDB community prides itself on open collaboration. At any given time, you’ll see TypeDB engineers and community members discussing solutions and contributions on Discord. We welcome new members every day, and hope to see you soon.

Discord

Meetup

Twitter

YouTube

LinkedIn

See how TypeDB is helping game changers revolutionize their space

Those who dare to think anything is possible are solving problems in previously unimaginable ways – and building the future with TypeDB.

Get started today

Cloud or containers, a database with strong typing, logical abstractions and declarative expressions is minutes away.

Bring the future forward

And show the world what's possible with a strongly typed database.