Fine-Grained Diagnostics of Ontologies with Assurance

This series is directed to diverse managerial professionals who are leading the transformation of individual domains by using expert information and domain knowledge to drive decision support systems (DSSs). The series offers a broad range of subjects addressed in specific areas such as health care, business management, banking, agriculture, environmental improvement, natural resource and spatial management, aviation administration, and hybrid applications of information technology aimed to interdisciplinary issues. This book series is composed of three volumes: Volume 1 consists of general concepts and methodology of DSSs; Volume 2 consists of applications of DSSs in the biomedical domain; Volume 3 consists of hybrid applications of DSSs in multidisciplinary domains. The book is shaped upon decision support strategies in the new infrastructure that assists the readers in full use of the creative technology to manipulate input data and to transform information into useful decisions for decision makers.


Introduction
Description logics (DL) is a class of logics for knowledge modeling, which are derived from semantic networks. Essentially they are to be understood as accessible fragments of predicate logic of first order, allowing strong expressions to be formulated. Other description logics permit strong (complex) expressions in a very compact representation. For description logics, there are special inputs and intuitive notation that facilitates the handling of them substantially. Modeling in expert systems is very important, especially in systems within highly complex domains where spatial and temporal data needs to be modeled. The ontology model permits the use of a reasoner that can check definitions of the statements in the ontology for consistency against each other. It can also recognize which concepts are the best for which definitions, pursuing an optimal solution in terms of size, speed, etc. This is particularly helpful when dealing with multiple classes hierarchies, therefore expert systems permit creating complex concepts from definitions of simpler ones. So, an ontology is an engineering artifact or is a formal representation of knowledge as a set of concepts within a domain, it often includes classification based information and constraints capturing the knowledge about the domain (cf. Kohler et al. (2003)). Rule-based systems are successfully applied across a lot of domains. The interest in ontologies has become stronger to develop a common rule base that could be computed by different rule engines. This effort has led to the development of several rule languages such as the rule markup language (RuleML), the semantic web rule language (SWRL), Metalog, ISO Prolog, and many others. Beside the weaknesses of SWRL are the weaknesses of the SPARQL protocol and RDF Query Language (SPARQL), where RDF is the acronym for resource description framework (see World Wide Web Consortium (2010)), to query an ontology, which requires the query writer to understand the data structure of the RDF resources. This understanding can be derived from eye parsing where sometimes the RDF or OWL ontology are large and the human being is not able to follow any more. This can become a major obstacle when debugging or extending an existing ontology. Other computing paradigms, such as constraint satisfaction, quantified boolean formulas (QBF), or first order logic (FOL), do not naturally offer the powerful expressive possibilities to define our knowledge database of to model the spatial and context models. In general the tasks posed in the constraint satisfaction paradigm are computationally intractable (NP-hard). 5 www.intechopen.com 2 Will-be-set-by-IN-TECH Thinking of real-time reasoning systems, the most challenging task is to provide decision support in competitive situations, which calls for fast and reliable decisions. Speaking about the quality of a decision, we can hardly hope to reliably forecast another entity's behavior during an interaction. This is due to different ontologies most likely residing in different agents, as well as other unexpected behavior of a human operator who decides to ignore the system's recommendation.

Assurance
In many situations, such as driving a car with an adaptive driving assistance system (ADAS), the situation at hand is not truly competitive, but equally sure not cooperative. Even if cooperative driving is intended by the individual assistance system (presuming those to be capable of vehicle-to-vehicle ad hoc networking), the ultimate decision lies with the driver, who can freely choose to obey or to ignore any recommendation. It follows that if we wish to assure a particular outcome tied to a recommendation, we have to consider the behavior of others as much as our own. Interestingly, concepts from game-theory do provide an elegant mean of having a guaranteed outcome regardless of what the other entities in the system do. These concepts have become known under the general term of security strategies (cf. Ghose & Prasad (1989)), and can effectively be carried over to the context of ontological reasoning. For the modeling, we shall assume an ontology with reasoning capabilities as a mere function taking some input values (constituting the query) to some recommendation (by performing internal reasoning). For illustrative purposes, let us take adaptive driving assistance as an example, stressing it whenever ideas or concept shall be exemplified. Suppose that the ADAS has been queried for driving directions, provides us with three alternative recommendations for guiding us to a given destination as fast as possible.
1. drive straight at high speed.
2. turn left at the next junction, speed can be moderate.
3. turn over with high speed.
The first recommendation may arise when the route is correct, but not necessarily the shortest one. The second advise may be appropriate if a faster route can be reached from the next junction, and the third statement could indicate an even shorter route provided that one immediately turns around. Having the additional objective that we seek to maximize safety, one can again use the ontology and reasoning capabilities to deduce the likelihood of an accident. Assume that the approaching traffic can either come at slow or fast speed, and is free to turn left, right or go straight. We cannot hope to correctly guess which one happens, so we seek the best possible outcome in this uncertain situation. The ontology plays a twofold role in the above scenario, as it can be used to 1. derive a recommendation for the next action, and to 2. assess the consequences that such an action might have.
While ontologies can do both, they are usually not explicitly designed to yield the "best" recommendation. Certainty factors, fuzzy reasoning and many other such approaches have been introduced to handle uncertainty, but a quantitative optimization of responses is mostly beyond the scope. Designing an ontology to provide us with both, • correct, and • provably optimal, recommendations is a hardly considered problem, and a solution proposal for it is the core contribution of this chapter. In the following, we discuss both problems separately, tackling the correctness issue with a refined form of diagnosis. Optimality of recommendation will be achieved with a post-processing step, to be described in section 4.

