<!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>Foundations of Ontology Template Language OT TR (Extended Abstract)</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Erik Snilsberg</string-name>
          <email>eriksni@ifi.uio.no</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Leif Harald Karlsen</string-name>
          <email>leifhka@ifi.uio.no</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Egor V. Kostylev</string-name>
          <email>egork@ifi.uio.no</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Martin G. Skjaeveland</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Department of Informatics, University of Oslo</institution>
          ,
          <country country="NO">Norway</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>OTTR is a template language for the Semantic Web data and knowledge representation languages RDF and OWL. OTTR sees use as a key technology in the Semantic Web systems and already gained popularity both in academia and industry. OTTR is also in active development, which is, however, limited by the fact that little is known about its theoretical aspects. In this extended abstract we begin to close this gap by laying the foundations of OTTR. To this end, we first introduce a mathematical formalisation of the language in terms of its syntax and semantics. Then, we report bounds for the size of OTTR expansion-that is, of the data encoded by templates. Finally, we overview our study of the data and combined complexity of an important decision problem associated with the language and its fragments.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;OTTR</kwd>
        <kwd>Semantic Web</kwd>
        <kwd>ontology management</kwd>
        <kwd>ontology templates</kwd>
        <kwd>theoretical foundations</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>set of template instances which may use template parameters as arguments. Base templates are used to
directly represent structures in the base language (e.g., RDF). A set of instances can be translated to
the base language by means of (template) expansion, which recursively replaces instances with their
corresponding template replicas until only instances of base templates are left. To have a feeling for
OTTR, let us consider a dataset with two templates, with names ex:Person and o-rdf:Type, taking two
parameters each:
ex:Person[?person, ?name] :: {</p>
      <p>o-rdf:Type(?person, foaf:Person), ottr:Triple(?person, foaf:name, ?name) } .</p>
      <p>o-rdf:Type[?instance, ?class] :: { ottr:Triple(?instance, rdf:type, ?class) } .</p>
      <p>Note that ex:Person relies on o-rdf:Type and another template, ottr:Triple, which is a base template whose
instances represent RDF triples. The dataset also has an instance ex:Person(:Bob, "Bobby Jackson"),
which expands in two steps to two RDF triples: (:Bob, rdf:type, foaf:Person) and (:Bob, foaf:name,
"Bobby Jackson"). This example illustrates only the basic OTTR functionality. However, OTTR has
more advanced features, including special treatment for possibly nested lists and sophisticated list
expansion, which we illustrate later.</p>
      <p>
        An OTTR specification, as well as its serialisation formats, are available as technical reports [
        <xref ref-type="bibr" rid="ref10 ref8 ref9">8, 9, 10</xref>
        ];
