Algorithms for Instance Retrieval and Realization in Fuzzy Ontologies

: Fuzzy description logics, the formalism behind fuzzy ontologies, are an important mathematical method with applications in many artiﬁcial intelligence scenarios. This paper proposes the ﬁrst speciﬁc algorithms to solve two reasoning tasks with respect to a fuzzy ontology: the instance retrieval and the realization problem. Our algorithms are based on a reduction of the number of optimization problems to solve by merging some of them. Our experimental evaluation shows that the novel algorithm to solve the instance retrieval outperforms the previous algorithm, and that in practice it is common to be able to solve a single optimization problem


Introduction
Description Logics (DLs for short) [1] are a popular family of logics to represent structured knowledge, particularly in ontologies.They make it possible to capture the relevant knowledge in a domain field and to infer implicit knowledge, providing a good balance between the expressiveness of the language and the practical computational complexity of the reasoning.For example, the current standard language OWL 2 (Web Ontology Language) is based on the DL SROIQ(D) [2,3].
One of the most important reasoning tasks in classical ontologies is the instance retrieval problem, which consists of retrieving all the individuals i that are known to belong to a given a concept C. In the fuzzy setting, this reasoning task can be extended to retrieving pairs i, α such that each individual i belongs to a given (possibly fuzzy) concept C with degree greater or equal than α > 0.
However, there are no specific reasoning algorithms to solve this problem in fuzzy ontologies.Instead, one needs a best entailment degree test for each individual i in the fuzzy ontology, retrieving a lower bound for its membership to C. For example, this is the algorithm implemented in the fuzzy ontology reasoner fuzzyDL [18], which, to the best of our knowledge, is the only software supporting instance retrieval with respect to a fuzzy ontology.Clearly, running several entailment tests is not an optimal solution, and may take a dramatic increase in the running time for hard ontologies.
A similar problem happens with the realization problem.In classical ontologies, realization consists of retrieving all the concepts C that a given individual i is an instance of.In fuzzy ontologies, it requires retrieving pairs C, α such that i belongs to C with degree greater or equal than α > 0. Because this can be computed using a best entailment degree test for each concept C in the fuzzy ontology, no specific algorithms have been designed.
In this paper, we propose two specific algorithms to solve the instance retrieval and the realization problem with respect to a fuzzy ontology.Such algorithms are based on an extension of an optimization technique called optimization partitioning, originally proposed in [19] and extended in [20].This optimization can be applied in a family of algorithms to reason with fuzzy DLs that are based on a collaboration of classical tableaux rules and mathematical programming [21], as it is the case of the algorithm implemented by fuzzyDL.In such cases, it is possible to compute a partition of the single optimization problem into smaller optimization problems, called constraint group optimization problems (CGO problems).The idea is to optimize independently, these CGO problems (perhaps optimizing the same CGO problem several times, if necessary) rather than optimizing the whole original problem several times.
The rest of this paper is organized as follows.Section 2 recalls some preliminaries on fuzzy DLs.Then, we present two novel algorithms to solve the realization (Section 4) and the instance retrieval (Section 3) given a fuzzy ontology.Next, Section 5 discusses an experimental evaluation of both algorithms.Finally, Section 6 sets out some conclusions and ideas for future work.

Background on Fuzzy DLs
This section overviews some results on fuzzy DLs that will be used in this paper.We assume that the reader is familiar with fuzzy logic [22,23] and with classical DLs [1].We will define a fuzzy DL (syntax and semantics), the main reasoning tasks, and some reasoning algorithms.For further details, we refer the interested reader to [4,18].Although our approach does not depend on the particular fuzzy DL, this paper will consider a relatively simple language, fuzzy ALC, to make the text more concrete.

Syntax
This section recalls the syntax of fuzzy ALC as originally proposed in [21].Fuzzy DLs have three elements: individuals, fuzzy concepts, and fuzzy properties (or roles).Fuzzy concepts are fuzzy sets of individuals, and fuzzy properties are fuzzy binary relations between individuals.
Concepts (denoted C) of the language can be built inductively from atomic concepts (A), top concept , bottom concept ⊥, properties (R), and individuals (a) as follows: A Fuzzy Ontology (or fuzzy knowledge base) O = A, T is composed of a fuzzy ABox A, including axioms about individuals, and a fuzzy TBox T , including axioms about concepts.
A fuzzy ABox contains a finite set of fuzzy assertions of the following types: . The intuitive idea is that individual a is an instance of concept C with degree greater than or equal to α.

