<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: TypeDB</title>
    <description>The latest articles on DEV Community by TypeDB (@typedb).</description>
    <link>https://dev.to/typedb</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F3144%2F9a962cf4-02b8-4e9a-85da-89f3fd30d1e9.png</url>
      <title>DEV Community: TypeDB</title>
      <link>https://dev.to/typedb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/typedb"/>
    <language>en</language>
    <item>
      <title>Why we built a polymorphic database</title>
      <dc:creator>mifuneson2</dc:creator>
      <pubDate>Fri, 20 Oct 2023 22:20:50 +0000</pubDate>
      <link>https://dev.to/typedb/why-we-built-a-polymorphic-database-53li</link>
      <guid>https://dev.to/typedb/why-we-built-a-polymorphic-database-53li</guid>
      <description>&lt;p&gt;&lt;strong&gt;Database models have failed to keep up with the rapid evolution of programming languages&lt;/strong&gt;, and modern applications must use complex layered architectures to manage data as result. In order to resolve this, we built &lt;a href="https://typedb.com?utm_source=devto&amp;amp;utm_medium=blog&amp;amp;utm_campaign=polymorphic2023&amp;amp;utm_content=dawn_of_polymorphic_db"&gt;TypeDB&lt;/a&gt; on &lt;strong&gt;a completely new, highly expressive database paradigm&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;In this blog post we explore the origin and core ideas that led us to create a polymorphic database.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why do we need a polymorphic database?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Relational databases lack the expressivity of model polymorphism.&lt;/strong&gt; Programming languages are becoming increasingly more declarative, empowering engineers to quickly write safe and expressive code backed by static type checking and abstract data constructs. Relational databases were designed at a time when procedural programming languages were the norm. They are built on Codd’s relational algebra and implemented using tables and one-dimensional tuples.&lt;/p&gt;

&lt;p&gt;Object-oriented programming involves complex modeling constructs such as abstraction, inheritance, and polymorphism, requiring the expression of multidimensional data structures.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Class inheritance in Java&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;email&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Employee&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;employeeId&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="nc"&gt;Employee&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;employeeId&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;super&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;employeeId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;employeeId&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;PartTimeEmployee&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Employee&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;weeklyHour&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="nc"&gt;PartTimeEmployee&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; 
                     &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;employeeId&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;weeklyHour&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;super&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;employeeId&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;wheeklyHour&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;weeklyHour&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Class instantiation in Java&lt;/span&gt;

&lt;span class="nc"&gt;PartTimeEmployee&lt;/span&gt; &lt;span class="n"&gt;john&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; 
    &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;PartTimeEmployee&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"john.doe@vaticle.com"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
                         &lt;span class="s"&gt;"John Doe"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;346523&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;35&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, &lt;strong&gt;relational databases are unable to natively model objects due to their lack of expressivity.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Table inheritance in SQL&lt;/span&gt;

&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;Users&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="nb"&gt;SERIAL&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;email&lt;/span&gt; &lt;span class="nb"&gt;TEXT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="nb"&gt;TEXT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;UNIQUE&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;Employees&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="nb"&gt;INTEGER&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;employeeId&lt;/span&gt; &lt;span class="nb"&gt;INTEGER&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="k"&gt;FOREIGN&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;REFERENCES&lt;/span&gt; &lt;span class="n"&gt;Users&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="k"&gt;UNIQUE&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;employeeId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;PartTimeEmployee&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="nb"&gt;INTEGER&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;weeklyHour&lt;/span&gt; &lt;span class="nb"&gt;INTEGER&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="k"&gt;FOREIGN&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;REFERENCES&lt;/span&gt; &lt;span class="n"&gt;Employees&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;-- Data inserting for extended tables in SQL&lt;/span&gt;

&lt;span class="k"&gt;DO&lt;/span&gt; &lt;span class="err"&gt;$$&lt;/span&gt;
&lt;span class="k"&gt;DECLARE&lt;/span&gt;
    &lt;span class="n"&gt;inserted_user_id&lt;/span&gt; &lt;span class="nb"&gt;INTEGER&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;BEGIN&lt;/span&gt;
    &lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="n"&gt;Users&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;VALUES&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;DEFAULT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;"john.doe@vaticle.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;"John Doe"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;RETURNING&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="n"&gt;inserted_user_id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="n"&gt;Employees&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;inserted_user_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;346523&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="n"&gt;PartTimeEmployees&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;inserted_user_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;35&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;COMMIT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;END&lt;/span&gt; &lt;span class="err"&gt;$$&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- Data retrieval for all Users and extended tables in SQL&lt;/span&gt;

&lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="n"&gt;Users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;Users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;Users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;   
    &lt;span class="k"&gt;null&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;employeeId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
    &lt;span class="k"&gt;null&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;weeklyHours&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nv"&gt;"user"&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;userType&lt;/span&gt; 
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Users&lt;/span&gt; 
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;EXISTS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Employees&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;Users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Employees&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;span class="k"&gt;UNION&lt;/span&gt; &lt;span class="k"&gt;ALL&lt;/span&gt; 
&lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="n"&gt;Users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
    &lt;span class="n"&gt;Users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;Users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;employeeId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;null&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;weeklyHours&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nv"&gt;"employee"&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;userType&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Users&lt;/span&gt; 
&lt;span class="k"&gt;INNER&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;Employees&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;Users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Employees&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;EXISTS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;Employees&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; 
    &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;PartTimeEmployee&lt;/span&gt; 
    &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;Employees&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;PartTimeEmployee&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;span class="k"&gt;UNION&lt;/span&gt; &lt;span class="k"&gt;ALL&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; 
    &lt;span class="n"&gt;Users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;Users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;Users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;employeeId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;weeklyHours&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nv"&gt;"partTimeEmployee"&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;userType&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Users&lt;/span&gt;
&lt;span class="k"&gt;INNER&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;Employees&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;Users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Employees&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;
&lt;span class="k"&gt;INNER&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;PartTimeEmployee&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;Employees&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;PartTimeEmployee&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This fundamental incompatibility between object and relational models has become one of the biggest challenges in database engineering. Because of &lt;strong&gt;object-relational mismatch, relational databases have been unable to evolve alongside programming languages.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NoSQL eliminated the schema at the cost of declarative data retrieval.&lt;/strong&gt; The limitations of relational databases led to the emergence of NoSQL databases, particularly document and graph databases. These databases eliminated the predefined schema, making data insertion trivial, but this comes with the cost of complicating retrieval. Without a schema, structural metadata must be stored as data, hardcoded into queries, or modeled in a secondary data store. This forces engineers to access their data imperatively, as the database does not have the context to correctly interpret declarative polymorphic queries.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Document databases&lt;/strong&gt; are optimized to store hierarchical data, but this &lt;strong&gt;breaks down when attempting to model highly interconnected data&lt;/strong&gt;. To do so, engineers are required to choose between using performance-intensive foreign ID references or duplicating data across documents without native consistency control.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Retrieval of polymorphic resources in MongoDB&lt;/span&gt;

