<!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>Towards Evolutionary, Domain-Specific Query Classification Based on Policy Rules</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Peter K. Schwab</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Klaus Meyer-Wegener</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Friedrich-Alexander-Universität Erlangen-Nürnberg</institution>
        </aff>
      </contrib-group>
      <abstract>
        <p>Many devices like smart sensors produce a vast amount of data that are still commonly stored in relational databases and are being processed using SQL queries. This data is only useable if it is processed in a fashion that results in applicable information for the users posing these queries. Thus, it can be very supportive for them to assess other queries that have already processed the targeted data. This is not a simple exercise, as SQL allows alias names and various syntactic structures to express equivalent queries. A manual assessment is also hard to accomplish due to the amount of qualified queries. We present a framework for evolutionary SQL query classification. Based on the analysis of query logs, query metadata like schema lineage and result statistics are automatically derived. Our framework enables users to define domainspecific policy rules for automatic query classification based on the query metadata. Classification is done according to domain-specific, contextual attributes that can be defined evolutionary at runtime, together with the policy rules. The classification results enrich the query metadata.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        Hoarding vast amounts of data is no longer a big thing to undertake, for example
by smart sensors in the context of Industry 4.0. Instead, the key task is to extract
the desired information from the data for a particular purpose at a certain point
in time [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. Data is only useable when accessed in a fashion that results in
applicable information for the users posing the accessing queries. Thus, it can be very
supportive for them to assess other queries that already have accessed the
targeted data set. Most data are still commonly stored in relational databases (DBs)
and are being processed using SQL queries. Analyzing these queries regarding
their kind of data access is not a simple exercise, as SQL allows alias names
and various syntactic structures for equivalent queries (e. g. subquery instead of
join). Query assessment can be supported by considering query metadata (QM).
A manual assessment is often hard to accomplish because of the vast amount of
qualified queries. In addition, most query-assessment results are not commonly
accessible but only available as tacit knowledge in the heads of the resp. users.
      </p>
      <p>Problem Statement. We require novel approaches that support query
assessment according to a certain processing context. They must ease the analysis of
the SQL queries’ syntactical variety and support automation of the query
classification. Users must be enabled to store their assessment results linked with the
underlying queries in order to share them with other users.</p>
      <p>Contribution. We present a framework for evolutionary, domain-specific SQL
query classification based on policy rules. QM like schema lineage and result
statistics are automatically derived based on the analysis of query logs. Our
framework enables users to externalize their tacit knowledge into domain-specific
policy rules for automatic query classification based on the QM. Classification
results are stored in contextual QM attributes (QMAs). They can be used for
further classification in other policy rules. The contextual QMAs as well as the
policy rules can be defined evolutionary at runtime.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Policy-Based Query Classification</title>
      <p>
        We provide a policy-based, automatic query classification [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] based on relational
and graph-based data models holding QM [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ].
      </p>
      <p>
        Evolutionary Definition of Contextual Query Metadata. Examples for
contextual QM are a query’s purpose, its compliance according to data-privacy
directives, or its aptitude for hardware acceleration. So far, this type of QM was
mapped to our relational model. We extend our multi-relational property-graph
model [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] to enable the evolutionary definition of contextual QM at runtime.
For every query, a graph with a root vertex holding a UID is modeled. This root
can have several edges of type hasContextualAttr to vertices of type
contextualAttibute. A vertex has two properties holding the name and the value of the resp.
contextual QMA. In addition, a contextualAttibute vertex has exactly one edge
hasDataType to a vertex of type dataType. To support a slender, user-centric set
of data types that can be selected for contextual QMA, we orientate towards the
requirements interchange format (ReqIF) as a standard for user-centric types
that fulfill an end-user’s plain idea of data types [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] and provide Boolean, String,
Integer, Float, Timestamp, and Enumeration, and lists of these data types.
Domain-Specific Policy Rules. Our policies are based on conditional rules.
The Boolean expression in their antecedent part describes a query-processing
pattern. We provide a domain-specific language to write it down [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. Our query
representation is independent from SQL syntax using the queries’ corresponding
trees of relational algebra operators. A single tree covers many syntactical
variants of semantically equivalent queries. This syntax-independent representation
enables a more generic definition of patterns. A basic pattern pbasic is related to
a single QM attribute and covers for example an accessed relation or schema
attribute, a certain filter predicate, the related DB user, or a query’s runtime or
number of result tuples. Schema lineage is resolved automatically. Up to now,
basic patterns have been combined by logical conjunction to a complex pattern
pcomplex. We extend the combination possibilities by adding Boolean operators
(NOT, OR, XOR) and nesting via parentheses to create richer complex patterns.
      </p>
      <p>
        Queries matching a complex pattern will be classified according to the rule’s
consequent part. So far, this part was fixed on the contextual QMA data-privacy
compliance. Based on our data-privacy use case [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], any policy rule classified a
matching query q always as non-compliant (cf. List. 1, line 2).
      </p>
      <p>We extend our policy rules’ consequent part and allow classification to
arbitrary contextual QMAs. Now both contextual QMAs and policy rules can be
defined at runtime. The assigned value v has to match the data domain of the
related contextual QMA qmac (cf. List. 1, line 5). When q is classified, its
contextual QM is enriched with the classification result and the related policy IDs
of all matching rules. This enables traceability of the classification process.
/* Status Quo of Policy - Rule D e f i n i t i o n */
IF q . match ( pcomplex ) THEN q . classify ( ‘ non - co mp li an t ’ )
/* E v o l u t i o n a r y Policy Rules */
IF q . match ( pcomplex ) THEN q . classify ( qmac , v )</p>
      <p>Listing 1. Status quo of our policy rules and the proposed extension.
3</p>
    </sec>
    <sec id="sec-3">
      <title>Exemplary Classification Use Case</title>
      <p>
        Up to now, our approach was tailored towards the use case of data-privacy
compliance [
        <xref ref-type="bibr" rid="ref6 ref7 ref8">6,7,8</xref>
        ]. Examples for policy rules in this context are the prohibition
of filters on certain personal data or the requirement of a minimum result size
in order to prevent users from drawing conclusions on individuals by queries.
We will motivate now another use case that is totally different to the present
one in order to demonstrate that by enabling evolutionary contextual QMAs,
policy-based query classification can be applied in arbitrary scenarios without
the need of adapting our implementation.
      </p>
      <p>
        To enable hardware-based acceleration of DB query processing, the project
“Reconfigurable Data Provider (ReProVide)” provides a sophisticated storage
solution based on field-programmable gate arrays (FPGAs) [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. Its query
optimization techniques consider the capabilities of the hardware for a scalable and
highly performant near-data processing of Big Data [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. ReProVide’s generic
FPGA architecture offers a library of query-processing modules, which can be
configured onto the FPGAs. So far, queries apt for near-data processing are
selected manually based on tacit expert knowledge. The ReProVide system is a
system on a chip (SoC) with its own storage [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. Only queries accessing data
that are stored there can be accelerated by the FPGAs. Filter operators, for
example, can be accelerated at line rate. But there are different query-processing
modules for filters, depending on the involved data type. Thus, assuming that
the date dimension of the TPC-DS benchmark suite1 is located on the
RePro1 http://www.tpc.org/tpcds/
      </p>
      <p>Vide storage, a responsible DB administrator could first create a new
contextual QMA at runtime with name hardware-acceleration aptitude and data type
List&lt;Enumeration&gt; with the elements {’filter (float)’, ’filter (int)’, ’filter (uint)’,
’filter (boolean)’, ’filter (string)’, ’filter (date)’, ’filter (timestamp)’}. Then, the
admin could create the policy rule shown in List. 2 which triggers automatic
classification of queries containing filter operations on integers. The admin
accordingly creates further policy rules covering filter operations on other data
types. This means, a query containing several filter operations on different data
types can be classified by different policy rules. Therefore, our contextual QMA
was defined as a List. For example, the query in List. 3 will finally be classified
as hardware-acceleration aptitude = {‘filter (int)’, ‘filter (string)’}.</p>
      <p>IF q . match (
r e s t r i c t s O n ( ‘ date_dim ’ , ‘ d_year ’) OR
r e s t r i c t s O n ( ‘ date_dim ’ , ‘ d_dow ’) OR
...</p>
      <p>r e s t r i c t s O n ( ‘ date_dim ’ , ‘ d_last_dom ’)
)
THEN q . classify ( ‘ hardware - a c c e l e r a t i o n aptitude ’ ,</p>
      <p>‘ filter ( int ) ’
)</p>
      <p>Listing 2. Example rule to classify queries apt for hardware acceleration.
SELECT d_year , d_dow
FROM date_dim</p>
      <p>WHERE d_d ay _n am e = " Monday " AND ( d_year &gt; 1900 OR d_moy &gt; 4)
Listing 3. Example query that filters on data stored within the ReProVide system.</p>
      <p>
        As ReProVide also allows hardware acceleration of projections and
semijoins, the enumeration’s elements of our contextual QMA can be extended by
respective elements and new policy rules could be defined to enable classification
of queries containing these operations. All of this can happen at runtime, without
adapting our implementation. Furthermore, the authors of ReProVide also aim
query-sequence optimization [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. Our framework can also support this aim by
defining additional contextual QMAs and policy rules – again at runtime.
4
      </p>
    </sec>
    <sec id="sec-4">
      <title>Next Steps</title>
      <p>We will elaborate the use case for hardware acceleration in more detail
concerning our approach. Furthermore, we have to solve the problem of contradicting
classification results based on conflicting policy rules. A prototypic
implementation will give further information about the applicability of our evolutionary
approach for arbitrary scenarios.</p>
      <p>Acknowledgement: The authors would like to thank the anonymous reviewers for their
valuable remarks.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Becher</surname>
          </string-name>
          , et al.:
          <article-title>Reprovide: Towards utilizing heterogeneous partially reconfigurable architectures for near-memory data processing</article-title>
          .
          <source>In: BTW</source>
          ,
          <fpage>18</fpage>
          .
          <string-name>
            <surname>Fachtagung des GIFachbereichs</surname>
            <given-names>DBIS</given-names>
          </string-name>
          , Workshopband. LNI, vol. P-
          <volume>290</volume>
          , pp.
          <fpage>51</fpage>
          -
          <lpage>70</lpage>
          . GI,
          <string-name>
            <surname>Bonn</surname>
          </string-name>
          (
          <year>2019</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Ebert</surname>
          </string-name>
          , et al.:
          <article-title>ReqIF: Seamless requirements interchange format between business partners</article-title>
          .
          <source>IEEE Softw</source>
          .
          <volume>29</volume>
          (
          <issue>5</issue>
          ) (
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Lee</surname>
          </string-name>
          , et al.:
          <article-title>Recent advances and trends in predictive manufacturing systems in big data environment</article-title>
          .
          <source>Manufacturing letters 1(1)</source>
          (
          <year>2013</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Lekshmi</surname>
            <given-names>B. G.</given-names>
          </string-name>
          , et al.:
          <article-title>The ReProVide query-sequence optimization in a hardwareaccelerated DBMS</article-title>
          .
          <source>In: 16th Int. Workshop DaMoN</source>
          . pp.
          <volume>17</volume>
          :
          <fpage>1</fpage>
          -
          <lpage>17</lpage>
          :
          <fpage>3</fpage>
          .
          <string-name>
            <surname>ACM</surname>
          </string-name>
          (
          <year>2020</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Lekshmi</surname>
            <given-names>B. G.</given-names>
          </string-name>
          , et al.:
          <article-title>SQL query processing using an integrated FPGA-based neardata accelerator in ReProVide</article-title>
          .
          <source>In: Proc. 23nd Int. Conf. EDBT</source>
          . pp.
          <fpage>639</fpage>
          -
          <lpage>642</lpage>
          . OpenProceedings.org (
          <year>2020</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Schwab</surname>
          </string-name>
          , et al.:
          <article-title>Query-driven enforcement of rule-based policies for data-privacy compliance</article-title>
          .
          <source>In: Proc. LWDA</source>
          (
          <year>2019</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Schwab</surname>
          </string-name>
          , et al.:
          <article-title>A framework for DSL-based query classification using relational and graph-based data models</article-title>
          .
          <source>In: Proc. Joint Wksh. GRADES-NDA. ACM</source>
          (
          <year>2020</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Schwab</surname>
          </string-name>
          , et al.:
          <article-title>We know what you did last session - policy-based query classification for data-privacy compliance with the DataEconomist</article-title>
          .
          <source>In: Proc. SSDBM</source>
          (
          <year>2020</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>