<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>MORTAL: A Tool of Automatically Designing Relational Storage Schemas for Multi-model Data through Reinforcement Learning?</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Gongsheng Yuan</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Jiaheng Lu</string-name>
          <email>jiaheng.lug@helsinki.fi</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Renmin University of China</institution>
          ,
          <addr-line>Beijing 100872</addr-line>
          ,
          <country country="CN">China</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>University of Helsinki</institution>
          ,
          <addr-line>FI-00014, Helsinki</addr-line>
          ,
          <country country="FI">Finland</country>
        </aff>
      </contrib-group>
      <fpage>7</fpage>
      <lpage>12</lpage>
      <abstract>
        <p>Considering relational databases having powerful capabilities in handling security, user authentication, query optimization, etc., several commercial and academic frameworks reuse relational databases to store and query semi-structured data (e.g., XML, JSON) or graph data (e.g., RDF, property graph). However, these works concentrate on managing one of the above data models with RDBMSs. That is, it does not exploit the underlying tools to automatically generate the relational schema for storing multi-model data. In this demonstration, we present a novel reinforcement learning-based tool called MORTAL. Speci cally, given multi-model data containing di erent data models and a set of queries, it could automatically design a relational schema to store these data while having a great query performance. To demonstrate it clearly, we are centered around the following modules: generating initial state based on loaded multi-model data, in uencing learning process by setting parameters, controlling generated relational schema through providing semantic constraints, improving the query performance of relational schema by specifying queries, and a highly interactive interface for showing query performance and storage consumption when users adjust the generated relational schema.</p>
      </abstract>
      <kwd-group>
        <kwd>Multi-model Data</kwd>
        <kwd>Reinforcement Learning</kwd>
        <kwd>Relational Schema</kwd>
        <kwd>JSON</kwd>
        <kwd>RDF</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        The powerful transaction management ability, mature recovery mechanism, high
availability, and excellent security of relational database management system
(RDBMS) make it outstanding in the eld of data management. Therefore, many
commercial and academic frameworks reuse RDBMSs to store and query
semistructured data (e.g., XML, JSON) or graph data (e.g., RDF, property graph).
For example, MDF (Mapping De nition Framework) [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] parses an XML schema
based on the annotation method to get a relational schema and loads the XML
document into tables.
? Copyright © 2021 for this paper by its author. Use permitted under Creative
Commons License Attribution 4.0 International (CC BY 4.0).
Social Network (RDF)
      </p>
      <p>Titanic
type</p>
      <p>Write
Movie</p>
      <p>James Cameron
{
}
" objId" : " o123" ,
" customerId" : " cus1"
" customer" : " JamesCameron" ,
" productId" : p1,
...
]</p>
      <p>Order (JSON)</p>
      <p>Feedback (Relation)
customerId
cus1
cus2
productId
p1
p2
rate
perfect
great</p>
      <p>The central task of existing works is to map a single data model into relational
tuples. However, the swift growth of applications and devices diversi es data
formats and makes managing these data in the same project di cult. Because
it may lead to latency or data inconsistency when utilizing several databases in
one project, such a dilemma calls for a novel multi-model database system. But
it is expensive to develop such a novel system and replace the current popular
RDBMS with it. Therefore, we consider mapping multi-model data (see Figure 1)
into relational data and use powerful RDBMSs to manage these shred data.
Unfortunately, this idea is extremely challenging as it demands a great relational
schema to store them while having an excellent query performance.</p>
      <p>In this demonstration, we present a novel tool called MORTAL (transforming
Multi-mOdel data into Relational TAbles based on reinforcement Learning) to
store multi-model data in RDBMSs. Given multi-model data containing di erent
data models and a set of queries, it could automatically design a relational
schema to store these data while having a great query performance.</p>
      <p>
        As an important area of machine learning, reinforcement learning (RL)
concentrates on how agents take actions in an environment to maximize the
cumulative reward. In the standard RL model, it allows an agent to explore, interact
with, and learn from the environment. On each step of interaction, the agent
takes in the current state observations of the environment as the inputs and
then chooses an action as the output. This action a ects the environment by
changing its state. Next, the environment produces a reward for that action
and passes it to the agent. Then, the agent should choose actions that tend to
maximize the long-run sum of rewards. This is achieved by systematic trial and
error over time. The promise of a future high reward might lead to a non-best
action for a certain iterative. RL achieves a trade-o between exploration (of
unvisited area) and exploitation (of known knowledge) when interacting with
the environment [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ].
      </p>
      <p>Since our goal is to generate a relational schema having a great query
performance (i.e., having minimum query time or maximum negative value of query
time), it is similar to the goal of the RL model. Therefore, we use the RL model to
address our problem. Speci cally, we utilize Markov Decision Process to model
the process of relational schema generation and let RL work with a dynamic
environment to generate the optimal outcome.</p>
    </sec>
    <sec id="sec-2">
      <title>Design Philosophy</title>
      <p>MORTAL is designed to provide end-users with the convenience to easily get