&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;resource_ownerships&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;aggregate&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;
  &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;$lookup&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
    &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;from:&lt;/span&gt; &lt;span class="s"&gt;"resources"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;localField:&lt;/span&gt; &lt;span class="s"&gt;"resource"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;foreignField:&lt;/span&gt; &lt;span class="s"&gt;"_id"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;as:&lt;/span&gt; &lt;span class="s"&gt;"resource"&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;},&lt;/span&gt;
  &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;$unwind&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
    &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;path:&lt;/span&gt; &lt;span class="s"&gt;"$resource"&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;},&lt;/span&gt;
  &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;$lookup&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
    &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;from:&lt;/span&gt; &lt;span class="s"&gt;"users"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;localField:&lt;/span&gt; &lt;span class="s"&gt;"owner"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;foreignField:&lt;/span&gt; &lt;span class="s"&gt;"_id"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;as:&lt;/span&gt; &lt;span class="s"&gt;"owner"&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;},&lt;/span&gt;
  &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;$unwind&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
    &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;path:&lt;/span&gt; &lt;span class="s"&gt;"$owner"&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;},&lt;/span&gt;
  &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;$unwind&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
    &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;path:&lt;/span&gt; &lt;span class="s"&gt;"$owner.emails"&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;},&lt;/span&gt;
  &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;$addFields&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
    &lt;span class="o"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;resource_id:&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;$switch&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="nl"&gt;branches:&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;
            &lt;span class="o"&gt;{&lt;/span&gt;
              &lt;span class="k"&gt;case&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; 
                &lt;span class="n"&gt;$eq&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"$resource.resource_type"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"file"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
              &lt;span class="o"&gt;},&lt;/span&gt; 
              &lt;span class="nl"&gt;then:&lt;/span&gt; &lt;span class="s"&gt;"$resource.path"&lt;/span&gt; 
            &lt;span class="o"&gt;},&lt;/span&gt;
            &lt;span class="o"&gt;{&lt;/span&gt;
              &lt;span class="k"&gt;case&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; 
                &lt;span class="n"&gt;$eq&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"$resource.resource_type"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"directory"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
              &lt;span class="o"&gt;},&lt;/span&gt; 
              &lt;span class="nl"&gt;then:&lt;/span&gt; &lt;span class="s"&gt;"$resource.path"&lt;/span&gt; 
            &lt;span class="o"&gt;},&lt;/span&gt;
            &lt;span class="o"&gt;{&lt;/span&gt;
              &lt;span class="k"&gt;case&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; 
                &lt;span class="n"&gt;$eq&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"$resource.resource_type"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"commit"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
              &lt;span class="o"&gt;},&lt;/span&gt; 
              &lt;span class="nl"&gt;then:&lt;/span&gt; &lt;span class="s"&gt;"$resource.hash"&lt;/span&gt; 
            &lt;span class="o"&gt;},&lt;/span&gt;
            &lt;span class="o"&gt;{&lt;/span&gt;
              &lt;span class="k"&gt;case&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; 
                &lt;span class="n"&gt;$eq&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"$resource.resource_type"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"repository"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
              &lt;span class="o"&gt;},&lt;/span&gt; 
              &lt;span class="nl"&gt;then:&lt;/span&gt; &lt;span class="s"&gt;"$resource.name"&lt;/span&gt; 
            &lt;span class="o"&gt;},&lt;/span&gt;
            &lt;span class="o"&gt;{&lt;/span&gt;
              &lt;span class="k"&gt;case&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; 
                &lt;span class="n"&gt;$eq&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"$resource.resource_type"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"table"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
              &lt;span class="o"&gt;},&lt;/span&gt; 
              &lt;span class="nl"&gt;then:&lt;/span&gt; &lt;span class="s"&gt;"$resource.name"&lt;/span&gt; 
            &lt;span class="o"&gt;},&lt;/span&gt;
            &lt;span class="o"&gt;{&lt;/span&gt;
              &lt;span class="k"&gt;case&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; 
                &lt;span class="n"&gt;$eq&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"$resource.resource_type"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"database"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
              &lt;span class="o"&gt;},&lt;/span&gt; 
              &lt;span class="nl"&gt;then:&lt;/span&gt; &lt;span class="s"&gt;"$resource.name"&lt;/span&gt; 
            &lt;span class="o"&gt;}&lt;/span&gt;
          &lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
      &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;},&lt;/span&gt;
  &lt;span class="o"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;$project&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
          &lt;span class="nl"&gt;_id:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
          &lt;span class="nl"&gt;email:&lt;/span&gt; &lt;span class="s"&gt;"$owner.emails"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
          &lt;span class="nl"&gt;resource_type:&lt;/span&gt; &lt;span class="s"&gt;"$resource.resource_type"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
          &lt;span class="nl"&gt;id:&lt;/span&gt; &lt;span class="s"&gt;"$resource_id"&lt;/span&gt;
      &lt;span class="o"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Meanwhile, graph databases excel at linking highly interconnected data, but are severely limited by the implementation of relations as edges. This means that more complex types like n-ary relations, nested relations, and variadic relations are impossible to express without reifying the data model.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cypher"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Retrieval of polymorphic resources in Neo4j's Cypher&lt;/span&gt;
