<!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>Granada: Relational Database Navigation and Scaling</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Jens Kotters</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Peter W. Eklundy</string-name>
        </contrib>
      </contrib-group>
      <abstract>
        <p>In this paper an application is presented that allows the construction of conjunctive queries (represented as labeled graphs), the presentation of the results of the queries (as tables), and the selection of options for specialization or generalization of the graph queries. The graph labels correspond to the query vocabulary, which is obtained by conceptual scaling of the database. Each scale provides the specialization and generalization options for a particular kind of graph node. At any time, the user is shown the current query, the result table, and a set of options to modify the query.</p>
      </abstract>
      <kwd-group>
        <kwd>conjunctive queries</kwd>
        <kwd>pattern concepts</kwd>
        <kwd>relational databases</kwd>
        <kwd>navigation</kwd>
        <kwd>conceptual scaling</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>The tool is realized as a web application, using Python 3 server-side. Supported
browsers are current versions of Firefox and Chrome, which support modern
standards like HTML5 and Javascript ES6. The Granada package contains a
Copyright c 2019 for this paper by its authors. Copying permitted for private and
academic purposes.
le app.wsgi, which is the interface to the web server (cf. https://www.python.
org/dev/peps/pep-0333/). For simplicity, the le can also be run as a script
with python3 app.wsgi, which starts the app in Python's built-in web server.
The initial application screen (Fig. 1) can then be found at localhost:8081.
The navigate and edit pane (left and middle in Fig. 1) list all databases known to
the system (both lists are identical). Initially, the lists will be empty. To include a
database in the list, the relevant information (user, password, host and database
name) is entered in the create section (right section in Fig. 1). This creates a
JSON le on the server with connection information and additional information
obtained from the database (e.g. tables and columns). We refer to this le (and
the information it contains) as a binding ; a name for the binding is optionally
speci ed on creation (this defaults to the database name). Once a binding is
created, it is listed in both the navigate and edit panes.</p>
      <p>
        Clicking on an item in the edit pane (middle in Fig. 1) displays the associated
binding in the edit view (Fig. 2). The tables in the database are listed on the
left of Fig. 2, and we refer to them as sorts. To the right of the sort list, all
binding information related to a particular sort (selected in the list) can be seen.
The cyan entries in the properties pane are the table columns, and each is listed
with its SQL datatype (similar to how attributes and methods are listed in an
API documentation). Green entries in the relations pane represent foreign keys
on or into the respective table/sort. Foreign keys are only included in the initial
binding if they are explicitly speci ed in the database. Otherwise, they have
to be speci ed manually, using the form at the bottom of the relations pane.
We refer to the entries in either the properties or relations section as
manyvalued attributes. Such attributes can be conceived as unary functions (a foreign
key is conceived as a Boolean function on object pairs, i.e. as the characteristic
function of the underlying relation). The output pane (top of Figure 2) speci es
how a table row is printed as text (by default, the primary key is printed). The
drop-down menu on the right-hand side of each attribute is used to con gure
whether the attribute can be used in queries and, if yes, what search mask is
used to specify conditions (in FCA terms, the drop-down menu is used to scale
the attribute, cf. [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]).
      </p>
      <p>The navigation view (cf. Fig. 3) is opened when the user clicks on a binding
in the navigate section in Fig. 1. We assume here that the database has already
been con gured for navigation, either in the editor view as described above, or
automatically by the system, using sensible defaults.</p>
      <p>The navigation view is partitioned into four panes, showing the query graph
(top right), the result table (lower right) and associated options (left windows).
The initial query graph consists of only a single rectangular node, labeled Any:x1.
It describes the set of all objects in the database (i.e. all rows of all tables). Only
in this particular case is an associated result table not shown in the lower right
pane, this is because there is no corresponding SQL query for the query graph.</p>
      <p>The only action that is initially available to the user is the restriction of x1
