SUMA: A Partial Materialization-Based Scalable Query Answering in OWL 2 DL

Ontology-mediated querying (OMQ) provides a paradigm for query answering according to which users not only query records at the database but also query implicit information inferred from ontology. A key challenge in OMQ is that the implicit information may be infinite, which cannot be stored at the database and queried by off -the -shelf query engine. The commonly adopted technique to deal with infinite entailments is query rewriting, which, however, comes at the cost of query rewriting at runtime. In this work, the partial materialization method is proposed to ensure that the extension is always finite. The partial materialization technology does not rewrite query but instead computes partial consequences entailed by ontology before the online query. Besides, a query analysis algorithm is designed to ensure the completeness of querying rooted and Boolean conjunctive queries over partial materialization. We also soundly and incompletely expand our method to support highly expressive ontology language, OWL 2 DL. Finally, we further optimize the materialization efficiency by role rewriting algorithm and implement our approach as a prototype system SUMA by integrating off-the-shelf efficient SPARQL query engine. The experiments show that SUMA is complete on each test ontology and each test query, which is the same as Pellet and outperforms PAGOdA. Besides, SUMA is highly scalable on large datasets.


Introduction
With the rapid development of the semantic web, there are more and more applications based on ontology, especially, query answering applications [3]. Query answering can return implicit information that is not explicitly stored at the database but instead entailed by ontology to a user query. In this sense, it improves the quality of the answers compared to traditional database querying. The most popular query answering systems can be categorized into two major types: materialization-based and query rewriting-based.
The materialization approach precomputes all consequences entailed by ontologies (also known as the universal model or chase) offline so that the online query can be evaluated directly on the extended RDF data. Thus, it is preferred at online query performance-critical scenarios. PAGOdA [30] is based on materialization algorithm. It is scalable by delegating a large amount of the computational load to a datalog reasoner [21,23] and using the hypertableau algorithm [22] only when necessary.
However, when the ontologies contain cyclic dependency relation, the universal model can be infinite [17]. The infinite extended data cannot be stored at the database and directly queried by the query engine. The infinite materialization is a significant challenge in materialization-based query answering systems. PAGOdA is incomplete in terms of infinite materialization (we proved it in Sect. 6).
The commonly adopted approach to deal with infinite materialization is query rewriting. Query rewriting techniques have been studied intensively and implemented in many systems, e.g., QuOnto [5], Mastro [7], Ontop [6] for 1 3 DL-Lite, Grind [11] for EL , Clipper [8] for Horn-SHIQ . These systems do not materialize the data , but rather first rewrite the query according to the ontologies and mappings. Query rewriting uses a virtual RDF graph technique to avoid infinite materialization. However, it significantly increases the cost of query because rewriting is performed at runtime, and usually, it requires manual mapping. Moreover, the rewritten query can be exponentially large [26].
Besides query rewriting, the materialization-based ontology reasoner, e.g., Pellet [28], adopts a tableau algorithm with a roll-up technique [14] to solve infinite materialization. Pellet is not scalable for large datasets. It can only be applied to small and medium-sized datasets due to the high complexity of the tableau algorithm.
gOWL [19] proposes a partial materialization-based approach that deals with acyclic queries. The materialization algorithm of gOWL has a high time and space complexity due to its poor indexes for the storage and rules. Besides, gOWL cannot handle cyclic queries and Boolean queries, and its approximation rules lose most of the semantics of the OWL 2 DL.
There is also a hybrid approach [15] that computes the canonical model, which is always finite by reusing the anonymous individual name. And it rewrites the queries to remove wrong answers that the canonical model produces. But this rewriting algorithm cannot deal with role inclusion axioms. Then, a filter mechanism is proposed to replace the rewriting technique. The filter mechanism does not rewrite queries at runtime but filters spurious answers after query evaluation [17]. It supports role inclusions. However, it is still limited to lightweight ontology languages, DL-Lite R [2].
Motivated by the users are mainly interested in the first few levels of the anonymous part of the universal models [10], in this paper, we describe a novel partial materialization approach. Partial means we do not compute all consequences entailed by ontology, but instead compute a subset of the universal model. Partial ensures the extended RDF data are always finite. Then, we propose a query analysis algorithm(QAA). QAA takes conjunctive queries as input, and its output indicates the size of the partial universal model. This algorithm is designed to ensure the partial materialization can always produce the same answers as a universal model for rooted conjunctive queries [16] and partial Boolean conjunctive queries in DL-Lite N horn [2]. Consider the following query and the infinite universal model (the RDF), as shown in Fig. 1.
In this paper, we select only one part from the entire model (the sRDF) for answering the query Q as ans(sRDF, Q ) = ans(RDF, Q ). The sRDF is the partial universal model.
To make our approach unlimited to lightweight ontology languages, we soundly and incompletely generalize our approach to deal with OWL 2 DL by rewriting and approximation techniques. The approximation techniques apply to axioms whose semantics exceed DL-Lite N horn . And, additional data structures are designed to preserve the semantics that approximation techniques may lose.
We implement our approach as a prototype system SUMA and integrate a role rewriting algorithm [27] to optimize materialization efficiency further. From a system perspective, SUMA allows us to design an offline modular architecture to integrate off-the-shelf efficient SPARQL [12] query engines. In this way, it makes online queries more efficient.
We validate our proposal in two cases: an evaluation in the finite universal model scenario and an evaluation in the infinite universal model scenario. In the former case, experiments are conducted on two widely adopted benchmark and two real datasets. In the latter case, we manually extend the LUBM [9] and UOBM [18] ontologies to evaluate query answering systems on an infinite universal model. These experiments confirm that: (i) the ontology reasoning algorithm used in PAGOdA cannot deal with infinite materialization, (ii) although Pellet is complete, it is not scalable and can only be used for small and medium data, (iii) SUMA is good at the trade-off the scalability and completeness. Experiments show that SUMA is highly efficient, only taking 124s to materialize LUBM(1000) and 411s to materialize UOBM(500). And, in each test query, it returns the same quality of answers as Pellet.
The rest of the paper is structured as follows. Section 2 introduces the basic notions. Section 3 presents the definition of QAA algorithm for rooted and Boolean conjunctive queries and gives a detailed proof. Section 4 shows how to approximate the OWL 2 DL axiom to DL axiom while preserving its semantics. Section 5 presents the architecture of SUMA and algorithms used at SUMA. The performance of SUMA on two benchmarks and real datasets is demonstrated in Sect. 6. Section 7 concludes this paper.
This work is an extension of the previous proceedings in [1]. In particular, (i) it extends QAA to support Boolean conjunctive queries that contain cyclic or fork structure, (ii) it adopts a role rewriting algorithm [27] to optimize materialization efficiency further, (iii) and it extends the experiments with role rewriting algorithm evaluation, gOWL system and YAGO dataset. This work confirms and extends the main finding from [1]: SUMA is good at the trade-off the scalability and completeness.