&lt;span class="k"&gt;MATCH&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="py"&gt;user:&lt;/span&gt;&lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="ss"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;:OWNS&lt;/span&gt;&lt;span class="ss"&gt;]&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="py"&gt;rsrc:&lt;/span&gt;&lt;span class="n"&gt;Resource&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;WITH&lt;/span&gt;
    &lt;span class="n"&gt;rsrc&lt;/span&gt;&lt;span class="ss"&gt;,&lt;/span&gt;
    &lt;span class="ss"&gt;[&lt;/span&gt;&lt;span class="n"&gt;user.primary_email&lt;/span&gt;&lt;span class="ss"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;user.alias_emails&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;emails&lt;/span&gt;&lt;span class="ss"&gt;,&lt;/span&gt;
    &lt;span class="nf"&gt;labels&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rsrc&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;resource_types&lt;/span&gt;&lt;span class="ss"&gt;,&lt;/span&gt;
    &lt;span class="nf"&gt;keys&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rsrc&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;properties&lt;/span&gt;
&lt;span class="k"&gt;UNWIND&lt;/span&gt; &lt;span class="n"&gt;emails&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;
&lt;span class="k"&gt;UNWIND&lt;/span&gt; &lt;span class="n"&gt;resource_types&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;resource_type&lt;/span&gt;
&lt;span class="k"&gt;WITH&lt;/span&gt;
    &lt;span class="n"&gt;rsrc&lt;/span&gt;&lt;span class="ss"&gt;,&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="ss"&gt;,&lt;/span&gt; &lt;span class="n"&gt;resource_type&lt;/span&gt;&lt;span class="ss"&gt;,&lt;/span&gt; &lt;span class="n"&gt;properties&lt;/span&gt;&lt;span class="ss"&gt;,&lt;/span&gt;
    &lt;span class="ss"&gt;{&lt;/span&gt;
        &lt;span class="py"&gt;File:&lt;/span&gt; &lt;span class="s2"&gt;"path"&lt;/span&gt;&lt;span class="ss"&gt;,&lt;/span&gt;
        &lt;span class="py"&gt;Directory:&lt;/span&gt; &lt;span class="s2"&gt;"path"&lt;/span&gt;&lt;span class="ss"&gt;,&lt;/span&gt;
        &lt;span class="py"&gt;Commit:&lt;/span&gt; &lt;span class="s2"&gt;"hash"&lt;/span&gt;&lt;span class="ss"&gt;,&lt;/span&gt;
        &lt;span class="py"&gt;Repository:&lt;/span&gt; &lt;span class="s2"&gt;"name"&lt;/span&gt;&lt;span class="ss"&gt;,&lt;/span&gt;
        &lt;span class="py"&gt;Table:&lt;/span&gt; &lt;span class="s2"&gt;"name"&lt;/span&gt;&lt;span class="ss"&gt;,&lt;/span&gt;
        &lt;span class="py"&gt;Database:&lt;/span&gt; &lt;span class="s2"&gt;"name"&lt;/span&gt;
    &lt;span class="ss"&gt;}&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;id_type_map&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;resource_type&lt;/span&gt; &lt;span class="ow"&gt;IN&lt;/span&gt; &lt;span class="nf"&gt;keys&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id_type_map&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;
&lt;span class="ow"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;id_type_map&lt;/span&gt;&lt;span class="ss"&gt;[&lt;/span&gt;&lt;span class="n"&gt;resource_type&lt;/span&gt;&lt;span class="ss"&gt;]&lt;/span&gt; &lt;span class="ow"&gt;IN&lt;/span&gt; &lt;span class="n"&gt;properties&lt;/span&gt;
&lt;span class="k"&gt;RETURN&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="ss"&gt;,&lt;/span&gt;
       &lt;span class="n"&gt;resource_type&lt;/span&gt;&lt;span class="ss"&gt;,&lt;/span&gt;
       &lt;span class="n"&gt;rsrc&lt;/span&gt;&lt;span class="ss"&gt;[&lt;/span&gt;&lt;span class="n"&gt;id_type_map&lt;/span&gt;&lt;span class="ss"&gt;[&lt;/span&gt;&lt;span class="n"&gt;resource_type&lt;/span&gt;&lt;span class="ss"&gt;]]&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;ORMs work around the fundamental problem by trading off performance.&lt;/strong&gt; Engineers have attempted to work around the mismatch problem, building layers of abstraction over databases in an attempt to give them the expressivity they were never designed with. This requires engineers to non-natively manage structural metadata, leading to the widespread use of ORMs. They offer object-oriented APIs for managing and storing data, but because of the imperfect translation to the underlying models, they can never express the full range of queries that can be written natively. This results in limited capabilities and poor query optimization, while introducing an additional layer of complexity and overhead to database architecture.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Databases have been left far behind programming languages in safety and expressivity.&lt;/strong&gt;&lt;/em&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Current paradigms are unable to natively handle the data abstractions that we so easily take for granted in programming languages. TypeDB aims to solve this problem by providing a database that natively understands complex object-oriented data structures and supports abstraction, inheritance, and polymorphism. By integrating the benefits of strong typing and query flexibility, TypeDB simplifies data access and eliminates the need for manual mapping.&lt;/p&gt;




&lt;h2&gt;
  
  
  What defines a polymorphic database?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;There are three forms of polymorphism in computer science&lt;/strong&gt;. In order to be fully polymorphic, a database must implement the three fundamental kinds of polymorphism possible in object-oriented programming:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Inheritance Polymorphism:&lt;/strong&gt; The ability to define a class hierarchy where children inherit properties from their parents, and to interpret queries that operate on instances of a class and all its children.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Interface Polymorphism:&lt;/strong&gt; The ability to define properties as interfaces that classes can implement independently of their parents, and to interpret queries that operate on instances of all classes that implement a specified interface.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Parametric Polymorphism:&lt;/strong&gt; The ability to interpret queries that are abstract and able to operate on instances of any class supplied as a parameter to the query.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;To be fully polymorphic, a database has to implement three systems:&lt;/strong&gt; &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Variablizable Language:&lt;/strong&gt; A query language that is expressive enough to variablize classes, either explicitly or implicitly. This is required to describe interface and parametric polymorphism, and so declaratively capture the intent of the query.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Polymorphic Schema:&lt;/strong&gt; A schema or equivalent metadata store containing the semantic context for interpreting the query’s intent. It must contain the class and interface definitions, the class hierarchy, and the interface implementations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Inference Engine:&lt;/strong&gt; An inference engine for reducing the declarative query into an imperative form before being sent to the query planner. This is based on the structure of the query combined with the semantic context provided by the schema.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Current databases do not implement any form of polymorphism&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Relational&lt;/strong&gt; schemas define tables and columns as direct analogs of classes and their properties. As columns cannot be independently implemented by multiple tables, relational databases cannot natively implement interface polymorphism. Tables and columns also cannot be variablized in SQL, meaning that SQL cannot express interface and parametric polymorphism.&lt;br&gt;
&lt;strong&gt;Document&lt;/strong&gt; and &lt;strong&gt;graph&lt;/strong&gt; databases can define a limited number of constraints on inserted data, but this does not have the expressivity of a hierarchical schema built with classes and interfaces. As a result, these databases cannot natively implement all three types of polymorphism.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A fully polymorphic database implements all three&lt;/strong&gt; of these requirements, that is a) a polymorphic query language, b) polymorphic schema, and c) inference engine. It is able to express all three fundamental kinds of polymorphism possible in object-oriented programming, which can be combined to yield unique and powerful features, not possible with any one kind alone. These include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the ability to write polymorphic queries in near-natural language,&lt;/li&gt;
&lt;li&gt;to construct polymorphic views that extend themselves when the schema is extended, and&lt;/li&gt;
&lt;li&gt;to perform polymorphic deductions that generate new data using rules.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A fully polymorphic database also displays model polymorphism - that is the ability to natively model data from relational, document, graph, and other database paradigms.&lt;/p&gt;


&lt;h2&gt;
  
  
  What makes TypeDB the polymorphic database?
