<!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>Verifying Description Logic Ontologies based on Competency Questions and Unit Testing</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Camila Bezerra</string-name>
          <email>camila.bezerra.br@gmail.com</email>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Fred Freitas</string-name>
          <email>fredg@cin.ufpe.br</email>
        </contrib>
      </contrib-group>
      <abstract>
        <p>Ontology testing can help guarantee ontology quality, by finding errors and inconsistencies in the ontology. There are few approaches for ontology testing inspired in methods employed by software engineering, and usually they depart from software requirements. Requirements in ontologies are the set of competency questions. A drawback of some ontology testing approaches resides on the fact that testing takes place only at the assertional level, since the query language SPARQL is relied on. In this work, we propose an approach and its implementation to test semi-automatically OWL-DL ontologies with both assertional and terminological queries, by using competency questions and the concept of unit testing. The tests accomplished in small ontologies sounds promising with good results.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        Bearing this in mind, in this work we propose an approach and a tool to test
semiautomatically OWL-DL ontologies with both ABox and TBox queries, by using
competency questions and checking whether they are being met or not. We rely on the idea of
unit testing, which aims to testing the individual units of a code in Software Engineering
[
        <xref ref-type="bibr" rid="ref9">Pressman 2001</xref>
        ].
      </p>
      <p>This paper is organized as follows: section 2 describes presents the proposed
method; section 3 presents a tool that implements the method, section 4 shows
preliminary results, section 5 is devoted to related work; and section 6 presents some conclusions
and future work.</p>
    </sec>
    <sec id="sec-2">
      <title>2. A method for ontology testing</title>
      <p>To introduce our ontology testing approach with DL, we start by presenting an ontology
formalization:
Definition 1. Vocabulary of Ontology. Voc(O) is the vocabulary, i.e., defined and used in
ontology O, defined over the triple (NC ; NR; NO) as explained before. We denote by O j=
if is true in all the possible models of O.</p>
      <p>Definition 2. Competency Questions. A competency question is a hQ; i such that Q is
a query expressed in a formal language and is an answer to this query expressed as a
variable substitution.</p>
      <p>Definition 3. Satisfied competency question. A competency question hQ; i is satisfied