Ontological reasoning in practice
The most recent developments for ontology design is ontology web language (OWL), with its dialects OWL DL (particularly optimized for description logics) and OWL Lite. It has various sets of operators and it is based on different logical models which simplify the description of the concepts. The semantic web rule language is based on OWL DL, OWL Lite, and the Rule Markup Language (cf. Snidaro et al. (2008)). All rules are expressed in terms of OWL concepts (classes, properties, individuals). This means that rules can be used to extract new knowledge from existing OWL ontologies. Therefore complex rules must be transformed to the requirements of SWRL (cf. Matheus et al. (2005)). Also, there are no inference engines that fully support SWRL up to now. The first step in building a context model is to specify the desired system behavior. The developer then lists a set of possible scenarios, where each scenario is a relationship between entities to be observed. The requirements for modeling information contexts (cf. Fuchs (2008)): Applicability: The model must restrict the domain of application. Traceability: The model must provide support for recording of provenance and processing of information. Inference: The model should include tools that permit the definition of new contextual categories and facts on the basis of low-order context. Re-usability: The model should allow re-usability in other independent modeling tasks. Flexibility: The model should not be easily changeable to extend the ontology. Completeness: The model should cover all relevant concepts and properties. Redundancy: The model should not contain a lot of defined instances that have the same properties.
Context reasoning extends context information implicitly by introducing deduced context derived from other types of context. It is a perfect solution to resolve context inconsistency.
In the light of the key role that ontologies play in many applications, it is essential to provide tools and services to support users in designing and maintaining high quality ontologies. This calls for:  Wang et al. (2004)). However, the problem of the current rules and reasoning systems is that they do not offer high performance according the highly declarative way of the encoding of the problem and the execution time to find the "best" solution.
As an example the used semantic web rule language (SWRL) has no negation or disjunction and the arithmetic predicates which it offers are weak.

Obstacles in writing logical programs
Semantic web technology is widely used for reasoning and expert systems. Especially the use of SWRL to define relationships between classes and individuals in the ontology may cause major problems due to the long execution time of semantic web technology for querying the ontology (e.g. via SWRL and SPARQL). This is indeed a problem when creating practical expert systems ought to perform in real-time. Some existing paradigms as well suffer from negation as failure, which has been discussed by Matheus et al. (2005). Moreover, they not necessarily allow n-ary predicates within a rule. Going away from SWRL, we still require constraints, negation as failure, and expressive representation that are decidable and permit reasoning (efficiently). In particular, some logical programming languages do not offer arithmetic operations "built-in", and numeric constraints can affect decidability. Since reasoning (like done in the Prolog-language for instance), is often a recursive procedure, its complexity can become exponential and thus infeasible for even a medium-size ontology. Now, to avoid the weaknesses of the existing paradigms answer set programming (ASP) offers flexible and high performance reasoning. ASP is a declarative approach for modeling and solves search problems by representing them as logic programs.

