<!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>PRONA: A Plugin for Well-Designed Approximate Queries in Jena</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Zhenyu Song</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Xiaowang Zhang</string-name>
          <email>xiaowangzhang@tju.edu.cn</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Zhiyong Feng</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>School of Computer Science and Technology, Tianjin University</institution>
          ,
          <addr-line>Tianjin</addr-line>
          ,
          <country country="CN">China</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>School of Computer Software, Tianjin University</institution>
          ,
          <addr-line>Tianjin</addr-line>
          ,
          <country country="CN">China</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>Tianjin Key Laboratory of Cognitive Computing and Application</institution>
          ,
          <addr-line>Tianjin</addr-line>
          ,
          <country country="CN">China</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>The time of answering a SPARQL query with its all exact solutions in large scale RDF dataset possibly exceeds users' tolerable waiting time, especially when it contains the OPT operations. It becomes essential to make a trade-o between the query response time and solution accuracy. We propose PRONA - an plugin for well-designed approximate queries in Jena, which provides help for users to answer well-designed SPARQL queries by approximate computation. The main features of PRONA comprise SPARQL query engine with approximate queries, as well as various approximate degrees for users to choose.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>Resource Description Framework (RDF) is the standard data model in the
Semantic Web. SPARQL recommended by W3C has become the standard language
for querying RDF data since 2008.</p>
      <p>
        OPT operation takes an core role in UNION-free well-designed patterns. For