&lt;/h2&gt;

&lt;p&gt;TypeDB is a polymorphic database with a strongly typed schema for defining inheritance and interfaces, a variablizable query language for composing declarative polymorphic queries, and a type inference engine for resolving queries against the schema. TypeDB schemas implement the polymorphic entity-relation-attribute (PERA) model for data, an extension of &lt;a href="https://en.wikipedia.org/wiki/Entity%E2%80%93relationship_model"&gt;Chen’s entity-relationship (ER) model&lt;/a&gt;. The ER model is the most widely used tool for building conceptual data models prior to translating them into the logical bounds of a database paradigm.&lt;/p&gt;
&lt;h3&gt;
  
  
  A conceptual data model built on a type-theoretic language
&lt;/h3&gt;

&lt;p&gt;TypeDB implements the &lt;strong&gt;PERA model&lt;/strong&gt; as its database paradigm, which &lt;strong&gt;allows schemas to be built directly from the conceptual models&lt;/strong&gt; that people use to represent domains and their data. Schemas and queries for TypeDB are described using TypeQL, its type-theoretic query language. By combining a strongly typed schema, a fully variablizable query language, and a type inference engine, TypeDB implements all three fundamental kinds of polymorphism, making it a truly polymorphic database.&lt;/p&gt;
&lt;h3&gt;
  
  
  Types are defined in a hierarchy
&lt;/h3&gt;

&lt;p&gt;The PERA model is described by types, defined in the schema as templates for data instances and analogous to classes in OOP. Each user-defined type extends one of the three root types: entity, relation, and attribute, or a previously user-defined type.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Entities&lt;/strong&gt; represent independent concepts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Relations&lt;/strong&gt; represent concepts that depend on one or more roles that can be played by entities and other relations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Attributes&lt;/strong&gt; represent properties that entities and relations can have, and they are defined with a declared value type and instantiated with a particular value.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Entities, relations, and attributes can all be either concrete or abstract, and roles in relations can be overridden by their subtypes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#Schema definition of the user-employee object model in TypeQL
#TypeQL is TypeDB's query language

define

id sub attribute, abstract, value string;
email sub id;
name sub id;
path sub id;

user sub entity;
admin sub user;
user-group sub entity;
resource sub entity, abstract;
file sub resource;

ownership sub relation, abstract,
    relates owned,
    relates owner;
group-ownership sub ownership,
    relates group as owned;
resource-ownership sub ownership,
    relates resource as owned;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Behaviors are implemented and inherited
&lt;/h3&gt;

&lt;p&gt;Once entity, relation, and attribute type hierarchies have been defined, interfaces are created by declaring the attributes that entities and relations own, and the roles they play in relations. Declared attributes owned and roles played are independent of each other, and multiple entity and relation types can own the same attribute or play the same role. The attributes a type owns and the roles it plays are inherited by its subtypes, and can be overridden to control the specificity of these properties.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#Attribute ownership in an entity 
#and entity role definition in a relation in TypeQL

define

user owns email,
    plays resource-ownership:owner;
admin plays group-ownership:owner;
user-group owns name,
    plays group-ownership:group,
    plays resouce-ownership:owner;
resource owns id,
    plays resource-ownership:resource;
file owns path as id;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Data is semantically validated
&lt;/h3&gt;

&lt;p&gt;With the type hierarchies and interfaces defined in the schema, data can be instantiated with an insert query. Data instances and types are defined by variables using a $variable-name that exists in the scope of the query and can be reused to describe complex data patterns. Relations are defined with a tuple of roleplayers and the roles they play. Insert queries undergo semantic validation against the schema, ensuring that the inserted data patterns are valid. Queries that would insert data not allowed by the schema are rejected.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#Compound insert statement that efficiently
#populates users, group definitions, assets 
#and various ownership relations into 
#a trivial IAM database in TypeDB.

insert

$naomi isa admin, has email "naomi@vaticle.com";
$amos isa user, has email "amos@vaticle.com";
$engineers isa user-group, has name "engineers";
$benchmark isa file, has path "/amos/benchmark-results.xlsx";
$roadmap isa file, has path "/vaticle/feature-roadmap.pdf";

(group: $engineers, owner: $naomi) isa group-ownership;
(resource: $benchmark, owner: $amos) isa resource-ownership;
(resource: $roadmap, owner: $engineers) isa resource-ownership;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Data is queried polymorphically
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Data is queried with high-level patterns&lt;/strong&gt;, in which any element can be variablized. Queries are analyzed by the type inference engine before going to the query planner. It resolves polymorphism by identifying possible types that could fit patterns as defined by the schema, and queries return instances of all those types:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Querying a supertype returns instances of subtypes that inherit from it (i.e. inheritance polymorphism).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Querying an interface returns instances of types that implement it (i.e. interface polymorphism)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Querying a variablized type parametrically returns instances of all types that match the pattern (i.e. parametric polymorphism)&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#An efficient 6-line polymorphic query in TypeDB 
#retrieves all instances of ownership relations 
#(i.e. group-ownership and resource-ownership)
#and their related data.

match
(owned: $object, owner: $owner) isa! $ownership-type;
fetch
$ownership;
$object: id;
$owner: id;

# Results:
[{
    "ownership-type": { "root": "relation", "label": "group-ownership" },
    "object": {
        "type": { "root": "entity", "label": "user-group" },
        "id": [
            { "value": "engineers", "value_type": "string",
              "type": { "root": "attribute", "label": "name" } }
        ]
    },
    "owner": {
        "type": { "root": "entity", "label": "admin" },
        "id": [
            { "value": "naomi@vaticle.com", "value_type": "string",
              "type": { "root": "attribute", "label": "email" } }
        ]
    }
},
{
    "ownership-type": { "root": "relation", "label": "resource-ownership" },
    "object": {
        "type": { "root": "entity", "label": "file" },
        "id": [
            { "value": "/amos/benchmark-results.xlsx",
              "value_type": "string", 
              "type": { "root": "attribute", "label": "path" }
            }
        ]
    },
    "owner": {
        "type": { "root": "entity", "label": "user" },
        "id": [
            { "value": "amos@vaticle.com", "value_type": "string", 
              "type": { "root": "attribute", "label": "email" } }
        ]
    }
},
{
    "ownership-type": { "root": "relation", "label": "resource-ownership" },
    "object": {
        "type": { "root": "entity", "label": "file" },
        "id": [
            { "value": "/vaticle/feature-roadmap.pdf", 
              "value_type": "string", 
              "type": { "root": "attribute", "label": "path" }
            }
        ]
    },
    "owner": {
        "type": { "root": "entity", "label": "user-group" },
        "id": [
            { "value": "engineers", "value_type": "string", 
              "type": { "root": "attribute", "label": "name" } }
        ]
    }
}]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  How does TypeDB impact database engineering?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;A unified way of working with data in the database and application.&lt;/strong&gt; TypeDB provides a database that natively models and implements complex object-oriented data structures like abstraction, inheritance, and polymorphism. With these capabilities, TypeDB enables engineers to work with flexible and adaptable data models, making it easier to manage, query, and reason over complex data structures. &lt;/p&gt;

