<!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>An On-Line Learning to Query System</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Proposed Demo</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Faculty of Computing, Poznan University of Technology ul. Piotrowo 3</institution>
          ,
          <addr-line>60-965 Poznan</addr-line>
          ,
          <country country="PL">Poland</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>We present an on-line system which learns a SPARQL query from a set of wanted and a set of unwanted results of the query. The sets are extended during a dialog with the user guided by recall and F1 measure. The system leverages SPARQL 1.1 and does not depend on any particular RDF graph.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1 Introduction</title>
      <p>
        A common problem with querying a Linked Data dataset is that the user must
have prior knowledge about the vocabulary used by the dataset and know a
querying language, e.g. SPARQL [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. A typical approach to remedy the
problem is to use some tool helping the user to formulate a SPARQL query, using
e.g. faceted browsing [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], natural-language interfaces [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ], visual interfaces [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] or
recommendations [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. In all these system the user speci es the query by
various means. We propose a di erent approach, where the user only speci es what
should and what should not be in the results of the query, and the system takes
care of formulating the query. The user does not need to know SPARQL, it is
enough for her to be able to distinguish wanted and unwanted results. If the user
is already familiar with the data (e.g. knows its representation in some other
format), it is quite an easy task for her. The system operates by conducting a dialog
with the user. In each part of the dialog, the user is asked about a small set of
URIs and for every URI she must decide if it should or should not be present
in the results of the nal query. A similar approach was already presented in
[
        <xref ref-type="bibr" rid="ref5">5</xref>
        ], where the system used mostly computational power of the computer system
of the user. We leverage new features of SPARQL 1.1 and move most of the
computation to a SPARQL endpoint, especially the process of query re nement
guided by recall and deciding on termination depending on F1 measure.
      </p>
      <p>Thought this work, we use the following pre xes: dbr: for http://dbpedia.
org/resource/, dbo: for http://dbpedia.org/ontology/, dbp: for http:
//dbpedia.org/property/, dct: for http://purl.org/dc/terms/, xsd: for
http://www.w3.org/2001/XMLSchema#.</p>
    </sec>
    <sec id="sec-2">
      <title>System Description</title>
      <p>A screenshot of the on-line system is presented in Figure 1. The source
code of the system is available in a Git 1 repository available at https://
bitbucket.org/jpotoniec/kretr/. An instance of the system is available at
https://semantic.cs.put.poznan.pl/ltq/. It uses a SPARQL endpoint set
up on Blazegraph2 2.1.1 and loaded with DBpedia 2015-04. Note that the
system itself does not depend neither on Blazegraph nor DBpedia, as it can use any
SPARQL 1.1 endpoint.</p>
      <p>The aim of the system is to build a SPARQL SELECT query with a single
variable in the head. The variable has a modi er DISTINCT. The query contains
only a WHERE clause (i.e. there is no GROUP BY, ORDER BY etc.), and in
the clause there is only a basic graph pattern (BGP, i.e. triple patterns and lter
expressions). The undirected graph corresponding to the BGP is a connected
1 https://git-scm.com/
2 https://www.blazegraph.com/
graph and the lter expressions are of a form variable &gt;=/&lt;= literal. An example
of such a query is
SELECT DISTINCT ?uri
WHERE f
?uri dct:subject dbr:Category:City_counties_of_Poland .
?uri dbo:populationTotal ?anon1.</p>
      <p>FILTER(?anon1 &gt;= "205934"^^xsd:nonNegativeInteger). g</p>
      <p>
        A typical work ow with the system is presented in Figure 2. First, the user
speci es a small set of URIs that should be present in the results of the nal
query, and a small set of URIs that should not be present in the results. Then, the
system re nes the query by adding to it a new triple pattern (or a triple pattern
and a lter expression) while maintaining recall of at least 0.99, i.e. covering
at least 99% of the positive examples. In a typical case of multiple possible
re nements, they are sorted by F1 measure and precision and the one with the
highest values is chosen. Next, the system generates a few new positive and
negative examples. The positive examples are simply selected from the results
of the re ned query, while the negative examples are computed by subtracting
from the results of the original query the results of the re ned query. In each
case we require the found examples to be new, i.e. they must not be already
labeled by the user. If nding the new examples is impossible, the re nement
is retracted and the next in order is tried. The user is then asked to decide
about each example if it should or not be present in the results of the nal query
(i.e. the user extends the sets de ned in the beginning). After the user decides,
the system checks if the decisions agrees with the query. If they do not, the
cycle repeats: the system re nes the query, asks the user and assess the query.
Otherwise, the system assumes that the correct query was found. The query is
displayed to the user along with the results of the query. If the user decides that
the results are not satisfactory, she must add at least one new URI to one of
the sets. More details about the algorithm, along with the templates of queries
used, is presented in [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ].
During the demo, we will present to the participants how to use the system,
what types of queries are possible to learn and what are the limitations. The
system has embedded two demo scenarios: the rst one to nd a query to select
all capitals of the member states of European Union and the second one to nd
a query to select all Polish cities having more than 2000000 citizens. For the
presentation, we will use the on-line instance available at https://semantic.
cs.put.poznan.pl/ltq/.
4
      </p>
    </sec>
    <sec id="sec-3">
      <title>Conclusion</title>
      <p>In this paper we presented a system which is able to learn a SPARQL query from
two sets of URIs obtained from the user in a dialog. The system leverages new
features of SPARQL 1.1 and does not depend on any particular RDF graph. It
also does not require any precomputation before it is ready to use. The source
code is publicly available.</p>
      <p>Acknowledgement. Jedrzej Potoniec acknowledges the support from the
Polish National Science Center (Grant No 2013/11/N/ST6/03065).</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Campinas</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          :
          <article-title>Live SPARQL auto-completion</article-title>
          . In: Horridge,
          <string-name>
            <given-names>M.</given-names>
            ,
            <surname>Rospocher</surname>
          </string-name>
          , M.,
          <string-name>
            <surname>van Ossenbruggen</surname>
          </string-name>
          ,
          <source>J. (eds.) Proc. of the ISWC 2014 Posters &amp; Demonstrations Track. CEUR Workshop Proceedings</source>
          , vol.
          <volume>1272</volume>
          , pp.
          <volume>477</volume>
          {
          <issue>480</issue>
          (
          <year>2014</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Ferre</surname>
            ,
            <given-names>S.:</given-names>
          </string-name>
          <article-title>SPARKLIS: a SPARQL endpoint explorer for expressive question answering</article-title>
          . In: Horridge,
          <string-name>
            <given-names>M.</given-names>
            ,
            <surname>Rospocher</surname>
          </string-name>
          , M.,
          <string-name>
            <surname>van Ossenbruggen</surname>
          </string-name>
          ,
          <source>J. (eds.) Proc. of the ISWC 2014 Posters &amp; Demonstrations Track. CEUR Workshop Proc.</source>
          , vol.
          <volume>1272</volume>
          , pp.
          <volume>45</volume>
          {
          <issue>48</issue>
          (
          <year>2014</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Harris</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Seaborne</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>SPARQL 1.1 query language</article-title>
          .
          <source>W3C recommendation</source>
          ,
          <source>W3C (Mar</source>
          <year>2013</year>
          ), http://www.w3.org/TR/2013/REC-sparql11
          <string-name>
            <surname>-</surname>
          </string-name>
          query-20130321/
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4. Ho ner,
          <string-name>
            <given-names>K.</given-names>
            ,
            <surname>Walter</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            ,
            <surname>Marx</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            ,
            <surname>Usbeck</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            ,
            <surname>Lehmann</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            ,
            <surname>Ngomo</surname>
          </string-name>
          ,
          <string-name>
            <surname>A.C.N.:</surname>
          </string-name>
          <article-title>Survey on challenges of question answering in the semantic web</article-title>
          .
          <source>Semantic Web Journal (accepted for publication)</source>
          (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Lehmann</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          , Buhmann, L.:
          <article-title>AutoSPARQL: Let users query your knowledge base</article-title>
          . In: Antoniou,
          <string-name>
            <given-names>G.</given-names>
            ,
            <surname>Grobelnik</surname>
          </string-name>
          ,
          <string-name>
            <surname>M.</surname>
          </string-name>
          , et al. (eds.)
          <source>The Semantic Web: Research and Applications. LNCS</source>
          , vol.
          <volume>6643</volume>
          , pp.
          <volume>63</volume>
          {
          <fpage>79</fpage>
          . Springer (
          <year>2011</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Potoniec</surname>
          </string-name>
          , J.:
          <article-title>Learning to Query: from Concepts in Mind to SPARQL Queries</article-title>
          .
          <source>Tech. Rep. RA-9/16</source>
          , Institute of Computing Science, Faculty of Computing, Poznan University of Technology (aug
          <year>2016</year>
          ), http://goo.gl/B7J008
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7. e Zainab,
          <string-name>
            <given-names>S.S.</given-names>
            ,
            <surname>Saleem</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            ,
            <surname>Mehmood</surname>
          </string-name>
          ,
          <string-name>
            <surname>Q.</surname>
          </string-name>
          , et al.:
          <article-title>Fedviz: A visual interface for SPARQL queries formulation and execution</article-title>
          . In: Ivanova,
          <string-name>
            <given-names>V.</given-names>
            ,
            <surname>Lambrix</surname>
          </string-name>
          ,
          <string-name>
            <surname>P.</surname>
          </string-name>
          , et al.
          <source>(eds.) Proc. of the International Workshop on Visualizations and User Interfaces for Ontologies and Linked Data. CEUR Workshop Proc.</source>
          , vol.
          <volume>1456</volume>
          , p.
          <volume>49</volume>
          (
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>