simpli cation, we directly call well-designed patterns instead of UNION-free
welldesigned patterns. OPT operation aims to extend solutions for users[
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. It may
take more time to obtain all exact solutions than only \non-optional" solutions.
Removing some \optional" parts of well-designed queries is a natural idea to
obtain approximate queries, which contributes to less query response time. For
instance, consider a pattern Q as follows:
      </p>
      <p>Q = ((?x; rdf:type; artist) OPT ((?x; country; ?y) OPT (?x; company; ?z))).</p>
      <p>Based on this natural idea, there are two approximate patterns with less
OPT operators as follows:
{ Q1 = (?x; rdf:type; artist);
{ Q2 = ((?x; rdf:type; artist) OPT (?x; country; ?y)).</p>
      <p>
        However, consider Q3 = ((?x; rdf:type; artist) OPT (?xcompany; ?z)), it is not
approximate query since (?x; company; ?z) directly depends on (?x; country; ?y).
The notion of approximation has been proposed in [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. However, it did not
provide a ne-grained approximation method. Jena[
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] is a free and open source Java
framework for building semantic web and linked data applications. But it does
not provide approximate queries for users to answer well-designed queries.
      </p>
      <p>
        In this paper, we focus on well-designed SPARQL queries, whose \optional"
parts are really optional. Moreover, it is maximal among all fragments of LSQ
[
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. Compared to our previous work [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ], furthermore, we develop a plugin for
Jena to answer well-designed SPARQL queries with approximate queries, which
combines our approximate method and query process in Jena.
2
      </p>
    </sec>
    <sec id="sec-2">
      <title>Preliminaries</title>
      <p>
        OPT Normal Form A UNION-free pattern P is in OPT normal form [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] if P
meets one of the following two conditions:
{ P is constructed by using only the AND and FILTER operators;
{ P = (P1 OPT P2) where P1 and P2 patterns are in OPT normal form.
      </p>
      <p>For instance, the pattern Q stated in Section 1 is in OPT normal form.</p>
      <p>
        Three rewriting rules[
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] can be applied to transform non OPT normal form
into OPT normal form: let P; Q; R be patterns and C a constraint,
{ (P OPT R) FILTER C (P FILTER C) OPT R;
{ (P OPT R) AND Q (P AND Q) OPT R;
{ P AND (Q OPT R) (P AND Q) OPT R.
      </p>
      <p>Well-Designed Patterns A UNION-free pattern P is well-designed if the
followings hold:
{ P is safe, that is, each subpattern of the form Q FILTER C of P holds the
condition: var (C) var (Q).
{ for every subpattern P 0 = (P1 OPT P2) of P and for every variable ?x
occurring in P , the following condition hold: If ?x occurs both inside P2 and
outside P 0, then it also occurs in P1.</p>
      <p>For instance, the pattern Q in Section 1 is a well-designed pattern.</p>
      <p>
        Note that the OPT operation provides really optional left-outer join due to
the weak monotonicity [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ].
3
      </p>
    </sec>
    <sec id="sec-3">
      <title>Approximate Queries</title>
      <p>OPT-depth in OPT Normal Form To characterize the di erent levels of
optional patterns, we de ne OPT-depth of patterns in OPT normal form.
De nition 1 (OPT-depth). Let P be a pattern in OPT normal form. We use
dep(P ) to denote its OPT-depth as follows:
{ dep(P ) = 0 if P is an AF -pattern;
{ dep(P ) = maxfdep(P1); : : : ; dep(Pm)g + 1 if O(P ) = fP1; : : : ; Pmg.</p>
      <p>For instance, the OPT-depth of the pattern Q stated in Section 1 is 2.</p>
      <p>Approximate Queries Intuitively, approximate patterns are subpatterns
obtained by reducing their OPT-depths.</p>
      <p>De nition 2 (k-approximation). Let P be a pattern in OPT normal form
(P0 OPT P1 OPT : : : OPT Pm) and k be a natural number. The k-approximate
pattern of P (written as P (k)) can be obtained in the following inductive way:
1;</p>
      <p>P (k) is more closed to P with higher value of k. For instance, in Section 1,
Q(0) = Q1 and Q(1) = Q2.
4</p>
    </sec>
    <sec id="sec-4">
      <title>PRONA Plugin</title>
      <p>PRONA Overview PRONA is written in Java in a 3-tier design shown in
Figure 1(a). The bottom layer consists of the Jena framework and the ARQ4 query
engine, both used as a black box for evaluating queries. Before answering
SPARQL queries, the second layer provides the rewriting process and approximation
evaluation, which lead to the generation of approximate queries.</p>
      <p>GUI is shown in Figure 1(b). For single query solution s, we denote its amount
of domain as dom(s). For instance, consider solution = f?x ! a; ?y ! bg,
dom( )=2. Given an approximate query solution S, which contains solution s1,
s2, , sn. It is notable that the total of domain (dom(s1) + dom(s2) + +
dom(sn)) re ects solution precision.</p>
      <p>(a) PRONA architecture</p>
      <p>(b) PRONA GUI</p>
      <p>Experiments The purpose of our experiments is to evaluate (1) the
performance improvement of approximate well-designed SPARQL queries, and (2) the
solution precision percentage after approximate queries.</p>
      <p>In our experiments, LUBM5 is used as dataset. Two 4-approximation
welldesigned SPARQL queries are designed. Q1 contains 4 OPT operators, 6 triple
patterns and 6 variables. Q2 contains 14 OPT operators, 17 triple patterns and
16 variables. Approximate solution precision dividing original query solution
precision leads to the solution precision percentage.</p>
      <p>It has shown in Figure 2 and Figure 3 that both query response time and
solution precision reduce with the increment of approximate degree (k value
4 http://jena.sourceforge.net/ARQ
5 http://swat.cse.lehigh.edu/projects/lubm
decreases). Solution precision percentage decreases about 10% with 25% query
response time decreasing when k changes from 4 to 3 in Figure 3.
100</p>
      <p>LUBM1
LUBM5</p>
      <p>LUBM10
0 1 2 3</p>
      <p>k
(a) Performance
(b) Solution Precision Percentage(%)</p>
    </sec>
    <sec id="sec-5">
      <title>Conclusion</title>
      <p>In this paper, we propose PRONA which helps users answer well-designed
SPARQL queries by approximate computation. In the future, we are going to handle
other non-well-designed patterns and deal with more operations such as UNION.
Acknowledgement. This work is supported by the program of the
National Key Research and Development Program of China (2016YFB1000603) and
the National Natural Science Foundation of China (NSFC) (61502336).</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>P.</given-names>
            <surname>Barcelo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Pichler</surname>
          </string-name>
          , and
          <string-name>
            <given-names>S.</given-names>
            <surname>Skritek</surname>
          </string-name>
          .
          <article-title>E cient evaluation and approximation of well-designed pattern trees</article-title>
          .
          <source>In Proc. of PODS</source>
          <year>2015</year>
          , pages
          <fpage>131</fpage>
          {
          <fpage>144</fpage>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>J. J.</given-names>
            <surname>Carroll</surname>
          </string-name>
          , I. Dickinson,
          <string-name>
            <given-names>C.</given-names>
            <surname>Dollin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Reynolds</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Seaborne</surname>
          </string-name>
          , and
          <string-name>
            <given-names>K.</given-names>
            <surname>Wilkinson</surname>
          </string-name>
          .
          <article-title>Jena: implementing the semantic web recommendations</article-title>
          .
          <source>In Proc. of WWW</source>
          <year>2004</year>
          , pages
          <fpage>74</fpage>
          {
          <fpage>83</fpage>
          ,
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>J.</given-names>
            <surname>Prez</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Arenas</surname>
          </string-name>
          , and
          <string-name>
            <given-names>C.</given-names>
            <surname>Gutierrez</surname>
          </string-name>
          .
          <article-title>Semantics and complexity of SPARQL</article-title>
          .
          <source>ACM Transactions on Database Systems</source>
          ,
          <volume>34</volume>
          (
          <issue>3</issue>
          ):
          <volume>30</volume>
          {
          <fpage>43</fpage>
          ,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>M.</given-names>
            <surname>Saleem</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. I.</given-names>
            <surname>Ali</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Hogan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Q.</given-names>
            <surname>Mehmood</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A.-C. N.</given-names>
            <surname>Ngomo</surname>
          </string-name>
          . LSQ:
          <article-title>The linked SPARQL queries dataset</article-title>
          .
          <source>In Proc. of ISWC</source>
          <year>2015</year>
          , pages
          <fpage>261</fpage>
          {
          <fpage>269</fpage>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>Z.</given-names>
            <surname>Song</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Zhang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Feng</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Wang</surname>
          </string-name>
          , and
          <string-name>
            <given-names>G.</given-names>
            <surname>Rao. LSQ:</surname>
          </string-name>
          <article-title>The linked SPARQL queries dataset</article-title>
          .
          <source>In Proc. of SemiBDMA</source>
          <year>2016</year>
          , to appear,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>