The SWKMServices: The Diff Service.
About the Comparison (Diff) Service.
The Comparison Service is responsible for comparing two collections of name or graph spaces (KBs) already stored in the repository and compute their delta in an appropriate form. The result of the comparison is a "delta" (or "diff") describing the differences between the two collections of name or graph spaces, i.e., the change(s) that should be applied upon the first in order to get to the second (see Figure 5.1 for an example). The intended use of the service is the comparison of two different versions of the same name or graph space to identify their differences; comparing unrelated name or graph spaces (i.e., name or graph spaces which are not different versions of the same name or graph space) would give results which have no intuitive meaning.
Figure 5.1: Comparing two name spaces
This problem is related to the problem of evolution that is handled by the Change Service; in the case of the Change Service, we know the original conceptualization and the changes that occurred, and want to determine the most adequate new conceptualization of the domain; in the case of the Comparison Service, we know the old and the new conceptualization of the domain, but lack the knowledge (control or access) of what caused the transition (i.e., we would like to determine what forced us to change our conceptualization).
Notice that the problem of comparing two name or graph spaces is very different from the problem of comparing the source files (e.g., TRIG files) which describe them. This is true because
It is clear by the above analysis that the comparison should be based on semantic, rather than syntactic considerations, so the comparison service will be based on the comparison of the triples contained in the name or graph spaces. There are alternative methods for computing a semantic delta between name or graph spaces. In particular, the implicit knowledge (i.e., the inferred triples) contained in the two name or graph spaces may or may not be taken into account, leading to the following four cases:
In the above bullets the operator C(.) stands for the consequence operator, which is a function producing all the consequences (implications) of a name or graph space K, i.e., all the inferred triples of K. In the example in Figure 5.1 , only the explicit knowledge is taken into account in the comparison, so the shown result corresponds to Δe. If the implicit knowledge was also taken into account, the result would be different (e.g., Δc, Δd and Δdc, would not report the addition of the [C IsA A] triple).
One of the main properties that we intuitively expect to hold in a comparison function is that its output, when applied upon the first name or graph space, should give the second; this property is called correctness. In order to study which of the four delta functions guarantees correctness, we should first determine what it means for the output of the diff service to be "applied" upon the first name or graph space. The latter issue is related to the semantics of the update operations considered, i.e., a formal description of how the output of the diff should be "applied" upon the name or graph space.
There are three options in this respect, namely: (a) that the operations (additions and deletions of triples) that are included in the delta are viewed as plain set additions and deletions (plain semantics - Up); (b) that they are coupled with redundancy elimination and computation of logical implications (inference and reduction semantics - Uir); or (c) that they are handled using the change semantics introduced by the Change Service (change service semantics - Ucs).
Using this definition of update semantics, in this paper it was shown that only certain pairs of delta functions with update semantics are correct, namely: (Δe,Up), (Δdc,Uir) and (Δc,Uir). Most existing comparison tools rely on the (Δe,Up) pair. If we consider the update semantics Ucs, then the Δc function guarantees correctness, so (Δc,Ucs) is also correct. Based on this result, we can guarantee that the output of the Comparison Service is compatible with the Change Service, i.e., that the output of the Comparison Service (under the Δc function) is a set of primitive update operations which, if applied (using the Change or Update Service) to the first name or graph space, would result to the second one.
Another critical consideration is related to the size of the delta; in this respect, delta dense (Δd) is best, compared to any other delta function, whereas Δdc gives smaller in size delta than Δc; on the other hand, Δc and Δe are incomparable. Notice however that, as we saw above, Δd (the smallest possible delta) does not guarantee correctness.
In out implementation, we don't adopt any particular policy regarding the "correct" or "best" delta function; in particular, the delta function to be used is just a parameter of the service, and the caller is assumed to understand the implications of using any particular delta function.

Figure 5.2: The Comparison Service
Figure 5.2 shows the general architecture of the web service of diff. As shown in the figure, the Comparison Service exposes a single service which is used to compare two collections of name or graph spaces and return their delta (diff) according to the selected delta function. The corresponding programming interface may be found here.
Last modified: September 22, 2008