<!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>SPACE: SPARQL Index for E cient Autocompletion</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Kasjen Kramer</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Renata Dividino</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Gerd Gro¨ner</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>WeST, University of Koblenz-Landau</institution>
          ,
          <country country="DE">Germany</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Querying Linked Data means to pose queries on various data sources without information about the data and the schema of the data. This demo shows SPACE, a tool to support autocompletion for SPARQL queries. It takes as input SPARQL query logs and builds an index structure for e cient and fast computation of query suggestions. To demonstrate SPACE, we use available query logs from the USEWOD Data Challenge 2013.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1 Introduction</title>
    </sec>
    <sec id="sec-2">
      <title>The SPACE Data Structure for Indexing SPARQL Queries</title>
      <p>When a user writes a SPARQL query, SPACE aims to find the most similar queries
available in the query logs in order to build new suggestions. A SPARQL query is a
tuple defined as Q = (A; V; G; P; M), where A is the set of prefix declarations (Line 1
in Fig. 1(a)), V is the output form (Line 2 in Fig. 1(a)). G refers to the RDF graph(s)
being queried (Line 3 in Fig. 1(a)), P is a graph pattern (Line 5-8 in Fig. 1(a)) and M are
query modifiers (Line 9 in Fig. 1(a)). In this work, we focus only on graph patterns. In
that view, a query is composed only by its P. The core of SPACE is its index structure.
The index structure is a graph, representing a set of SPARQL queries.
(a) It returns the email of the persons named John (b) It returns the email of the persons named John
Doen and Peter Doen Doen and Sarah Carey
Definition 1 (SPACE Index). The SPACE index I is a hierarchical index in form of a
directed acyclic ordered graph I = (V; E). Each vertex v 2 V is associated with a level
l(v) 2 0; : : : n 1. Each edge (v; v0) 2 E leads to a vertex at a higher level (l(v) &lt; l(v0)).
The partial relation (set-inclusion) on the set V defines v v0 for all (v; v0) 2 E.</p>
      <p>According to Def. 1, the index structure has the following shape:
