<!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>
      <journal-title-group>
        <journal-title>Tm</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>PIWD: A Plugin-based Framework for Well-Designed SPARQL (Extended Abstract)</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Xiaowang Zhang</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff3">3</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Zhenyu Song</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff3">3</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Zhiyong Feng</string-name>
          <xref ref-type="aff" rid="aff2">2</xref>
          <xref ref-type="aff" rid="aff3">3</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Xin Wang</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff3">3</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Key Laboratory of Computer Network and Information Integration (Southeast University), Ministry of Education</institution>
          ,
          <addr-line>Nanjing 211189</addr-line>
          ,
          <country country="CN">China</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>School of Computer Science and Technology, Tianjin University</institution>
          ,
          <addr-line>Tianjin</addr-line>
          ,
          <country country="CN">China</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>School of Computer Software, Tianjin University</institution>
          ,
          <addr-line>Tianjin 300350</addr-line>
          ,
          <country country="CN">China</country>
        </aff>
        <aff id="aff3">
          <label>3</label>
          <institution>Tianjin Key Laboratory of Cognitive Computing and Application</institution>
          ,
          <addr-line>Tianjin</addr-line>
          ,
          <country country="CN">China</country>
        </aff>
      </contrib-group>
      <volume>0</volume>
      <issue>4</issue>
      <abstract>
        <p>In the real world datasets (e.g.,DBpedia query log), queries built on well-designed patterns containing only AND and OPT operators (for short, WDAO-patterns) account for a large proportion among all SPARQL queries. In this paper, we present a plugin-based framework for all SELECT queries built on WDAO-patterns, named PIWD. Theoretically, we can reduce the query evaluation of WDAO-patterns to subgraph homomorphism as well BGP since the query evaluation of BGP is equivalent to subgraph homomorphism. Furthermore, our preliminary experiments on gStore and RDF-3X show that PIWD can answer all queries built on WDAO-patterns e ectively and e ciently.</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. The standard query language for RDF graphs is SPARQL. Though
SPARQL is powerful to expressing queries over RDF graphs, generally, the query
evaluation of the full SPARQL is PSPACE-complete [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ].
      </p>
      <p>
        Currently, there are some popular query engines for supporting the full
