<!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>Implementing Controlled Query Evaluation in OBDA</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Divya Baura</string-name>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Diego Calvanese</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Lorenzo Marconi</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Free University of Bozen-Bolzano</institution>
          ,
          <addr-line>Bolzano</addr-line>
          ,
          <country country="IT">Italy</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Sapienza Università di Roma</institution>
          ,
          <addr-line>Rome</addr-line>
          ,
          <country country="IT">Italy</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>Umeå Universitet</institution>
          ,
          <addr-line>Umeå</addr-line>
          ,
          <country country="SE">Sweden</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>In the Ontology Based Data Access (OBDA) framework, users access a relational data source by querying a domain ontology, whose classes and properties are connected to the data via declarative mappings. OBDA is adopted for data management in various sectors, notably healthcare, where confidentiality of information is a key concern that requires data to be properly protected from unauthorized accesses. Controlled Query Evaluation (CQE) is a framework for privacy-preserving query answering in the presence of an ontology. In CQE, policies are used to represent the information that should be kept confidential, and the aim is to devise from policy specifications suitable censors that enforce data protection. Therefore, it is desirable to integrate CQE in OBDA to obtain a robust privacy-aware data management framework. This has been done in the recently proposed Policy-Protected OBDA (PPOBDA) framework, which ensures the integration of CQE within OBDA by embedding policies into mappings. In this paper, we present an open-source solution that implements PPOBDA and a simplified algorithm for policy embedding, compared to previously proposed ones. This facilitates the adoption of PPOBDA using any OBDA query engine capable of translating SPARQL queries into SQL. In our implementation, we rely on Ontop, a state-of-the-art open-source OBDA tool.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Ontology Based Data Access</kwd>
        <kwd>Controlled Query Evaluation</kwd>
        <kwd>Policy-Protected OBDA</kwd>
        <kwd>Privacy</kwd>
        <kwd>Ontop</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        Within the Ontology-Based Data Access (OBDA) framework [
        <xref ref-type="bibr" rid="ref1 ref2">1, 2</xref>
        ], illustrated in the left part