1. The vertices at the highest index level (n 1) are represented by elements of the
(pairwise disjoint) infinite sets I, B, L and V (IRIs, Blank nodes, literals and
variables). Additionally, they represent the binary operators AND, UNION, OPT,
FILTER, and GRAPH used to combine graph patterns. These vertices have only
incoming edges.
2. The vertices from index level n 2 until index level 1 represent graph patterns,
according to the recursive definition in [4]. A triple pattern is a graph pattern of the
form (I [ L [ V) (I [ V) (I [ L [ V). If P1 and P2 are graph patterns then (P1 AND
P2), (P1 OPT P2), and (P1 UNION P2) are also graph patterns. Given a SPARQL
built-in condition R, then (P1 FILTER R) is a graph pattern. Finally, given a G 2 I
or 2 V, then (G GRAPH P) is a graph pattern.
3. The vertices from index level 1 represent SPARQL queries. Each query is
composed by one graph pattern.
4. The (single) vertex, at the (lowest) level 0 (also called root vertex) represents a set
of queries, e.g., all queries of a query log. This vertex has only outgoing edges.</p>
      <p>Please note that, the number of graph patterns in the queries determine the height of
the index tree. To illustrate our approach, Fig. 1(a) and Fig: 1(b) present two SPARQL
queries. The first query searches for the email of the persons named John Doen and Peter
Doen. The second one searches for the email of the persons named John Doen and Saray
Carey. The SPACE index structure is shown in Fig. 2. The IRIs foaf:name, foaf:mbox,
the literals ’John Coen’, ’Peter Coen’ and ’Sarah Carey’, the variables ?person and
?email, as well as the operator AND and UNION are represented by the nodes at the
last level. The graph patterns are represented in the levels above. For instance, the triple
pattern t1 is composed by the nodes ?person, foaf:name and ’John Coen’.</p>
      <p>The process of searching for suggestions is done by sub-graph matching. Whenever
there is a match of the query written by the user in the index graph, the tool is able to
provide suggestions. The suggestions are ordered regarding to a popularity score. The
popularity score represents the frequency of an element in the queries of the dataset.
When the user start writing a query, up the first symbols he writes, he gets some
suggestions. For instance, if the user starts with the symbols h, then the tools suggest all
possible URIs found in the graph’ nodes. If the user writes ”?”, the tool searches for
all the nodes representing a variable in the index. Given a variable, the possible
followup suggestions are the predicates nodes, in our case, the predicates in ”foaf:name” and
”foaf:mbox”, since they are the only predicates connected to variable nodes in the
index graph. The tool only suggests (parts of) already observed queries. The more the
user writes the smaller is the region where the query may be located in the index graph.
Therefore, the longer the written query is, the more precise are the suggestions. The tool
searches for the most similar queries in the query log in a bottom-up matching manner.
For speeding up, an extra index for prefixes and namespaces is built. Please note that,
nodes representing variables are not named and can be seen as just placeholders. The
substitution method is used to check the equality of graph patterns.
3</p>
    </sec>
    <sec id="sec-3">
      <title>SPACE in Use</title>
      <p>Dataset: To demonstrate our tool, we collect queries from available query logs from the
USEWOD Data Challenge 2013 1 posted to SPARQL endpoints. In particular, the logs
are from the two following sources: Open-BioMed.org.uk and BioPortal. The
OpenBioMed.org.uk service o ers gene expression search for Drosophila research, as well
as drug discovery for the Alzheimer’s disease. BioPortal provides access to commonly
used biomedical ontologies.</p>
      <p>
        Tool demonstration: The SPACE2 is a web application tool written in Java and is based
on the Jena framework. Its client-side is implemented in Javascript code. Fig. 3 shows a
screenshot of the tool. SPACE is composed of two parts: (
        <xref ref-type="bibr" rid="ref1">1</xref>
        ) the not-editable part,
representing an incomplete SELECT query and (
        <xref ref-type="bibr" rid="ref2">2</xref>
        ) the editable part, representing the graph
pattern of the query. Suggestions are given to the user starting from the moment the
user writes something in this field. The autocompletion functionality includes
suggestion of IRIs such as classes and properties, of literals, of variables, of SPARQL binary
operators as well as of namespaces and prefixes.
1 USEWOD Data Challenge: data.semanticweb.org/usewod/2013/challenge.html
2 SPACE: http://west.uni-koblenz.de/Research/systems/SPACE
4
      </p>
    </sec>
    <sec id="sec-4">
      <title>Conclusion and Outlook</title>
      <p>In this paper, we have shown SPACE, a SPARQL editor that assists users when
writing SPARQL queries. The tool is based on a hierarchical index structure of SPARQL
queries, which enables fast computation of the most similar queries that are available
in the query logs in order to generate new suggestions. So far, we have focused on the
suggestions of query patterns.</p>
      <p>
        We plan to proceed this research into three directions: (
        <xref ref-type="bibr" rid="ref1">1</xref>
        ) incorporate all operators
of SPARQL and apply optimizations, (
        <xref ref-type="bibr" rid="ref2">2</xref>
        ) combine with approaches based on dataset
statistics to improve recommendation, (
        <xref ref-type="bibr" rid="ref3">3</xref>
        ) conduct a user evaluation to get feedback
from users to estimate which suggestion is intuitive with respect to human feeling.
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>S.</given-names>
            <surname>Campinas</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T. E.</given-names>
            <surname>Perry</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Ceccarelli</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Delbru</surname>
          </string-name>
          , and
          <string-name>
            <given-names>G..</given-names>
            <surname>Tummarello</surname>
          </string-name>
          .
          <article-title>Introducing RDF Graph Summary with application to Assisted SPARQL Formulation</article-title>
          . In DEXA,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>T.</given-names>
            <surname>Gottron</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Scherp</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Krayer</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Peters</surname>
          </string-name>
          . Lodatio:
          <article-title>Using a schema-level index to support users in finding relevant sources of linked data</article-title>
          .
          <source>In K-CAP'13</source>
          ,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>M.</given-names>
            <surname>Jarrar</surname>
          </string-name>
          and
          <string-name>
            <given-names>M. D.</given-names>
            <surname>Dikaiakos</surname>
          </string-name>
          .
          <article-title>A Query Formulation Language for the Data Web</article-title>
          .
          <source>IEEE Trans. on Knowledge and Data Engineering</source>
          ,
          <volume>24</volume>
          (
          <issue>5</issue>
          ):
          <fpage>783</fpage>
          -
          <lpage>798</lpage>
          ,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4. J. Pe´rez, M. Arenas, and
          <string-name>
            <given-names>C.</given-names>
            <surname>Gutierrez</surname>
          </string-name>
          .
          <article-title>Semantics and complexity of sparql</article-title>
          .
          <source>ACM Trans. Database Syst</source>
          .,
          <volume>34</volume>
          (
          <issue>3</issue>
          ):
          <volume>16</volume>
          :
          <fpage>1</fpage>
          -
          <lpage>16</lpage>
          :
          <fpage>45</fpage>
          ,
          <year>September 2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>M.</given-names>
            <surname>Zviedris</surname>
          </string-name>
          and Barzdins G.
          <article-title>ViziQuer: A Tool to Explore and Query SPARQL Endpoints</article-title>
          .
          <source>In ESWC</source>
          , volume
          <volume>6644</volume>
          <source>of LNCS</source>
          , pages
          <fpage>441</fpage>
          -
          <lpage>445</lpage>
          . Springer,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>