Preliminaries
In this section, we briefly introduce the syntax and semantics of description logics(DLs)DL-Lite N horn , conjunctive query, and universal model.

Description Logics
Description Logic is a family of logics that have been studied and used in knowledge representation and reasoning. DLs underlie the standard Web Ontology Language OWL and OWL 2. In DLs, the elements of the domain are compiled into concepts (corresponding to unary predicates in first-order languages), and their properties are structured by means of roles (corresponding to binary predicates in first-order languages). Complex concepts and role expressions are made from atomic concepts and atomic role names. These names are connected by suitable constructors. The set of available constructors depends on the semantic of specific description logic. The richer the constructors that the description logic contains, the more complex the semantics that the description logic can capture.
Description logic knowledge base K consists of TBox ( T ) and ABox ( A ). A TBox typically consists of a set of axioms stating the inclusion between concepts and roles. The semantics of TBox is affected by the constructors.
In an ABox, one can assert membership of objects (i.e., constants) in concepts, or that a pair of objects are connected by a role.
Let be the individual set. In this paper, by default, we use a, b, c, d, e (with subscripts) to represent individual names. A, B, Z denote concept names, C (with subscripts) are concepts, P, S are role names, and R (with subscripts) are roles. Next, we present a brief overview of two different description logics, DL-Lite N horn , and SROIQ. DL-Lite N horn defines roles and concepts as follows: DL-Lite N horn presents ∃R as ≥ 1R and defines (P − ) − with P. Let − denote the set of roles.
A DL-Lite N horn T is a finite collection, including concept inclusions (CIs) axioms, that are in the form of horn ABox consists of concept assertions A(a) and role assertions P(a, b).
The semantics of DL-Lite N horn are defined by the interpretation I = ( I , ⋅ I ) , where I is a non-empty domain. The function is denoted by ⋅ I , which can map each A into the set A I , each P into the relation P I and each a to an element a I . A I and P I are subsets of I and I × I , respectively. The a I is an element of I . Besides, DL-Lite N horn implements the unique name assumption (UNA), that is, if v and w are distinct, then v I is different from w I . ⋅ I interprets each complex concept or role in the following ways: Here ♯ denotes the cardinality.
The I satisfies a CIs axiom T 1 in the form of If a I ∈ A I then I ⊧ A(a) holds. If (a I , b I ) ∈ P I then I ⊧ P(a, b) holds. If I satisfies all TBox and ABox axioms of K then I is a model of K.
SROIQ i s t h e u n d e rly i n g l o g i c o f OW L 2 DL. The concept of SROIQ is defined as: A , and ≤ nR.A can be rewritten to ¬(¬A ⊓ ¬B) , ¬∃R.¬A , and ¬ ≥ (n + 1)R.A , respectively. Enumeration {a 1 , a 2 , … , a n } is equal to A SROIQ K consists of RBox R , TBox T and ABox A.
In addition to the concept inclusions (CIs) axioms contained in DL-Lite, a SROIQ T also includes disjointness axioms ( Dis(C 1 , C 2 ) ) and Equivalent concepts ( C 1 ≡ C 2 ). Given an interpretation I , we write I ⊧ Dis(C 1 , The RBox is a limited collection of either role inclusion axioms like R 1 ⊑ R 2 or R 1 •R 2 ⊑ R 3 , or disjointness axioms in the form of Dis(R 1 , R 2 ) . The inverse role is denoted as Inv(R) with Inv(R) = R − , the symmetric role is denoted as Sym(R) (defined as Inv(R) ≡ R ), and the transitive role is denoted as Trans(R) (defined as R•R ⊑ R ). Fun(R) represents functional role. Given an interpretation A SROIQ ABox A without UNA includes individual equality a ≐ b ( ≐ is called sameAs in OWL) and individual inequality a≠b . If I ⊧ a ≐ b then a I = b I . If I ⊧ a≠b then a I ≠ b I . If the role R is functional, then I ⊧ (≥ 2R ⊑ ⊥) . Besides, if both (a, b) ∈ R I , (a, d) ∈ R I and b≠d ∉ A , then b ≐ d.

Conjunctive Query
We use to denote a collection of variables. A(t) denotes the concept atomic form, and P(t, t � ) denotes role atomic form with t, t � ∈ ∪ . A conjunctive query (CQ) q = ∃ ( , ) . It is making up of concept and role atoms. It connects these atoms by conjunction. The vector consists of free variables. If | | = 0 , we call q Boolean. The vector comprises a collection of variables that are quantified. Since disconnected queries can be divided into connected subqueries for processing, this article only considers connected conjunctive queries. If a CQ is connected and not Boolean, it is a rooted CQ.
The notions of answers and certain answers of CQ are introduced as follows [15]. Let q( ) be a CQ with | | = k , and I be an interpretation. The is used for indicating the collection of all terms in q, that is = ∪ . Let be a mapping which maps each term of q to I and each constant a to a I , we call I satisfies q under if only if for every A(t) ∈ q , (t) ∈ A I and for every P(t, t � ) ∈ q , ( (t), (t � )) ∈ P I . The is called a match for CQ in I . The vector = a 1 … a k is an answer of q, when given a mapping with (v i ) = a I i ( i ≤ k ) and I ⊧ q . The ans(q( ), K) represents the collection of all answers of q( ) . Ind(A) represents a set of individual names occurring in A . Let's call a certain answer when is a subset of Ind(A) and each model of K satisfies q( ) . The certain answer collection is denoted as cert(q( ), K).

Universal Model
Materialization is a forward chain algorithm that expands ABox according to the axioms in TBox. The ABox extension means expanding the ABox A to a universal model for the given KB K = (T, A) . More specifically, during the materialization, the universal model is enriched by a set of additional individuals derived from existential and number restrictions axioms and additional assertions derived from CIs in T .
A role R is called generating in K if there exists a ∈ Ind(A) and R 1 , … , R n = R such that the followings hold: (agen) K ⊧ ∃R 1 (a) but R 1 (a, b) ∉ A , for all b ∈ Ind(A) (written a ⇝ c R 1 ); (rgen) for i < n , T ⊧ ∃R − i ⊑ ∃R i+1 and If R is generating in K , then c R is called an anonymous individual. And, the anonymous individual collection is denoted as T , which is disjoint from Ind(A) . A new assertion C 2 (a) will be included in universal model, if the ABox A contains C 1 (a) , TBox T contains C 1 ⊑ C 2 and ABox A does not contain C 2 (a).
The canonical interpretation I K for K is defined as follows: The last element of in a path is denoted by tail( ). The universal model U K is defined as follows: The difference between a canonical interpretation and a universal model is that the canonical interpretation is always finite. It ensures that the extended ABox is finite by reusing the symbols of anonymous individuals. However, this reuse mechanism can lead to the canonical model producing wrong answers to conjunctive queries under the certain answer semantic. We compare the definitions of canonical interpretation I K and universal model U K by Examples 1 and 2.
Thus, K ̸ ⊧ q , the canonical interpretation I K produces wrong answers.
The universal model of this example is shown in Fig. 1. Kontchakov et al. proposed that for every consistent DL-Lite N horn KB K and every CQ q, we have cert(q, K) = ans(q, U K ) [15].

n-step Universal Model DL-Lite N horn
In this section, we present the definition of n-step universal model and query analysis algorithm. The n-step universal model is a implementation of the partial materialization idea. And the query analysis algorithm is proposed to ensure the n-step universal model always has the same answers as the universal model.

n-step Universal Model
Query answering over A with T can be reduced to query answering over the universal model, as shown in preliminaries. However, the universal model can be infinite.
Considering such axioms, it satisfies three characteristics. Firstly, it belongs to the concept of inclusions. Secondly, its head and body directly or indirectly contain both existential quantifiers. Thirdly, the roles included in this axiom are inverse to each other. We refer to this kind of axiom as cyclic existential quantifiers axioms (CEQ, for short) in this paper. The simple form of CEQ axioms is ∃R − ⊑ ∃R or ∃R − ⊑ A , A ⊑ ∃R . When ontology contains CEQ axioms, the universal model is infinite [17], as shown in Examples 1 and 2. The infinite RDF data cannot be directly stored and queried with off the shelf query engine.
We propose an n-step universal model to replace the possible infinite universal model. Intuitively, the process of materialization is to extend ABox to a universal model. The process can be thought of as a sequence U = {ABox, The (agen) and (rgen) (see Sect. 2) are the fundamental reasons for expand- K is always finite. The difference between partial materialization and materialization is that the core of partial materialization is to calculate the n-step universal model, while materialization computes the whole model. We ensure our materialization is always finite by selecting U n K from the U K for query answering. To formalize U n K , we require some preliminary definitions. We label R as n-step generating in K , when a is an individual of Ind(A) , and the R = R 1 … R n satisfies (agen) and (rgen). The denotes the set of roles that are ≤ nstep generating in K . The n-step canonical interpretation is defined as follows: All roles included in the n-step canonical interpretation must be ≤ n-step generating in K . All anonymous variables are witness of roles which are ≤ n-step generating in K . Based on the definition of the n-step canonical interpretation, we can derive the definition of n-step universal model ( U n K ).

Definition 2 n-step universal model
The graph of the 2-step universal model is shown in Fig. 2.

Example 4
The 2-step universal model (sRDF) of Example 2 is shown in Fig. 1.

QAA Based on Rooted Conjunctive Queries
We design a query analysis algorithm (QAA) to ensure that the n-step universal model can always compute the same answer as the universal model. QAA takes a rooted query as input and calculates the number of quantified variables n. Obviously, n can be calculated in O(| |) . The number of quantified variables denotes the step of the universal model. If the step size is n, then the n-step universal model, i.e., the U n K in U, can produce the same answers for q as the universal model. This method is proved in Theorem 2. We define a new triple relation on q. denotes a path that consists of terms. represents a path that includes roles. Definition 3 Let q = ∃ ( , ) be a CQ, T be a TBox and be a mapping, we define a triple relation and all other terms are mapped to T . A certain path collection is represented as CertPath(q, ) . The max certain path is defined as The anonymous part of the universal model is a forestshaped structure, as shown in Examples 3 and 4. Thus, the subquery that is matched to the anonymous part of the universal model must be a forest-shaped structure. If a term t in q wants to be mapped to an anonymous part of U K , it can only be mapped in this way, Example 5 Let q(x) be a cyclic CQ of the following form: Given the first knowledge base K 1 = {T, A 1 } and A 1 = {A(a)} . As shown in Fig. 3, the universal model is heterogeneous to the query q. Thus, ans(q, U K ) = cert(q, K 1 ) = �.
Given the second knowledge base These two examples demonstrate that the cyclic part of the query only can be mapped into the ABox part of the universal model because the anonymous part of the universal model is a forest-shaped structure.
These two examples confirm that not only a cyclic query, but also a fork query, the fork part of the query can only be mapped into the ABox part of the universal model, due to the anonymous part of the universal model is a forest-shaped structure.

Theorem 1 For every consistent DL-Lite
Proof (⇒ ) For every with dep(q, ) = n , then there exists a max certain path = t 0 t 1 ⋯ t n−1 t n and R(t n−1 , t n ) ∈ q . Thus, R is n-step generating, and all other roles are ≤ n-step generating. By definition of U n K , we have that for every R ∈ q , if a a … This creates a contradiction.
Because is finite, if is not finite, then there exists is not a function. However, we have proved that if U K ⊧ q , then f is a function. This creates a contradiction.
Suppose dep(q, ) > | | , then there exists a with | | > | | + 1 . Because free variables can only be mapped into Ind(A) , a quantified variable repeatedly appears in the path exists. Thus, is infinite. We have proved that if U K ⊧ q , then every ∈ MaxCertPath(q, ) is finite. This creates a contradiction. ◻ Based on Lemma 1 and Theorem 1, we can conclude that, for every rooted query, we extend the model at most | | steps. The core of the QAA: Theorem 2 For each consistent DL-Lite N horn KB K and each rooted conjunctive query q = ∃ ( , ) , with | | = n , we have cert(q, K) = ans(q, U n K ).
Proof K o n t c h a k o v e t a l . p r o p o s e d t h a t cert(q, K) = ans(q, U K ) (see Sect. 2). Thus, we only need to proof ans(q, U K ) = ans(q, U n K ). (⇒ ) Lemma 1 shows that for every mapping , if U K ⊧ q , then n * = dep(q, ) ≤ | | . Based on Theorem 1, we can In conclusion, ans(q, U K ) = ans(q, U n K ) , that is, cert(q, K) = ans(q, U K ) . ◻

QAA Based on Boolean Conjunctive Queries
A Boolean conjunctive query is in the form of q = ∃ ( ) . It is a special case of conjunctive queries q = ∃ ( , ) , with | | = 0 . As mentioned in Sect. 2, all non-connected queries can be decomposed into connected subqueries for processing, so we only consider connected Boolean queries. Because Boolean conjunctive query does not have a variable that must be mapped into ABox, the query analysis algorithm does not explicitly apply to Boolean conjunctive queries. As shown in Example 8, the query analysis algorithm is unsound for Boolean conjunctive queries q(x), that is, when U n K does not satisfy q, it is possible for K to satisfy q.

Example 8
Let q(x) be a Boolean CQ of the following form: Figure 7 shows the graph of 3-step universal model and query. Obviously, the 3-step universal model does not satisfy q, but the universal model does.
To extend QAA to support Boolean conjunctive queries, we firstly summarize the general properties of the universal model.
The universal model of K If the ontology contains the CEQ axioms, the universal model is infinite. The anonymous part of the universal model is forestlike, and is heterogeneous to the cyclic and fork structures.
The two properties are explained or proved in the preceding two sections. Based on the two attributes, we can conclude that if the Boolean conjunctive query contains a cyclic structure or fork structure and the Boolean conjunctive query can be satisfied, then there must be a variable mapped to ABox. Therefore, the Boolean conjunctive queries which contain a cyclic or fork structure can be directly solved by QAA. To verify this, we first extend the triple relation f defined in the rooted queries to Boolean queries by modifying the definition of .

Definition 4
Let q = ∃ ( , ) be a CQ, T be a TBox and be a mapping, we define a triple rela-

Lemma 2 For each consistent DL-Lite N
horn KB K and each Boolean conjunctive query q = ∃ ( ) which contains a cyclic structure or fork structure, we have that if U K satisfies q and q contains a cyclic structure or fork structure, then there are variables in the query that must be mapped to ABox.
Proof Assuming that all variables in q are mapped to anonymous variables, if U K satisfies q and q contains a cyclic structure or fork structure, then there must be a variable t ∈ , such that (t, . This creates a contradiction. Thus, if U K satisfies Boolean conjunctive query q and q contains a cyclic structure or fork structure, then there are variables in the query that must be mapped to ABox. Based on the definition of f , we have that (z, x ⋅ z, R) ∈ f and (z, y ⋅ z, R) ∈ f . If U K satisfies q under and all variables are mapped to anonymous individuals, then (z) = (x) ⋅ c R = (y) ⋅ c R . However, (x) ≠ (y) , this creates a contradiction. Thus, there is no mapping where U K satisfies q under this mapping and all variables are mapped to anonymous individuals.
As shown in the following Fig. 8, the universal model is heterogeneous to the query q. Thus, U K ̸ ⊧ q.

Theorem 3 For each consistent DL-Lite N
horn KB K and each Boolean conjunctive query q = ∃ ( ) which contains a cyclic structure or fork structure, we have that U K satisfies q if only if U n K satisfies q with n = | |.
Proof (⇒ ) Based on Lemma 2, if U K satisfies q under and q contains a cyclic structure or fork structure then there are variables in the query that must be mapped to ABox. Then, we can conclude that dep(q, ) ≤ | | based on Lemma 1. We label the max certain path of q as = t 0 t 1 ⋯ t m−1 t m and R(t m−1 , t m ) ∈ q . Thus, R is m-step generating with m is ≤ | | . By definition of U n K , we have that for every R ∈ q , if (a, b) ∈ R U K then a ∈ U n K and b ∈ U n K . Thus, (a, b) ∈ R U n K . Since q is connected, for every A ∈ q , suppose a ∈ A U K , then (a, * ) ∈ R U K or ( * , a) ∈ R U K . Thus, a ∈ U n K and a ∈ A U n K . In conclusion, U n K ⊧ q. (⇐ ) Because U n K satisfies q and U n K is a subset of U K , so U K satisfies q. ◻

n-step Universal Model in OWL 2 DL
OWL 2 DL is based on SROIQ . Because SROIQ has more complex constructors than DL-Lite N horn , more complex information about the described domain can be captured by OWL 2 DL. Particularly, OWL 2 DL has complex restrictions, such as property restrictions and arbitrary cardinality. Besides, UNA is not adopted by OWL 2 DL, that is, different individual names may point to the same individual.
However, with the improvement of ontology language expressiveness, the complexity of reasoning algorithms will also increase. For instance, when dealing with the axioms in the form of UNION, such as C ⊑ C 1 ⊔ C 2 , it is necessary to try all possibilities and backtrace the tree when To enjoy the high expressiveness of OWL 2 DL and improve materialization efficiency, we implement the support for OWL 2 DL through approximation and rewriting mechanisms. Given an OWL 2 DL ontology, we first attempt to rewrite it as an equivalent DL-Lite N horn TBox axiom, if possible. Otherwise, we have three choices, approximate processing or adding additional data structures or other ABox transformation rules. The last two methods can preserve the semantics that approximate processing would lose.

TBox Transformation
TBox transformation is presented in Tables 1 and 2 (r and s denote role names). Given a SROIQ TBox axiom, we first rewrite it to an equivalent one according to the rewriting rules in Table 1, also known as normalization in [25]. We add concept and its complement to a complement table (CT), which is designed to record complement semantic.
Because of the normalized TBox axioms T beyond the expressiveness of DL-Lite N horn , and the axiom in the form of C ⊑ ⊔ n i=1 C i or C ⊑ ∃R.{a 1 , a 2 , a 3 } will lead to non-determinism, we syntactically approximate partial axioms by their complement, as shown in Table 2. Specially, we construct a new concept for nominals at No.10 approximation rule. All TBox transformation rules are sound, as shown in [25].

ABox Transformation
The semantics of DL-Lite N horn do not cover the axiom shown in Table 3. Thus, we design tractable ABox transformation rules, i.e., ABox reasoning rules for them based on the semantics of SROIQ.
An extended TBox T * is a set of axioms obtained from T by applying TBox transformation rules and adding ABox transformation rules. Let K * ∶= (T * , A) . Let n be a natural number. The n-step universal model of (T * , A) is called an extended n-step universal model, denoted by U n K * , of K. By Theorem 2 and the definition of the transformation rules, we can conclude: Proposition 1 (Approximation) Let K = (T, A) be a consistent KB and q = ∃ ( , ) be a rooted CQ with | | = n . For every ⊆ Ind(A) with | | = | | , if ∈ ans(q, U n K * ) then ∈ cert(q, K).

Axiom
Expression Axiom Expression

The System and Implementation of SUMA
SUMA computes universal model offline and executes queries online. The offline stage consists of three modules: ontology processor, storage, and materialization (Fig. 9). The ontology processor module has four submodules. OWL 2 DL processor parses the ontology through the OWL API [13], rewrites it to DL − Lite axioms according to rewriting and approximation techniques. It builds the inverse role table and equivalent role table to support role rewriting algorithm.
The role processor implements role scoring algorithm [27]. The role rewriter firstly generates equivalent and inverse role mappings following [27]. For instance, if role d is equivalent to role e and d.score < e.score , then d is mapped to e. Formally, mapping(d) = e, mapping(e) = e . If d.score = e.score and d.id > e.id , then d is mapped to e. Secondly, the role rewriter rewrites axioms and facts.

Example 11
We use the ontologies and facts in Fig. 10 to illustrate the process of role rewriting. The role graph is generated by role score algorithm. Based on the role graph, taughtBy is mapped to teach and like is mapped to love. After choosing the mapping, the role rewriting can be divided into three parts: axiom rewriting, fact rewriting and optimizing rewriting. In fact rewriting phase, taughtBy(Physics, Lisa) and like(Lisa, basketball) are changed to teach(Lisa, Physics) and love(Lisa, basketball), respectively. The axiom range(taughtBy, Teacher) is rewritten at axiom rewriting phase. It was first rewritten to range(teach − , Teacher) and then optimized to domain(taughtBy, Teacher). During the materialization process, taughtBy(Physics, Lisa) and like(Lisa, basketball) are not stored in memory, and Teacher(Lisa) can only be generated once by teach(Lisa, Physics).
The storage module uses the Jena API to load RDF data and generates a dictionary by encoding each RDF resource in integer ID. The dictionary is shared by the storage module and ontology processor. The RDF data are stored as Fig. 9 The architecture of SUMA Axiom  Fig. 10 An example of role rewriting algorithm a triple table with three types of indexes, e.g., a primary index, a secondary index, and a tertiary index. TableIterator can traverse the triple table efficiently by three types of indexes. And, it maintains an index array that records the n-step model corresponding index ranges in the triple table.
The materialization module has three submodules: binding query, axiom matcher, and sameAs reasoner. The detailed materialization algorithm is shown in Algorithm 1. It iteratively reads a new triple F from the triple table through TableIterator. If F has an equivalent triple G (For instance, F = (d, R, e) , G = (d � , R, e � ) , d ≐ d ′ , e ≐ e ′ ), then the program does not process F to improve reasoning efficiency. The reasoning of F can be divided into three situations. if G.equals(F ) then 4: if F is the form of (d, . =, e) then 5: sameAsReasoning(F ); 6: else 7: if F is the form of (d, P, e) ∧ P.isFunctionalProperty then 8: for e * ∈ I.getIndividual(d, P ) do 9: if I.contains((e, . =, e * )) then 10: result in contradiction; 11: else I.add((e, . =, e * )); 12: end if 13: end for 14: else 15: for each (type, r, F ) ∈ matchAxiom(F, T ) do 16: for Firstly, if F is the form of (d, ≐, e) , it is processed by Algorithm 2. The sameAs reasoning function puts the individual d and e into an equivalent pool and selects the individual with the smallest ID as the identifier. We set the sameAs mapping of d as c if there exists (d, ≐, c) and c is the smallest ID of the equivalent pool. Secondly, if the role in F is a functional or an inverse functional role, (for instance, F = (d, P, e) , and P is a functional role), then, all triples like (d, P, * ) are returned by I.getIndividual(d, P) . A new fact (e, ≐, * ) is added to I if I does not contain a fact (e,≠, * ) . Thirdly, axiom matcher returns all axioms that can match the triple F through matchAxiom(F, T) . Binding query function converts these partially matched axioms into partial binding queries. The function I.evaluate executes these queries over I and returns a new fact. i.setSameAsMapping(c); 5: end for The online part includes a SPARQL processor and a model matcher. The SPARQL processor applies QAA technologies to compute the step size (n) of the model. In essence, it takes O(1) time complexity to calculate the number of quantified variables. The model matcher takes n as input and passes the n-step universal model to the SPARQL query engine. The SPARQL query engine executes SPARQL queries and returns query results.

Experiments and Evaluations
SUMA delegates SPARQL queries to RDF-3X [24] at this experiment. The experimental environment is a 24-core machine that is equipped with 180GB RAM and Ubuntu 18.04. The experiment is divided into three parts: the evaluation of query answering system on finite model, the evaluation of query answering system on infinite model and role rewriting algorithm evaluation.
Evaluation criteria We test two aspects, (i) the soundness and completeness of the answers, (ii) the scalability of the query answering system. The first aspect is testing the number of queries that the system can answer correctly under the certain answer semantic. The evaluation of the scalability of the query answering system is to test the pre-processing time, consists of data load time and materialization time, and the query processing time on the increasing datasets.
Data load time: This time includes all the data pre-processing steps before materialization, such as constructing a dictionary, generating an index, etc. Materialization time: The time taken by reasoner to compute consequences. Query processing time: The time taken by the system to execute a query on the extended data and return the query results.
Comparison system We compare SUMA with the following four systems, all of which use materialization methods.
Pellet is sound and complete in OWL 2 DL. It is adopted as the criterion for soundness and completeness evaluation.
PAGOdA employs RDFox for highly scalable reasoning. Therefore, we mainly test the scalability of SUMA with PAGOdA. gOWL also adopts partial materialization algorithm to solve infinite materialization problem. We evaluate two kinds of partial materialization algorithms from the experimental perspective. SUMA-N indicates a query answering system that does not use the role rewriting algorithm. SUMA-N is used to evaluate the performance of the role rewriting algorithm. Table 4 gives a summary of all datasets and queries used in this experiment. Besides the 14 standard queries of LUBM, we also test ten queries from PAGOdA. The DBPedia [4] axiom is simple. It could be captured by OWL 2 RL [20]. Therefore, we adopt the DBPedia+ axiom and 1024 DBPe-dia+ queries provided by PAGOdA. The DBPedia+ axiom includes additional tourism ontologies. We generate 260 atomic queries for the YAGO [29] dataset.

The Soundness and Completeness Evaluation
Because Pellet and gOWL cannot give query results on LUBM(100), UOBM(100), DBPedia+ and YAGO in 2 h, we do not display the results of them. As shown in Table 5, SUMA can correctly answer all queries on each test dataset.

The Scalability Test
Since gOWL cannot materialize DBPedia+ and YAGO in less than 2 hours, we compare SUMA and gOWL on small datasets before comparing SUMA and PAGOdA. gOWL takes 1.77 h to materialize LUBM(10), while SUMA takes 1.51 s. The materialization time of gOWL on UOBM(10) is 3.19 h. SUMA only costs 8.34 s materializing UOBM (10). SUMA is more scalable than gOWL.
Next, we test SUMA and PAGOdA on a series of datasets. For LUBM, we use datasets of increasing size with a step of 200. Since UOBM ontology is more complicated than LUBM ontology, we set the UOBM dataset growth step length as 100. For each dataset and ontology, we test the pre-processing time (pre-time), data load time, materialization time (mat-time), and average query processing time (avg-time).
Pre-processing Time Evaluation As shown in Fig. 11, SUMA significantly reduces pre-processing time. Time increases linearly with the size of the dataset. On each test dataset, the pre-processing time of SUMA is faster than PAGOdA.
SUMA only takes 124s to materialize LUBM(1000). The pre-processing time of SUMA on LUBM(1000) is 549s, faster than PAGOdA's 1692s. The time taken by SUMA to materialize UOBM(500) is 411s. The total pre-processing time is 862s. Compared with the 5937s pre-processing time of PAGOdA, SUMA is much faster. SUMA takes 18s and 6s to materialize DBPeida+ and YAGO, respectively. The preprocessing time of SUMA on DBPedia+ and YAGO is 71s and 63s, respectively. PAGOdA costs 309s pre-processing DBPedia+ and 139s pre-processing YAGO. SUMA is more scalable than PAGOdA.

Average Query Processing Time Evaluation
The average query processing time of SUMA on LUBM (1) and UOBM (1) is four and five orders of magnitude faster than Pellet, respectively. Because SUMA and gOWL both rely on existing query engines to perform queries, we only compare SUMA with PAGOdA in the average query processing time evaluation.
We test the average query processing time of 24 LUBM queries on six LUBM datasets, 15 UOBM queries on five UOBM datasets, 1024 DBPedia+ queries on one DBPe-dia+ dataset and 260 YAGO queries on the YAGO dataset. As shown in Fig. 12a, SUMA has a faster average query processing time than PAGOdA on all LUBM datasets except LUBM(100). (Time(SUMA, LUBM(100)) = 0.62 s, Time(PAGOdA, LUBM(100)) = 0.57 s). The significant decrease in the query processing time of SUMA on LUBM (500) is related to RDF-3X. RDF-3X can provide shorter query time on larger data by building different efficient indexes. Figure 12b shows the average query processing time of SUMA is an order of magnitude faster than that of PAGOdA on all UOBM datasets.
The average query processing time of SUMA on DBPe-dia+ is 24.337ms faster than PAGOdA's 33.235ms. The

Query Answering over Infinite Universal Model
Since the LUBM, UOBM, DBPedia+ all have a finite universal model, they are not suitable for the second experiment. We add some manual CEQ axioms to the LUBM and UOBM ontologies, respectively. Table 6 shows all the data used at the infinite model evaluation.
We also customize some additional queries to test LUBM+ and UOBM+. Table 7 summarizes our queries. Besides the queries included in the first experiment, we add nine queries for LUBM+ and five customized queries for UOBM+. The third column shows the number of queries that contain a cyclic structure. The number of queries with more than two quantified variables is given in the table's fourth column.

The Soundness and Completeness Evaluation
As shown in Table 8, SUMA and Pellet can calculate all the correct answers for all test queries, whereas PAGOdA is incomplete on five LUBM+ queries (Q2, Q4, Q5, Q6, Q7) and three UOBM+ queries (Q1, Q2, Q3). 1 gOWL is complete only on a few queries.

The Scalability Test
According to statistical analysis of the actual SPARQL queries, more than 96% of the queries include up to 7 triple patterns [10]. Therefore, in most cases, we only need to consider the step of universal model (n) is not greater than 7. Besides, we find that SUMA is also efficient when n is more than 7. SUMA shows high scalability on LUBM+ and UOBM+. The average query processing time of SUMA on LUBM+(1) and UOBM+(1) is 1.99 ms and 6.48 ms, respectively. It is faster than the PAGOdA's 11.78 ms and 10.40 ms and five orders of magnitude faster than Pellet.
We focus on testing the materialization time of the infinite universal model. To make our test more challenging, we manually add 100 CEQ axioms to LUBM+ and UOBM+ ontologies, named as LUBM++ and UOBM++, as shown in Table 6.
The materialization time of the 15-step universal model of LUBM++(1000) and UOBM++(500) is 276.869 s and 584.600 s, respectively. When n = 7 , the materialization time of LUBM++(1000) and UOBM++(500) is 172.308 s and 486.504 s, respectively. SUMA is highly scalable on the infinite universal model.

The Role Rewriting Algorithm Evaluation
As shown in the previous two experiments, SUMA is complete on all test queries, which shows that the role rewriting algorithm does not lose the completeness of materialization. Table 9 shows the number of equivalent and inverse roles in the test dataset. Because the YAGO dataset does not include equivalent roles and inverse roles, it is not used to evaluate role rewriting algorithm. Fig. 12e, f, on all LUBM and UOBM test data sets, the materialization time of SUMA is faster than that of SUMA-N. SUMA takes 124 s to materialize the LUBM(1000) dataset, while SUMA-N takes 202 s to materialize the LUBM(1000) dataset. SUMA takes 411 s to materialize the UOBM(500) dataset, while SUMA-N takes 515 s to materialize the UOBM(500) dataset.

Materialization Efficiency Evaluation As shown in
As shown in Fig. 12g, h, on all LUBM++ and UOBM++ test data sets, the materialization time of SUMA is faster than that of SUMA-N. SUMA takes 276 s to materialize the 15-step LUBM++(1000) model, while SUMA-N takes 351 s to materialize the 15-step LUBM++(1000) data set. SUMA took 584 s to materialize the 15-step UOBM++(500) data set, while SUMA-N took 698 s to materialize the 15-step UOBM++ (500) data set.
On the DBPedia+ dataset, SUMA materialization takes 18 s, while SUMA-N takes 20 s.
The experiment verifies that the role rewriting algorithm can improve materialization efficiency without reducing the answers' quality.

Memory Optimization Evaluation
Since SUMA is calculated based on memory, this experiment uses the number of triples in the materialization process to measure the memory consumption of the system. Figure 12i, j shows the number of redundant facts reduced by SUMA. It can be seen from the figure that as the size of the dataset increases, the number of redundant data reduced by the role rewriting algorithm increases linearly. The role rewriting algorithm reduces the memory consumption of LUBM data by 9.48% on average, and reduces the memory consumption of UOBM data by 12.42%. And with the increase in the number of equivalent roles and inverse roles, the effect of memory optimization becomes more obvious.

Conclusions
In this paper, we have proposed a partial materializationbased approach for ontology-mediated query answering over OWL 2 DL. Our technique's core idea is that for a rooted conjunctive query or a Boolean conjunctive query with n quantified variables, the answer to the n-step universal model is the same as the answer to the universal model in DL. SUMA significantly reduces offline materialization costs by building efficient indexes for facts and rules and integrates role rewriting algorithm. The low complexity materialization algorithm makes SUMA can support efficient reasoning of large-scale datasets. In future works, we are interested in extending this proposal to support distributed reasoning, and extending our approach to support other normalized ontology models.
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creat iveco mmons .org/licen ses/by/4.0/.