<!DOCTYPE html>
<html lang="en-US">

  <head>
    <meta charset='utf-8'>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,maximum-scale=2">
    <link rel="stylesheet" href="assets/css/style.css?v=">
    <script src="https://code.jquery.com/jquery-3.3.0.min.js" integrity="sha256-RTQy8VOmNlT6b2PIRur37p6JEBZUE7o8wPgMvu18MC4=" crossorigin="anonymous"></script>
    <script src="assets/js/main.js"></script>
<!-- Begin Jekyll SEO tag v2.6.1 -->
<title>BIRDS | Bidirectional Transformation for Relational View Update Datalog-based Strategies</title>
<meta name="generator" content="Jekyll v4.0.0" />
<meta property="og:title" content="BIRDS" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="Bidirectional Transformation for Relational View Update Datalog-based Strategies" />
<meta property="og:description" content="Bidirectional Transformation for Relational View Update Datalog-based Strategies" />
<meta property="og:site_name" content="BIRDS" />
<script type="application/ld+json">
{"@type":"WebSite","url":"/","name":"BIRDS","headline":"BIRDS","description":"Bidirectional Transformation for Relational View Update Datalog-based Strategies","@context":"https://schema.org"}</script>
<!-- End Jekyll SEO tag -->

  </head>

  <body>

    <!-- HEADER -->
    <div id="header_wrap" class="outer">
        <header class="inner">
          
            <a id="forkme_banner" href="https://github.com/dangtv/BIRDS">View on GitHub</a>
          
          <a id="project_title" href="/BIRDS">BIRDS</a>
           <!-- <h1 id="project_title">  BIRDS </h1>  -->
          <h2 id="project_tagline">Bidirectional Transformation for Relational View Update Datalog-based Strategies</h2>

          
        </header>
    </div>

    <!-- MAIN CONTENT -->
    <div id="main_content_wrap" class="outer, wrapper">
      <div class="inner">
          <nav>
              <h3>Contents</h3>
              <ul></ul>
            </nav>
        <section id="main_content">
          <h1 id="overview">Overview</h1>

<p>BIRDS (<strong>BI</strong>directional transformation for <strong>R</strong>elational view update <strong>D</strong>atalog-based <strong>S</strong>trategies) is a framework for programming view update strategies on relations in Datalog. 
The framework is based on the theory of (putback-based) bidirectional transformations (BX) but specifically developed for relational database management systems (RDBMSs).
BIRDS frees programmers from the burden of manually:</p>

<ul>
  <li>Checking the well-behavedness of view update strategies,</li>
  <li>Optimizing view update strategies,</li>
  <li>Translating update strategies into triggers and trigger procedures for views in PostgreSQL to handle SQL DML statements of UPDATE/INSERT/DELETE on the views.</li>
</ul>

<h1 id="view-update-strategy-how-to-write">View update strategy: How to write?</h1>
<p>We are given schemas of tables and a view. Traditionally, over the base tables, we write a query that defines the view. However, this defining query is not enough to determine how view updates are propagated to the base tables.</p>

<p>BIRDS allows developers to focus on the reverse direction, i.e., the view update strategy, which is more essential for updatable views. An update strategy can be completely described by a Datalog program over the base tables and the view that results in updates (insertions/deletions) on the base tables. In fact, this update strategy captures both the view update propagation and the defining query of the view.</p>

<p>A well-behaved update strategy should make full use of data on the view in updating the source tables. We must ensure that no information on the view is lost in the updated source. BIRDS supports us to verify the well-behavedness of the written update strategy.</p>

<p>Writing view update strategies by example: <a href="basic-tutorial.html">The basics</a></p>

<p>The Datalog core Syntax: BIRDS currently accepts extensions of Datalog including negation and built-in predicates but no recursion in the Datalog program. See more details at <a href="syntax.html">Syntax</a></p>

<h1 id="from-datalog-to-sql-triggers">From Datalog to SQL triggers</h1>

<p>BIRDS is integrated with PostgreSQL as a backend SQL database. BIRDS generates an SQL program that implements the described view update strategy in the PostgreSQL database by using triggers.
See the <a href="triggers.html">trigger generation</a> for details.</p>