by an ontology O if O [ Q j= .</p>
      <p>Since we are dealing with controlled natural language, we are dealing with some
patterns of CQs that we have found, below some of them:
Pattern: Which + &lt;class&gt; + &lt;property&gt; + &lt;class&gt; + not + &lt;property&gt; + &lt;class&gt;?
Pattern: From which + &lt;property&gt; + &lt;class&gt;?
Pattern: Is + &lt;individual&gt;+ a +&lt;class&gt;?
Pattern: Is &lt;class&gt; + &lt;individual&gt; + or + &lt;individual&gt;?</p>
      <p>In Software Engineering, the phase of testing is very important to guarantee
software quality, since it aims at detecting errors, and, to check if the software was
implemented in accordance with the requirements and user expectations. The motivation of
this work is applying the very same idea in the context of Ontology Engineering.</p>
      <p>Analogously, CQs represent user demands for knowledge regarding a domain of
discourse. They usually enable developers to define the ontology. Given that domains of
discourse and user requirements may change through time, ontologies should evolve in
order to represent them accordingly. Thus, it is important that a permanent correspondence
among the users goals and the ontology requirements exists. This must be accomplished
using a method of systematic testing.</p>
      <p>In this paper, we propose description logic ontology testing, relying on
competency questions as the units to test single requirements. Following, we formalize the
components of an ontology testing approach.</p>
      <p>Definition 4. Test case, test plan. A Test case is represented by a CQ that is represented
as already defined pair hQ; i. A Test Plan contains a set of test cases, besides other
information like author and date. A Test Plan is represented by fhQ; igin=1,where n is
the number of CQs.</p>
      <p>Definition 5. Test suite and execution result. A Test Suite is a subset of Test cases of
a Test Plan, i.e, if ts is a Test Suite, and tp is its Test Plan then ts tp. A test suite
is important to reuse a set of test cases between test executions. A Test Execution result
is an instance of a test suite that corresponds a set of test cases selected to be tested,
the result of the tests, the author the performed the test, and date. The execution result
is represented by the tuple &lt; fhQ; iin=1g; fhQ; 0 iin=1gauthor; date &gt;, where is the
expected result, and 0 is the result of the test for each CQ of the suite, whereas the suite
has n CQs.</p>
      <p>Definition 6. Base Ontology and Testing Ontology. Given an ontology O, we assume that
exists (defined by the developer or by the test engineer) a small set of O that represents
a base set Ob, so that Ob Pa2setofaxiomsfromO a [ Pi2setofinstancesofO i ,on the other
hand, we assumed that the complement of Ob is Ot, which is the part the needs to be
tested, such that O = Ob [ Ot, e Ob \ Ot = ;.</p>
      <p>Definition 7. Representative Testing Ontology. Given an ontology O, a representative
testing ontology Ot’ is a subset of axioms and/or a set of representative instances from
Ot, defined by the test engineer as Ot0 Pa2setofaxioms a [ Pi2setofaxioms i.</p>
      <p>
        These definitions rely in the initial knowledge contained in the ontology, i.e. the
base ontology, which requires no competency questions. An example of such type of
ontology can be upper-domain ones, like BTL2 [
        <xref ref-type="bibr" rid="ref10">Schulz and Boeker 2013</xref>
        ] and GFO-Bio
[
        <xref ref-type="bibr" rid="ref7">Hoehndorf et al. 2008</xref>
        ]. The extending ontology is the one required to be tested.
Therefore, not the whole content, e.g. classes and individuals, but a representative set selected
by the ontology engineer should and can be used for testing.
      </p>
    </sec>
    <sec id="sec-3">
      <title>3. OWL TESTING TOOL</title>
      <p>With the aid of this tool, a user can manage test plans, test suites, test cases and execute
test suites through the modules of the layer. First, it is required to create a test plan
that contains test cases. As put before, we consider here a test case as a CQ. Figure 1
displays our testing method steps. Considering the Pizza ontology, a test case could be
“From which nation is the American Pizza”, “America”, where “From which nation is the
American Pizza” is the small piece from the ontology to be tested, while “America” is the
expected result from the test. In the test execution, besides the test case there is a field
that indicates if the test case passes or not.</p>
      <p>In a test execution module, the user chooses which test suite will be executed and
the ontology to be tested. The execution is performed by the CQChecker, a tool to support
the automation of verifying CQs against OWL ontologies. It provides a mechanism to
verify whether the ontology meets its corresponding CQs. CQChecker supports both
assertional and terminological queries.</p>
      <p>
        CQChecker module [
        <xref ref-type="bibr" rid="ref2">Bezerra et al. 2014</xref>
        ] supports the automation of checking
CQs during Ontology Evaluation, and particularly for asserting functional requirements
expressed as CQs. The basic functioning of the tool can be summarized in the following
terms: first, it analyzes the CQ in order to classify it into one of three types, according to
the possible answer it is supposed to retrieve (over classes or instances). Then, the system
directs the CQ to the corresponding module, where it will be converted and checked. To
accomplish this, our algorithm [
        <xref ref-type="bibr" rid="ref2">Bezerra et al. 2014</xref>
        ] basically takes a CQ, splits it into
tokens and tries to find the concepts and relations from the ontology described in OWL
DL, which the CQ referred to.
      </p>
      <p>Consider the CQ “What is the base of Real Italian Pizza?” about the Pizza
ontology. With it and the CQChecker, we want to check if there is any class that would provide
an individual for the image of RealItalianPizza, through the relation hasBase, which is
a PizzaBase. For this to be achieved, we first search for an object property which can
be a verb or a noun, and afterwards we look for the class, which has an image that is a
PizzaBase in the relation, in this case ThinAndCrispyBase.</p>
    </sec>
    <sec id="sec-4">
      <title>4. Preliminaries Experiments</title>
      <p>As a validation, we performed tests with three ontologies: Pizza, Travel and Wine
ontologies, which are available on the Prote´ge´ website. We created a test plan with 12 test cases
and 3 test suites. The preliminaries experiments were preformed by the authors.</p>
      <p>The CQs are related to several constructs of OWL-DL like class hierarchies,
individuals, disjoint classes, intersection (A \ B) and union of classes (A [ B); equivalent
classes(A B), universal (8), existential quantification(9) and “has-value” restrictions;
and cardinality restrictions.</p>
      <p>We performed a test execution in each of them. Each test suite contains the test
result. The tool deploys the CQ set, so that the user can select CQs to test. The user can
also compare the answer of the test with the expected answer, thus checking if the test
passed.</p>
      <p>The first measured used is accuracy that is % of execution test correctly answered
by the tool. For the Pizza test we get 90% of accuracy. For the Travel test we get 80% of
accuracy, and for the Wine test we get 90% of accuracy.</p>
      <p>We show now a demonstration of our approach with the pizza
ontology. First we create the test cases to the test plan and two test suites
available in https://www.dropbox.com/sh/ec6dwv83anqp64s/
AAB-7VgJytljII9f5jqpgw2sa?dl=0. The test suite number 1 is showed
below:</p>
      <p>CQ1: What is the spiciness of a chicken Topping? Correct answer: Mild
CQ2: What is the base of Real Italian Pizza? Correct answer: ThinAndCrispyBase
CQ3: What is the country of Origin of American Pizza? Correct answer: American
CQ4: Which are the pizzas disjoint of Vegetarian Pizza? Correct answer:
NonVegetarianPizza</p>
      <p>Considering an user named joseph that takes this test suite to do a test execution
on 08/10/2016. The goal is to verify if the ontology follows this set of CQs.</p>
      <p>So, Joseph load the pizza ontology, the test suite number 1, and test each CQ. The
tool returned an answer that can be equal or not the correct answer. If the the returned
answer is equal to correct answer then, Joseph will check this CQ as correct. In the end,
the tool will save the results from the table, moreover who did and date, in this case,
Joseph and the date 08/10/2016.</p>
    </sec>
    <sec id="sec-5">
      <title>5. Related Work</title>
      <p>
        Few engineering methodologies cite how, for what purpose, and by which means the
ontology engineer has to use CQs. However, there are few proposals of test ontologies
approaches. [
        <xref ref-type="bibr" rid="ref13">Vrandecˇic´ and Gangemi 2006</xref>
        ] discusses in their paper the need for unit
testing and describes some possible approaches that can be applied. However, it seems to
be a position paper, as no concrete approach or tools were provided.
      </p>
      <p>
        [
        <xref ref-type="bibr" rid="ref3">Blomqvist et al. 2012</xref>
        ] provides a methodology and a tool for dealing with
ontology testing. It resembles ours in some aspects; however, they use CQs only at the
assertional level by relying on SPARQL. Also, a method and a tool called
OntologyTest been proposed to test the functional requirement of an ontology-OWL DL by
[
        <xref ref-type="bibr" rid="ref5">Garc´ıa-Ramos et al. 2009</xref>
        ]. The queries must be defined in SPARQL.
      </p>
      <p>
        In relation to these works, ours deals at both assertional and terminological levels.
Moreover, while [
        <xref ref-type="bibr" rid="ref3">Blomqvist et al. 2012</xref>
        ] represent the test plan and test cases as an
ontology, our approach stores them in CSV files, to provide more flexibility to the ontology
engineering.
      </p>
    </sec>
    <sec id="sec-6">
      <title>6. Conclusions</title>
      <p>In this paper, we proposed a new method to ontology testing based on competency
questions for OWL-DL ontologies, for this, we use the concept of unit testing. Furthermore,
we proposed a tool that implements this method. Ontology testing helps to guarantee the
quality of ontologies, by detecting errors and inconsistences in the ontology. Competency
questions can be used both in requirements specification as in evaluation phase.</p>
      <p>There are some limitations of our approach, for instance, only treats simple
English sentences by identifying key words. It is necessary to build a mechanism to accept
complex sentences like “Does a bouquet or body of a specific wine change with vintage?”.</p>
      <p>For future work, solving these deficiencies is certainly the main task. However, in
general, we believe that our approach and the tool can make the job of to test description
logic ontologies efficiently and rapidly. And, we intend in the future to make experiments
with other users outside of the project.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          <string-name>
            <surname>Angles</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          and
          <string-name>
            <surname>Gutierrez</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          (
          <year>2008</year>
          ).
          <article-title>The expressive power of sparql</article-title>
          . In Sheth,
          <string-name>
            <given-names>A.</given-names>
            ,
            <surname>Staab</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            ,
            <surname>Dean</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            ,
            <surname>Paolucci</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            ,
            <surname>Maynard</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            ,
            <surname>Finin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            , and
            <surname>Thirunarayan</surname>
          </string-name>
          , K., editors,
          <source>The Semantic Web - ISWC</source>
          <year>2008</year>
          , volume
          <volume>5318</volume>
          of Lecture Notes in Computer Science, pages
          <fpage>114</fpage>
          -
          <lpage>129</lpage>
          . Springer Berlin Heidelberg.
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          <string-name>
            <surname>Bezerra</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Santana</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          , and
          <string-name>
            <surname>Freitas</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          (
          <year>2014</year>
          ).
          <article-title>Cqchecker: A tool to check ontologies in owl-dl using competency questions written in controlled natural language</article-title>
          .
          <source>Learning &amp; Nonlinear Models</source>
          ,
          <volume>12</volume>
          (
          <issue>2</issue>
          ):
          <fpage>115</fpage>
          -
          <lpage>129</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          <string-name>
            <surname>Blomqvist</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Seil</surname>
            <given-names>Sepour</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            , and
            <surname>Presutti</surname>
          </string-name>
          ,
          <string-name>
            <surname>V.</surname>
          </string-name>
          (
          <year>2012</year>
          ).
          <article-title>Ontology testing - methodology and tool</article-title>
          . In ten Teije,
          <string-name>
            <given-names>A.</given-names>
            , Vo¨lker, J.,
            <surname>Handschuh</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            ,
            <surname>Stuckenschmidt</surname>
          </string-name>
          , H.,
          <string-name>
            <surname>d'Acquin</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nikolov</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Aussenac-Gilles</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          , and
          <string-name>
            <surname>Hernandez</surname>
          </string-name>
          , N., editors,
          <source>Knowledge Engineering and Knowledge Management: 18th International Conference, EKAW</source>
          <year>2012</year>
          ,
          <string-name>
            <given-names>Galway</given-names>
            <surname>City</surname>
          </string-name>
          , Ireland, pages
          <fpage>216</fpage>
          -
          <lpage>226</lpage>
          , Berlin, Heidelberg. Springer Berlin Heidelberg.
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          <article-title>Ferna´ndez-Lo´pez, M., Go´mez-Pe´rez, A., and</article-title>
          <string-name>
            <surname>Juristo</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          (
          <year>1997</year>
          ).
          <article-title>Methontology: From ontological art towards ontological engineering</article-title>
          .
          <source>In Proceedings of the Ontological Engineering AAAI-97 Spring Symposium Series. American Asociation for Artificial Intelligence</source>
          . Ontology Engineering Group ? OEG.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          <article-title>Garc´ıa-</article-title>
          <string-name>
            <surname>Ramos</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Otero</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          , and Ferna´ndez-Lo´pez,
          <string-name>
            <surname>M.</surname>
          </string-name>
          (
          <year>2009</year>
          ).
          <article-title>Ontologytest: A tool to evaluate ontologies through tests defined by the user</article-title>
          . In Omatu, S.,
          <string-name>
            <surname>Rocha</surname>
            ,
            <given-names>M. P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bravo</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          , Ferna´ndez,
          <string-name>
            <given-names>F.</given-names>
            ,
            <surname>Corchado</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            ,
            <surname>Bustillo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            , and
            <surname>Corchado</surname>
          </string-name>
          , J. M., editors,
          <source>10th International Work-Conference on Artificial Neural Networks, IWANN 2009 Workshops</source>
          , Salamanca, Spain, pages
          <fpage>91</fpage>
          -
          <lpage>98</lpage>
          , Berlin, Heidelberg. Springer Berlin Heidelberg.
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          <article-title>Go´mez-Pe´rez,</article-title>
          <string-name>
            <surname>A.</surname>
          </string-name>
          (
          <year>2004</year>
          ). Ontology Evaluation, chapter
          <volume>13</volume>
          , pages
          <fpage>251</fpage>
          -
          <lpage>274</lpage>
          . Springer Berlin Heidelberg.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          <string-name>
            <surname>Hoehndorf</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Loebe</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Poli</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Herre</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          , and
          <string-name>
            <surname>Kelso</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          (
          <year>2008</year>
          ).
          <article-title>Gfo-bio: A biological core ontology</article-title>
          .
          <source>Applied Ontology</source>
          ,
          <volume>3</volume>
          (
          <issue>4</issue>
          ):
          <fpage>219</fpage>
          -
          <lpage>227</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          <string-name>
            <surname>Noy</surname>
            ,
            <given-names>N. F.</given-names>
          </string-name>
          and
          <string-name>
            <surname>Hafner</surname>
            ,
            <given-names>C. D.</given-names>
          </string-name>
          (
          <year>1997</year>
          ).
          <article-title>The state of the art in ontology design: A survey and comparative review</article-title>
          .
          <source>AI Magazine</source>
          ,
          <volume>18</volume>
          :
          <fpage>53</fpage>
          -
          <lpage>74</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          <string-name>
            <surname>Pressman</surname>
            ,
            <given-names>R. S.</given-names>
          </string-name>
          (
          <year>2001</year>
          ).
          <article-title>Software Engineering: A Practitioner's Approach. McGraw-Hill Higher Education, 5th edition</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          <string-name>
            <surname>Schulz</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          and
          <string-name>
            <surname>Boeker</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          (
          <year>2013</year>
          ).
          <article-title>Biotoplite: An upper level ontology for the life sciencesevolution, design and application</article-title>
          .
          <source>In Informatik</source>
          <year>2013</year>
          ,
          <volume>43</volume>
          . Jahrestagung der Gesellschaft fu¨r Informatik e.V. (GI),
          <source>Informatik angepasst an Mensch</source>
          ,
          <source>Organisation und Umwelt</source>
          ,
          <volume>16</volume>
          .-
          <fpage>20</fpage>
          .
          <year>September 2013</year>
          , Koblenz, pages
          <fpage>1889</fpage>
          -
          <lpage>1899</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          <article-title>Sua´rez-</article-title>
          <string-name>
            <surname>Figueroa</surname>
            ,
            <given-names>M. C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Go´</surname>
            mez-Pe´rez, A., and Ferna´ndez-Lo´pez,
            <given-names>M.</given-names>
          </string-name>
          (
          <year>2012</year>
          ).
          <article-title>The neon methodology for ontology engineering</article-title>
          . In Ontology Engineering in a Networked World., pages
          <fpage>9</fpage>
          -
          <lpage>34</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          <string-name>
            <surname>Uschold</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          and
          <string-name>
            <surname>Gruninger</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          (
          <year>1996</year>
          ).
          <article-title>Ontologies: principles, methods and applications</article-title>
          .
          <source>The Knowledge Engineering Review</source>
          ,
          <volume>11</volume>
          :
          <fpage>93</fpage>
          -
          <lpage>136</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          <string-name>
            <surname>Vrandecˇic´</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          and
          <string-name>
            <surname>Gangemi</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          (
          <year>2006</year>
          ).
          <article-title>Unit tests for ontologies</article-title>
          . In Meersman, R.,
          <string-name>
            <surname>Tari</surname>
            ,
            <given-names>Z.</given-names>
          </string-name>
          , and
          <string-name>
            <surname>Herrero</surname>
          </string-name>
          , P., editors,
          <source>On the Move to Meaningful Internet Systems</source>
          <year>2006</year>
          :
          <article-title>OTM 2006 Workshops: OTM Confederated International Workshops</article-title>
          and Posters, Montpellier, France, pages
          <fpage>1012</fpage>
          -
          <lpage>1020</lpage>
          , Berlin, Heidelberg. Springer Berlin Heidelberg.
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>