SPARQL such as Jena [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. However, they become not highly e cient when they
handle some large RDF datasets[
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. Currently, gStore[
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] and RDF-3X[
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] can
highly e ciently query large datasets. But gStore and RDF-3X merely provide
querying services of BGP. Therefore, it is necessary to develop a query engine
with supporting more expressive queries for large datasets.
      </p>
      <p>
        Since the OPT operator is the least conventional operator among SPARQL
operators [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], it is interesting to investigate those patterns extending BGP with
the OPT operator. In fact, we investigate that queries bulit on well-designed
patterns are very popular in a real world. For example, in LSQ, a Linked Dataset
describing SPARQL queries extracted from the logs of four prominent public
SPARQL endpoints containing more than one million available queries, queries
built on well-designed patterns are over 70% [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ].
      </p>
      <p>
        Furthermore, queries with well-designed AND-OPT patterns (for short,
WDAOpatterns) are over 99% among those queries with well-designed patterns in LSQ
[
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. In a short, the fragment of WDAO-patterns are a natural extension of BGP.
      </p>
      <p>In this paper, we present a plugin-based framework for all SELECT queries
built on WDAO-patterns, named PIWD. Within this framework, we can employ
any query engine evaluating BGP for evaluate queries bulit on WDAO-patterns
in a convenient way.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Preliminaries</title>
      <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 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="ref5">5</xref>
        ].
3
      </p>
    </sec>
    <sec id="sec-3">
      <title>Well-Designed And-Opt Tree</title>
      <p>De nition 1 (WDAO-tree). Let P be a well-designed pattern in OPT normal
form. A well-designed tree T based on P is a redesigned parse tree, which can be
de ned as follows:
{ All inner nodes in T are labeled by OPT operators and leaf nodes are labeled
by BGP.
{ For each subpattern (P1 OPT P2) of P , the well-designed tree T1 of P1 and
the well-designed tree T2 of P2 have the same parent node.</p>
      <p>For instance, consider a WDAO-pattern P 5 = (((p1 AND p3) OPT2
p2) OPT1 ((p4 OPT4 p5) OPT5 (p6 OPT6 p7))).</p>
      <p>The WDAO-tree T is shown in Figure 1(a). As shown in this example, BGP
- (p1 AND p3) is the exact matching in P , which corresponds to the non-optional
pattern. Besides, in WDAO-tree, it is the leftmost leaf in T .
4</p>
    </sec>
    <sec id="sec-4">
      <title>PIWD Demonstration</title>
      <p>PIWD is written in Java in a 2-tier design shown in Figure 1(b). The bottom
layer consists of any BGP query framework which is used as a black box for
evaluating BGPs. Before answering SPARQL queries, the second layer provides
the rewriting process and left-outer join evaluation, which lead to the solutions.</p>
      <p>BGP query framework supports both query and RDF data management, such
as gStore, RDF-3X and so on, which solve the problem of subgraph isomorphism.
5 We give each OPT operator a subscript to di erentiate them so that readers
understand clearly.</p>
      <p>OPT3
p1 AND p3p2</p>
      <p>OPT4</p>
      <p>OPT5
p4
p5
p6</p>
      <p>p7
(a) WDAO-tree</p>
      <p>(b) PIWD architecture
PIWD provides the left-outer join between the BGPs. That is, the problem of
answering well-designed SPARQL has been transformed into the problem of
subgraph isomorphism and left-outer join between triple patterns.
5</p>
    </sec>
    <sec id="sec-5">
      <title>Experiments and Evaluations</title>
      <p>
        Experiments All experiments were carried out on a machine running Linux,
which has one CPU with four cores of 2.40GHz, 32GB memory and 500GB
disk storage. All of the algorithms were implemented in JAVA. gStore[
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] and
RDF-3X[
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] are used as the underlying query engines to handle BGPs. In our
experiments, there is no optimization in our OPT operation. In our experiments,
we used LUBM1, LUBM50, LUBM100, LUBM150 and LUBM200 as our query
datasets. The queries over LUBM were designed as four di erent forms, which
corresponds to di erent WDAO-trees. OPT nesting in Q2 is the most complex
among four forms. Furthermore, we built AND operators in each query.
      </p>
      <p>Evaluation on PIWD The variation tendencies of query response time are
shown in Figure 2. Query e ciency is decreased with higher response time when
OPT nesting becomes more complex. Furthermore, there has been a signi cant
increase in query response time when the dataset scale grows up. For instance,
we observe Q2, which corresponds to the most complex pattern in our four
experimental SPARQL patterns. When the dataset is ranging from LUBM100
to LUBM200, its query response time extends more than ve times even though
the dataset scale extends two times.
6</p>
    </sec>
    <sec id="sec-6">
      <title>Conclusion</title>
      <p>In this paper, we have presented PIWD, which is a plugin adaptable for any BGP
query framework to handle WDAO-patterns. Theoretically, PIWD rebuilds the
query plan based on WDAO-tree. After employing BGP query framework on
WDAO-tree, PIWD supports left-outer join operation between triple patterns.
Our experiments show that PIWD can deal with complex and multi-level nested
1
0:8
0:2
0
LUBM1 LUBM50LUBM100LUBM150LUBM200</p>
      <p>Dataset scale
(a) Performance on gStore</p>
      <p>LUBM1 LUBM50LUBM100LUBM150LUBM200</p>
      <p>
        Dataset scale
(b) Performance on RDF-3X
WDAO-patterns. In the future, we will further handle other non-well-designed
patterns and deal with more operations such as UNION. Besides, we will consider
OPT operation optimization to improve e ciency of PIWD and implement our
framework on distributed RDF graphs by applying the distributed gStore [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ].
      </p>
    </sec>
    <sec id="sec-7">
      <title>Acknowledgments</title>
      <p>This work is supported by the program of the program of the National Key
Research and Development Program of China (2016YFB1000603), the National
Natural Science Foundation of China (NSFC) (61502336), and the open funding
project of Key Laboratory of Computer Network and Information Integration
(Southeast University), Ministry of Education (K93-9-2016-05). Xiaowang Zhang
is supported by Tianjin Thousand Young Talents Program and the
projectsponsored by School of Computer Science and Technology in Tianjin University.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Carroll</surname>
            <given-names>J.J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dickinson</surname>
            <given-names>I.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dollin</surname>
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Reynolds</surname>
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Seaborne</surname>
            <given-names>A.</given-names>
          </string-name>
          , and
          <string-name>
            <surname>Wilkinson</surname>
            <given-names>K.</given-names>
          </string-name>
          (
          <year>2004</year>
          ).
          <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>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Han</surname>
            <given-names>X.</given-names>
          </string-name>
          , Feng
          <string-name>
            <given-names>Z.</given-names>
            ,
            <surname>Zhang</surname>
          </string-name>
          <string-name>
            <given-names>X.</given-names>
            ,
            <surname>Wang</surname>
          </string-name>
          <string-name>
            <given-names>X.</given-names>
            , and
            <surname>Rao</surname>
          </string-name>
          <string-name>
            <surname>G.</surname>
          </string-name>
          (
          <year>2016</year>
          ).
          <article-title>On the statistical analysis of practical SPARQL queries</article-title>
          .
          <source>In: Proc. of WebDB</source>
          <year>2016</year>
          , article 2.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Neumann</surname>
            <given-names>T.</given-names>
          </string-name>
          and
          <string-name>
            <surname>Weikum</surname>
            <given-names>G.</given-names>
          </string-name>
          (
          <year>2010</year>
          ).
          <article-title>The RDF3X engine for scalable management of RDF data</article-title>
          .
          <source>VLDB Journal</source>
          ,
          <volume>19</volume>
          (
          <issue>1</issue>
          ):
          <volume>91</volume>
          {
          <fpage>113</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Peng</surname>
            <given-names>P.</given-names>
          </string-name>
          , Zou L.,
          <string-name>
            <given-names>O</given-names>
            <surname>zsu M.T.</surname>
          </string-name>
          ,
          <string-name>
            <surname>Chen</surname>
            <given-names>L.</given-names>
          </string-name>
          , and
          <string-name>
            <surname>Zhao</surname>
            <given-names>D.</given-names>
          </string-name>
          (
          <year>2016</year>
          ).
          <article-title>Processing SPARQL queries over distributed RDF graphs</article-title>
          . VLDB J.,
          <volume>25</volume>
          (
          <issue>2</issue>
          ):
          <volume>243</volume>
          {
          <fpage>268</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Perez</surname>
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Arenas</surname>
            <given-names>M.</given-names>
          </string-name>
          , and
          <string-name>
            <surname>Gutierrez</surname>
            <given-names>C.</given-names>
          </string-name>
          (
          <year>2009</year>
          ).
          <article-title>Semantics and complexity of SPARQL</article-title>
          .
          <source>ACM Trans. Database Syst</source>
          .,
          <volume>34</volume>
          (
          <issue>3</issue>
          ):
          <volume>30</volume>
          {
          <fpage>43</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Zhang</surname>
            <given-names>X</given-names>
          </string-name>
          . and
          <string-name>
            <surname>Van den Bussche</surname>
            <given-names>J</given-names>
          </string-name>
          . (
          <year>2014</year>
          ).
          <article-title>On the primitivity of operators in SPARQL</article-title>
          . Inf. Process. Lett.,
          <volume>114</volume>
          (
          <issue>9</issue>
          ):
          <fpage>480</fpage>
          -
          <lpage>485</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Zou</surname>
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>O</given-names>
            <surname>zsu M.T.</surname>
          </string-name>
          ,
          <string-name>
            <surname>Chen</surname>
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Shen</surname>
            <given-names>X.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Huang</surname>
            <given-names>R.</given-names>
          </string-name>
          , and
          <string-name>
            <surname>Zhao</surname>
            <given-names>D.</given-names>
          </string-name>
          (
          <year>2014</year>
          ).
          <article-title>gStore: A graph-based sparql query engine</article-title>
          .
          <source>VLDB J</source>
          .,
          <volume>23</volume>
          (
          <issue>4</issue>
          ):
          <volume>565</volume>
          {
          <fpage>590</fpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>