<!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>exible extension of XQuery Full-Text</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Emanuele Panzeri</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Gabriella Pasi</string-name>
          <email>pasig@disco.unimib.it</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>University of Milano-Bicocca Viale Sarca 336</institution>
          ,
          <addr-line>20126 Milano</addr-line>
          ,
          <country country="IT">Italy</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>This paper presents the implementation of an extension of the XQuery Full-Text language on top of the BaseX query engine. The proposed extension adds to the language two new exible axes that allow users to express structural constraints that are evaluated in an approximate way with respect to a considered path; the constraints evaluation produces a scored set of elements. The implementation and the e ciency evaluations of the constraints are reported in this paper.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>For each element matched by the Below and Near, a score is computed by the
approximate matching; the score is in the interval ]0; 1] where 1 represents a full
satisfaction of the constraint evaluation, while values less than 1 are assigned to
target nodes far from the context node.</p>
      <p>The constraint Below is de ned as an XPath axis (like, for example, the
children, self, etc axes) the evaluation of which is aimed at identifying
elements that are direct descendants of a node. The Below constraint is
speci ed as: c/below::t, where c is the context node, and t is the target node.
The score computed by the Below axis evaluation, is computed by the formula:
wbelow(c; t) = jdesc a1rcs(c;t)j . Where desc arcs(c; t) is a function that returns the
set of unique descending arcs from c to t.</p>
      <p>The constraint Near is speci ed as a exible axis of a path expression; it
allows to identify XML elements connected through any path to the context
node. The axis allows to de ne a maximum distance n that acts as a threshold
on the number of arcs between the context node and the target node; nodes the
distance of which is more then n arcs are ltered out from the possible results.
The Near syntax is: c/near(n)::t and the score for its evaluation is computed
as: wnear(c; t; n) = jarcs1(c;t)j if jarcs(c; t)j n where c is the context node, t
0 else.
is the current target node, n is the maximum allowed distance and arcs(c; e)
returns the set of arcs in the shortest path between c and t.</p>
    </sec>
    <sec id="sec-2">
      <title>3 Implementation</title>
      <p>
        The new axes have been integrated into the BaseX XQuery engine by extending
both its language interpreter and its XQuery evaluation processor to include
a new score-structure Score Variable de nition. BaseX has been chosen for
being the rst system (and the only one, to the best of our knowledge) to
implement the full XQuery Full-Text language. As described in [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], BaseX adopts
an e cient indexing schema for XML documents. The XQuery FLOWR clauses
have been made capable to identify the new structural score variable, and to
allow its usage in sorting, ordering and results display. As an example the XQuery
for clause has been extended as follows:
      </p>
      <p>where Varname is a valid variable name; TypeDeclaration is a variable type
declaration; and ExprSingle is the actual query for node selection as de ned in
the XQuery language. From the user point of view this approach o ers unlimited
possibilities of the usage of the new Structure Score Variable: the user can de ne
aggregation functions using the default XQuery constructs.</p>
      <p>Fig. 1a shows an example of the Near constraint application: the query
person//act/near::title is evaluated and the three gray title nodes are
matched with a score of 0:3, for the act/movie/title node, and 0:25 for the
other two nodes. In Fig. 1b the evaluation of the query person/below::name is
shown: three name nodes are retrieved; person/name node with a score of 1 and
0:3 for the other nodes.</p>
      <p>(a)
(b)
The performed evaluations compare the e ciency of all the new axes constraints
with the standard XPath/XQuery counterparts (if available): in particular for
the Below axis evaluation we executed each query using both the Below and the
descendant axes. Concerning the Near axis evaluation, instead, no counterpart
could be identi ed due to the innovative nature of the proposed axis.</p>
      <p>The axes evaluations have been performed by using the IMDB INEX
DataCentric collection. Performance tests have been executed with an increasing size
of the evaluated collection to verify the overhead introduced by the exible axis
evaluation in comparison with standard (if applicable) XPath axes constraints.
Due to the nature of the BaseX indexing system that caches queries, result set,
and opened databases, the evaluations have been performed by unloading the
BaseX system between each run. All evaluation tests have been executed 5 times,
and the average timings (removing the worst and the best results) are presented.</p>
      <p>Below axis evaluation: The Below axis has been compared with the
standard descendant axis: both axes have been evaluated by executing the test
without any query optimization introduced by BaseX. Five queries containing
the Below axis have been evaluated against each collection by measuring its
execution time. The same query, with the Below axis replaced by the descendant
axis has then been executed and its timings compared. In Fig. 2 the evaluation
results are sketched: not surprisingly the Below axis evaluation takes more time
than the equivalent descendant axis to obtain the query results, due to the
computation of the structural score. The Below axis evaluation takes in average
36% more time than the execution of the descendant counterpart.</p>
      <p>Near axis evaluation: The Near axis evaluation has been performed by