of Figure 1, an ontology encapsulates relevant domain knowledge and provides to users a
vocabulary of classes and properties over which they can formulate queries. In OBDA, domain
knowledge is typically expressed in OWL 2 QL, a profile (i.e., fragment) of the Web Ontology
Language OWL 2, standardized by the W3C [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], while the actual data is stored in a relational
source, which is linked to the ontology through declarative mappings, expressed in the R2RML
mapping language [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. Intuitively, mapping assertion specify how to populate the classes and
properties of the ontology by means of data retrieved through SQL queries over the source.
      </p>
      <p>
        Guaranteeing the privacy of information represents a challenge across all data management
systems, especially in those cases where sensitive data, such as medical records, need to be
manipulated. This holds in particular for OBDA, where the main objective is to eficiently and
efectively answer queries posed by users over the ontology, but transferring the necessary
data from the underlying data source requires suitable privacy preserving methods that prevent
any unauthorized disclosure of sensitive data. Recently, Controlled Query Evaluation (CQE) has
emerged as a promising privacy-preserving framework for query answering in the presence of
ontologies [
        <xref ref-type="bibr" rid="ref5 ref6 ref7">5, 6, 7</xref>
        ]. In CQE, policies represent confidential information and a censor protects these
policies from being violated, by suitably modifying query answers. Therefore, the inclusion of
CQE within OBDA would help in improving data confidentiality, reducing risks of unauthorized
data access, and ensuring compliance with regulatory privacy frameworks.
      </p>
      <p>
        Building upon the foundational principles of CQE and of OBDA, the Policy-Protected OBDA
(PPOBDA) framework was introduced in [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. In PPOBDA, policies are denial assertions
formulated as first-order logic (FOL) formulas. These policies are then integrated into mapping
assertions, thus establishing new mappings that are policy-protected, i.e., they ensure that
policies are not violated when answering queries over the ontology by accessing the underlying
data source (cf. Fig. 1). This framework has showcased promising results, and its first
implementation highlights its potential to enhance privacy preservation in the OBDA settings. However,
this initial implementation of PPOBDA relied on closed-source software, specifically the Mastro
system [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ], as the underlying OBDA query engine, which represents a limitation towards the
wide adoption of PPOBA and the experimentation with such a framework.
      </p>
      <p>
        To address this limitation, our ongoing research implements PPOBDA using the open-source
OBDA engine Ontop [
        <xref ref-type="bibr" rid="ref10 ref11">10, 11</xref>
        ], by relying on its query rewriting functionalities for realizing most
of the functions needed for PPOBDA. In this paper, we present the technical challenges that we
faced in the implementation process. We also propose a simplified algorithm for embedding
policies into mappings, with respect to the one presented in [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ].
      </p>
    </sec>
    <sec id="sec-2">
      <title>2. Preliminaries</title>
      <p>In this section, we present the technical preliminaries that are necessary to understand the
remaining part of the paper. Specifically, we introduced Description Logics, the logical-based
formalism providing the underpinning for the OWL 2 language, and present the formalization
of OBDA, and the query language used to express both queries in OBDA and policies in CQE.
Finally, we introduce the open-source system Ontop, on which we rely for query reformulation.</p>
      <p>We make use of countably infinite pairwise disjoint alphabets Σ  of relation names, Σ  of
unary and binary ontology predicates, and Σ  of constants.</p>
      <sec id="sec-2-1">
        <title>2.1. Description Logics</title>
        <p>
          Description Logics (DLs) [
          <xref ref-type="bibr" rid="ref12">12</xref>
          ] are a family of logics widely adopted in knowledge representation
and reasoning. A DL can be considered as a decidable fragment of FOL, typically restricted
to unary and binary predicates, respectively called concepts and roles. Concepts denote sets
of objects, while roles denote binary relationships between objects. In a DL, knowledge is
represented in a knowledge base (or ontology)  = ⟨ , ⟩, which consists of two components:
a TBox  , used to represent intensional knowledge, and an ABox , used to represent facts
about individual objects. In OBDA, ontologies are typically expressed in some variant of
DL-Lite, which is a family of lightweight DLs that are specifically tailored towards eficient
data access. Specifically, we adopt DL-Liteℛ [
          <xref ref-type="bibr" rid="ref13">13</xref>
          ], which provides the logical underpinning for
the OWL 2 QL profile of OWL 2 [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ]. In DL-Liteℛ, a TBox  consists of axioms of the form:
1 ⊑ 2 (concept inclusion) 1 ⊑ ¬2 (concept disjointness)
1 ⊑ 2 (role inclusion) 1 ⊑ ¬2 (role disjointness)
Here and in the following, we use  (possibly with a subscript) to denote either an atomic
role (i.e., a role name /2 ∈ Σ ), or an inverse role − , and  (possibly with a subscript) to
denote either an atomic concept (i.e., a concept name /1 ∈ Σ ) or an unqualified existential
restriction, which is a concept of the form ∃. An ABox  is a finite set of ground atoms,
comprising assertions of the form () or (, ′), where /1, /2 ∈ Σ , and , ′ ∈ Σ  .
        </p>
        <p>The semantics of DL-Liteℛ is given in terms of FOL interpretations, where an interpretation
ℐ = ⟨∆ ℐ , · ℐ ⟩, consists of a domain ∆ ℐ , and a function · ℐ that assigns to each concept name
 ∈ Σ  a set ℐ ⊆ ∆ ℐ of objects, to each role name  ∈ Σ  a binary relation ℐ ⊆ ∆ ℐ × ∆ ℐ ,
and to each constant  ∈ Σ  a domain element ℐ ∈ ∆ ℐ . We make the unique name assumption,
i.e.,  ̸= ′ implies ℐ ̸= ′ℐ . Concept and role expressions are interpreted as follows:
(− )ℐ = {(′, ) | (, ′) ∈ ℐ } ¬ℐ = ∆ ℐ ∖ ℐ
(∃)ℐ = { | ∃′ ∈ ∆ ℐ s.t. (, ′) ∈ ℐ } ¬ℐ = (∆ ℐ × ∆ ℐ ) ∖ ℐ
We say that ℐ satisfies a concept/role inclusion/disjointness 1 ⊑ 2, if 1ℐ ⊆ 2ℐ , and
it satisfies an ABox assertion () (resp., (, ′)) if ℐ ∈ ℐ (resp., (ℐ , ′ℐ ) ∈ ℐ ). An
interpretation that satisfies all axioms and assertions in  (resp.,  , ) is called a model of 
(resp.,  , ).</p>
      </sec>
      <sec id="sec-2-2">
        <title>2.2. Ontology Based Data Access</title>
        <p>
          In OBDA, users can query a data source through an ontology TBox, which is connected to the
data source via declarative mappings [
          <xref ref-type="bibr" rid="ref1 ref2">1, 2</xref>
          ]. We formalize this through the notion of OBDA
specification , which is a triple  = ⟨ , , ℳ⟩, where  denotes a DL-Liteℛ TBox,  a relational
database (DB) schema over the alphabet Σ , and ℳ a mapping between  and . The mapping
ℳ is a finite set of mapping assertions from  to  , where each mapping assertion  has
form  (⃗) ⇝  (IRI(⃗)). Here,  () denotes a FOL (or SQL) source query over  with answer
variables ⃗. Instead,  (IRI(⃗)), called the head of , is an ABox atom over the variables in ⃗
and so-called IRI-templates IRI(⃗). Each IRI-template iri(⃗) in IRI(⃗) is a term that concatenates
string values and the answer variables in ⃗, and is used to construct object identifiers (i.e., IRIs)
from the DB values returned by the source query  (⃗). A concrete mapping language that
provides such form of mappings is R2RML, standardized by the W3C [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ].
        </p>
        <p>Given an OBDA specification  = ⟨ , , ℳ⟩ and a DB instance  for , the pair  = ⟨, ⟩
is called an OBDA instance. The retrieved ABox for  , denoted ret( ), consists of all facts
 (IRI(⃗)), where  (⃗) ⇝  (IRI(⃗)) is a mapping assertion in ℳ, and ⃗ ∈ eval( (⃗), ) is
a tuple of constants in the evaluation of the mapping source query over . Notice that the
fact  (IRI(⃗)) contains IRIs of the form iri(⃗) constructed from the answer tuple ⃗ using the IRI
template iri(⃗) in the mapping head. Hence, ret( ) is an ABox over constants in the set ∆ 
consisting of (i) all DB values in  and (ii) all possible IRIs iri(⃗) constructed from some tuple ⃗
of values in  and some IRI template iri(⃗) in some mapping assertion in ℳ. Then, a model of
the OBDA instance  is defined as a model of the knowledge base ⟨ , ret( )⟩. We denote the
set of models of  by Mod( ), and we say that  is inconsistent if Mod( ) = ∅. Moreover,
 |=  , indicating that  entails a sentence  , holds if  is true in every model in Mod( ).</p>
        <p>We make here the standard name assumption, i.e., given ⟨, ⟩, we consider interpretations
over a fixed domain ∆ containing ∆  and such that all values in ∆  are interpreted as
themselves. Notice that the standard name assumption implies the unique name assumption.</p>
      </sec>
      <sec id="sec-2-3">
        <title>2.3. Queries</title>
        <p>We consider queries, expressed as FOL formulas, over DB and OBDA instances. A query 
over an OBDA instance  is formulated over the ontology predicates, and we are interested
in the certain answers cert(,  ) to , which are defined as those answers that hold over
all models of  , i.e., ⃗ ∈ cert(,  ) if  |= (⃗). A conjunctive query (CQs) has the form
(⃗) = ∃⃗. 1(⃗, ⃗) ∧ · · · ∧  (⃗, ⃗), where each   is a DB/ontology predicate. A Boolean CQ
(BCQ) is a CQ () without answer variables, i.e., of zero arity, which returns either the empty
tuple {()} (i.e., true), or the empty set ∅ (i.e., false). A ground atom (GA) is a BCQ with only one
atom and no variables. CQ denotes the language of BCQs, and GA the language of GAs.</p>
      </sec>
      <sec id="sec-2-4">
        <title>2.4. The OBDA System Ontop</title>
        <p>
          We make use here of the state-of-the-art open-source OBDA system Ontop [
          <xref ref-type="bibr" rid="ref10 ref11">10, 11</xref>
          ], which
implements query answering over an OBDA instance, by adopting a query transformation
approach and advanced query optimization techniques. Specifically, an Ontop installation
operates over an OBDA specification  = ⟨ , , ℳ⟩, where  is an OWL 2 QL TBox, ℳ
an R2RML [
          <xref ref-type="bibr" rid="ref4">4</xref>
          ] mapping, and  a relational schema with constraints. It is able to eficiently
answer SPARQL queries1 [
          <xref ref-type="bibr" rid="ref14">14</xref>
          ] over the OBDA instance ⟨, ⟩, where  is a DB instance for
, according to the OWL 2 QL entailment regime [
          <xref ref-type="bibr" rid="ref15">15</xref>
          ]. Ontop is compliant with all relevant
W3C standards, and supports all major commercial and free relational DB engines (and also
several data federation tools, such as Denodo, Dremio, and Teiid, which expose a collection of
heterogeneous data sources via a single relational DB schema).
        </p>
        <p>Ontop implements query answering by rewriting, i.e., it computes the certain answers to
SPARQL queries over the OBDA instance, by reformulating them into SQL queries expressed
over , which then get executed by the underlying DB engine. To do so, Ontop first performs
some of-line tasks, in which it pre-processes  , , and ℳ (e.g., by saturating ℳ w.r.t.  ), in
1We can consider SPARQL as a concrete syntax for CQs, although SPARQL features additional constructs not present
in CQs (e.g., OPTIONAL and aggregations), and adopts a diferent semantics for existentially quantified variables.
order to be then more eficient during query answering. At query answering time, it transforms
a given SPARQL query  into a logically equivalent (w.r.t. ) SQL query SQL and optimizes
such query by taking into account mapping information and the DB constraints in .</p>
        <p>Ontop’s toolkit encompass a Plugin for the widely adopted Protégé ontology editor, facilitating
the development of OBDA specifications. Moreover, it allows for setting up a SPARQL endpoint,
via a command line interface, with which users can interact by issuing queries via HTTP requests.
In our work, we have used Ontop as a blackbox to exploits its query rewriting functionalities.</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>3. Encoding a Policy into a Mapping</title>
      <p>
        To create a privacy-preserving OBDA setting, one can proceed in three ways: (i) the ontology
can be modified by adjusting TBox axioms based on policy requirements [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ]; (ii) the answers
of queries can be modified through a censor, leading to Controlled Query Evaluation, which is
an extensively explored topic [
        <xref ref-type="bibr" rid="ref17 ref6">6, 17</xref>
        ]; (iii) mappings can be modified according to policies, user
authorization rights, or so that instances are anonymized. We follow here the third approach,
on the one hand because of the promising outcomes demonstrated by the existing PPOBDA
framework, e.g., for query evaluation over the NPD Benchmark [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ], on the other hand because
of the flexibility that manipulating mappings gives to introduce more privacy aspects.
      </p>
      <p>
        To introduce formally the PPOBDA setting, we first define a denial (assertion) as a FOL
sentence of the form ∀⃗. (⃗) → ⊥, such that ∃⃗. (⃗) is a BCQ. Given a set  of FOL sentences
(e.g., a TBox) and a denial  , we have that  ∪ { } is consistent if  ̸|= ∃⃗. (⃗). Following [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ],
we define a PPOBDA specification as a 4-tuple ℰ = ⟨ , , ℳ, ⟩, such that ⟨ , , ℳ⟩ is an
OBDA specification and  a policy, i.e., a finite set of denials over the signature of  , such
that  ∪  is consistent. The semantics of a PPOBDA specification coincides with that of the
underlying OBDA specification, and we naturally extend to PPOBDA also all other notions
(source DB , instance ⟨ℰ , ⟩, retrieved ABox ret(⟨ℰ , ⟩), and set Mod(⟨ℰ , ⟩) of models).
      </p>
      <p>For a query language ℒ (e.g., CQ or GA), let ℒ( ) be the restriction of ℒ to the predicates in
 , and ℒ the formulas in ℒ mentioning only constants in . An optimal censor for ℰ in query
language ℒ is a function cens(· ) that, for each source DB  for ℰ , returns a set cens() ⊆ ℒ 
such that (i) ⟨⟨ , , ℳ⟩, ⟩ |=  , for each  ∈ cens(), and (ii)  ∪  ∪ cens() is consistent.
ℒ is called the censor language. We are interested in optimal censors, i.e., that return as much
formulas as possible. The set of all optimal censors in ℒ for a PPOBDA specification ℰ is denoted
ℒ-OptCensℰ .</p>
      <p>
        To obtain a notion of censor that allows for embedding a policy into the mapping, [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] have
defined censors that approximate censors for ℰ in GA, the language of ground atoms [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ].
, censIGA() = ⋂︀cens∈GA-OptCensℰ cens().
      </p>
      <p>
        Definition 1 (IGA censor [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]). Given a PPOBDA specification ℰ = ⟨ , , ℳ, ⟩, the
intersection GA (IGA) censor for ℰ is the function censIGA(· ) such that, for every DB instance  for
▷
Hence, an IGA censor, when applied to a DB instance  for source schema  of ℰ , returns the
intersection of the sets of ground atoms computed by all optimal censors.
      </p>
      <p>
        In [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ], an algorithm, called PolicyEmbed is presented, that embeds a policy  into a OBDA
mapping ℳ and generates a new mapping ℳ′. Such mapping has the property that all answers
Algorithm 1: EncodeMapping
      </p>
      <p>Input: a DL-Liteℛ TBox  , a mapping ℳ, a policy .</p>
      <p>Output: a mapping ℳ0.
1 Let ′ be the expansion of the policy  w.r.t.  ;
2 ℳ0 ← ∅ ;
3 for each atomic concept  do
4  ← addConstraints((), ′);
5 ℳ′ ← ℳ ′ ∪ {(unfold(rewrite(,  ), ℳ) ⇝ ()}
6 for each atomic role  do
7  ← addConstraints((, ), ′);
8 ℳ′ ← ℳ ′ ∪ {(unfold(rewrite(,  ), ℳ) ⇝ (, )}
9 return ℳ′
returned to queries posed over the ontology and processed by an OBDA engine making use
of ℳ’ automatically comply to  according to an IGA censor. We present in Algorithm 1
EncodeMapping, a streamlined version of that algorithm that reduces the number of calls to a
DL-Liteℛ query rewriting procedure. We discuss its functioning on the following example:
 = { Reviewer ⊑ Student , ∃ReviewsProject − ⊑ Student },
ℳ = { 1 : ∃.student(, ) ⇝ Student ()
2 : student(, ’review’) ⇝ Reviewer ()
3 : project(, ) ⇝ ReviewsProject (, ) }
 = { Reviewer () ∧ ReviewsProject (, ) ∧ Student () → ⊥ }
Here, the TBox  specifies that reviewer students (concept Reviewer ) are special kinds of
students (concept Student ), and that projects of students are being reviewed (inverse of role
ReviewsProject ). The policy says that the fact that a reviewer reviews a project of a student is
a confidential information (to protect the information regarding who graded whom).</p>
      <p>Following the definition of the IGA censor, the target is to remove the facts that belong to
at least one minimal ABox  such that  ∪  ∪  is inconsistent. Identifying such facts is
facilitated when we can analyze each denial independently. This requires that the policy 
exhibits the following property: for every denial  in , every minimal ABox  where  ∪  ∪ 
is inconsistent must also be minimal when  ∪  ∪  is inconsistent.</p>
      <p>
        To achieve this, [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] introduces the concept of an extended denial, formulated as ∀. () ∧
¬ () → ⊥, where ∃. () forms a BCQ and  () is a disjunction of conjunctions of equality
atoms. The extended policy is a finite set of extended denials, enabling the transformation of
the initial policy into an updated policy  satisfying the above mentioned property.
      </p>
      <p>
        In Step 1, we use the perfectRef(,  ) algorithm of DL-Liteℛ to expand policy  with respect
to  [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ]. The existing policy expands as follows:
1 : Reviewer () ∧ ReviewsProject (, ) ∧ Student () → ⊥
2 : Reviewer () ∧ ReviewsProject (, ) ∧ Reviewer () → ⊥
3 : Reviewer () ∧ ReviewsProject (, ) → ⊥
Since 3 implies 1 and 2, we discard 1 and 2 and  ′ = {3}.
      </p>
      <p>Then, one mapping assertion is constructed for each ontology predicate.</p>
      <p>
        At Step 4, for each concept  of the ontology, addConstraints((),  ′) transforms ()
into a formula ensuring that the conditions leading to a policy violation cannot be satisfied, when
retrieving data from the source through the mapping. Specifically, assume that all denials in  ′
containing an atom that unifies with () are ∀, ⃗.(()∧ (, ⃗)) → ⊥, for  ∈ {1, . . . , }.
Then addConstraints((),  ′) returns () ∧ ⋀︀1≤ ≤  ¬∃⃗. (, ⃗). Similarly, at Step 7, for
each role  of the ontology. For instance, assume that  ′ contains the denials ∀.(() ∧
()) → ⊥ and ∀, .(() ∧ (, ) ∧ ()) → ⊥. Then, addConstraints((),  ′) returns
() ∧ ¬() ∧ ¬∃.((, ) ∧ ()). For predicates that are not present in the policy  ′, we
do not apply the transformation, as they pose no threat to the policy. In our running example,
Student () is not transformed, while
addConstraints(Reviewer (),  ′) = Reviewer () ∧ ¬∃.ReviewsProject (, )
addConstraints(ReviewsProject (, ),  ′) =  (, ) ∧ ¬Reviewer ()
Steps 5 and 8 invoke rewrite(,  ), which rewrites each of the transformed predicates w.r.t.
the TBox  . Notice that  might contain negated atoms, and for this step we rely on the
capability of the query rewriting engine to correctly deal with SPARQL queries containing the
MINUS operator. The resulting expression is then unfolded with respect to the original mapping
ℳ [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], to obtain the source query of the new mapping ℳ′ for the concept  or role . For
this, we again rely on the OBDA engine.
      </p>
      <p>In our running example, EncodeMapping( , ℳ,  ) returns the following mapping ℳ′:
′1 : ∃.student(, ) ∨ student(, ’review’) ∨ ∃.project(, ) ⇝
′2 : (,′ ′) ∧ ¬∃.project(, )) ⇝ Reviewer ()
′3 : project(, ) ∧ ¬student(, ’review’) ⇝ ReviewsProject (, )
Student ()</p>
    </sec>
    <sec id="sec-4">
      <title>4. Implementation in the Ontop System</title>
      <p>
        To implement the EncodeMapping algorithm, we need to exploit the query answering
capabilities of an OBDA engine, and specifically both query rewriting with respect to an OWL 2 QL
TBox, and query unfolding with respect to R2RML mappings. The original implementation of
the PPOBDA framework described in [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] relied on the Mastro system [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. That tool is, however,
a proprietary software that is not openly accessible, therefore the implementation described
in [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] is not available for experimentation and for possible extensions. For this reason, we have
reimplemented the PPOBDA framework from scratch, by relying on an open-source OBDA
engine, and specifically on the Ontop system [
        <xref ref-type="bibr" rid="ref10 ref11">10, 11</xref>
        ]. The workflow we followed for our
implementation is depicted in Fig. 2.
      </p>
      <p>The initial step of expanding the policy w.r.t. the TBox  relies on the query rewriting
functionality. Since for optimization purposes, Ontop combines the steps of query rewriting
and of unfolding w.r.t. the mapping, it requires the existence of a relational data source and
of mappings even to perform only query rewriting. To address this, we have developed a
Direct Mapping Generator, which simulates a data source with unary and binary relations
corresponding directly to the concepts and roles names in the ontology, and establishes direct
(one-to-one) mappings from this dummy DB to the ontology. The Policy Expander function
exploits this setup to activate the Ontop query reformulation functionality over the denials in
the policy  as queries to be expanded. Given that the mappings are one-to-one, they have no
impact on the outcome of the reformulation.</p>
      <p>The rewritten queries, serving as policies expanded w.r.t. the ontology, are then provided
as input to the addConstraints algorithm, which redefines each predicate as a SPARQL query.
These SPARQL queries, along with the ontology, the original mapping, and the DB schema
are then processed by the Policy Embed function, which converts them into SQL queries using
Ontop for query reformulation. Subsequently, a new mapping is created with these SQL queries
as the source parts for the respective predicates, which appear in the target part of the mapping
assertions. This process efectively generates mappings that embed the policy constraints.</p>
    </sec>
    <sec id="sec-5">
      <title>5. Conclusions</title>
      <p>
        We have described an ongoing research efort that aims at extending the OBDA framework
so as to incorporate privacy policies expressed as denials, in line with the Controlled Query
Evaluation (CQE) approach. Following an approach in the literature, we have provided an
initial implementation in a prototype system that builds on the open-source OBDA system
Ontop. Our implementation is available as an open-source project2. We rely on our prototype
implementation in our ongoing research, which aims at analyzing privacy requirements in
real-world scenarios, and at assessing the adequacy of the CQE approach to capture them.
We also plan to investigate how the approach we have presented for embedding policies into
mappings impacts performance of query evaluation in OBDA, specifically when compared to
the original approach proposed in [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ].
      </p>
    </sec>
    <sec id="sec-6">
      <title>Acknowledgments</title>
      <p>This work has been partially supported by the Wallenberg AI, Autonomous Systems and Software
Program (WASP) funded by the Knut and Alice Wallenberg Foundation, by the Province of
Bolzano and DFG through the project D2G2 (DFG grant n. 500249124), and by the HEU project
CyclOps (under GA n. 101135513).
2https://github.com/divyabaura/PPOBDA-with-Ontop</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>A.</given-names>
            <surname>Poggi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Lembo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Calvanese</surname>
          </string-name>
          , G. De Giacomo,
          <string-name>
            <given-names>M.</given-names>
            <surname>Lenzerini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Rosati</surname>
          </string-name>
          ,
          <article-title>Linking data to ontologies</article-title>
          ,
          <source>J. on Data Semantics</source>
          <volume>10</volume>
          (
          <year>2008</year>
          ). doi:
          <volume>10</volume>
          .1007/978-3-
          <fpage>540</fpage>
          -77688-
          <issue>8</issue>
          _
          <fpage>5</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>G.</given-names>
            <surname>Xiao</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Calvanese</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Kontchakov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Lembo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Poggi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Rosati</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Zakharyaschev</surname>
          </string-name>
          ,
          <article-title>Ontology-based data access: A survey</article-title>
          ,
          <source>in: Proc. IJCAI</source>
          , IJCAI Org.,
          <year>2018</year>
          , pp.
          <fpage>5511</fpage>
          -
          <lpage>5519</lpage>
          . doi:
          <volume>10</volume>
          .24963/ijcai.
          <year>2018</year>
          /777.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>B.</given-names>
            <surname>Motik</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B. Cuenca</given-names>
            <surname>Grau</surname>
          </string-name>
          ,
          <string-name>
            <given-names>I.</given-names>
            <surname>Horrocks</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Wu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Fokoue</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Lutz</surname>
          </string-name>
          , OWL 2
          <string-name>
            <given-names>Web</given-names>
            <surname>Ontology Language Profiles (Second Edition</surname>
          </string-name>
          ),
          <source>W3C Recommendation, W3C</source>
          ,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>S.</given-names>
            <surname>Das</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Sundara</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Cyganiak</surname>
          </string-name>
          ,
          <article-title>R2RML: RDB to RDF Mapping Language</article-title>
          ,
          <source>W3C Recommendation, W3C</source>
          ,
          <year>2012</year>
          . Available at http://www.w3.org/TR/r2rml/.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>P. A.</given-names>
            <surname>Bonatti</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Sauro</surname>
          </string-name>
          ,
          <article-title>A confidentiality model for ontologies</article-title>
          ,
          <source>in: Proc. ISWC</source>
          , volume
          <volume>8218</volume>
          <source>of LNCS</source>
          , Springer,
          <year>2013</year>
          , pp.
          <fpage>17</fpage>
          -
          <lpage>32</lpage>
          . doi:
          <volume>10</volume>
          .1007/978-3-
          <fpage>642</fpage>
          -41335-
          <issue>3</issue>
          _
          <fpage>2</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>B. C.</given-names>
            <surname>Grau</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Kharlamov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E. V.</given-names>
            <surname>Kostylev</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Zheleznyakov</surname>
          </string-name>
          ,
          <article-title>Controlled query evaluation for Datalog and OWL 2 Profile ontologies</article-title>
          ,
          <source>in: Proc. IJCAI</source>
          , AAAI Press,
          <year>2015</year>
          , pp.
          <fpage>2883</fpage>
          -
          <lpage>2889</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>D.</given-names>
            <surname>Lembo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Rosati</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D. F.</given-names>
            <surname>Savo</surname>
          </string-name>
          ,
          <article-title>Revisiting controlled query evaluation in description logics</article-title>
          ,
          <source>in: Proc. IJCAI</source>
          , IJCAI Org.,
          <year>2019</year>
          , pp.
          <fpage>1786</fpage>
          -
          <lpage>1792</lpage>
          . doi:
          <volume>10</volume>
          .24963/IJCAI.
          <year>2019</year>
          /247.
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>G.</given-names>
            <surname>Cima</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Lembo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Marconi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Rosati</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D. F.</given-names>
            <surname>Savo</surname>
          </string-name>
          ,
          <article-title>Controlled query evaluation in ontology-based data access</article-title>
          ,
          <source>in: Proc. ISWC</source>
          , volume
          <volume>12506</volume>
          <source>of LNCS</source>
          , Springer,
          <year>2020</year>
          , pp.
          <fpage>128</fpage>
          -
          <lpage>146</lpage>
          . doi:
          <volume>10</volume>
          .1007/978-3-
          <fpage>030</fpage>
          -62419-
          <issue>4</issue>
          _
          <fpage>8</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>D.</given-names>
            <surname>Calvanese</surname>
          </string-name>
          , G. De Giacomo,
          <string-name>
            <given-names>D.</given-names>
            <surname>Lembo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Lenzerini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Poggi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Rodriguez-Muro</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Rosati</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Ruzzi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D. F.</given-names>
            <surname>Savo</surname>
          </string-name>
          ,
          <article-title>The Mastro system for ontology-based data access</article-title>
          ,
          <source>Semantic Web J</source>
          .
          <volume>2</volume>
          (
          <year>2011</year>
          )
          <fpage>43</fpage>
          -
          <lpage>53</lpage>
          . doi:
          <volume>10</volume>
          .3233/SW-2011-0029.
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>D.</given-names>
            <surname>Calvanese</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Cogrel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Komla-Ebri</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Kontchakov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Lanti</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Rezk</surname>
          </string-name>
          , M. RodriguezMuro, G. Xiao,
          <article-title>Ontop: Answering SPARQL queries over relational databases</article-title>
          ,
          <source>Semantic Web J</source>
          .
          <volume>8</volume>
          (
          <year>2017</year>
          )
          <fpage>471</fpage>
          -
          <lpage>487</lpage>
          . doi:
          <volume>10</volume>
          .3233/SW-160217.
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>G.</given-names>
            <surname>Xiao</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Lanti</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Kontchakov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Komla-Ebri</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Güzel-Kalayci</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Ding</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Corman</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Cogrel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Calvanese</surname>
          </string-name>
          ,
          <string-name>
            <surname>E. Botoeva,</surname>
          </string-name>
          <article-title>The virtual knowledge graph system Ontop</article-title>
          ,
          <source>in: Proc. ISWC</source>
          , volume
          <volume>12507</volume>
          <source>of LNCS</source>
          , Springer,
          <year>2020</year>
          , pp.
          <fpage>259</fpage>
          -
          <lpage>277</lpage>
          . doi:
          <volume>10</volume>
          .1007/ 978-3-
          <fpage>030</fpage>
          -62466-8_
          <fpage>17</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>F.</given-names>
            <surname>Baader</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Calvanese</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>McGuinness</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Nardi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P. F.</given-names>
            <surname>Patel-Schneider</surname>
          </string-name>
          (Eds.),
          <source>The Description Logic Handbook: Theory, Implementation and Applications</source>
          , CUP,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>D.</given-names>
            <surname>Calvanese</surname>
          </string-name>
          , G. De Giacomo,
          <string-name>
            <given-names>D.</given-names>
            <surname>Lembo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Lenzerini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Rosati</surname>
          </string-name>
          ,
          <article-title>Tractable reasoning and eficient query answering in description logics: The DL-Lite family</article-title>
          ,
          <source>JAR</source>
          <volume>39</volume>
          (
          <year>2007</year>
          )
          <fpage>385</fpage>
          -
          <lpage>429</lpage>
          . doi:
          <volume>10</volume>
          .1007/s10817-007-9078-x.
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>S.</given-names>
            <surname>Harris</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Seaborne</surname>
          </string-name>
          , SPARQL
          <volume>1</volume>
          .
          <article-title>1 Query Language</article-title>
          ,
          <source>W3C Recommendation, W3C</source>
          ,
          <year>2013</year>
          . Available at http://www.w3.org/TR/sparql11-query.
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <given-names>B.</given-names>
            <surname>Glimm</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Ogbuji</surname>
          </string-name>
          , SPARQL
          <volume>1</volume>
          .1 Entailment Regimes,
          <source>W3C Recommendation, W3C</source>
          ,
          <year>2013</year>
          . Available at http://www.w3.org/TR/sparql11-entailment/.
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <given-names>F.</given-names>
            <surname>Baader</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Kriegel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Nuradiansyah</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Peñaloza</surname>
          </string-name>
          , Repairing Description Logic Ontologies by Weakening Axioms,
          <source>CoRR Technical Report arXiv:1808</source>
          .
          <volume>00248</volume>
          , arXiv.org,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [17]
          <string-name>
            <given-names>P. A.</given-names>
            <surname>Bonatti</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Cima</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Lembo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Marconi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Rosati</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Sauro</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D. F.</given-names>
            <surname>Savo</surname>
          </string-name>
          ,
          <article-title>Controlled query evaluation in OWL 2 QL: A “longest honeymoon” approach</article-title>
          , in
          <source>: Proc. ISWC</source>
          , volume
          <volume>13489</volume>
          <source>of LNCS</source>
          , Springer,
          <year>2022</year>
          , pp.
          <fpage>428</fpage>
          -
          <lpage>444</lpage>
          . doi:
          <volume>10</volume>
          .1007/978-3-
          <fpage>031</fpage>
          -19433-7_
          <fpage>25</fpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>