<!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>Ontology-Based Determining of Evaluation Order of C Expressions and the Fault Reason for Incorrect Answers?</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>C programming</institution>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Volgograd State Technical University</institution>
          ,
          <addr-line>Lenin Ave, 28, Volgograd, 400005</addr-line>
          ,
          <country country="RU">Russia</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>The article describes the process of developing an automated tool to determine the evaluation order in the expression on C programming language and describe the faults made by a student in this task. The main part of this tool is based on the SWRL rule set, which can be divided into several di erent tasks: calculation of the evaluation order of expression based on constructing abstract syntax tree of expression, determine contradictions with the partial student's evaluation order, and describing fault reasons.</p>
      </abstract>
      <kwd-group>
        <kwd>ontology language SWRL</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>Developing basic programming skills is a high-demand area of teaching that is
challenging both for teachers and students that makes it a popular research area.
Introductory programming courses are a good example of a situation where
students have to learn a signi cant number of new concepts but these concepts are
formal and well-de ned. This makes basic programming courses a good area to
test di erent forms of concept-based education methods, including using
ontologies.</p>
      <p>
        Ontologies is commonly used to representing mathematical knowledge as
shown in [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ], can be used to model the certain domain [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], interactively help
learners understand the new domain [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] or new code [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. On the other hand, there
are code analyzers that are not aimed at learning programming, but creating a
code representation in the model; some of them are based on the ontological
approach, like the static ontological code analyzers [
        <xref ref-type="bibr" rid="ref6 ref9">9, 6</xref>
        ].
      </p>
      <p>In order to facilitate the comprehension of concepts, ontologies should model
the usage of these concepts in the typical domain tasks. This allows calculating
the correct answer for a question and, with the student's response converted to
? The reported study was funded by RFBR, project number 20-07-00764.</p>
      <p>Copyright c 2020 for this paper by its authors. Use permitted under Creative
Commons License Attribution 4.0 International (CC BY 4.0).
the ontology, determining the exact fault reason that allows explanatory
feedback on mistakes. Such ontologies would have an advantage over procedural
task-solving systems which have limited capability for explanatory feedback.
However, the suitability of current ontological reasoners for solving
problemoriented tasks needs to be researched rst. In this study, we aimed at creating
ontology to determine the evaluation order of a C-language expression and
detect fault reasons in student-supplied evaluation order using SWRL rules. The
studied concepts were operators, their precedence and associativity, sequence
points, and order of evaluation.</p>
      <p>The order of evaluation in C programming language is a partial order.
Because of sequenced-before relation, evaluation order isn't fully de ned by the
abstract syntax tree of the expression but can be expressed as a directed acyclic
graph where child nodes must be evaluated before the parent nodes.
a + b
c &lt; f (d ? e jj
f : j +
k; l)
(1)</p>
      <p>So, for the questions about evaluation order, the developed ontology should
determine the sequenced-before relation as a direct acyclic graph, compare the
student's evaluation order marks with the graph to determine fault reasons, and
provide information necessary to generate explanatory feedback.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Determining order of evaluation</title>
      <p>The ontology model receives an expression split into tokens. For each token,
its position in the expression and the text of the token are set. Each input
token is representing by several individuals in ontology, one for each step of
constructing abstract syntax tree (AST). First, the ontology builds the AST for
the given expression. This takes place inside the ontology that records the state
of the expression at each step, marking which operators are evaluated and which
evaluation results have already been used by the other operators. Using SWRL
rules for building AST di ers from regular imperative algorithms and supplies
the later fault-reason determining stage with the necessary information.</p>
      <p>A tree node has data properties arity, precedence, associativity,
prefix_postfix (for unary operators) lled at initial step of constructing AST
using information from text and neighboring tokens. At each step of constructing
AST, a set of SWRL rules nds an operator that can be evaluated and
generates the tree copy for the next step, connecting the evaluated operator with its
operands using property has_operand and changing markers of evaluated and
used operators.</p>
      <p>To create the evaluation-order graph based on AST, the rules determining
sequenced-before relations are applied, accounting for the operators guaranteeing
a certain order of evaluation for their operands like binary logical operators, the
ternary operator, and the comma operator.</p>
      <p>After the end of this stage, AST and the evaluation order graph are copied
to a special step that will be used to perform further calculations while the steps
for constructing the tree remain to provide information for generating a detailed
explanation of found errors.
3</p>
    </sec>
    <sec id="sec-3">
      <title>Determining fault reasons</title>
      <p>For fault reason determining, students must provide their responses, assigning
numbers to the operators in their evaluation order. As the evaluation order is a
partial order, many expressions allow several correct answers. The nodes lacking
student's order marks are assumed to be evaluated after all marked nodes so
they are assigned large numbers corresponding to their positions in the graph.
A student makes a mistake by assigning a smaller number to a parent node of
the evaluation order graph than to its child node both for the edges representing
operands and sequenced-before relations.</p>
      <p>The developed ontology provides information about all faults in the given
student's answer, including fault reasons and supplementary information for
generating the explanation message using a natural-language template. All possible
faults are split into two categories: calculating the result of an operator before
its operand (for example, mistakes in operator precedence or associativity) and
wrong evaluation order of two operators caused by sequence points created by
another operator (e.g. trying to evaluate the right operand of a logical and operator
before nishing evaluating its left operand). Errors is stored as object properties
between two error nodes named like student_error_strict_operands_order
or student_error_more_priority_left, etc. In the following examples, the $
followed by a number shows the position of the preceding operator in the
student's evaluation order. For example, formula 2 demonstrates a simple mistake
caused by the student ignoring associativity. The mistake message generated for
it will be: "Operator + on pos 4 cannot be evaluated before operator + on pos
2 because operator + has left associativity".</p>
      <p>a + $2 b + $1 c
(2)</p>
      <p>Formula 3 shows a more complex mistake involving three operators. The
mistake message for it will be: "Operator + on pos 6 that belongs to the right
operand of operator jj on pos 4 cannot be evaluated before its left operand,
including operator * on pos 2."
a
$2 b jj$3 c + $1 d
(3)</p>
      <p>So the developed ontology can detect fault reason for mistakes in operators
precedence, associativity, and sequence points during evaluating an expression,
providing the necessary information for explanatory feedback including the fault
reason and operator nodes.</p>
      <p>The ontology was tested using Java unit testing framework; constructing
expression AST (144 tests), evaluation order tree (10 tests), and determining
fault reasons (20 tests, including mistake combination) were tested separately.
The ontology and testing system is available on Github1.
4</p>
    </sec>
    <sec id="sec-4">
      <title>Conclusion and further work</title>
      <p>We developed ontology able to solve determine the evaluation order of a
Clanguage expression and fault reasons in a student's answer with the potential
to generate explanatory feedback including correctly processing multiple errors.
It also supports a subset of C++ language. The results prove that ontological
reasoners are capable to process expressions and determine fault reasons so they
can be used as a basis of the testing system generating questions, solving them,
and generating explanatory feedback for students.</p>
      <p>
        The developed ontology di ers from other ontologies used to generate and
grade questions [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] in that it captures domain knowledge about concept usage
in the form of SWRL rules and provides information for the generation of
explanatory feedback based on the domain laws that the student violated in their
answer. Generating feedback is described as an important eld for further
research in recent question-generation survey [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. Our ontology can be used for
1 https://github.com/ShadowGorn/ontology evaluation order check
grading and providing feedback for complex expression-related tasks like
determining an order of evaluation for randomly-generated expression which is more
complex questions than currently existing systems, allowing extending generated
questions to higher levels of Bloom's taxonomy [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ].
      </p>
      <p>The further development of the ontology includes fully supporting C++
expressions containing complex operators and operands like template function calls
and initializer lists and supporting other programming languages like Python,
adapting the ontology to the chosen language by tagging its rules. The ontology
also will be enhanced to support other expression-related exercises, including
determining subexpression data types for statically-typed languages. To use the
developed ontology in the learning process, we will develop the core of the testing
system and question-generation routines.</p>
      <p>The developed testing system will be modular and able to work with other
domains provided that the relevant ontologies and question-generation routines
are implemented. Our research group is open for collaboration with researchers
interested in developing support for their domains.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Anikin</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sychev</surname>
            ,
            <given-names>O.</given-names>
          </string-name>
          :
          <article-title>Ontology-based modelling for learning on bloom's taxonomy comprehension level</article-title>
          .
          <source>In: Biologically Inspired Cognitive Architectures Meeting</source>
          . pp.
          <volume>22</volume>
          {
          <fpage>27</fpage>
          . Springer (
          <year>2019</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Grevisse</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Botev</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Rothkugel</surname>
            ,
            <given-names>S.:</given-names>
          </string-name>
          <article-title>An extensible and lightweight modular ontology for programming education</article-title>
          .
          <source>In: Colombian Conference on Computing</source>
          . pp.
          <volume>358</volume>
          {
          <fpage>371</fpage>
          . Springer (
          <year>2017</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Kurdi</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Leo</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Parsia</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sattler</surname>
            ,
            <given-names>U.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Al-Emari</surname>
            ,
            <given-names>S.:</given-names>
          </string-name>
          <article-title>A systematic review of automatic question generation for educational purposes</article-title>
          .
          <source>International Journal of Arti cial Intelligence in Education</source>
          <volume>30</volume>
          (
          <issue>1</issue>
          ),
          <volume>121</volume>
          {
          <fpage>204</fpage>
          (
          <year>2020</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Lange</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          :
          <article-title>Ontologies and languages for representing mathematical knowledge on the semantic web</article-title>
          .
          <source>Semantic Web</source>
          <volume>4</volume>
          (
          <issue>2</issue>
          ),
          <volume>119</volume>
          {
          <fpage>158</fpage>
          (
          <year>2013</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Leo</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kurdi</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Matentzoglu</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Parsia</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sattler</surname>
            ,
            <given-names>U.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Forge</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Donato</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dowling</surname>
            ,
            <given-names>W.</given-names>
          </string-name>
          :
          <article-title>Ontology-based generation of medical, multi-term mcqs</article-title>
          .
          <source>International Journal of Arti cial Intelligence in Education</source>
          <volume>29</volume>
          (
          <issue>2</issue>
          ),
          <volume>145</volume>
          {
          <fpage>188</fpage>
          (
          <year>2019</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Pattipati</surname>
            ,
            <given-names>D.K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nasre</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Puligundla</surname>
            ,
            <given-names>S.K.</given-names>
          </string-name>
          :
          <article-title>OPAL: An extensible framework for ontology-based program analysis</article-title>
          .
          <source>Software: Practice and Experience</source>
          <volume>50</volume>
          (
          <issue>8</issue>
          ),
          <volume>1425</volume>
          { 1462 (Mar
          <year>2020</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Rawashdeh</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Alnusair</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Almiani</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sawalha</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          :
          <article-title>Jmentor: An ontologybased framework for software understanding and reuse</article-title>
          .
          <source>In: 2019 IEEE/ACS 16th International Conference on Computer Systems and Applications (AICCSA)</source>
          . pp.
          <volume>1</volume>
          {
          <issue>8</issue>
          .
          <string-name>
            <surname>IEEE</surname>
          </string-name>
          (
          <year>2019</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Silva</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dorca</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          :
          <article-title>An automatic and intelligent approach for supporting teaching and learning of software engineering considering design smells in object-oriented programming</article-title>
          .
          <source>In: 2019 IEEE 19th International Conference on Advanced Learning Technologies (ICALT)</source>
          . vol.
          <volume>2161</volume>
          , pp.
          <volume>321</volume>
          {
          <fpage>323</fpage>
          .
          <string-name>
            <surname>IEEE</surname>
          </string-name>
          (
          <year>2019</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Zhao</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Chen</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Liao</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Shen</surname>
            ,
            <given-names>X.</given-names>
          </string-name>
          :
          <article-title>Towards ontology-based program analysis</article-title>
          .
          <source>In: 30th European Conference on Object-Oriented Programming (ECOOP</source>
          <year>2016</year>
          ).
          <article-title>Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik (</article-title>
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>