&lt;p&gt;By integrating a conceptual data model, a strong subtyping system, a symbolic reasoning engine, and a type-theoretic language, TypeDB has redefined database architecture and achieved the native expressivity required for modern applications.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Class inheritance in Java of a user-employee model &lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;email&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Employee&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;employeeId&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="nc"&gt;Employee&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;employeeId&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;super&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;employeeId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;employeeId&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;PartTimeEmployee&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Employee&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;weeklyHour&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="nc"&gt;PartTimeEmployee&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; 
                     &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;employeeId&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;weeklyHour&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;super&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;employeeId&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;wheeklyHour&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;weeklyHour&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Class instantiation in Java&lt;/span&gt;

&lt;span class="nc"&gt;PartTimeEmployee&lt;/span&gt; &lt;span class="n"&gt;john&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; 
    &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;PartTimeEmployee&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"john.doe@vaticle.com"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
                         &lt;span class="s"&gt;"John Doe"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;346523&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;35&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#the TypeQL schema definition for the user-employee model

define

email sub attribute, value string;
name sub attribute, value string;
emloyee-id sub attribute, value long;
weekly-hour sub attribute, value long;

user sub entity,
    owns name,
    owns email;

employee sub user,
    owns employee-id;

part-time-employee sub employee,
    owns weekly-hour;

insert $john isa part-time-employee,
    has email "john.doe@vaticle.com", 
    has name "John Doe",
    has employee-id 346523, 
    has weekly-hour 35;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Moreover, as a truly polymorphic database, TypeDB offers a number of unique capabilities not natively attainable with other database paradigms:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Object Model Parity&lt;/strong&gt;: TypeDB’s type-theoretic schemas allow for perfect parity with object models. Constructs that can be challenging to natively model in other databases are simple and intuitive in TypeDB. Utilize type hierarchies, abstract types, multivalued attributes, n-ary relations, nested relations, variadic relations, and complex cardinality constraints all without normalization, reification, or any other process that warps the conceptual model.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Continuous Extensibility&lt;/strong&gt;: Types can be polymorphically queried, so the results of queries automatically extend to include new valid types that are added to the schema after the query is written. This minimizes the need to maintain and update queries when the schema is intended, so long as the semantic intent of the query remains the same. With careful design of the initial schema to ensure extensibility, migrations can be entirely avoided.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Logical Abstractions&lt;/strong&gt;: TypeDB allows for logical abstractions by defining rules for the native symbolic reasoning engine. They are written using the same patterns as queries and resolved against the schema, combining the flexibility of polymorphism with the power of symbolic reasoning. By employing sequential and recursive triggering of rules, extremely complex logical behaviors can arise from rules that are individually very simple, mirroring the true semantic logic of complex data domains.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Data Consistency&lt;/strong&gt;: When utilizing symbolic reasoning, new fact generation occurs at query time, ensuring that generated data is never stale. By using rules to govern data dependencies within the database, all inferred data can be made to have a single source of truth, preventing data conflicts from ever occurring. This ensures that the database is always in a consistent and current state, preventing the need for precomputation cycles.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Unified Data Models&lt;/strong&gt;: The high-level conceptual data model means that schemas in relational, document, and graph databases can be translated with no loss of information, and then enhanced with TypeDB’s unique modeling constructs. This allows for easy transfer of data from other databases, as part of migrations or a multi-database architecture.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Near-Natural Language&lt;/strong&gt;: Due to the declarative nature of TypeQL and its careful syntax design, schemas and queries read close to natural language. This allows engineers to state the intent of their queries at the highest level, without having to use imperative language to describe low-level data structure. Because of this, engineers and domain experts can understand the intent of queries, even with no experience of writing them.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Though it is possible to implement these features in other databases&lt;/strong&gt; by building a layer of abstraction over the database, the lack of native support means that engineers have to build, maintain, and debug these solutions themselves. Such &lt;strong&gt;solutions are also poorly optimized&lt;/strong&gt; because they cannot take advantage of direct integration with the database. With TypeDB, all of these features are built-in, robust, and performant.&lt;/p&gt;




&lt;h2&gt;
  
  
  Welcome to the dawn of the polymorphic database
&lt;/h2&gt;

&lt;p&gt;TypeDB enables engineers to work with flexible and adaptable data models, making it easier to manage, query, and reason over complex data structures. By integrating a conceptual data model, a strong subtyping system, a symbolic reasoning engine, and a type-theoretic language, TypeDB has redefined database architecture and achieved the native expressivity required for modern applications.&lt;/p&gt;

&lt;p&gt;To learn more about TypeDB and its features, please visit &lt;a href="https://typedb.com"&gt;https://typedb.com&lt;/a&gt; and &lt;a href="https://typedb.com/features"&gt;https://typedb.com/features&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;To download TypeDB, please visit &lt;a href="https://typedb.com/deploy"&gt;https://typedb.com/deploy&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;To read TypeDB's documentation, please visit &lt;a href="https://typedb.com/docs"&gt;https://typedb.com/docs&lt;/a&gt; &lt;/p&gt;

</description>
      <category>database</category>
      <category>dataengineering</category>
      <category>oop</category>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>A New Era for TypeDB</title>
      <dc:creator>Skip Everling</dc:creator>
      <pubDate>Mon, 10 Jul 2023 22:49:53 +0000</pubDate>
      <link>https://dev.to/typedb/a-new-era-for-typedb-njh</link>
      <guid>https://dev.to/typedb/a-new-era-for-typedb-njh</guid>
      <description>&lt;p&gt;When we started building TypeDB, we saw a continuously growing complexity of data in modern applications. Modern programming languages have evolved by introducing powerful abstractions and constructs to express more complex logic – JavaScript is succeeded by TypeScript, Java by Kotlin, C/C++ by Rust, and Haskell emerging as the leader of functional languages. &lt;strong&gt;Modern languages all have a stronger and more expressive type system.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;However, when we look at the evolution of database technologies since relational algebra and SQL, even though there has been incredible progress in performance and operational capabilities in the past 40 years, &lt;strong&gt;databases have yet to provide more powerful abstractions to express more advanced logic.&lt;/strong&gt; In fact, graph, document, key-value, wide-column, and every other NoSQL database provide lower-level and more primitive data structures for us to express our models and queries. This is a huge problem for future applications, as they will need to work with more complex datasets and interrogate their data more intelligently.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;We built TypeDB &amp;amp; TypeQL to provide much more powerful abstractions in the database language,&lt;/strong&gt; allowing you to tackle the next order of complexity in future applications. For the first time, TypeDB brings to the database the power of a &lt;strong&gt;strong type system&lt;/strong&gt; &lt;em&gt;,&lt;/em&gt; the simplicity of a &lt;strong&gt;composable language&lt;/strong&gt;, and the intelligence of &lt;strong&gt;symbolic reasoning&lt;/strong&gt; to infer data.&lt;/p&gt;