•
Property assertions of the form (a 1 , a 2 ):R ≥ α , α ∈ [0, 1].The intuition here is that the pair of individuals (a 1 , a 2 ) is an instance of property R with degree greater than or equal to α.
A fuzzy TBox consists of a finite set of fuzzy general concept inclusions (fuzzy GCIs).A fuzzy GCI is an expression of the form The intuition here is that the degree of concept C 1 being subsumed by C 2 is greater than or equal to α.
Two important types of axioms that will be mentioned in the rest of this paper are disjoint axioms of the form C 1 C 2 ⊥ ≥ 1 , and range axioms of the form ∀R.C ≥ 1 .

Semantics
This section recalls the semantics of fuzzy ALC as originally proposed in [21].The semantics is defined using a fuzzy interpretation and a fuzzy logic, composed of a t-norm ⊗, t-conorm ⊕, negation function , and implication function ⇒.Table 1 summarizes the definitions of those fuzzy operators in the main four fuzzy logics; namely, Gödel, Łukasiewicz, Product, and Zadeh.

Gödel Logic
Łukasiewicz Logic Product Logic Zadeh Logic A fuzzy interpretation (or model) I = (∆ I , • I ) consists of a nonempty set ∆ I (the domain) and of a fuzzy interpretation function • I that assigns:

•
To each individual a an element a I ∈ ∆ I .

•
To each fuzzy concept C a function Table 2 shows how to extend the interpretation function to complex concepts and fuzzy axioms.

Reasoning Tasks
Common reasoning tasks on DLs include consistency (checking if an ontology has a model), concept satisfiability (checking if a concept can have instances), entailment (checking if an ontology necessarily entails an axiom), realization (retrieving all the concepts an individual belongs to), and instance retrieval (retrieving all the instances of a concept).In fuzzy DLs, we have extensions of those tasks and some new ones, such as the best entailment degree (BED).The BED of an axiom φ ∈ {a:C, (a 1 , a 2 ):R, C D} with respect to a fuzzy ontology O is defined as [24]: These reasoning tasks are usually inter-definable (depending on the expressivity of the language and the semantics of the fuzzy operators).Some popular fuzzy ontology reasoners are fuzzyDL [18], Fire [25], FPLGERDS [26], YADLR [27], DeLorean [28], GURDL [19], FRESG [29], LiFR [30], and SMT-based solver [31].To the best of our knowledge, fuzzyDL, FRESG and YADLR are the only ones supporting instance retrieval, while FRESG, and YADLR are the only ones supporting realization.
The fuzzyDL reasoner reduces the previous reasoning services to the variable minimization problem, that is, to minimize a [0, 1]-variable x, given a consistent fuzzy ontology O [18].For instance, bed(O, a:C) is computed as: where ¬ Ł denotes Łukasiewicz negation.Then, fuzzyDL solves the instance retrieval of C with respect to O by computing bed(O, a:C) for every individual a ∈ O.
Regarding FRESG and YADLR, no specific reasoning algorithms to solve those tasks are reported.FRESG computes instance retrieval and realization by reducing to several tableaux algorithm tasks, and YADLR to several BEDs.(Strictly speaking, YADLR checks if an individual is a member of a given concept with an unknown degree of truth, represented using a variable).
That is, if the fuzzy ontology has n i individuals and n c atomic concepts, existing algorithms require n i tests to solve the instance retrieval and n c tests to solve the realization problem.

The fuzzyDL Reasoning Algorithm
In the rest of this section, we will give some more details about fuzzyDL reasoning algorithm [18], as we will extend it in the next sections.The algorithm is based on a combination of a tableaux algorithm and an optimization problem with respect to a constraint set C.

•
Firstly, there is some pre-processing.For example, in Łukasiewicz and Zadeh fuzzy DLs, each concept is transformed into its negation normal form [18], where the negation only appears before atomic concepts.

•
Then, for each concept assertion a : Next, it applies some tableau rules.As usual in classical DLs, rules transform complex concept expressions into simpler ones, but in the fuzzy case they also create a set of linear in-equation constraints.Table 3 shows the rules for ALC, and the encoding of the fuzzy operators is shown in Table 4 for Łukasiewicz (Ł), Gödel (G), and Zadeh (Z) fuzzy logics, where > 0. These inequations have to hold in order to respect the semantics of the DL constructors.

