<!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>TRENDy: a tool for temporal modelling and database generation</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Stephan Maree</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Richard Taylor</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>C. Maria Keet</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Department of Computer Science, University of Cape Town</institution>
          ,
          <country country="ZA">South Africa</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Temporal ontologies, knowledge graphs, and conceptual data models persist as requirements, since much data collected is temporal and constraints must hold to ensure data quality. Temporal conceptual modelling and ontology development face various challenges in uptake, notably the cognitive load and then extra eforts to squeeze it into an atemporal OWL, and once represented, to convert it into something concretely useful in applications. We introduce the TRENDy tool, which ofers browser-based diagrammatic modelling of the logicbased temporal conceptual data modelling language Trend, and subsequent automated conversion into SQL statements to create the corresponding relational database. The evaluation showed the tool to outperform the baseline modelling tool in usability. Software availability: https://github.com/richietaylor/trendy</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Temporal ontologies</kwd>
        <kwd>Temporal conceptual models</kwd>
        <kwd>Graphical modelling tool</kwd>
        <kwd>Model transformations</kwd>
        <kwd>SQL</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        The visual paradigm for ontology authoring is well-known, and for conceptual data models such as
UML and EER, it is considered essential. For temporal ontologies and conceptual models, this is even
more important, because the extra set of constraints impose a higher cognitive demand, especially
when ternary relations have to be reified in OWL [
        <xref ref-type="bibr" rid="ref1 ref2">1, 2</xref>
        ]. In addition, reasoning over temporal logics is