&lt;p&gt;This year, we’re launching &lt;a href="https://typedb.com"&gt;typedb.com&lt;/a&gt; to help you understand &lt;a href="https://typedb.com/introduction"&gt;our paradigm&lt;/a&gt; and &lt;a href="https://typedb.com/features"&gt;unique features&lt;/a&gt;, and to deliver a brand new and enhanced &lt;a href="https://typedb.com/docs/typedb/2.x/overview.html"&gt;documentation portal&lt;/a&gt;. We are also incredibly excited to invite you to the very first &lt;a href="https://typedb.com/webinars"&gt;webinar series&lt;/a&gt; on &lt;strong&gt;TypeDB Fundamentals&lt;/strong&gt;, happening in just 3 weeks!&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://typedb.com/webinars/introducing-typedb"&gt;July 25th, 12pm ET: Introducing TypeDB&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://typedb.com/webinars/pattern-matching"&gt;July 26th, 12pm ET: Pattern Matching with TypeQL&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://typedb.com/webinars/power-of-inference"&gt;July 27th, 12pm ET: The Power of Inference&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We see the problem of data complexity in many modern applications, especially those serving intelligent operations.&lt;/p&gt;

&lt;p&gt;In &lt;a href="https://typedb.com/solutions/cybersecurity"&gt;Cybersecurity&lt;/a&gt;, Cyber Threat Intelligence and Identity Access Management solutions struggle to keep up with rapid evolution of data and the amount of hidden patterns. In &lt;a href="https://typedb.com/solutions/platform-engineering"&gt;Platform Engineering&lt;/a&gt;, Internal Developer Platforms and Continuous Delivery systems struggle with the unknown consequences of change and fragmentation of data. In &lt;a href="https://typedb.com/solutions/knowledge-engineering"&gt;Knowledge Engineering&lt;/a&gt;, Drug Discovery and Risk Management solutions find that their biggest hurdle is connecting independent datasets in a way that makes it easy to derive hidden and implicit connections. &lt;a href="https://typedb.com/solutions/virtual-representations"&gt;Virtual Representations&lt;/a&gt;, such as those found in Robotics, Digital Twins, and Gaming, struggle with modeling real-world details in a virtual environment.&lt;/p&gt;

&lt;p&gt;This year, we’ll be sharing with you the research we’ve done on applications of TypeDB in these advanced domains, starting with our first &lt;a href="https://typedb.com/webinars"&gt;webinar series&lt;/a&gt; on our new &lt;strong&gt;TypeDB Use Cases&lt;/strong&gt;, happening 4 weeks from now!&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://typedb.com/webinars/identity-access-management"&gt;August 1st, 12pm ET: Building an IAM Platform on TypeDB&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://typedb.com/webinars/cyber-threat-intelligence"&gt;August 2nd, 12pm ET: Building a CTI Platform on TypeDB&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://typedb.com/webinars/drug-discovery"&gt;August 3rd, 12pm ET: Accelerating Drug Discovery with TypeDB&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;TypeDB Cloud&lt;/strong&gt; Alpha is here!
&lt;/h2&gt;

&lt;p&gt;After a whole year of engineering, we are finally ready to invite you to try out &lt;a href="https://typedb.com/cloud"&gt;TypeDB Cloud&lt;/a&gt;! You can now automatically deploy TypeDB in the US and Europe, on Google Cloud and Amazon AWS. More regions across the globe will be coming soon, as well as the option for Microsoft Azure. At this alpha stage of TypeDB Cloud, we’d love to hear your feedback on how TypeDB Cloud meets your expectations, and you’ll have the opportunity to contribute to our development roadmap! &lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;a href="https://typedb.com/cloud?dialog=cloud-waitlist"&gt;Join the TypeDB Cloud waitlist!&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Finally, &lt;strong&gt;TypeDB 2.18 &amp;amp; 2.19&lt;/strong&gt; are released with major updates!
&lt;/h2&gt;

&lt;p&gt;We’ve had 2 major releases in the past month: 2.18 and 2.19. We introduced new functionalities to perform arithmetic operations in TypeQL. We’ve significantly improved import/export of schema &amp;amp; data together. We replaced our storage engine from &lt;a href="https://rocksdb.org/"&gt;RocksDB&lt;/a&gt; to &lt;a href="https://www.speedb.io/"&gt;SpeeDB&lt;/a&gt; and boosting performance. And finally, we now natively support ARM processors for both Mac and Linux, which means you can run TypeDB on Apple silicon chips as well as Raspberry Pis!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/vaticle/typedb/releases/tag/2.18.0"&gt;TypeDB 2.18 Release Notes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/vaticle/typedb/releases/tag/2.19.0"&gt;TypeDB 2.19 Release Notes&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are a lot more major updates coming in the next few months: a new and highly-performant TypeDB Rust driver – and every other driver wrapping the Rust driver binary, new TypeQL capabilities to fetch all attributes of entities and relations as part of answers, optional query patterns in TypeQL, native JSON response format, and many more! For now, we hope you enjoy the new TypeDB 2.19!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://typedb.com/deploy"&gt;&lt;strong&gt;Deploy the new TypeDB&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>database</category>
      <category>backend</category>
      <category>programming</category>
      <category>news</category>
    </item>
    <item>
      <title>How Roche Discovered Novel Potential Gene Targets with TypeDB</title>
      <dc:creator>daniel crowe</dc:creator>
      <pubDate>Thu, 10 Jun 2021 16:54:32 +0000</pubDate>
      <link>https://dev.to/typedb/how-roche-discovered-novel-potential-gene-targets-with-typedb-982</link>
      <guid>https://dev.to/typedb/how-roche-discovered-novel-potential-gene-targets-with-typedb-982</guid>
      <description>&lt;h2&gt;
  
  
  How a type system brings speed and novelty to the drug discovery pipeline
&lt;/h2&gt;

&lt;p&gt;Debrief from a &lt;a href="https://vaticle.com" rel="noopener noreferrer"&gt;Vaticle&lt;/a&gt; Community talk — featuring David Dylus, Scientist, Systems Biology, at Roche. This talk was delivered virtually at &lt;a href="https://youtube.com/c/vaticle" rel="noopener noreferrer"&gt;Orbit 2021&lt;/a&gt; in April.&lt;/p&gt;