to one of the sorts (i.e. table names) available in the database. The `Literature'
database, which is used in the examples, consists of two relations/tables Author
and Book. These can be selected in the label view (upper left). The numbers
next to the sorts represent the number of rows in the respective tables. Selecting
one of the sorts (cf. Fig. 3) updates the query graph (the node label now shows
the selected sort, see top right), produces a table which lists all objects of that
sort (bottom right), and shows all properties and relations associated with the
objects of that sort in the link view (bottom left). Unchecking the sort in the
label view leads back to the previous query. This allows one to quickly examine
the available sorts, their associated properties and relations. What properties
and relations are exactly shown can be speci ed in the bindings editor (Fig. 2).</p>
      <p>
        The Author sort has two properties, DOB (date-of-birth) and nationality,
listed in the link view under properties. The eye icon is an a ordance that allows
one to view the respective property in the result table (by adding an additional
column in each case). Clicking the eye icon again toggles the view on the
respective column. This does not modify the graph. Clicking the plus control symbol
on the other hand, adds a relation node to the graph (relation nodes are drawn
as rounded nodes), which represents a condition on the many-valued attribute.
Some initial condition is given, which may or may not restrict the current result
set. In the case of the DOB attribute, the initial condition speci es that authors
are born between 1800 and 2000 (a suitable range is computed which does not
restrict the result set). A minus now appears in place of the plus control symbol;
clicking on it destroys the relation node (and thus removes the condition).
Clicking the button with the property name shows options to modify the condition
in the label view (top left), if the property is active (i.e. an associated relation
node exists in the graph). For the DOB property, the label options are given by
a slider with two handles, which allows one to select an interval of permissible
values (cf. Fig. 4). The nationality attribute is associated with a di erent kind
of scale, which allows the user to specify that the string-valued attribute must
begin with a certain pre x. A pre x can be entered in a text eld in the label
view, or chosen out of a list of occurring values (cf. Fig. 5). The plus symbol
on a relation link creates a relation node together with object nodes for the
associated objects, with a corresponding sort. For example, clicking on the plus
symbol for the wrote relation creates the corresponding relation node plus an
associated Book node (cf. Fig. 6). Clicking on the large button with the relation
name on it shows the pairs in the relation that satisfy the query constraints. If
a relation between objects has an associated value (an example from [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] is the
age at which an author wrote book), conditions on that value can be set in the
label view. Currently, only three types of scales are implemented: interval scale,
pre x scale and foreign key scale. Figures 4, 5 and 6 show examples of their
application. The application is still evolving, and a future version will allow to
provide implementations of further scales as modular extensions.
3
      </p>
    </sec>
    <sec id="sec-2">
      <title>Related Work</title>
      <p>
        Granada is based on a navigation principle previously described in [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. In that
paper, concepts were not yet formalized, because a suitable notion of extents
was still missing. The theoretical foundation was presented in [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], with extents
being described by tables (as in relational algebra). Such tables describe relations
between objects, and are best thought of as containing only primary keys; the
value columns in Granada's table view represent additional information which
is not (and does not have to be) covered by the concept model in [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. Technically,
a navigation state (consisting of a query graph and its result table) is a
semiconcept, rather than a concept, because Granada does not compute the query
closure (i.e. the intent). Bringing concepts back in is a matter of computing the
query closure in each navigation state. Providing the user with such information
can be considered an additional feature that might be implemented in a future
version of Granada. Basic ideas with regard to conceptual scaling, on which
Granada's editor is based, are described in [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. A preliminary version of the
application has been presented at Int. Conf. on Formal Concept Analysis 2017.
      </p>
      <p>
        Sparklis [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] is a similar tool for interactive query building which also uses
natural language features. Relational data exploration has also been considered
in the context of Relational Concept Analysis (RCA), see e.g. [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. An early
contribution to querying relational data in the context of FCA, based on the
same theoretical notions as the present work, is a relational Toscana extension
described in [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ].
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Dolques</surname>
            ,
            <given-names>X.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Le Ber</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Huchard</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nebut</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          :
          <article-title>Relational concept analysis for relational data exploration</article-title>
          . In: Guillet,
          <string-name>
            <given-names>F.</given-names>
            ,
            <surname>Pinaud</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            ,
            <surname>Venturini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            ,
            <surname>Zighed</surname>
          </string-name>
          ,
          <string-name>
            <surname>D</surname>
          </string-name>
          . (eds.)
          <article-title>Advances in Knowledge Discovery and Management</article-title>
          .
          <source>Studies in Computational Intelligence</source>
          , vol.
          <volume>615</volume>
          , pp.
          <volume>57</volume>
          {
          <fpage>77</fpage>
          . Springer, Cham (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Eklund</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Groh</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Stumme</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Wille</surname>
            ,
            <given-names>R.:</given-names>
          </string-name>
          <article-title>A contextual-logic extension of toscana</article-title>
          . In: Ganter,
          <string-name>
            <given-names>B.</given-names>
            ,
            <surname>Mineau</surname>
          </string-name>
          , G.W. (eds.) Conceptual Structures: Logical, Linguistic, and Computational Issues. pp.
          <volume>453</volume>
          {
          <fpage>467</fpage>
          . Springer Berlin Heidelberg, Berlin, Heidelberg (
          <year>2000</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Ferre</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          : Sparklis:
          <article-title>An expressive query builder for SPARQL endpoints with guidance in natural language</article-title>
          .
          <source>Semantic Web</source>
          <volume>8</volume>
          (
          <issue>3</issue>
          ),
          <volume>405</volume>
          {
          <fpage>418</fpage>
          (
          <year>2017</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Ganter</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Wille</surname>
          </string-name>
          , R.:
          <source>Formal concept analysis: mathematical foundations</source>
          . Springer, Berlin (
          <year>1999</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5. Kotters, J.:
          <article-title>Object con guration browsing in relational databases</article-title>
          . In: Valtchev,
          <string-name>
            <surname>P.</surname>
          </string-name>
          , Jaschke, R. (eds.)
          <source>Proceedings of ICFCA 2011. LNCS</source>
          , vol.
          <volume>6628</volume>
          , pp.
          <volume>151</volume>
          {
          <fpage>166</fpage>
          . Springer (
          <year>2011</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6. Kotters, J.:
          <article-title>Concept lattices of a relational structure</article-title>
          . In: Pfei er, H.D.,
          <string-name>
            <surname>Ignatov</surname>
            ,
            <given-names>D.I.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Poelmans</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gadiraju</surname>
          </string-name>
          , N. (eds.)
          <source>Proceedings of ICCS 2013. LNCS</source>
          , vol.
          <volume>7735</volume>
          , pp.
          <volume>301</volume>
          {
          <fpage>310</fpage>
          . Springer (
          <year>2013</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7. Kotters, J.,
          <string-name>
            <surname>Eklund</surname>
            ,
            <given-names>P.W.:</given-names>
          </string-name>
          <article-title>The theory and practice of coupling formal concept analysis to relational databases</article-title>
          . In: Kuznetsov,
          <string-name>
            <given-names>S.O.</given-names>
            ,
            <surname>Napoli</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            ,
            <surname>Rudolph</surname>
          </string-name>
          , S. (eds.)
          <source>Proceedings of FCA4AI 2018. CEUR Workshop Proceedings</source>
          , vol.
          <volume>2149</volume>
          , pp.
          <volume>69</volume>
          {
          <fpage>80</fpage>
          .
          <string-name>
            <surname>CEUR-WS.org</surname>
          </string-name>
          (
          <year>2018</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>