using the same IMDb collection used for the evaluation of the Below axis. The
queries used during the evaluation process have been de ned so as to require the
BaseX engine to retrieve all the XML elements without neither adopting any
optimization strategy nor any query re-writing; this aspect forced the BaseX
system to perform a sequential analysis of the target nodes, and thus to provide a
complete execution of the Near axis evaluation. Furthermore the BaseX Full-Text
index has been avoided, further enforcing the complete iteration over any target
node without using any BaseX pre-pruning strategy. These aspects allowed to
measure the e ciency of the Near axis evaluation implementation.</p>
    </sec>
    <sec id="sec-3">
      <title>Conclusions and Future Work</title>
      <p>
        The Below and Near axes, semantically and syntactically de ned in [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] have
been implemented and evaluated on top of the BaseX system, where both the
query interpreter and the evaluation engine have been extended to identify and
evaluate the new axes. The obtained results con rm that, although the exible
evaluation of both axes requires relatively longer times, the proposed exible
evaluation and the subsequent XML element ranking based on both textual and
structural constraints can be successfully introduced into the XQuery language.
Ongoing works are being conducted related to the de nition, alongside the BaseX
data structures, of ad-hoc indexes to better evaluate the new exible constraints
by adopting e cient pruning techniques during target node identi cation, thus
further improving the axis evaluation performance.
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>S.</given-names>
            <surname>Amer-Yahia</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Botev</surname>
          </string-name>
          , and
          <string-name>
            <surname>J. Shanmugasundaram.</surname>
          </string-name>
          <article-title>TeXQuery: A Full-Text Search Extension to XQuery</article-title>
          . In WWW '
          <volume>04</volume>
          , pages
          <fpage>583</fpage>
          {
          <fpage>594</fpage>
          . ACM,
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>S. S.</given-names>
            <surname>Bhowmick</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Dyreson</surname>
          </string-name>
          , E. Leonardi, and
          <string-name>
            <given-names>Z.</given-names>
            <surname>Ng</surname>
          </string-name>
          .
          <article-title>Towards non-directional Xpath evaluation in a RDBMS</article-title>
          .
          <source>In CIKM '09</source>
          , pages
          <fpage>1501</fpage>
          {
          <fpage>1504</fpage>
          ,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>C.</surname>
          </string-name>
          <article-title>Grun. Storing and Querying Large XML Instances</article-title>
          .
          <source>PhD thesis</source>
          , Universitat Konstanz,
          <year>December 2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4. C. Grun,
          <string-name>
            <given-names>S.</given-names>
            <surname>Gath</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Holupirek</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M. H.</given-names>
            <surname>Scholl. XQuery Full Text</surname>
          </string-name>
          <article-title>Implementation in BaseX</article-title>
          . In XSym '
          <volume>09</volume>
          , pages
          <fpage>114</fpage>
          {
          <fpage>128</fpage>
          ,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>E.</given-names>
            <surname>Panzeri</surname>
          </string-name>
          and
          <string-name>
            <given-names>G.</given-names>
            <surname>Pasi</surname>
          </string-name>
          .
          <article-title>An Approach to De ne Flexible Structural Constraints in XQuery</article-title>
          . In AMT, pages
          <volume>307</volume>
          {
          <fpage>317</fpage>
          ,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>B.</given-names>
            <surname>Truong</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Bhowmick</surname>
          </string-name>
          , and
          <string-name>
            <given-names>C.</given-names>
            <surname>Dyreson</surname>
          </string-name>
          .
          <article-title>Sinbad:towards structure-independent querying of common neighbors xml databases</article-title>
          .
          <source>In DASFAA'12</source>
          , pages
          <fpage>156</fpage>
          {
          <fpage>171</fpage>
          .
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7. W3C. XQuery/XPath FullText. www.w3.org/TR/xpath-full-text-
          <volume>10</volume>
          ,
          <year>March 2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>C.</given-names>
            <surname>Yu</surname>
          </string-name>
          and
          <string-name>
            <given-names>H. V.</given-names>
            <surname>Jagadish</surname>
          </string-name>
          .
          <article-title>Querying Complex Structured Databases</article-title>
          .
          <source>In VLDB '07</source>
          , pages
          <fpage>1010</fpage>
          {
          <fpage>1021</fpage>
          ,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>