•
When no more rules can be applied, the reasoner solves an optimization problem with respect to C. This problem has a solution iff the fuzzy ontology is consistent [18].To solve the optimization problem, fuzzyDL uses Gurobi (http://www.gurobi.com)optimization problem solver.
Remark 1.For simplicity, Table 3 assumes that standard Łukasiewicz negation is representable, so that concepts can be represented in negation normal form (NNF).This is obviously the case in Zadeh and Łukasiewicz fuzzy DLs, but in Gódel ALCit requires extending the logic with standard negation, as fuzzyDL does.Similar rules can be defined when concepts cannot be represented in NNF (e.g., in Gódel DLs); see, e.g., [4].Please also note that in Zadeh DLs it is usual to consider two different fuzzy implications, one for universal restriction concepts ∀R.C and another one for subclass axioms C 1 C 2 [32].
In Łukasiewicz, Gödel, and Zadeh fuzzy DLs, we obtain a bounded mixed integer linear programming (MILP) problem [21]; in other fuzzy DLs more complex optimization problems can be obtained.A MILP problem consists of minimizing a linear function with respect to a set of constraints C that are linear inequations in which rational and integer variables can occur [24].In particular, a constraint set C can contain linear equations w 1 x 1 + • • • + w n x n w 0 or restrictions of the form x i ∈ {0, 1} (forcing x i to be a binary value), where x i denotes a variable taking values in R ∩ [0, 1], w i denotes a rational number, and ∈ {≤, ≥, =}.
Table 3. Rules of the tableaux algorithm combined with an optimization problem [33].

Rule Preconditions Actions
Encoding of some popular fuzzy logic operators [33].
Let the connection relation ; C between two variables z 1 , z 2 be defined as follows: define z 1 ; C z 2 if ∃ψ ∈ C with a term w 1 z 1 and a term w 2 z 2 , and then, extend ; C to its transitive closure.The following result can be shown: Lemma 1 ([20]).A constraint set C can be partitioned into a set of constraint sets {C 1 , C 2 , . . ., C m } verifying the following conditions: (OP1) If z occurs in C i , then z does not occur in C j , ∀i, j ∈ {1, . . ., m}, i = j; C has a solution iff the C i has a solution for every i ∈ {1, . . ., m}.Furthermore, given the MILP problem of minimizing an objective variable z with respect to C, the solution is the same as the solution of minimizing with respect to C j , where C j is the optimization problem where z appears.
Computing the partition can be reduced to the problem of computing all the connected subgraphs of a graph.Given a constraint set C, it is possible to build an undirected graph with as many nodes as variables in C and an edge linking two nodes n z 1 , n z 2 for every pair of variables z 1 and z 2 appearing in the same constraint ψ ∈ C. The connected subgraphs indicate the contraint sets; i.e., if a variable z is in the i-th connected component, then the constraints where z occurs should be placed in C i [20].

Realization in Fuzzy Ontologies
The intuition behind our algorithm is to reduce the number of optimization problems to be solved by merging them.Clearly, optimization problems cannot be merged in general, as Example 1 shows.
Example 1.Consider an ontology O with the axiom johnSmith : DemocratVoter RepublicanVoter ≥ 1 stating that citizen JohnSmith either voted for the Democratic Party or for the Republican Party in the last USA elections.If we want to retrieve all the concepts johnSmith belongs to, the answer should be an empty set, because we cannot infer that he is a DemocratVoter and we cannot infer that he is a RepublicanVoter.In Łukasiewicz fuzzy DLs, the axiom in O leads to a constraint x johnSmith:DemocratVoter + x johnSmith:RepublicanVoter ≥ 1 We can indeed compute the realization problem by (i) adding johnSmith : ¬C ≥ x C to O, where x C is a new variable, for one of the atomic concepts C ∈ KB, (ii) minimizing x C , and (iii) repeating the process for each of the atomic concepts in O.For example, adding johnSmith : ¬DemocratVoter ≥ x DemocratVoter leads to a constraint and the minimum value of x DemocratVoter with respect to Equations ( 2) and (3) is 0; i.e., there is a solution to the MILP problem such that x DemocratVoter = 0 (and x johnSmith:RepublicanVoter = 1).However, if we also added johnSmith : ¬RepublicanVoter ≥ x RepublicanVoter , we would have a constraint x johnSmith:RepublicanVoter .≤ x RepublicanVoter (4) Now, in any of the solutions of the optimization problem in Equations ( 2)-( 4), x DemocratVoter > 0 or x RepublicanVoter > 0 hold, it is incorrect.
However, we can merge optimization problems as long as the involved variables are independent.Based on this idea, Algorithm 1 solves the realization problem of an individual a given a fuzzy ontology O.The output is a (possibly empty) list of pairs of the form A, α , where A ∈ O is an atomic concept, α > 0 and O |= a : A ≥ α .
Lines 1-6 add a new assertion (involving a new variable) for each named concept in the ontology, create an empty list of results L, and apply some reasoning rules that create a set of MILP constraints.The new assertions are similar to those in the previous algorithm implemented in fuzzyDL [18], but now we create them in the same step.x a:A = new variable end if 34: end for 35: return L Lines 7-10 partitions the single constraint set with respect to C into a set of constraint sets C i .This is similar to the approach in [20].However, we also compute the number of variables to be minimized x a:C in each of the problems so that we can consider three cases:

•
Constraint sets without an objective variable (so that we only need to check if they have a solution);

•
Constraint sets with exactly one objective variable of the form x a:C ; • Constraint sets with more than one objective variable of the form x a:C (so they are dependent variables).
Lines 11-14 address the first case.Constraint sets are merged and we check if there is a solution to the merged constraint set to guarantee that there are not inconsistencies.We could also solve the problems independently, but some experiments showed empirically that it is faster to solve a single problem [20].
Lines 15-24 address the second case.Constraint sets are merged and we optimize with respect to a variable with a value equal to the sum of all the variables x a:C to be minimized.This is possible only because all variables x a:C are independent: in this case the minimum of the sum occurs when all the variables have its minimum value.The value of each x a:C is added to the list of results if it is greater than 0.
Finally, Lines 25-34 address the third case.In this case, constraint sets are merged, but the merged problem is optimized independently with respect to a single variable, and this is repeated for each variable x a:C introduced in Lines 1-6 that belongs to C two_or_more .The minimal value of each x a:C is added to the list of results if it is greater than 0.
An alternative to the third case is not to merge all the constraint sets into a single one and optimize them independently with respect to each x a:C .Note that each independent constraint set would need to be optimized two or more times.
Another alternative is to merge the first and the second case to optimize a single optimization problem.This seems more promising in practice, as the evaluation in [20] showed that solving a problem is not more expensive than solving two simpler ones, disjoint subsets of the original one.
A particularly interesting case happens when C two_or_more is empty.In this case, we can solve a single optimization problem (with the union of the first and the second case).However, in practice, those cases might not happen very often.For example, Example 2 shows that having disjoint concept axioms introduces dependencies.
Example 2. If there is an axiom stating that two concepts C 1 and C 2 are disjoint, this introduces a constraint x a:C 1 ⊗ x a:C 2 = 0 for each individual a in the ontology, so variables x a:C 1 and x a:C 2 are dependent.Computing the realization of any individual a requires adding two assertions ∪ a : Then, the variables x a:C 1 and x a:C 2 are connected (x a:C 1 ; C x a:C 2 ) and so are x 1 , x 2 , so C two_or_more is not empty (there is a partition that contains at least two objective variables, x 1 , x 2 ).

Instance Retrieval in Fuzzy Ontologies
Algorithm 1 can be easily adapted to the instance retrieval problem.Algorithm 2 solves the instance retrieval of a fuzzy concept C given a fuzzy ontology O.The output is a (possibly empty) list of pairs of the form a, α , where a ∈ O is an individual, α > 0 and O |= a : C ≥ α .
Lines 1-6 are similar to the same lines in Algorithm 1, but now we add a new assertion for each named concept in the ontology.Then, Lines 7-10 partitions the single constraint set into several sets C i .Next, we address the same cases: Lines 11-14 address the first case, Lines 15-24 address the second case, and Lines 25-34 address the third case.
We can also consider the same alternatives as in the realization problem: in the third case it is possible not to merge all the constraint sets, and the constraint sets in the first and the second cases can be merged.
As our experiments show, the particularly interesting case when C two_or_more is empty happens relatively often.In this case, we can solve a single optimization problem (with the union of C zero and C one ).However, we have identified some cases where C two_or_more is not empty, described in Examples 3 and 4.
Example 3. Assume that a fuzzy ontology O has a range axiom (stating that the range of an object property R is C) and two object property assertions stating that individuals a 1 , a 2 are related via R with an individual a 3 .Assume also that we want to retrieve the instances of a concept D such that D C ≥ α ∈ O, so that we need to add assertions a 1 : ¬ Ł D, 1 − x 1 and a 2 : ¬ Ł D, 1 − x 2 .Then, the variables x a 1 :D and x a 2 :D are connected (x a 1 :D ; C x a 2 :D ) and so are x 1 , x 2 , so C two_or_more is not empty (there is a partition that contains at least two objective variables, x 1 , x 2 ).Note that this does not happen if both a 1 , a 2 are related via R to a 3 but there is not a range axiom.Although a 1 , a 2 , and a 3 belong to the same ABox partition in the sense of [19], they do not belong to the same optimization problem partitioning.x a:C = new variable end if 34: end for 35: return L Example 4. Assume again that we want to retrieve the instances of a concept D. In more expressive languages with nominals, there is an additional rule called ∃ a [34] that adds a constraint of the form x a:{a} ⇒ (x a i :∃R.{a} ⇒ x (a i ,a):R ) ≥ 1 for each individual a i related to a.If there are two individuals a 1 , a 2 related via R to a 3 , x a 1 :D ; C x a 2 :D , because both of them are connected to x a:{a} .Therefore, C two_or_more is not empty.

Evaluation of the Instance Retrieval Algorithm
To evaluate our novel algorithms, we compare the new implementation of the instance retrieval algorithm with the previous algorithm implemented in the fuzzyDL ontology reasoner.In our implementation, we chose to merge C zero and C one , so if C two_or_more is empty, we only need to solve one optimization problem.Because fuzzyDL did not previously implement an algorithm for concept realization, the evaluation of that algorithm is left as future work.

Datasets
We firstly considered Fuzzy Beer, a fuzzy ontology with information about beers used in GimmeHop, a knowledge-based recommender system for mobile devices [7].Fuzzy Beer ontology is able to represent concepts (e.g., beer types or breweries), object properties (e.g., between beers and breweries), data properties (e.g., alcohol level ABV, color, or bitterness), instances (e.g., beers and countries), and fuzzy datatypes.In particular, Fuzzy Beer has 15,317 beer individuals.
Fuzzy datatypes are the only fuzzy element of the ontology, and make it possible to associate linguistic labels to some data properties.For instance, it is possible to define the fuzzy datatypes VeryLowAlcohol, LowAlcohol, NeutralAlcohol, HighAlcohol, and VeryHighAlcohol, as illustrated in Figure 1.Those fuzzy datatypes values were obtained using Datil [35], a software to learn fuzzy datatypes from real data using different clustering algorithms.Fuzzy Beer was originally developed in the language Fuzzy OWL 2 [36], which extends classical OWL 2 with OWL 2 annotations encoding the fuzzy information (only those parts that cannot be represented in OWL 2 using an XML-like syntax).For the experiments in this paper, we firstly translated the ontology into FDL format, the native syntax supported by fuzzyDL, using an existing parser [36].The parser discarded a few axioms that fuzzyDL was not able to support (one for each instance of the class Country), making it possible to deduce the country associated to a beer given the brewery associated to a beer, and the country associated to a brewery [7].
Because of the number of individuals, running time is very high.Indeed, the old approach takes several days to finish an instance retrieval query.Therefore, we restricted the run to several subsets of the Fuzzy Beer ontology, with different numbers of beers.In the following, we use Beer n to denote the subset of Fuzzy Beer with n beer individuals.Note that the number of individuals is higher than n, as there are also breweries and countries.
First, we solved Beer 500 20 times and studied the standard deviation.In particular, we repeated, 20 times, the process of randomly selecting a subset of Fuzzy Beer with 500 beers and solved the instance retrieval problem.The average, standard deviation, and coefficient of variation (or CV, defined as the ratio of the standard deviation to the mean) are shown in Table 5 for both the old and the new algorithm.The new algorithm has a slightly higher CV (6.6% versus 4.3%) but it is still rather stable.Therefore, for the rest of the fuzzy ontologies Beer i we just solved once the instance retrieval problem in order to decrease the time needed to finish our experiments.In Fuzzy Beer (and in its subsets Fuzzy Beer i ), C two_or_more is empty, so it is possible to solve the instance retrieval with a single optimization problem.However, we have considered a harder version, Fuzzy Beer h (with its corresponding subsets Beer h i ), with two additional axioms, stating the range of two object properties (brewedBy and country).
We also considered the 50 fuzzy ontologies in the Absorption dataset developed in [37].Although there are several fuzzy versions of each crisp ontology, we considered here fuzzy ontologies of the form l.66, with a semantics given by Łukasiewicz fuzzy logic and 66% fuzzy axioms.
To make the comparison fair, we slightly optimized the previous algorithm implemented in fuzzyDL.The existing approach simply looped over all concept assertion entailment problems, and for each of them expanded both the original fuzzy ABox and the new fuzzy concept assertions.However, we made sure that the original fuzzy ABox is expanded only the first time and a cloned copy was shared by the next tests.
All experiments were performed on a laptop computer with Intel Core i7-8550U 1.8 GHz, 16 GB RAM under Windows 7 64-bits.We used Java 1.8 and Gurobi 8.1.0build V8.1.0rc1(Academic License).In general, we randomly selected an atomic concept to retrieve their instances, but for Fuzzy Beer i we also considered a complex concept (the list of queries can be found in the Appendix.During our experiments, we set a timeout of six hours to solve the instance retrieval problem using the new algorithm (as the old seems to take more time).

Results
Table 6 shows the results for 15 fuzzy ontologies of the Absorption dataset.For each ontology we include the number of individuals, the running time (in seconds) of the previous algorithm (denoted Old), the running time (in s) of the novel algorithm (denoted New), and some optional observations.We can see that the new algorithm outperforms the previous one in the case of consistent ontologies.However, in inconsistent ontologies (process.l.66 and propreo.l.66), the old algorithm solves a simpler case (as it only needs to add a single axiom to find the inconsistency) and finishes faster.In general, all the partitions were independent, so C two_or_more was empty and it was enough to solve a single MILP problem.There were only two exceptions: FuzzyWine.l.66, and lubm.l.66.Table 7 shows some information about the fuzzy ontologies in the Absorption dataset that could not be considered: 29 ontologies did not have any individual and seven reached a timeout; in four cases the timeout was not surprising as there were more than 25,000 individuals.
Table 8 shows the results for the Fuzzy Beer i and Fuzzy Beer h i ontologies.In this case, we show the number of individuals, the running time (in s) for Beer i using the old algorithm and the new one, the running time (in s) for Beer h i using the new algorithm, and the number of objective dependent variables to solve Beer h i .The table does not include the number of variables to solve Beer i because C two_or_more was always empty and it was enough to solve a single MILP problem.Also, the table does not show the time needed by the old algorithm to solve Beer i because it is very similar to the time to solve the harder version Beer h i .We show the results for a query involving an atomic concept, but we also tried a complex concept obtaining a similar trend (see Appendix for details).
Similarly as for the Absorption dataset, we can observe that the new algorithm outperforms the previous one, and the improvement gets more spectacular as the number of individuals grows.This is illustrated in Figure 2. The three functions exhibit quadratic growth, but the new algorithms grow in a notably slower way.We can also observe that when it is possible to solve a single MILP problem (in Beer i ), the running time of the new algorithm is much smaller than in the harder case (Beer h i ).
Next, we did some experiments with inconsistent versions of the Beer i and Beer h i fuzzy ontologies, obtained by asserting that one the beer instances has two different alcohol levels.The results are shown in Table 9.We can see that the old algorithm is faster than the new one, as with the Absorption dataset.Furthermore, we can observe that the new algorithm performs similarly for Beer i and Beer h i .The reason is that although the hard versions of the ontologies require solving several optimization problems; after one of them is found to be inconsistent there is no need to solve the remaining ones.Furthermore, the problems solved by Beer h i are smaller than the single problem solved by Beer i .

Conclusions and Future Work
Fuzzy description logics, the formalism behind fuzzy ontologies, are an important mathematical method for many artificial intelligence scenarios requiring knowledge representation and automate reasoning.In this paper, we have proposed two specific algorithms to solve two important reasoning services given a fuzzy ontology, the instance retrieval and the realization problems.To the best of our knowledge, this is the first work not repeating a (best entailment degree) test for all individuals or concepts of the ontology.
Our approach is based on merging the optimization problems into three optimization problems according to the number of variables to be optimized: zero, one, or more than one.The key is that the first two problems can be solved just once.Furthermore, our experience shows that in practice, the latter problem is often empty, i.e., instance retrieval often leads to independent optimization problems that can be merged to be solved as a single problem.
It is worth noting that the results of [20] involve reasoning tasks where just one optimization problem needs to be solved.In such cases, splitting the optimization problem into several does not decrease, in general, the running time.In this paper, however, we address problems that require solving several (n) optimization problems.In realization, the basic algorithm requires as many tests as atomic concepts in the ontology; in instance retrieval, as many tests as individuals in the ontology.With our novel algorithm, we decrease the number of optimization problems, and in some particular cases we are able to solve a single one.
Our approach has been implemented in the fuzzyDL fuzzy ontology reasoner and we performed an empirical evaluation with several fuzzy ontologies, some of them with an important number of individuals.Our experiments confirm that our novel algorithm to compute instance retrieval outperforms the previous implementation in all cases involving consistent ontologies, and the reduction of the reasoning time is more important as the number of individuals in the ontology grows.Furthermore, in almost all cases, it was enough to solve a single optimization problem.However, in inconsistent ontologies, the basic algorithm finds the inconsistency faster.
In future work we would like to test the instance retrieval with more fuzzy ontologies, either real or artificial, with more dependent variables.In such cases, we would like to study the best strategy to solve the optimization problems (i.e., merging all problems in C two_or_more , solving all of them independently, or using a hybrid approach).Furthermore, we would like to implement and evaluate the realization algorithm as well.

Algorithm 1
Algorithm to compute the realization problem given a fuzzy ontology O. Input: A fuzzy ontology O and an individual a Output: A set of pairs individual-membership degree A 1 , α 1 , . . ., A n , α n 1: for each atomic concept A ∈ O do 2:

Algorithm 2
Algorithm to compute the instance retrieval problem given a fuzzy ontology O. Input: A fuzzy ontology O and a fuzzy concept C Output: A set of pairs individual-membership degree a 1 , α 1 , . . ., a n , α n 1: for each individual a ∈ O do 2:

Figure 1 .
Figure 1.Linguistic labels for the alcohol level data property.

Figure 2 .
Figure 2. Running time for subsets of the Fuzzy Beer ontology.
a 1 , a 2 ):R, C D}.A fuzzy interpretation I satisfies (is a model of) a fuzzy axiom τ = φ ≥ α , denoted I |= τ, iff φ I ≥ α.An interpretation satisfies (is a model of) a fuzzy ontology if it satisfies each axiom in it.A fuzzy ontology O entails an axiom τ, denoted O |= τ, if any model of O satisfies τ.