a great relational schema for storing any multi-model data source in RDBMSs
while having a great query performance. Concretely, its design is based on the
following two principles:
1. No need to extend RDBMSs. Our RL-based approach should be able
to work with any RDBMSs. With each interaction, our tool could obtain
a relational schema by selecting an action. The nal generated relational
schema could be loaded into any RDBMSs without extending them.
2. Query-aware. A key issue in generating relational schema to store
multimodel data is that it could have a great query performance. Such a
requirement naturally requires a query-aware approach. Fortunately, MORTAL
(reinforcement learning model) satis es this condition.</p>
      <p>Fr o nt End
Generate Initial State</p>
      <p>Set Parameters
Give Semantic Constraints</p>
      <p>Input Queries
Draw Visualiizations</p>
      <p>Resu l t
Set t i ng</p>
      <p>Ag e nt</p>
      <p>Act i o n
(Obser vat i on) A1 A2 ...</p>
      <p>St at e .S1
.
.</p>
      <p>A =f (s)</p>
      <p>Bac k End</p>
      <p>Act i o n</p>
      <p>Rewar d
Obser vat i o n RDBMS</p>
      <p>
        Env i r o nme nt
Figure 2 depicts the architecture of MORTAL. It consists of the following
components. And [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] gives more detail about this method.
      </p>
      <p>The GUI module. Figure 3 depicts a screenshot of the MORTAL GUI.
Panel 1 contains a list of distinct buttons that enables a user to ¶ generate an
initial relational schema and · load it, ¸ set parameters (e.g., learning rate), ¹
specify semantic constraints, º and input queries. After nishing setting Panel
1, users could use the buttons from Panel 2 to start up learning or stop the whole
program. Panel 3 is like a hyperlink, which could open an interface for
showing query performance and storage consumption after users adjusting selected
relational schema. MORTAL uses Panel 4 to manifest the generated relational
schema in the process of learning, the query time over this relational schema,</p>
      <sec id="sec-2-1">
        <title>Dialog 2</title>
      </sec>
      <sec id="sec-2-2">
        <title>Dialog 3</title>
      </sec>
      <sec id="sec-2-3">
        <title>Panel 1</title>
      </sec>
      <sec id="sec-2-4">
        <title>Panel 3</title>
      </sec>
      <sec id="sec-2-5">
        <title>Panel 5</title>
      </sec>
      <sec id="sec-2-6">
        <title>Panel 6</title>
      </sec>
      <sec id="sec-2-7">
        <title>Dialog 4</title>
      </sec>
      <sec id="sec-2-8">
        <title>Dialog 5</title>
      </sec>
      <sec id="sec-2-9">
        <title>Panel 2</title>
      </sec>
      <sec id="sec-2-10">
        <title>Dialog 6</title>
      </sec>
      <sec id="sec-2-11">
        <title>Dialog 7</title>
      </sec>
      <sec id="sec-2-12">
        <title>Panel 4</title>
      </sec>
      <sec id="sec-2-13">
        <title>Dialog 1</title>
        <p>and space consumption of this schema in RDBMSs, and display the changes in
time and space on Panels 5 and 6, respectively.</p>
        <p>
          Data clean module. Since MORTAL needs to load data into RDBMSs to
execute queries for getting the reward (the reduction of query time compared
to the previous query), we would use a fully decomposed storage model (DSM)
[
          <xref ref-type="bibr" rid="ref1">1</xref>
          ] and the model-based method [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ] to shred multi-model data into several little
tables. Those little tables form the initial schema that is also the initial state of
the RL model.
        </p>
        <p>
          Parameter module. To make the RL model work, it needs to know the
learning rate, reward decay, greedy, and the value of the episode. MORTAL
adopts a variant Q-leaning called Double Q-tables as a learning algorithm to
help choose actions. This method could reduce the dimension of the original
Q-table [
          <xref ref-type="bibr" rid="ref5">5</xref>
          ] and improve learning e ciency. With Double Q-tables, we de ne the
action as a join operation. Therefore, the dimension of the Q-table is equal to
the distinctive number of attributes (i.e., the number of little tables generated
in the previous module). For each iteration, MORTAL rstly chooses one table
(attribute) based on the rst Q-table. Next, it selects another table (attribute)
Gnerate Initial
Relational Schema
        </p>
        <p>JSON</p>
        <p>Set
Parameters</p>
        <p>Relational
Tables</p>
        <p>Specify
Constraints
by the second Q-table to prepare to join. Based on the Double Q-tables method,
users could try MORTAL's best to explore di erent schemas by setting a small
greedy value, or could assign a larger greedy value to accelerate converging of
learning. Besides, the higher the given value of the episode, the higher probability
MORTAL will nd the optimal relational schema for the given queries and
multimodel data. However, this would cost more time.</p>
        <p>Semantic constraints module. There is one crucial issue in the progress