&lt;p&gt;Central to drug discovery is the search for targets that are important in disease mechanisms. However, currently, all known targets have been slowly tried and tested. In this project, David and his team designed a rule system to infer and find hidden connections between targets and diseases. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ff.hubspotusercontent40.net%2Fhubfs%2F4332244%2FVaticle%2FImage%2520Hosting%2Fgrakn_orbit_presentation%25204.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ff.hubspotusercontent40.net%2Fhubfs%2F4332244%2FVaticle%2FImage%2520Hosting%2Fgrakn_orbit_presentation%25204.jpg" alt="Problem Statement"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the story to follow, David presents how his team at Roche was able to identify potential novel targets that were not identified by &lt;a href="https://www.opentargets.org/" rel="noopener noreferrer"&gt;Open Targets&lt;/a&gt; as highly ranked. This was made possible with &lt;a href="https://github.com/vaticle/typedb" rel="noopener noreferrer"&gt;TypeDB&lt;/a&gt;, which his team used to store the relevant data and then find underlying biological evidence for those new targets. &lt;/p&gt;

&lt;h3&gt;
  
  
  What datasets were used?
&lt;/h3&gt;

&lt;p&gt;For this project, three datasets were used: STRING, Oma, and DisGeNET.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ff.hubspotusercontent40.net%2Fhubfs%2F4332244%2FVaticle%2FImage%2520Hosting%2Fgrakn_orbit_presentation%25206.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ff.hubspotusercontent40.net%2Fhubfs%2F4332244%2FVaticle%2FImage%2520Hosting%2Fgrakn_orbit_presentation%25206.jpg" alt="Datasets Used"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://string-db.org/cgi/about" rel="noopener noreferrer"&gt;STRING&lt;/a&gt; is a database of known and predicted protein-protein interactions. The interactions include direct (physical) and indirect (functional) associations; they stem from computational predictions, knowledge transfer between organisms, and interactions aggregated from other (primary) databases. This includes not only literature but also experimental evidence for proteins interacting with other proteins. This means that we can search for proteins that have only an experimentally validated protein-protein-interaction.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://omabrowser.org/oma/home/" rel="noopener noreferrer"&gt;Oma&lt;/a&gt; was used to insert gene families, parallax genes, i.e. similar genes that have been conserved in function and are duplicates on the genome, potentially having a similar function to each other.&lt;/p&gt;

&lt;p&gt;Finally, &lt;a href="https://www.disgenet.org/" rel="noopener noreferrer"&gt;DisGeNET&lt;/a&gt; was used to provide variant information, which allowed them to link mutations to genes: for example, if you have a mutation on your genome, if that mutation is linked to a gene, and if that gene is linked to a disease, we can association the disease to that mutation. This database was also mentioned by Tomás in his Orbit 2021 talk [&lt;a href="https://www.youtube.com/watch?v=XJDr_prOp9g&amp;amp;t=1s" rel="noopener noreferrer"&gt;Computational Future of Biology&lt;/a&gt;].&lt;/p&gt;

&lt;p&gt;This then leads us to ask a question such as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Do people that have this mutation, also have some type of prevalence for a specific disease?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To answer this, we should check how closely the specific mutation is to the gene and then assign that this variant somehow modulates that gene. This would explain why we see this type of disease phenotype.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Model and Query for Insights
&lt;/h3&gt;

&lt;p&gt;To start, the team looked at existing targets on the Open Targets database and selected those already ranked highly and known to have a high association score— due to internal Roche IP, unfortunately, they cannot mention which ones specifically; they have been renamed for understanding.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ff.hubspotusercontent40.net%2Fhubfs%2F4332244%2FVaticle%2FImage%2520Hosting%2Fgrakn_orbit_presentation%25207.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ff.hubspotusercontent40.net%2Fhubfs%2F4332244%2FVaticle%2FImage%2520Hosting%2Fgrakn_orbit_presentation%25207.jpg" alt="Existing Targets"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;David called the highly ranked targets taken from Open Targets &lt;code&gt;billionDollarTarget&lt;/code&gt; and  &lt;code&gt;bestTarget&lt;/code&gt;, which overall have a high association score, in other words, they are strongly linked to the disease that David's team is interested in. Below we’ll see how TypeDB can be used to find targets that don’t rank highly on Open Targets, but are still indirectly modulating the disease and are therefore potentially high-value targets to explore. &lt;/p&gt;

&lt;p&gt;For this purpose, David built out a set of rules and schema in TypeQL. Below is just a very small excerpt of how such data can be modelled — taken from &lt;a href="https://github.com/vaticle/biograkn-covid" rel="noopener noreferrer"&gt;BioGrakn-Covid&lt;/a&gt;, a Vaticle community-led project by &lt;a href="https://www.linkedin.com/in/konrad-my%C5%9Bliwiec-764ba9163/" rel="noopener noreferrer"&gt;Konrad Mysliwiec&lt;/a&gt; (Data Science Software Engineer, Roche). Note that this is a selected schema; the full schema can be found within the BioGrakn-Covid schema &lt;a href="https://github.com/vaticle/biograkn-covid/blob/master/Schema/biograkn-covid.gql" rel="noopener noreferrer"&gt;file&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;define
gene sub fully-formed-anatomical-structure,    
  owns gene-symbol,       
  owns gene-name,      
  plays gene-disease-association:associated-gene;
disease sub pathological-function,    
  owns disease-name,    
  owns disease-id,    
  owns disease-type,    
  plays gene-disease-association:associated-disease;
protein sub chemical,    
  owns uniprot-id,    
  owns uniprot-entry-name,    
  owns uniprot-symbol,    
  owns uniprot-name,    
  owns ensembl-protein-stable-id,      
  owns function-description,    
  plays protein-disease-association:associated-protein;
protein-disease-association sub relation,    
  relates associated-protein,    
  relates associated-disease;
gene-disease-association sub relation, 
  owns disgenet-score,    
  relates associated-gene,    
  relates associated-disease;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With the right schema, rules and data inserted, we can write the first query. The relation below is one that David’s team called &lt;code&gt;gene-disease-inference&lt;/code&gt;, with an attribute &lt;code&gt;order:1&lt;/code&gt; to denote that it’s a direct relation. The query looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;match