end if 29: for each
← number of variables x a:A ∈ C i 10: end for 11: C zero ← C i s.t.v[i] = 0 12: if C zero does not have a solution then C one ← C i s.t.v[i] = 1 16: if C one does not have a solution then Minimize z s.t.C one ∪ {z = ∑ x a:A } 20: for each solution x a:A in the model of the solution do C two_or_more ← (C \ C zero ) \ C one 26: if C two_or_more does not have a solution then x a:A ∈ C two_or_more do L ← L ∪ A, α α ← min x a:A s.t.C two_or_more 31: ← number of variables x a:C ∈ C i 10: end for 11: C zero ← C i s.t.v[i] = 0 12: if C zero does not have a solution then C one ← C i s.t.v[i] = 1 16: if C one does not have a solution then Minimize z s.t.C one ∪ {z = ∑ x a:C } 20: for each solution x a:C in the model of the solution do C two_or_more ← (C \ C zero ) \ C one 26: if C two_or_more does not have a solution then α ← min x a:C s.t.C two_or_more 31:

Table 5 .
Coefficient of variation for the Fuzzy Beer 500 ontology.

Table 6 .
Running time (s) for the Absorption dataset.

Table 8 .
Running time (s) for subsets of the Fuzzy Beer ontology.

Table 9 .
Running time (s) for subsets of the inconsistent Fuzzy Beer ontology.