Answer set programming
The importance of ASP lies in the fact that it provides meaning to logic programs with default negation "not". Many interesting applications exist in planning, reasoning about action, configuration, diagnosis, space shuttle control, spatial, temporal and probabilistic reasoning, constraint programming, etc. The Technical University of Vienna (TU-Wien) hosts a the research group "knowledge based systems", whose members are running a project on "Answer Set Programming for the Semantic Web". The goal of this project is research towards methods for providing advanced reasoning services in the context of the Semantic Web, using declarative knowledge representation and reasoning techniques (see Eiter et al. (2005)). A logic program in the language of AnsProlog (also known as A-Prolog) is a set of rules of the form: a 0 ← a 1 ,...,a m , not a m+1 , . . . , not a n where 0 m n, each a i is an atom of some propositional language and not represents negation-as-failure. A negation-as-failure literal (or naf-literal) has the form not a, where a is an atom. Given a rule of this form, the left and right hand sides are called the head and body, respectively. A rule may have either an empty head or an empty body, but not both. Rules with an empty head are called constraints, while those with an empty body are known as facts.
A definite rule is a rule which does not contain naf-literals, and a definite program is solely composed of definite rules (cf. Baral et al. (2010)). Let X be a set of ground atoms (i.e. all atoms constructed with the predicate in Herband base of a logic program). The body of a rule of the form (1) is satisfied by X if {a m+1 ,...,a n } X = ∅ and {a 1 ,...,a m }⊆X. A rule with a non-empty head is satisfied by X if either its body is not satisfied by X,ora 0 ∈ X. A constraint is satisfied by X if its body is not satisfied by X.
Since logic programs unify declarative and procedural representations of knowledge, one way to reason is by using Horn clauses, backward reasoning and selective linear definite clause (SLD) resolution. The reduct of a program is a possibility to generate answer sets. Given an arbitrary program, Π and a set of ground atoms, X, the reduct of Π w.r.t. X, Π X , is the definite program obtained from the set of all ground instances of Π by: 1. deleting all the rules that have a naf-literal not a in the body where a ∈ X, and 2. removing all naf-literals in the bodies of the remaining rules.
A set of ground atoms X is an answer set of a program Π, if it satisfies the following conditions: 1. If Π is a definite program, then X is a minimal set of atoms that satisfies all the rules in Π.
2. If Π is not a definite program, then X is the answer set of Π X . (Recall that Π X is a definite program, and its answer set is defined in the first item (cf. Baral et al. (2010)).
The other advantage of ASP is that the order of program rules does not matter and the order of subgoals in a rule is also not relevant. For an example, if we have the famous problem "3-colorability", where we have a map and we want to check whether 3 colors (blue, yellow and red) are sufficient to color a map. A map is represented by a graph, with facts about nodes and edges. Every vertex must be colored with exactly one color: Of course, we need to say what colors are: After running this program we will get all possible coloring cases to color the whole map with three different colors. The other advantage of ASP that the order of program rules does not a matter and the order of subgoals in a rule does not a matter also.

Logic programming with ordered disjunction
Logic programming can be extended to allow us to represent new options for problems in the head of the rules. ASP gives us this ability by the way of ordered disjunctions. Using ASP under specific conditions reasoning from most preferred answer sets gives optimal problem solutions. Through logical programs with ordered disjunction (LPODs), such as normal logic programs we are able to express incomplete and defeasible knowledge through the use of default negation, they allow us to represent performances among intended properties of problem solutions which depend on the current context. It is possible to use the degree of satisfaction of a rule to define a preference relation on answer sets. We will present an alternative on game-theoretic grounds in section 4. Brewka (2002) defines a rule as having

83
Fine-Grained Diagnostics of Ontologies with Assurance www.intechopen.com degree 1 under the following condition: when A is an answer set of P, then A satisfies all rules of P. For example, let us plan a vacation: Normally you prefer to go to Mallorca but also to Stockholm (denoted by the preference relation ≺). Usually people prefer Mallorca over Stockholm, unless it is hot. If it is hot Mallorca is preferred over Stockholm. In summer it is normally hot, but there are exceptions. If it is winter, then Mallorca is no long considered (cf. Brewka (2002)).
Without further information about the weather we obtain the single preferred answer set A 1 = {Stockholm}, there is no information that it might be hot, so rule 1 will determine preferences. A 1 satisfies all rules to degree 1. Now if we add a new fact summer, then the new answer set is {summer, hot, Mallorca}. If we add the literal hot, then the new answer set is {summer, ¬hot, Stockholm}. Finally, if we add the facts summer and rain. The single answer set is {summer, rain, hot, ¬Mallorca, Stockholm}, we see that it is not possible to satisfy all rules to degree 1. As in real life there are situations where the best options simply do not work out, there for LPODs are very well suited for representing problems where a certain choice has to be made. In general, using ASP we can optimize the solution we want to generate, we can improve the rules and define the constraints we are using to get the maximum optimization of the desired answer sets (solutions) (cf. Brewka (2002)). Assurance, as introduced in section 4, pursues similar goals.

Guess and check programs in answer set programming
Answer set programming (ASP) is widely used, expressing properties in NP (i.e. properties whose verification can be done in polynomial time), where answer sets of normal logic programs can be generated through solutions and polynomial time proofs for such properties.
The solution of such problems can be carried out in two steps: 1. Generate a candidate solution through a logic program 2. Check the solution by another logic program (cf. Eiter & Polleres (2006)) However, it is often not clear how to combine Π guess and Π check into a single program Π solve which solves the overall problem. If we simply take the union Π guess ∨ Π solve does not work, so we have to rewrite the program. Theoretical results prove that for problems with Σ P 2 complexity, it is required that Π check is rewritten into a disjunctive logic programΠ check such that the answer sets of Π solve = Π guess ∨ Π check yield the solutions of the problem, whereΠ check emulates the inconsistency check for Π check as a minimal model check, which is co-NP-complete for disjunctive programs. This becomes even more complicated by the fact thatΠ check must not crucially rely the use of negation, since it is essentially determined by the Π guess part. These difficulties can make rewriting Π check toΠ check a formidable and challenging task (cf. Eiter & Polleres (2006)). As an example, if we are talking about planning the problem to find a sequence of actions, which it takes the system from an initial state p 0 to a state p n , where the states are changing over the time. Conformant planning looks for a plan L which works under all contingencies cases that may be caused by incomplete information about the initial state and/or nondeterministic actions effects which is Σ P 2 under certain restrictions (see Eiter & Polleres (2006)). We consider the problem of the"fire alarm", we have an alarm that there is a fire in a building which is supported through a fire alarm system. Possible actions (states) of the system turn off the electricity and then to pump water. After just having turned off the electricity, it does not extinguish the fire, but only the pumping of water guarantees that it is really extinguished. Using the following guess and check programs fire guess and fire check respectively, we can compute a plan for extinguishing the fire by two actions, fire guess and fire check , the program fire guess guesses all candidate plans P = p 1 , p 2 , ..., p n using time points for action execution, while fire check checks whether any such plan P is conformant for the goal g = not extinguished (2) The final constraint eliminates a plan execution if it reaches the goal; thus, fire check has no answer set if the plan P is conformant. The program fire guess generates the answer set S = {time(0), time (1), turn of f (0), pump(1)} which corresponds to the (single) conformant plan {P = turn of f , pump} for goal not fired(2). Using the method fire guess and fire check can be integrated automatically into a single program fire solve = fire guess ∨fire check It has a single answer set, corresponding to the single conformant plan P = {turn of f , pump} as desired.
With these examples in mind, we now turn to the problem of diagnosing such ontologies. As should have become evident by now, spotting an error in a large-scale program is a challenging task. We deliver a solution that is flexible and can be implemented with widely standard components. In particular, our proposal does not require substantial changes to an 85 Fine-Grained Diagnostics of Ontologies with Assurance www.intechopen.com existing diagnostic engine, so it can be seen as an "add-on" or refinement of a debugging system.

Fine-grained axiom diagnosis
In order to generalize diagnostic methods to fine-grained axiom diagnosis, we review the concepts behind model-based diagnosis. This prepares the ground for the diagnostic algorithm that concludes this section. The workflow when designing and debugging an ontology is briefly sketched in figure 1. Our focus in this section will be on debugging. We assume the reader familiar with the resolution principle and predicate and propositional logic. For convenience, however, we will briefly review some basics and results before going into technical details (see (de Wolf & Nienhuys-Cheng, 1997, Chapter 2) for full details). Let ψ be a first-order logic formula. An interpretation of ψ is an assignment of the variables to values from a given domain, and an assignment of predicates over this domain to truth-values, such that ψ becomes true. We write lit(Σ) for the set of literals appearing in either a formula Σ or a set Σ of formulas. For a set of formulas Σ,amodel is an interpretation such that every ψ ∈ Σ is true. Let Σ be a set of formulas and let ψ be a formula. We say that Σ logically implies ψ, writing Σ |= ψ, if every model of Σ is also a model of ψ. For sets of formulas, we write Σ |= Γ,ifΣ |= ψ for every ψ ∈ Γ. A clause is basically a logical disjunction of literals. Let two clauses C 1 = L 1 ∨ ...∨ L m and C 2 = M 1 ∨ ...∨ M n be given and assume that there are two terms L i and M j that can be unified with each other such that L i = ¬M j . The resolvent of C 1 , C 2 is the expression C 1 ∨ C 2 , having the terms L i and M j omitted. For the upcoming results, it is not necessary to fully introduce the concept of clauses and resolution, and we will confine ourselves to the following informal example of resolution: assume that we know that Peter plays either chess or football (clause C 1 ). In addition, we know that he does not play chess (clause C 2 ). We conclude that he must play football (the resolvent is thus C 1 ∨ C 2 without the assertion of Peter playing chess). For a clause C, we say that it can be derived from a set Σ, if there is a finite sequence of clauses R 1 ,...,R n = C such that each clause R i is either in Σ or a resolvent of two (previous) clauses R j , R k with j, k < i. In that case, we write Σ ⊢ r C. Finally, we denote the empty clause as ⊥, and note that a set of sentences is inconsistent,i fi t models the empty clause. Hence, writing Σ |= ⊥ is equivalent to saying that a contradiction is derivable from Σ.

86
Efficient Decision Support Systems -Practice and Challenges From Current to Future www.intechopen.com Fine-Grained Diagnostics of Ontologies with Assurance 9

The general diagnosis problem
The theory of diagnosis as employed in this work is based on the seminal paper of Reiter (1987), with corrections made by Greiner et al. (1989). The method devised in the sequel proves axiom pinpointing to be a mere special case of standard diagnosis, except for some preprocessing. Hence, competing alternative approaches to the same problem, such as contrived by Schlobach & Cornet (2003) for instance, are technically interesting but come at the disadvantage of calling for intricate extensions to a diagnostic engine. Our approach comes at negligible additional computational cost, as we will need a parser for the axiom syntax (which cannot be avoided anyway).
To reason within an ontology is the process of deriving assertions about individuals from known facts and rules. Occasionally, we have certain facts and rules in φ that are undoubtedly correct and consistent, and we collect these in a set B ⊆ φ, calling it the consistent background theory. These are explicitly excluded from the diagnostic process. The remainder KB = φ \ B is the set of facts and rules that are subject to the diagnosis. An ontology is usually verified by testing it against positive and negative test-cases. Informally, a diagnosis D is a minimal set of components whose replacement will create a consistent ontology. This has been formally captured by Friedrich & Shchekotykhin (2005), and is clearly defined in where KB is an ontology, comprising a set of facts and rules to be diagnosed, B is a consistent set of facts and rules (called the background theory, and TC + and TC − are positive and negative test-cases. A diagnosis D ⊂ KB is a minimal set (in terms of the subset-relation) of sentences such that there is an extension EX, where EX is a set of logical sentences added to KB, such that Rephrasing this definition, in essence it states that by replacing the components in the diagnosis D with the components in EX makes the ontology φ consistent with every positive test-case and inconsistent with every negative test-case. Example: for illustration, consider the following example ontology: The inconsistency is revealed by the following reasoning, starting with A 1 as a known fact: from A 1 , we can deduce (among others) the assertion that A 3 holds true. This one in turn implies the validity of A 4 and A 5 via rule A 3 .Y e tA 4 tells that all individuals s enjoy property F, while A 5 implies that there is at least one individual that does not fall into the class F. This inconsistency is to be removed with the aid of diagnosis. The problem tackled in the following is motivated by the (initially made) observation that the process will not remain that simple in a real-life ontology. Facing very complicated axioms, the diagnostic algorithms inspired by the work of Reiter (1987), essentially provide rather coarse-grained pointers towards the error. We shall improve on this.
Computing a diagnosis relies on the concept of conflict sets as introduced by de Kleer (1976) and adapted by Reiter (1987). Given a diagnosis problem (KB, B, TC + , TC − ),aconflict set C ⊆ KB is such that C ∪ B is inconsistent (either by itself or with any of the test-cases). A conflict is said to be minimal, if no subset of C is a conflict. Computing conflict sets can be done 87 Fine-Grained Diagnostics of Ontologies with Assurance www.intechopen.com with a divide-and-conquer approach, and we refer the reader to the QUICKXPLAIN-algorithm by Junker (2004) for that matter.
Returning to the example, for illustrative purposes, one conflict for the ontology is found as: Removing the set C from the ontology makes everything consistent again. It is easy to construct examples where other conflicts can be found as well.
Computing a diagnosis then amounts to computing a hitting-set for the collection of all conflicts that exist within KB. This is basically theorem 4.4 in Reiter (1987). This is not surprising and easily justified intuitively: assume D to be a hitting-set for the set of minimal conflicts. Then retracting D from KB will reduce every conflict set by at least one element, thus destroying the conflict because those sets are minimal. Since this approach to diagnosis has seen widespread implementation and many appropriate systems are in place, we leave the details of the computation aside and concentrate on the problem of axiom pinpointing, which arises from a shortcoming of the so-far described method.

Pinpointing erroneous parts of an axiom
Despite the elegance of the existing diagnosis theory, its accuracy is limited to pointing towards entire axioms. Hence these can be rather complicated and lengthy, which makes the actual debugging process, i.e. finding the replacement EX (cf. definition 3.1) actually hard. Consequently, we would like to extend the scope of diagnosis to the smallest building blocks of the sentences within φ. This problem is known as axiom diagnosis. The trick is using the syntactical structure of a sentence to decompose a complicated axiom into a sequence of simple axioms representing only single logical connectives, quantifiers, etc. We will call this an irreducible decomposition, and the whole process of axiom pinpointing then boils down to diagnosing such an irreducible decomposition of the axiom to be debugged. We will expand the details in this section, strongly drawing from the work of Friedrich et al. (2006), whilst presenting further theoretical results that do not appear in this reference. To ease technicalities in the following, we need two technical yet mild assumptions: • axioms obey a non-ambiguous formal grammar G, such that every application of a production rule produces only one new logical connective or quantifier in each step of the derivation. We denote the language induced by the grammar G as L(G), and assume A∈L(G) for every axiom A, i.e. it is generated by G in a non-ambiguous manner. Although the ambiguity decision problem is undecidable for general grammars, those permitting disambiguation by lookahead tokens are provably unambiguous and thus suitable for our needs.
• the open world assumption states that a proposition is true if it can be proven, and assumed to be false if it can be disproved. Any non-present proposition remains unknown until proven to be true or false. In other words, reasoning under the open-world assumption demands first making choices before deducing anything.
Our first result formally captures the observation that the parse-tree of an axiom naturally yields a decomposition that only consists of axioms of the simplest possible form. Let A be an axiom with its associated parse-tree. As an example, the axiom A → (B ∧ C) ∨ D can be decomposed into In this sense, an "atomic" axiom in the above sense, i.e. an axiom A for which the set ζ(A) is singleton, is said to be irreducible. For example, the formula A ∧ B is irreducible, as it involves only a single connective between two literals. On the contrary, the formula A →∃ x : p(x) ∧ q(x) involves a quantifier, an implication and two unary predicates, and is therefore reducible. This formula can be decomposed into which is a set of irreducible axioms. For sets C of axioms, we define ζ(C)= A∈C ζ(A). Such a decomposition is called irreducible, if each of its elements is irreducible. For example, the statement is irreducibly decomposed into the set ζ being In the light of these considerations, the next result is immediately clear: Lemma 3.1. Let G be a non-ambiguous grammar satisfying the assumption above, and let A denote an axiom in L(G). Then there is a unique set of axioms of the form p(X, Y 1 ,...,Y n ), where p is a logical connective or a quantifier, and X, Y 1 ,...,Y n are literals.

We denote the decomposition implied by the lemma 3.1 by ζ(A). It is quite obvious that ζ(A)
is logically equivalent to A, as we can recover A by back-substituting the literals, which is equivalent to stating that ζ(A) |= A and vice versa. To ease notation, for logical implications or equivalences like A : X → p(Y 1 ,...,Y n ) or A : X ≡ p(Y 1 ,...,Y n ), we write lhs(A) to denote the set {X}, and rhs(A) to collect all literals appearing on the right-hand side of A, i.e. rhs(A)={Y 1 ,...,Y n }. Returning to the example above, we would have lhs(X 0 → X 1 )={X 0 } and rhs(X 0 → X 1 )={X 1 }. For a set C of axioms, we set lhs(C)= A∈C lhs(A). The symbol rhs(C) is defined analogously. As a mere technical tool, we introduce a graphic representation of the structure of an axiom. It is closely related to the concept of parse-trees: Definition 3.2 (structure graph). Let ζ(A) be an irreducible decomposition of an axiom. The vertices of the structure graph G s A are given by V(G s A )=lhs(ζ(A)), i.e. the vertices are the names of all axioms that appear in ζ(A). The graph has an edge between two axioms A i and A j , if and only if rhs Graphically, the decomposition (2) would look like shown in figure 2. The vertices of the structure graph are given by lhs(ζ)={X 0 ,...,X 10 }, reading off the left-hand sides from the decomposition (2). An arc is present between two vertices, if they appear on different sides of the corresponding axiom, i.e. X 0 and X 1 are connected because the decomposition contains the rule "X 0 → X 1 ". This provides us with an adequate tool for simplifying axioms before putting it to the diagnosis. Indeed, the structure graph's connectivity can be related to logical inconsistency:  Proof. By construction, an irreducible axiom decomposition is tree-structured, so let X 0 denote the top-level literal. Assume the proposition to be false: Let C be a minimal conflict and let the corresponding structure graph be disconnected, having two non-empty connectivity components C 1 and C 2 (C = C 1 ∪ C 2 ). Let S, S 1 and S 2 be standard forms of B, C 1 and C 2 , respectively. Then, by (de Wolf & Nienhuys-Cheng, 1997, theorem 5.20), we have B∪C |= ⊥⇐ ⇒S ∪ S 1 ∪ S 2 ⊢ r ⊥.

By definition, this is the case if and only if
Since C is a minimal conflict, B∪C 1 is consistent as well as B∪C 2 . Hence, we cannot have both R 1 and R 2 derivable from the same connectivity component, say C 1 , for otherwise S ∪ S 1 ⊢ r {R 1 , R 2 } ⊢ r ⊥ and therefore B∪C 1 |= ⊥ by (de Wolf & Nienhuys-Cheng, 1997, theorem 4.39). This would mean that C 1 is a smaller conflict set than C, contradicting the minimality of C. So assume without loss of generality that S ∪ S 1 ⊢ r R 1 and S ∪ S 2 ⊢ r R 2 . (3) By construction, there must be a sequence R ′ 1 , R ′ 2 ,...,R ′ n ≡ R 1 with R ′ i ∈ S ∪ S 1 or R ′ i a resolvent of R ′ p , R ′ q for p, q < i. Since B is consistent, S ⊢ r R 1 and there must be an R ′ j so that a (leaf-)literal L 1 in S 1 occurs in R ′ j , as no set of interior literals can solely contribute to the derivation of R 1 . Hence we must have a path from X 0 to X k ≡ L 1 by our assumptions on the grammar and the method of construction, for otherwise X k (and therefore L 1 ) would not occur anywhere during the inference. The same argument applies for the derivation of R 2 from B∪C 2 , so any inference giving {R 1 , R 2 } necessarily induces paths from X 0 to the node X k ≡ L 1 ∈ lit(R ′ 1 , R ′ 2 ,...,R 1 ) and from X 0 to X l ≡ L 2 ∈ lit(R ′′ 1 , R ′′ 2 ,...,R 2 ).Y e tX 0 ∈ C 1 (without loss of generality), and C 1 is not connected to C 2 in the structure graph, so the path from X 0 to X l does not exist. This contradicts (3) and completes the proof.
Based on the previous result, we can state an interesting criterion that permits further minimizing conflict sets in terms of literals, even when they are already minimal in terms of set inclusion. Proposition 3.3 ( (Rass, 2005, Lemma 5.3.4)). Let K be a knowledge-base and C be a minimal and irreducible conflict-set, and let A∈C be an axiom involving the literals X, Y 1 ,...,Y n . Then X can be removed without loosing the minimality or inconsistency if, and only if, Proof. ("if") Let C = {A 1 ,...,A n } be inconsistent, that is B ∪ C |= ⊥ for some consistent background theory B. Without loss of generality, we assume A 1 : p(...,X,...) to be the axiom that shall be simplified by removing X. Then it is clear that Since the literal X neither appears on the left-hand side of any axiom nor anywhere else in the knowledge-base, we do not have any specification or information on it. Thus, by the open-world assumption, equation (4) does especially hold if we assume an arbitrary but fixed value c for X. Let c be the neutral element for the operator p (which would be false if p = ∨ or true if p = ∧, respectively). By setting X ≡ c we get which can be rewritten as 1 being the axiom A 1 having X removed. If C is minimal, then so is (C \ {A 1 }) ∪ A * 1 , because removing A * 1 results in the set C \ {A 1 }, which is consistent due to the minimality of C. ("only if") we show that removing a literal in (rhs(C) \ lhs(C)) ∩ lit(K) = rhs(C) ∪ lhs(C) ∪ lit(K) destroys either the conflict or the minimality: by the construction of an irreducible decomposition as used in lemma 3.1, the structure graph induced by C is a tree. Assume the existence of another axiom A k : X ≡ q(...) ∈ C and that the set is still a minimal conflict after having removed X from the right hand side of A 1 . However, if we do so, then the edge between A 1 and A k disappears and the tree breaks up into two non-connected components. By lemma 3.2, the resulting set is not a minimal conflict any more, thus contradicting our assumption. Furthermore, we cannot remove any literal L ∈ lit(K), because the construction employed by lemma 3.1 implies that all axioms having L appear on their right hand side are of the form Y ≡ L. This does not involve any operator so no further simplification is possible.
Example: for illustrating the last result, take the set of three (inconsistent) rules They form a minimal conflict set for some axiom decomposition. The literal X 4 appears on the right-hand sides of C, but not on the left-hand side, since we have lhs(C)={X 1 , X 2 , X 3 } 91 Fine-Grained Diagnostics of Ontologies with Assurance www.intechopen.com and rhs(C)={X 2 , X 3 , X 4 , B}. Since the literals X i were auxiliary and introduced merely for the decomposition, the literal X 4 can be unhesitatingly deleted. This results in a simplified set which is still inconsistent for the same reasons as C is.

The axiom diagnosis algorithm
With all these preliminaries, the axiom pinpointing algorithm is essentially a standard diagnosis with preprocessing. It comprises two stages: 1. Decompose the given set of axioms A 1 ,...,A n irreducibly into the set KB = n i=1 ζ(A i ).

Run a standard diagnosis on KB.
It is known that diagnosis is a computationally hard problem (due to the need of reasoning for computing the conflict sets and the computation of hitting sets, which is an NP-complete problem in general Garey & Johnson (1979)). While the algorithm above has been stated previously in Friedrich et al. (2006), this preliminary work does not exploit the potential simplification provided by proposition 3.3, by instantly drawing away the attention from literals that cannot contribute to the inconsistency. The idea of decomposing an axiom into (irreducible) sub-axioms permits controlling the granularity as well as the scope of the diagnosis most easily.

Controlling the granularity:
We are free to define the production rules of the underlying grammar in such a way that more complicated axioms can be generated in one blow. A simpler, yet equally effective, approach is backsubstituting a selection of irreducible axioms, thus creating more complicated expressions, yet remaining structurally simpler than the original axiom. Returning to the previous example, one could backsubstitute some of the axioms in the decomposition (2) in order to obtain the (logically equivalent but less fine-grained) decomposition Diagnosing the latter decomposition obviously provides us with less precise information than diagnosing the full decomposition (2).

Controlling the scope:
If some parts of the axiom are correct beyond doubt, then we can simply shift these to the background theory B when running the diagnostic engine. Hence, the scope comprises all axioms in KB, explicitly excluding those in B.
Example: Reiter's diagnostic algorithm, when applied to the example ontology given in section 3.1 returns the following three diagnoses: which just says that we may change one of three axioms in order to achieve a repair. Taking the first of these diagnoses D 1 and performing axiom-diagnosis on a decomposition of the axiom provides us with the following diagnoses (among others): • X 4 ≡ A 5 : This directly points at something wrong with the literal A 5 in the axiom. Indeed, A 5 permits deriving the expression ∃s : ¬F which yields an inconsistency in connection with ∀s : F (derived via A 4 ).
• X 2 ≡ X 3 ∧ X 4 : This points at the ∧-operator as possible flaw. This is correct, since if we replace the ∧ by a ∨, we can easily avoid the inconsistency. Moreover, the diagnosis showed that both arguments of the ∧ are necessary for the inconsistency, which is also correct as we have to be able to conclude A 4 and A 5 from A 3 to be inconsistent.
Notice the appeal of this form of refined diagnosis, as the precise location of the error is actually marked with an "X". By then, it is up to the human engineer to do the repair properly.

Assurance
Suppose that an ontology upon receiving the query has presented us with a number of, say n 1 , answers from which we can choose one. From the viewpoint of the ontology, each answer is logically correct, and in the absence of preferences, certainty factors, or other means of selection, we can only choose the best one subjectively. The goal of assurance is making this decision with a provable benefit. For that matter, we briefly introduce some elements from the theory of games, which will become handy when putting things together to a reasoning engine with assurance. The reader familiar with matrix games may safely skip section 4.1, and move on to section 4.2 directly.

Matrix-games
Although we will use the general definition here, our application use of game-theory will be with 2-player games, with player 1 being the user of the ontology, and player 2 being the whole set of remaining entities outside the user's scope. A (Nash-)equilibrium is a choice s * =(s * 1 ,...,s * n ) such that and for all i ∈ N, i.e. if any of the players solely chooses an action other than s * i , his revenue will decrease. It is easy to construct examples where equilibria are not existing among the pure strategies in PS i . But, if strategies are understood as probabilities for taking certain actions during repetitions of the game, then Glicksberg (1952) has proven that equilibria exist for every game with continuous payoff functions. In that case, the payoff is averaged over the repetitions of the game, i.e. we consider the expected payoff. Strategies which are interpreted as probability distributions over the sets in PS are called mixed strategies, and we shall exclusively refer to these in the sequel. The set S i consists of all mixed strategies over PS i . A game is called zero-sum,if∑ i u i = 0, or in the two-person case, if u 1 = −u 2 . The game is called finite, if the sets in PS are all finite. For a finite zero-sum game Γ 0 , the average revenue under an equilibrium strategy is the value of the game, denoted as v(Γ 0 )=max x min y x T Ay. How is this related to our above reasoning problem? Player 1 will be the user of the ontology, and player 2 will be the collection of all other agents in the system. The use of zero-sum games is convenient because it implicitly (and perhaps pessimistically) assumes the other agents to 93 Fine-Grained Diagnostics of Ontologies with Assurance www.intechopen.com cooperate with each other so that they can cause as much harm to player 1 as possible. Of course, this assumption is dramatic and most surely not correct, but as we seek to assure the quality of decisions against all scenarios, it turns out as a sharp worst-case scenario sketch. This is made explicit in the following result: Proposition 4.1 (Rass & Schartner (2009)). Let Γ =( N, PS, H) with N = {1, 2}, PS = {PS 1 , PS 2 }, and H = x T Ay, x T By ) be a bi-matrix game with game-matrices A ∈ R |PS1|×|PS2| , B ∈ R |PS2|×|PS1| for player 1 (honest) and player 2 (adversary), respectively. Let Γ 0 = (N, PS, x T Ay, x T (−A)y ) be the zero-sum game from player 1's perspective (i.e. player 2 receives the payoff −x T Ay), and let v(Γ 0 ) denote its value (i.e. average outcome under a Nash-equilibrium strategy in Γ 0 ). Then v(Γ 0 ) ≤ (x * ) T Ay * for all Nash-equilibria (x * , y * ) of the game Γ.
The proof is by simply observing that player 2 can either play the zero-sum strategy of Γ 0 (in this case the assumption is valid and we get equality in (5)) or act according to his own wishes.
In the latter case, he necessarily deviates from the zero-sum strategy and thus increases the expected revenue for player 1.

Reasoning games
The observation that a zero-sum game soundly models a worst-case scenario from one player's point of view (proposition 4.1) leads to a simple way of assuring the quality of a decision: whenever we are facing random behavior, proposition 4.1 permits calculating the worst-case distribution and provides us with a behaviorial rule so that we get an assured outcome under this worst imaginable scenario. This is what we call Assurance: when facing an uncertain situation, our recommendation should be such that it provides a guaranteed outcome, independently of how much the observed behavior deviates from the assumptions under which a decision was made.
Proposition 4.1 is the key to do this, and the process is made rigorous after the following Example: let us return to the introductory example sketched in section 1.1. We now invoke the game-theory and the (properly debugged) ontology to get the best answer from the three candidates. ontology classifies the accident likelihood in discrete terms like "none" (value 0), "negligible" (value 1) and "significant" (value 2), then the resulting matrix A could look like Solving this game for its equilibrium value gives v(A)=0.5 with equilibrium strategies x * =( 1/2, 1/2, 0) and y * =( 1/2, 0, 1/2, 0, 0, 0). Observe that this indicates that -aiming at maximal safety -we should never be advised to turn over, and can take either of the remaining choices with equal probability. Following this rule, we end up having a less than negligible chance (the value is 0.5 and as such strictly less than the negligible-value 1) of having an accident. This process can be repeated for different scenarios, but crucially hinges on the ontology to be correct and perform reasoning efficiently. Each query to the system yields a different matrix-game with strategy sets PS 1 , PS 2 , with its own unique Nash-equilibrium solution (which can as well be pre-computed). The actual recommendation provided to the user is a random selection from PS 1 , where the particular choice is drawn from the equilibrium profile. This solution, among the valid alternatives, is presented as the recommendation, along with possible alternatives that are not explicitly recommended but possible. This method is indeed computationally feasible, as a large set of possible games along with their corresponding Nash-equilibria can be pre-computed and stored for later usage in a game-database (indeed, all we need is the strategy set PS 1 and the corresponding Nash-equilibrium; the game matrix itself can be discarded). If the input parameters are discrete, then the set of queries is finite and hence the number of such games remains tractable. This is even more substantiated by the fact that a human operator will most likely not enter more than a few parameters as well as these will not be entered at arbitrary precision. As humans tend to reason in fuzzy terms, any natural mapping of these to parameters of a query answering system will consist of a small number of inputs to specify within small ranges to get an answer. The ontology is then used to select the particular game at hand and provide the best behavior under uncertain behavior of others. The overall workflow is depicted in figure 3. The only block to be further explained in this picture is the sampler, drawing the concrete recommendation from the set of possible ones according to the Nash-equilibrium. This is a trivial task, as it amounts to sampling from a discrete probability distribution. We refer the interested reader to Gibbons (1992) for a formal justification, as we will restrict our presentation to giving the sampling algorithm: assume that a discrete distribution is given by (p 1 ,...,p n ).
2. Find and return (as the result) the smallest integer k such that x ≤ ∑ k i=1 p i . So the overall process of reasoning with assurance can be described in a sequence of simple steps, presupposing a logically consistent ontology: 1. Unless the current query is found in the set of pre-computed ones, 2. generate the set of candidate recommendations,  (2008)) 3. set up a game-matrix and solve for its equilibrium, 4. sample from the equilibrium profile and return the (so randomly selected) recommendation to the user.
From this process, it is evident that ontology and query optimization are major concerns, and therefore receive attention in the next section.

Maximizing reasoning performance
Optimization is the act of design and developing systems to take maximum advantage of the resources available. Ontology optimization formally defines the vocabularies in describing optimization methods and their configurations aiming to provide knowledge guidance in optimization selection and configuration Tao et al. (2004). Query optimization over an ontology consider the possible query plans to determine which of those plans will be most efficient. An ASP system usually consists of a grounder a grounder and a solver (see figure 4). First, a grounder translate A logic program in the language of AnsProlog s a non-ground problem description into a propositional program, which can be processed by the second component of the system, the solver (cf. Gebser (2008)). There are algorithms that can be used for an effective optimization strategy for queries on knowledge databases query optimization. One of the hardest problems in query optimization is the accurate estimation of the costs of alternative query plans. Cardinality estimation depend on estimates of the selection factor of predicates in the query. The estimation of the cardinality of a query usually is used to approximate the data transfer times of the result set, as part of the estimation of the total cost of executing a query (cf. Gebser (2008)). As an example a maximal complete query pattern path consists of a maximal query pattern path and a set of value constraints (cf. Shironoshita et al. (2007)). The total cardinality of such a path is obtained by calculating the product of the cardinality estimate of its maximal query path with all the value ratios for every variable in the query pattern path (cf. Shironoshita et al. (2007)).
In a highly distributed architecture where data in different locations connected through the internet, this is the most critical aspect of query execution time and the speed of the connections and the amount of data plays an important role. A query optimization strategy is crucial to obtain reasonable performance over queries against ontology data models, especially if they are done over a highly distributed architecture. However, using the answer set programming paradigm, we are able to model the spatial and temporal context models and define the relationships between classes and individuals (rules) and generating the answer sets using advanced solvers that support binder splitting, backjumping and all other features. The statements can be optimized to find the maximal or the minimal answer set of the logic program. The statement can be weighted or not, therefore weights can be omitted. If there are several minimize maximize statements in the logic program the latter will be preferred. The difference between the performance of ASP solvers and other existed ontology query languages is clearly high.The estimation of the cardinality of a query usually is used to approximate the data transfer times of the result set, as part of the estimation of the total cost of executing a query.

Conclusion
In the light of the growing importance and complexity of nowadays ontologies, tools that support debugging of reasoning systems are as well an increasing demand. In many cases, particularly for legacy systems, complex rules and facts that contribute to an inconsistency can present themselves as mere "black-boxes" to the human engineer. Fine-grained diagnosis targets at turning such black-boxes into white-boxes by enhancing the accuracy of the diagnosis up to the smallest grammatical construct that the language permits. Even if an ontology is consistent, the user should not be overloaded with (logically correct) answers, without a tool for choosing among them. Besides taking the degree of satisfaction as a selection criterion, the concept of assurance yields answers that are provably optimal according to a user-definable goal. Hence, we can have the ontology give us the answer that will maximize the benefit for the user. The process is cyclic in the sense that assurance hinges on consistency and vice versa. Moreover, retrieving answers timely calls for optimization, which in turn can make rules and facts even more complicated, again calling for fine-grained diagnostics. This chapter is hoped to provide useful starting points to enter this (implicit) cycle at any point for future research.