<h1 id="installation-and-usage">Installation and Usage</h1>

<p>BIRDS can be used via the Command line interface (CLI) or the Web-based interface (WebUI).</p>

<h3 id="command-line-tool">Command line tool</h3>

<p>The instructions of building and installing the command line tool <code class="highlighter-rouge">birds</code> can be found at <a href="https://github.com/dangtv/BIRDS">https://github.com/dangtv/BIRDS</a>.</p>

<p>To use the <code class="highlighter-rouge">birds</code> command:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>birds <span class="o">[</span>OPTIONS]
<span class="nt">--version</span>               Print version
<span class="nt">--log</span>                   Print running information
<span class="nt">--debug</span>                 Enable debugging mode
<span class="nt">--explain</span>               Show only explanations <span class="k">in </span>the debugging mode
<span class="nt">-f</span> &lt;file&gt;               Input program file, <span class="k">if </span>not chosen, <span class="nb">read </span>from stdin
<span class="nt">-b</span> &lt;file&gt;               Shell script file specifying the action, which will be executed when there is an update on the view, <span class="k">if </span>not chosen, execute nothing
<span class="nt">-o</span> &lt;file&gt;               Output SQL file, <span class="k">if </span>not chosen, print to stdout
<span class="nt">-l</span> &lt;file&gt;               Output verification file <span class="o">(</span>optional<span class="o">)</span>
<span class="nt">-s</span> &lt;schema&gt;             Database schema name to connect to <span class="o">(</span>default: public<span class="o">)</span>
<span class="nt">-h</span> &lt;host&gt;               Database server host <span class="o">(</span>default: <span class="s2">"localhost"</span><span class="o">)</span>
<span class="nt">-c</span>                      Connect and run the generated SQL on the database server
<span class="nt">--import</span>                Connect and import the data schema from the database server
<span class="nt">-v</span>                      Enable verifications
<span class="nt">-x</span> &lt;size&gt;               Get a counterexample with the maximum size <span class="k">if </span>the program is not well-behaved
<span class="nt">--counterexample</span> &lt;size&gt; The same as <span class="nt">-x</span>
<span class="nt">-i</span>                      Optimize the update propagation by incremental rewriting rules
<span class="nt">--incrementalization</span>    The same as <span class="nt">-i</span>
<span class="nt">-e</span>                      Optimize datalog rules
<span class="nt">--optimization</span>          The same as <span class="nt">-e</span>
<span class="nt">-u</span>                      Speed up the verifications
<span class="nt">--speedup</span>               The same as <span class="nt">-u</span>
<span class="nt">-p</span> &lt;port&gt;               Database server port <span class="o">(</span>default: <span class="s2">"5432"</span><span class="o">)</span>
<span class="nt">-U</span> &lt;user&gt;               Database user <span class="o">(</span>default: <span class="s2">"postgres"</span><span class="o">)</span>
<span class="nt">-g</span> &lt;user&gt;               The special user <span class="k">for </span>global dejima synchronization <span class="o">(</span>default: <span class="s2">"dejima"</span><span class="o">)</span>
<span class="nt">--dejima</span>                Detect updates on dejima views to perform pre-defined actions <span class="k">in </span>the shell script file
<span class="nt">-w</span> &lt;password&gt;           Database user password <span class="o">(</span>default: 12345678<span class="o">)</span>
<span class="nt">-d</span> &lt;dbname&gt;             Database name to connect to <span class="o">(</span>default: <span class="s2">"datalogdb"</span><span class="o">)</span>
<span class="nt">-t</span> &lt;<span class="nb">timeout</span><span class="o">&gt;</span>            Timeout <span class="o">(</span>second<span class="o">)</span> <span class="o">(</span>default: 120s<span class="o">)</span>
<span class="nt">-help</span>                   Display this list of options
<span class="nt">--help</span>                  Display this list of options
</code></pre></div></div>

<p>For example, this command will transform the update strategy described in <code class="highlighter-rouge">test.dl</code> to sql:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>birds <span class="nt">-f</span> test.dl <span class="nt">-o</span> test.sql
</code></pre></div></div>

<h3 id="webui">WebUI</h3>

<p>Learn to use this WebUI at <a href="webui-installation.html">the instruction for the WebUI editor</a></p>