computationally costly [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] and the transformation to temporal databases to gain a practical concrete
advantage with the temporal constraints has not been designed, let alone implemented, although there
are theoretical advances on temporal OBDA with a few constraints surveyed in [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] and on transforming
temporal entity types to the relational model [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. A transformation-based approach to link ontologies to
data has been shown to be promising [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] thanks to its increased expressiveness, but only for atemporal
application ontologies and EER models.
      </p>
      <p>
        To address the temporal modelling and deployment hurdles, we developed the TRENDy tool. It
provides, first, a graphical editor front end, which uses the syntax and semantics of the Trend
modelling language [
        <xref ref-type="bibr" rid="ref7 ref8">7, 8</xref>
        ] that has a mapping into the Description Logic ℒℛ [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] that is is based on
linear temporal logic with the Until and Since operators. It not only contains temporal entity types,
relationships, and attributes, but also transitions constraints, principally among entity types and among
relationships. For instance, to be able to assert that “each alumnus must have been a student before” and
“an employee may also become a manager”. Trend was extensively tested with over 1000 participants
and shown to be efective for both understanding and modelling [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. The TRENDy tool ofers the first
implementation of Trend.
      </p>
      <p>Second, we designed and implemented transformation algorithms from Trend models into SQL such
that all constraints are preserved. Efectively, columns for time are added and then triggers to ensure
data integrity. This is, to the best of our knowledge, the first implementation of a conversion from a
temporal conceptual model into a relational database.</p>
      <p>The remainder of this demo paper presents the front-end with the graphical modelling of logic-based
temporal models in Section 2 and the transformation into SQL in Section 3. We then conclude, look
ahead, and outline what can be expected at the demo in Section 4.</p>
    </sec>
    <sec id="sec-2">
      <title>2. TRENDy’s graphical editor as front-end</title>
      <p>TRENDy is built using the Model-View-Controller (MVC) design pattern, ensuring a robust and scalable
framework. The Model serialisation is implemented as a JSON object, maintaining separate lists for nodes
(the implementation of entities, attributes) and edges (the implementation of temporal constraints).
Said lists contain all necessary information for on-screen rendering and integration with the SQL
schema generation component (described in the next section). The View and Controller are managed
by ReactFlow, a React library optimised for node-based UI design, enabling features like drag-and-drop,
resizing, and an infinitely expanding canvas. The architecture allows easy long-term maintainability
and adaptability of the codebase.</p>
      <p>The interface with full layout is shown in Fig. 1. Key components include state management (therewith
allowing the user to undo and redo changes on the model), basic syntax checking and explanation of
errors, a verbalisation feature that provides natural language renderings of selected temporal constraints
(see Fig. 2), and other features, such as snap-to-grid, panning, and saving.</p>
      <p>
        TRENDy was evaluated through a user study involving 16 computer science students that had
completed a database course including EER two years before. They were divided equally between
TRENDy and the control tool Draw.io. The learning curve for TRENDy compared to the relatively
well-known Draw.io was not factored into the experiment set-up. Participants were tasked with creating
temporal models based on Trend’s controlled natural language [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] that was generated from the
precreated models. Performance was measured in terms of task completion time and correctness (marking
scheme as in Experiment 11 of [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]), and it was supplemented by the System Usability Scale (SUS) for
usability assessment. A small incentive was provided to the participants as remuneration for their efort
and time, being pizza for lunch. Ethics approval was obtained from the UCT Science Faculty Ethics
Committee. See supplementary material on GitHub for experiment details.
      </p>
      <p>The scatter plot in Fig. 3 shows the results for each participant. For Draw.io, the average mark was
12.63/21 (60.12%) and the average time to complete the tasks was 25:10 minutes; for TRENDy, they were
A. Example of temporal constraint verbalisation and of the contextual menu
B. Example of basic validation. Top: error display; Bottom: explanation upon
selecting the line.
17.13/21 (81.55%) and 21:07 minutes, respectively. Thus, TRENDy users were 16.01% faster with a 21.43%
improvement in their model correctness, on average. The average SUS score was 43.13 (“poor”) for
Draw.io and 75.63 (“good”) for TRENDy. The downside of familiarising oneself with a new tool of good
quality was thus ofset by faster, and better, modelling. Future interface evaluations might elucidate
whether this can be attributed to the specific and guided options, cf. a flexible Draw.io palette, and/or
additional model explanations in TRENDy.</p>
    </sec>
    <sec id="sec-3">
      <title>3. Converting a Trend model to SQL with TRENDy</title>
      <p>
        This component of the tool converts Trend models into functional SQL databases. The SQL files are
designed to work for MariaDB [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] and adhere to the SQL:2011 standard [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ].
      </p>
      <p>All standard features present in Extended Entity Relationship Diagrams are implemented, as well as
the temporal logics and transition constraints of Trend. This was achieved by developing an algorithm
that takes a serialised Trend model from the graphical editor and generates an SQL file containing the
tables and triggers specified according to the model. The algorithm scales log linearly with input size
converting a list of nodes and edges into data structures representing the finalised tables. Each of these
data structures are then used to generate SQL strings which are appended to the output file.</p>
      <p>For the temporal entities, it adds ‘start’ and ‘end’ columns for the valid time. The temporal constraints
in Trend are converted into SQL triggers. The triggers for the temporal transition constraints prevent
the insertion of any tuple that violates the formal semantics of Trend. Each temporal constraint in
Trend maps to a trigger pattern, which is then completed with the relevant elements from the Trend
model that is being converted. For instance, given two entities, A and B with identifiers, AID and BID
respectively, the trigger to enforce an optional dynamic evolution in the past (chg, with a dotted arrow
in the diagram) is the following:
A. Each bonus customer was already a loyal customer B. TREND syntax</p>
      <p>LoyalCustomer ISAC Customer
BonusCustomer ISAC Customer
ID(Customer) = CustID
mextLoyalCustomer,BonusCustomer</p>
      <p>C. Semantics of ‘mandatory ext’
D. Section of the SQL code generated</p>
      <p>where C1 is the Loyal Customer and C2 the Bonus Customer and EXT is defined as:</p>
      <p>This trigger prevents entries being made in B’s table that overlap with existing entries with the same
identifier in A, enforcing the rule that “each object in B could have been in A, but is not in A anymore”,
by preventing an object from being in both A and B. An example with generated SQL code for the
‘mandatory extension in the past’ is shown in Fig. 4.</p>
      <p>Thorough testing has shown that the tool can accurately generate schemas based on the user’s models,
and that these models obey Trend’s semantics. This schema generation feature is expected to decrease
the barrier to entry of developing temporal databases by reducing the time and costs associated with it,
solving the problem of needing to manually implement all temporal features in the application logic.
This demo paper introduced the Web-based TRENDy tool, with which a user can develop temporal
conceptual data models in Trend notation and convert it into a temporal relational database that also
enforces the temporal constraints specified in the model. The small-scale evaluation with typical novice
modellers showed the tool to outperform the baseline modelling tool.</p>
      <p>This proof-of-concept constitutes enabling infrastructure, not only to simplify temporal modelling,
but also for future experiments regarding uptake of temporal constraints, how a transformation-based
OBDA pipeline may be designed, and to what extent that may overlap with requirements for temporal
knowledge graphs. Either temporal SQL-to-RDF or a direct conversion to RDF with SHACL is another
avenue of future work.</p>
      <p>The demo will showcase all features and participants can try it themselves, be it from scratch or
based on examples, such as those used in the user evaluation of the front-end. The machine will also
run an instance of MariaDB so that the TRENDy-generated SQL can be executed to create the temporal
database where the correct functioning of the temporal constraints can be verified.</p>
    </sec>
    <sec id="sec-4">
      <title>Acknowledgments</title>
      <p>We thank the participants in the evaluation.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>S.</given-names>
            <surname>Batsakis</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Petrakis</surname>
          </string-name>
          , I. Tachmazidis, G. Antoniou,
          <article-title>Temporal representation and reasoning in OWL 2</article-title>
          ,
          <source>Semantic Web Journal</source>
          <volume>8</volume>
          (
          <year>2017</year>
          )
          <fpage>981</fpage>
          -
          <lpage>1000</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>V.</given-names>
            <surname>Milea</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Frasincar</surname>
          </string-name>
          , U. Kaymak,
          <article-title>towl: a temporal web ontology language</article-title>
          ,
          <source>in: IEEE Transactions on Systems, Man and Cybernetics</source>
          . Part B,
          <string-name>
            <surname>Cybernetics (IEEE T-SMC-Part</surname>
            <given-names>B</given-names>
          </string-name>
          )„ volume
          <volume>42</volume>
          ,
          <year>2012</year>
          , pp.
          <fpage>268</fpage>
          -
          <lpage>281</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>C.</given-names>
            <surname>Lutz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Wolter</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Zakharyaschev</surname>
          </string-name>
          ,
          <article-title>Temporal description logics: A survey</article-title>
          ,
          <source>in: Proc. of TIME'08</source>
          , IEEE Computer Society Press,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>A.</given-names>
            <surname>Artale</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Kontchakov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Kovtunova</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Ryzhikov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Wolter</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Zakharyaschev</surname>
          </string-name>
          ,
          <article-title>Ontologymediated query answering over temporal data: A survey (invited talk)</article-title>
          ,
          <source>in: Proc. of TIME'17</source>
          , volume
          <volume>90</volume>
          of LIPIcs,
          <source>Schloss Dagstuhl - Leibniz-Zentrum für Informatik</source>
          ,
          <year>2017</year>
          , pp.
          <volume>1</volume>
          :
          <fpage>1</fpage>
          -
          <lpage>1</lpage>
          :
          <fpage>37</fpage>
          .
          <year>2017</year>
          , October 16-
          <issue>18</issue>
          ,
          <year>2017</year>
          , Mons, Belgium.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>Q.</given-names>
            <surname>Gao</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Lee</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Dobbie</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Zeng</surname>
          </string-name>
          ,
          <article-title>A semantic framework for designing temporal SQL databases</article-title>
          ,
          <source>in: Proc of ER'18</source>
          , volume
          <volume>11157</volume>
          <source>of LNCS</source>
          , Springer,
          <year>2018</year>
          , pp.
          <fpage>382</fpage>
          -
          <lpage>396</lpage>
          .
          <source>Xi'an, China, October 22-25</source>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>P. R.</given-names>
            <surname>Fillottrani</surname>
          </string-name>
          ,
          <string-name>
            <surname>C.</surname>
          </string-name>
          <article-title>M. Keet, KnowID: An architecture for eficient knowledge-driven information and data access</article-title>
          ,
          <source>Data Intelligence</source>
          <volume>2</volume>
          (
          <year>2020</year>
          )
          <fpage>487</fpage>
          -
          <lpage>512</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>C. M.</given-names>
            <surname>Keet</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Berman</surname>
          </string-name>
          ,
          <article-title>Determining the preferred representation of temporal constraints in conceptual models</article-title>
          ., in: H.
          <string-name>
            <surname>Mayr</surname>
          </string-name>
          , et al. (Eds.),
          <source>Proc. of ER'17</source>
          , volume
          <volume>10650</volume>
          <source>of LNCS</source>
          , Springer,
          <year>2017</year>
          , pp.
          <fpage>437</fpage>
          -
          <lpage>450</lpage>
          .
          <fpage>6</fpage>
          -
          <issue>9</issue>
          <year>Nov 2017</year>
          , Valencia, Spain.
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>S.</given-names>
            <surname>Berman</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C. M.</given-names>
            <surname>Keet</surname>
          </string-name>
          , T. Shunmugam,
          <article-title>The temporal conceptual data modelling language TREND</article-title>
          ,
          <source>Technical report</source>
          ,
          <year>2024</year>
          . URL: https://arxiv.org/abs/2408.09427. arXiv:
          <volume>2408</volume>
          .
          <fpage>09427</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>A.</given-names>
            <surname>Artale</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Franconi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Wolter</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Zakharyaschev</surname>
          </string-name>
          ,
          <article-title>A temporal description logic for reasoning about conceptual schemas and queries</article-title>
          , in: S. Flesca,
          <string-name>
            <given-names>S.</given-names>
            <surname>Greco</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Leone</surname>
          </string-name>
          , G. Ianni (Eds.),
          <source>Proc of JELIA'02</source>
          , volume
          <volume>2424</volume>
          <source>of LNAI</source>
          , Springer Verlag,
          <year>2002</year>
          , pp.
          <fpage>98</fpage>
          -
          <lpage>110</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <surname>C. M. Keet</surname>
          </string-name>
          ,
          <article-title>Natural language template selection for temporal constraints</article-title>
          ,
          <source>in: Proc. of CREOL'17, part of JOWO'17</source>
          , volume
          <volume>2050</volume>
          <source>of CEUR-WS</source>
          ,
          <year>2017</year>
          , p.
          <fpage>12</fpage>
          .
          <fpage>21</fpage>
          -
          <issue>23</issue>
          <year>September 2017</year>
          , Bolzano, Italy.
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <surname>MariaDB</surname>
          </string-name>
          ,
          <article-title>Mariadb server: the innovative open source database</article-title>
          ,
          <year>2024</year>
          . URL: https://mariadb.org/.
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>K.</given-names>
            <surname>Kulkarni</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.-E.</given-names>
            <surname>Michels</surname>
          </string-name>
          , Temporal features in
          <source>sql: 2011, ACM Sigmod Record</source>
          <volume>41</volume>
          (
          <year>2012</year>
          )
          <fpage>34</fpage>
          -
          <lpage>43</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>