there is an open-source reference implementation of OTTR, Lutra (http://www.ottr.xyz). OTTR is in
active development and is used by a wide range of projects [
        <xref ref-type="bibr" rid="ref11 ref12 ref13">11, 12, 13</xref>
        ]. There are several approaches
with a purpose similar to the one of OTTR [
        <xref ref-type="bibr" rid="ref14">14, 15, 16, 17, 18</xref>
        ]. However, OTTR has features that are not
present in the other systems, most prominently, list expansion.
      </p>
      <p>While OTTR has been gaining in popularity, its development is limited by the fact that it lacks a
mathematical formalisation and that little is known about its theoretical properties. In this extended
abstract, we report that we begin to close this gap and lay down the foundations of OTTR. In particular,
we first introduce a mathematical formalisation of a core of the OTTR language, including its key
advanced features, thus enabling its formal studies; we then report several upper bounds on the size
of the result of OTTR expansion, giving an indication of how concisely OTTR can encode ontologies;
ifnally, we overview our study combined and data computational complexity of OTTR expansion and
establish fine-grained borders between OTTR fragments, separating those that can be easily evaluated
from those that are more dificult.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Key Features of OTTR</title>
      <p>
        The key features covered in our formalisation are optional parameters, default values, and list expansion
modes (the latter of which is the most interesting and demanding from the theoretical point of view), and
we introduce them in this section by means of examples. Note, however, that OTTR specifications [
        <xref ref-type="bibr" rid="ref8">8, 19</xref>
        ]
include additional features, such as type system for parameters, non-blank parameters, which are omitted
from our formalisation for brevity.
      </p>
      <p>We begin with our first two features. As illustrated by the following example, parameters marked
as optional with symbol ? allow a special term none to be used as an argument for these parameters.
Meanwhile, for non-optional parameters, if none is given as an argument in some instance, then the
entire instance is ignored during expansion. A parameter may also have a default value, specified as
a predefined constant. When none is given as an argument for a parameter with a default value, it is
replaced by the default value.</p>
      <p>For example, we can extend the ex:Person template of the example in the introduction to include
information about the email address and the location of the person:
ex:Person[?person, ?name, ? ?mail, ?loc=ex:Norway] :: {</p>
      <p>o-rdf:Type(?person, foaf:Person), ottr:Triple(?person, foaf:name, ?name),
ottr:Triple(?person, foaf:mbox, ?mail), ottr:Triple(?person, foaf:based, ?loc) } .</p>
      <p>Since parameter ?mail is marked by (another) ? as optional, we may give none as the corresponding
argument. In that case, all occurrences of ?mail are replaced with none in the ex:Person template
during its expansion. However, since the ottr:Triple template is non-optional for all parameters, the
second instance of ottr:Triple would be ignored. Next, since ?location has a default value, we can also
give none as the corresponding argument. In this case, ?location uses its default value instead. So,
overall, expanding the instance ex:Person(:Bob, "Bobby Jackson", none, none) results in the triple (:Bob,
foaf:based, ex:Norway), in addition to the two triples generated in the original example.</p>
      <p>We move on to the third key feature, list expansions, which is used to access the elements of list
terms. There are three expansion modes: cross, zipMin, and zipMax. Instances can be specified as
having one of these modes, indicating special treatment for list arguments during expansion. Only
arguments marked with ++ are afected, while unmarked arguments are treated as normal, even if they
are lists. An error is raised if a non-list argument is marked with ++. For all three expansion modes,
new instances are created during expansion, with the elements of the lists replacing the lists themselves
as instance arguments. In particular, cross combines the list elements via the Cartesian product of the
input lists, while zipMin and zipMax combines elements that have the same position in the input lists.
The diference between the latter two is that zipMin combines elements up the length of the shortest
list, while zipMax pads shorter lists with none up to the length of the longest list.</p>
      <p>For example, given two lists of people (:Bob, :John, :Jane) and (:Stephanie, :Ross) we can specify
which people in the first list knows the people in the second list. If each person in the first list knows
everyone in the second list, then we can use expansion mode cross:
ex:Knows[?knowers, ?knowees] :: {</p>
      <p>cross | ottr:Triple(++ ?knowers, foaf:knows, ++ ?knowees) } .</p>
      <p>Then, expanding the instance ex:Knows((:Bob, :John, :Jane), (:Steph, :Ross)) results in the six triples
with all possible combinations of list elements, from (:Bob, foaf:knows, :Steph) to (:Jane, foaf:knows,
:Ross). If instead the knowing-relation corresponds with position in the two lists (i.e., :Bob knows
:Steph, :John knows :Ross, etc.), then we can use zipping modes zipMin or zipMax instead of cross. For
example, replacing cross with zipMin results in the two triples (:Bob, foaf:knows, :Steph) and (:John,
foaf:knows, :Ross). Since position of person :Jane exceeds the length of the shorter list, this element is
simply ignored with zipMin. Replacing zipMin with zipMax and expanding the same instance results in
the additional intermediate instance ottr:Triple(:Jane, foaf:knows, none), which is, however, ignored
since the third parameter of ottr:Triple is non-optional, resulting in the same triples as for zipMin.</p>
      <p>Finally, we bring attention to the fact that lists inside templates may have variables as elements, as
in, for example, (:Bob, :John, ?person, :Jane). This is a way to construct new terms during expansion,
which has a significant impact on the expressivity and complexity or OTTR.</p>
    </sec>
    <sec id="sec-3">
      <title>3. Overview of Results</title>
      <p>We first report several upper bounds for the size of expansion with respect to the size of datasets, which
gives us an indication of the conciseness of OTTR. We established a general bound for full OTTR, as well
as bounds for two of its important fragments: a fragment without list expansion and a fragment where
all lists are ground (i.e., variable-free). In particular, the size of expansion is bounded exponentially by
both template nesting depth and by maximal template arity. If no list expansion is allowed, then only
template nesting is in the exponent (in fact, only cross mode is essential); if all lists are ground, then
only template arity is in the exponent.</p>
      <p>We next report our studies of the computational (combined) complexity of a central decision problem
associated with the expansion process, namely, the problem Expansion of determining whether a given
instance occurs in the expansion of a given error-free OTTR dataset. Studying Expansion helps us
understand how dificult it is to retrieve the data stored in OTTR datasets. We consider Expansion for
diferent syntactic fragments of OTTR, which allows us to separate the types of datasets which are easy
to expand from the ones that are more dificult. In particular, we established a fine border, separating
fragments of OTTR for which the combined complexity of Expansion is NP-complete and for which it
is NL-complete. It is worth to note that the former includes the full OTTR, while the latter includes
essentially the simplest possible fragment.</p>
      <p>Finally, we report our results on data complexity of Expansion. In this setting, we assume that the
templates of an OTTR dataset are ‘fixed,’ and only the instances of the dataset are considered to form
the input. This gives a more practical view of the complexity of Expansion, because the number of
templates is usually rather small, while the number of instances may be arbitrarily big. In this case, all
relevant OTTR fragments fall into two complexity classes, TC0-complete (under AC0 reductions) and
AC0, and the separating property is the presence of lists and expansion modes zipMin or zipMax.</p>
    </sec>
    <sec id="sec-4">
      <title>4. Conclusion and Future Work</title>
      <p>In this extended abstract we report our results on the foundations of OTTR. This is just the beginning of
OTTR formal studies, which opens up many further research avenues: we plan to formalise remaining
OTTR features, including types, look at DL ontologies produced by OTTR, and study OTTR under a
generalisation of OBDA. We also plan to investigate how our algorithms can be used to improve the
eficiency of real-life OTTR systems, such as Lutra.
[15] B. Krieg-Brückner, T. Mossakowski, Generic Ontologies and Generic Ontology Design Patterns,
in: Workshop on Ontology Design and Patterns, 2017.
[16] L. Iannone, A. L. Rector, R. Stevens, Embedding Knowledge Patterns into OWL, in: Extended</p>
      <p>Semantic Web Conference (ESWC), 2009, pp. 218–232.
[17] M. Lefrançois, A. Zimmermann, N. Bakerally, A SPARQL Extension for Generating RDF from</p>
      <p>Heterogeneous Formats, in: Extended Semantic Web Conference (ESWC), 2017.
[18] P. Lord, The Semantic Web takes Wing: Programming Ontologies with Tawny-OWL, in:
International Workshop on OWL: Experiences and Directions (OWLED), 2013.
[19] L. H. Karlsen, M. G. Skjaeveland, Adapting Reasonable Ontology Templates to RDF (rOTTR),
Technical Report, 2019.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>R.</given-names>
            <surname>Cyganiak</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Wood</surname>
          </string-name>
          ,
          <string-name>
            <surname>M.</surname>
          </string-name>
          <article-title>Lanthaler, RDF 1.1 Concepts and Abstract Syntax</article-title>
          ,
          <source>Technical Report, W3C</source>
          ,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>B.</given-names>
            <surname>Motik</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P. F.</given-names>
            <surname>Patel-Schneider</surname>
          </string-name>
          ,
          <string-name>
            <surname>B. Parsia,</surname>
          </string-name>
          <article-title>OWL 2 Web Ontology Language Structural Specification</article-title>
          and
          <string-name>
            <surname>Functional-Style</surname>
            <given-names>Syntax</given-names>
          </string-name>
          ,
          <source>Technical Report, W3C</source>
          ,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>F.</given-names>
            <surname>Baader</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Calvanese</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D. L.</given-names>
            <surname>McGuinness</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Nardi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P. F.</given-names>
            <surname>Patel-Schneider</surname>
          </string-name>
          (Eds.),
          <source>The Description Logic Handbook: Theory</source>
          , Implementation, and
          <string-name>
            <surname>Applications</surname>
          </string-name>
          , Cambridge University Press,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>P. F.</given-names>
            <surname>Patel-Schneider</surname>
          </string-name>
          ,
          <string-name>
            <surname>B. Motik,</surname>
          </string-name>
          <article-title>OWL 2 Web Ontology Language Mapping to RDF Graphs</article-title>
          ,
          <source>Technical Report, W3C</source>
          ,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>T.</given-names>
            <surname>Tudorache</surname>
          </string-name>
          , Ontology engineering: Current state, challenges, and future directions,
          <source>Semantic Web</source>
          <volume>11</volume>
          (
          <year>2020</year>
          )
          <fpage>125</fpage>
          -
          <lpage>138</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>M. G.</given-names>
            <surname>Skjaeveland</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D. P.</given-names>
            <surname>Lupp</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L. H.</given-names>
            <surname>Karlsen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. W.</given-names>
            <surname>Klüwer</surname>
          </string-name>
          , OTTR:
          <article-title>Formal Templates for PatternBased Ontology Engineering</article-title>
          , in: Workshop on Ontology Design and
          <source>Patterns (WOP)</source>
          , volume
          <volume>51</volume>
          ,
          <year>2021</year>
          , pp.
          <fpage>349</fpage>
          -
          <lpage>377</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>M. G.</given-names>
            <surname>Skjaeveland</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Forssell</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. W.</given-names>
            <surname>Klüwer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D. P.</given-names>
            <surname>Lupp</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Thorstensen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Waaler</surname>
          </string-name>
          , Reasonable Ontology Templates:
          <article-title>APIs for OWL</article-title>
          ,
          <source>in: ISWC Posters&amp;Demonstrations and Industry Tracks</source>
          ,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>L. H.</given-names>
            <surname>Karlsen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. G.</given-names>
            <surname>Skjaeveland</surname>
          </string-name>
          ,
          <article-title>Concepts and Abstract Model for Reasonable Ontology Templates (mOTTR)</article-title>
          ,
          <source>Technical Report</source>
          ,
          <year>2023</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>M. G.</given-names>
            <surname>Skjaeveland</surname>
          </string-name>
          ,
          <source>Web Reasonable Ontology Templates (wOTTR)</source>
          ,
          <source>Technical Report</source>
          ,
          <year>2023</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>M. G.</given-names>
            <surname>Skjaeveland</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L. H.</given-names>
            <surname>Karlsen</surname>
          </string-name>
          ,
          <article-title>Terse Syntax for Reasonable Ontology Templates (stOTTR)</article-title>
          ,
          <source>Technical Report</source>
          ,
          <year>2023</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>M.</given-names>
            <surname>Hodkiewicz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. W.</given-names>
            <surname>Klüwer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Woods</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Smoker</surname>
          </string-name>
          ,
          <string-name>
            <surname>E. Low,</surname>
          </string-name>
          <article-title>An ontology for reasoning over engineering textual data stored in fmea spreadsheet tables</article-title>
          ,
          <source>Computers in Industry</source>
          <volume>131</volume>
          (
          <year>2021</year>
          )
          <fpage>103496</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>Y.</given-names>
            <surname>Svetashova</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Zhou</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Pychynski</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Schmidt</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Sure-Vetter</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Mikut</surname>
          </string-name>
          ,
          <string-name>
            <surname>E. Kharlamov,</surname>
          </string-name>
          <article-title>OntologyEnhanced Machine Learning: a Bosch Use Case of Welding Quality Monitoring</article-title>
          , in: International Semantic Web Conference (ISWC),
          <year>2020</year>
          , pp.
          <fpage>531</fpage>
          -
          <lpage>550</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>A.</given-names>
            <surname>Ekelhart</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F. J.</given-names>
            <surname>Ekaputra</surname>
          </string-name>
          , E. Kiesling,
          <source>Automated Knowledge Graph Construction from Raw Log Data, in: ISWC Posters&amp;Demonstrations and Industry Tracks</source>
          ,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>D.</given-names>
            <surname>Vrandec</surname>
          </string-name>
          <article-title>˘ić, Explicit Knowledge Engineering Patterns with Macros</article-title>
          ,
          <source>in: Ontology Patterns for the Semantic Web Workshop</source>
          ,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>