<h3 id="docker">Docker</h3>

<p>The easiest way to use both the command line tool <code class="highlighter-rouge">birds</code> and the web-based interface is creating a docker container from <a href="https://hub.docker.com/r/dangtv/birds">BIRDSâ€™s docker image</a>:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>docker run <span class="nt">--name</span> <span class="s2">"birds"</span> <span class="nt">-ti</span> <span class="nt">-p</span> 5432:5432 <span class="nt">-p</span> 3010:3010 dangtv/birds
</code></pre></div></div>

<p>In this docker image, the PostgreSQL database runs on port 5432 with a default user whose name is <code class="highlighter-rouge">postgres</code> and password is <code class="highlighter-rouge">12345678</code>. The BIRDS WebUI runs on port 3010 without a default user (an administrator user can be created at the first time).</p>

<h1 id="case-studies">Case studies</h1>

<ul>
  <li><a href="basic-tutorial.html">The basics</a></li>
  <li><a href="customer.html">Customers database</a></li>
  <li><a href="employee.html">Employees database</a></li>
  <li><a href="ridesharing-tutorial.html">Ride-sharing system</a></li>
  <li><a href="music-tutorial.html">Music database</a></li>
</ul>

<h1 id="publications">Publications</h1>

<ol>
  <li>
    <p>Van-Dang Tran, Hiroyuki Kato, Zhenjiang Hu. <strong>Programmable View Update Strategies on Relations</strong>. <em>46th International Conference on Very Large Data Bases (<a href="https://vldb2020.org">VLDB 2020</a>)</em>, Tokyo, Japan, 2020. [<a href="assets/bib/vldb2020.bib">BibTeX</a>, <a href="https://doi.org/10.14778/3377369.3377380">DOI</a>, <a href="https://arxiv.org/abs/1911.05921">extended version</a>]</p>
  </li>
  <li>
    <p>Van-Dang Tran, Hiroyuki Kato, Zhenjiang Hu. <strong>BIRDS: Programming view update strategies in Datalog</strong>. <em>46th International Conference on Very Large Data Bases (<a href="https://vldb2020.org">VLDB 2020</a>)</em>, Demonstration, Tokyo, Japan, 2020. [<a href="assets/bib/vldb2020demo.bib">BibTeX</a>, <a href="https://doi.org/10.14778/3415478.3415503">DOI</a>]</p>
  </li>
</ol>

<h1 id="acknowledgments">Acknowledgments</h1>

<p>This work is partially supported by the Japan Society for the Promotion of Science (JSPS) Grant-in-Aid for Scientific Research (S) No. 17H06099 (<a href="http://www.biscuits.work/">the BISCUITS project</a>). We thank the authors of the open source software projects (<a href="https://github.com/Z3Prover/">Z3</a>, <a href="https://github.com/leanprover/">Lean</a>, <a href="https://github.com/rickbergfalk/sqlpad">SQLPad</a>, <a href="https://github.com/emina/rosette">Rosette</a>, <a href="https://github.com/c-cube/datalog">datalog</a>, and so forth) that are used and extended in BIRDS.</p>

<h1 id="contact">Contact</h1>

<p><a href="https://dangtv.github.io/">Van-Dang Tran</a> (The Graduate University for Advanced Studies, SOKENDAI, Japan),</p>

<p><a href="https://researchmap.jp/katohiroyuki?lang=en">Hiroyuki Kato</a> (National Institute of Informatics (NII), Japan),</p>

<p><a href="http://research.nii.ac.jp/~hu/">Zhenjiang Hu</a> (Peking University, China).</p>

        </section>
      </div>
    </div>
    
    <!-- FOOTER  -->
    <div id="footer_wrap" class="outer">
      <footer class="inner">
        <p style="margin-bottom:0em"><small>
          
          Maintained by <a href="https://dangtv.github.io">Vandang Tran</a>, Hiroyuki Kato, Zhenjiang Hu</small>.
        
        <small>Theme based on <a href="https://github.com/pages-themes/slate">Slate</a></small>.
        <small>Last updated on 2 Dec 2020</small></p>
      </footer>
    </div>

    
  </body>
</html>