$d isa disease, has disease-name "Disease";
$r ($gene, $d) isa gene-disease-inference, has order 1;
get $r, $d, $gene;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result is below, we can see that the &lt;code&gt;billionDollarTarget&lt;/code&gt;, the bestTarget, and the &lt;code&gt;youWillNeverGuessTarget&lt;/code&gt; are linked to &lt;code&gt;Disease&lt;/code&gt;. We also see that these three targets are of &lt;code&gt;order: 1&lt;/code&gt;, which indicates a direct and previously known association between the disease and the genes. However, the goal is to find novel targets. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ff.hubspotusercontent40.net%2Fhubfs%2F4332244%2FVaticle%2FImage%2520Hosting%2Fgrakn_orbit_presentation%25209.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ff.hubspotusercontent40.net%2Fhubfs%2F4332244%2FVaticle%2FImage%2520Hosting%2Fgrakn_orbit_presentation%25209.jpg" alt="TypeDB Workbase - IED"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To do this, they write the query shown below. This looks for diseases and genes connected through a &lt;code&gt;gene-disease-inference&lt;/code&gt; relation with &lt;code&gt;order: 2&lt;/code&gt;, but explicitly excludes those that already are connected with a gene-disease-inference relation with &lt;code&gt;order:1&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;match
$d isa disease, has disease-name "Disease";
$r ($gene, $d) isa gene-disease-inference, has order 2;
not {($gene, $d) isa gene-disease-inference, has order 1;};
get $r, $d, $gene;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This query returns a completely different list of genes: &lt;code&gt;whatCouldIBeTarget&lt;/code&gt;, &lt;code&gt;awesomeTarget&lt;/code&gt;, and &lt;code&gt;thatTarget&lt;/code&gt;. All these are targets connected to &lt;code&gt;Disease&lt;/code&gt; through a &lt;code&gt;gene-disease-inference&lt;/code&gt; with &lt;code&gt;order:2&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ff.hubspotusercontent40.net%2Fhubfs%2F4332244%2FVaticle%2FImage%2520Hosting%2Fgrakn_orbit_presentation%252011.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ff.hubspotusercontent40.net%2Fhubfs%2F4332244%2FVaticle%2FImage%2520Hosting%2Fgrakn_orbit_presentation%252011.jpg" alt="negation query result"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;If you are not familiar with TypeDB Workbase, you can right-click one of the inferred relations and select “Explain” in the dropdown. This will explain those inferences and tell you how these targets are connected to our disease via typed roles, played by the targets.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If we explain the inferred relation that links &lt;code&gt;deadTarget&lt;/code&gt;, we see that this target is part of the same gene family as &lt;code&gt;youWillNeverGuessTarget&lt;/code&gt; with &lt;code&gt;order: 1&lt;/code&gt;. This inference was made possible through a &lt;a href="https://docs.vaticle.com/docs/schema/rules" rel="noopener noreferrer"&gt;rule&lt;/a&gt;, which allows us to infer new data based on existing data. In this case, we found a previously unknown indirect interaction between two targets.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ff.hubspotusercontent40.net%2Fhubfs%2F4332244%2FVaticle%2FImage%2520Hosting%2Fgrakn_orbit_presentation%252012.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ff.hubspotusercontent40.net%2Fhubfs%2F4332244%2FVaticle%2FImage%2520Hosting%2Fgrakn_orbit_presentation%252012.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The logic behind the rule that gives this inference breaks down as follows:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;When:&lt;/em&gt;&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a gene target is linked to a disease &lt;/li&gt;
&lt;li&gt;and that target is also in the same gene family as another target already identified as having a strong association to a disease&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Then:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;this gene target and the disease should connected through a gene-disease-inference relation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For the other novel targets, &lt;code&gt;awesomeTarget&lt;/code&gt; and &lt;code&gt;bestTarget&lt;/code&gt;, we see that those inferences are based on a protein-to-protein interaction, which connects to the &lt;code&gt;whatCouldIBeTarget&lt;/code&gt;. If we explain that relation, we see that it is connected to the &lt;code&gt;billionDollarTarget&lt;/code&gt; via a &lt;code&gt;gene-disease-association&lt;/code&gt;, potentially sharing the same variant to the disease. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ff.hubspotusercontent40.net%2Fhubfs%2F4332244%2FVaticle%2FImage%2520Hosting%2Fgrakn_orbit_presentation%252014.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ff.hubspotusercontent40.net%2Fhubfs%2F4332244%2FVaticle%2FImage%2520Hosting%2Fgrakn_orbit_presentation%252014.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Even though &lt;code&gt;awesomeTarget&lt;/code&gt; and &lt;code&gt;thatTarget&lt;/code&gt; appear in the Open Targets database for the disease of interest, they ranked very low. That means they had some link to that disease, but not a strong one. TypeDB uncovered new evidence that suggests those targets could be higher ranked.&lt;/p&gt;

&lt;p&gt;This is how David’s team at Roche was able to leverage TypeDB’s reasoning engine to find novel targets that might have been missed using standard approaches or more direct approaches.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ff.hubspotusercontent40.net%2Fhubfs%2F4332244%2FVaticle%2FImage%2520Hosting%2Fgrakn_orbit_presentation%252015.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Ff.hubspotusercontent40.net%2Fhubfs%2F4332244%2FVaticle%2FImage%2520Hosting%2Fgrakn_orbit_presentation%252015.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That said, biology is a very complicated field that is constantly evolving. Data sets that have been true in the past might not be true today. We are constantly dealing with new confounders, different methodologies, the noise that is inherent in biology. The goal is to find novel ways of modulating a disease with strong biological evidence that will work.&lt;/p&gt;

&lt;p&gt;Having found a novel target does not necessarily mean that this is now a solution or ready for trials. However, it is a great hypothesis to start digging into its efficacy to modulate a specific disease, whether to find a cure or provide better therapeutics to a patient.&lt;/p&gt;

&lt;h3&gt;
  
  
  Where can we go from here?
&lt;/h3&gt;

&lt;p&gt;Instead of targeting a single protein, more advanced targeting can be done by integrating additional information such as protein complexes and pathways. For example, we could look for several genes that are part of the same pathway. If a drug cannot modulate a single target enough to impose a positive change in the state of a patient, then we might consider targeting multiple points on the same pathway. &lt;/p&gt;

&lt;p&gt;David also mentioned he considered extending the rules to, for example, find higher-order relations, to enable the examination of third, fourth or fifth order connections to the specific disease. There is also room for expanding beyond protein-protein interactions and incorporate very specific query constraints. For instance, we could filter that we want genes X and Y to be part of the same pathway, expressed in the same cell type, shown to be up or down-regulated in disease expression, etc. In this way, like boundary conditions, we can increase our target prioritization and make this highly valuable to our process.&lt;/p&gt;

&lt;p&gt;A special thank you to David for his work, contribution to the community and for always bringing joy into his work.&lt;/p&gt;

&lt;p&gt;All slides used with permission. You can find the full presentation on the Vaticle YouTube channel &lt;a href="https://www.youtube.com/watch?v=9Vtn3xE2cfo&amp;amp;list=PLtEF8_xCPklY3P5NLSQb1SyIYLhQssxfY&amp;amp;index=15" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>database</category>
      <category>typedb</category>
      <category>reasoning</category>
    </item>
  </channel>
</rss>