of generating relational schema. That is, we need to take the relationships among
the multi-model data into account. Besides, we previously introduce that
MORTAL selects two tables (attributes) through two Q-tables for preparing the join
operation in the Parameter module. But we do not know whether they could
do the join operation for selected attributes. Here, the semantic constraints could
help address this problem and tells the MORTAL what kinds of schemas users
want to obtain.</p>
        <p>Interactive module. Finally, this module allows users to input their own
designed schema or adjusted relational schema selected on the Panel 4 for
observing or verifying its query performance and storage consumption.
4</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>Demonstration</title>
      <p>MORTAL is implemented with Python and PySide2. Our demonstration will be
loaded with a multi-model dataset (Person) 3 and show the results in Figure 3.
The key scenarios of the demonstration are as follows.</p>
      <p>Generate relational schema based on RL. On the MORTAL's main
interface (see Dialog 1 in Figure 3), users rstly utilize the Data Clean button
3 https://www2.helsinki. /en/researchgroups/uni
ed-database-managementsystems-udbms/datasets/person-dataset
to open Dialog 2 where users could get initial relational schema by multi-model
data. Then users use the Load Multi-Model File button to feed the generated
tables to MORTAL in Dialog 3 to prepare to run the program. Next, with the
Parameter Setting button, users could open Dialog 4 to specify the value of
parameters. In this dialog, users could also ll in the cost of query time and space
for a competitor ( e.g., ArangoDB) to contrast that with MORTAL. Speci cally,
In Figure 3, these values correspond to the red lines. For example, on Panel 5,
since the query time of ArangoDB is far larger than that of MORTAL, so it does
not show the red line. But on Panel 6, we could see that the red line is above the
blue line. This is, the space consumption of relational schema is less than the
ArangoDB's within these 20 episodes (set in Dialog 4) of learning. After that,
users could use the Constraint Pool and Input Queries Workload buttons to open
corresponding Dialogs 5 and 6 and input what MORTAL needs according to the
label's description. For example, users could provide a piece of information, \5
= 98" (see Dialog 5 of Figure 3), to let MORTAL know that the attribute \title"
(\5") in JSON is equal to the attribute \title" (\98") in RDF, and they could
be joined together. Finally, users could start up MORTAL by the Start button
on Panel 2, and the results will be displayed on Panel 3, Panel 5, and Panel 6.
Figure 4 depicts this process.</p>
      <p>Interactive interface. Using Panel 3 or other items below it, users could
open Dialog 7 after double-clicks. In this dialog, users could input a new
relational schema designed by users or adjust the selected relational schema to
get its query performance and space consumption through pushing the Execute
button. And users could sort the relational schema according to time or space
by clicking the header of Panel 4 to obtain the optimal schema.</p>
    </sec>
    <sec id="sec-4">
      <title>ACKNOWLEDGEMENT</title>
      <p>The work is partially supported by the China Scholarship Council and the
Academy of Finland project (No. 310321). We would also like to thank all the
reviewers for their valuable comments and helpful suggestions.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Copeland</surname>
            ,
            <given-names>G.P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Khosha an</surname>
            ,
            <given-names>S.N.:</given-names>
          </string-name>
          <article-title>A decomposition storage model</article-title>
          .
          <source>SIGMOD Rec</source>
          .
          <volume>14</volume>
          (
          <issue>4</issue>
          ),
          <volume>268</volume>
          {279 (May
          <year>1985</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Du</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Amer-Yahia</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Freire</surname>
          </string-name>
          , J.: Shrex:
          <article-title>Managing xml documents in relational databases</article-title>
          .
          <source>In: VLDB</source>
          (
          <year>2004</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Florescu</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kossmann</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          :
          <article-title>Storing and querying xml data using an rdmbs</article-title>
          .
          <source>IEEE data engineering bulletin 22</source>
          ,
          <issue>3</issue>
          (
          <year>1999</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Kaelbling</surname>
            ,
            <given-names>L.P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Littman</surname>
            ,
            <given-names>M.L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Moore</surname>
            ,
            <given-names>A.W.</given-names>
          </string-name>
          :
          <article-title>Reinforcement learning: A survey</article-title>
          .
          <source>J. Artif. Int. Res</source>
          .
          <volume>4</volume>
          (
          <issue>1</issue>
          ),
          <volume>237</volume>
          {285 (May
          <year>1996</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Watkins</surname>
            ,
            <given-names>C.J.C.H.</given-names>
          </string-name>
          :
          <article-title>Learning from delayed rewards (</article-title>
          <year>1989</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Yuan</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lu</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          , Zhang,
          <string-name>
            <given-names>S.</given-names>
            ,
            <surname>Yan</surname>
          </string-name>
          ,
          <string-name>
            <surname>Z.</surname>
          </string-name>
          :
          <article-title>Storing multi-model data in rdbmss based on reinforcement learning</article-title>
          .
          <source>In: Proceedings of the 30th ACM International Conference on Information &amp; Knowledge Management</source>
          (
          <year>2021</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>