SELECT S
2
.K, S
1
.B, COALESCE(S
2
.A
1
,S
1
.A
1
), ..,
COALESCE(S
2
.A
n
,S
1
.A
n
),S
2
.C
FROM S
1
LEFT OUTER JOIN S
2
ON S
1
.K = S
2
.K
The Prioritized Merge operator. The Prioritized
Merge operation S
1
S
2
, can be easily expressed by
means of an SQL statement, as follows:
SELECT S
1
.K, S
1
.B, COALESCE(S
1
.A
1
,S
2
.A
1
), ..,
COALESCE(S
1
.A
n
,S
2
.A
n
),S
2
.C
FROM S
1
LEFT OUTER JOIN S
2
ON S
1
.K = S
2
.K
UNION
SELECT S
2
.K, NULL(B),S
2
.A, S
2
.C
FROM S
2
,S
1
WHERE S
2
.K NOT IN (SELECT S
1
.K FROM S
1
)
6.2 Computing Consistent Answer
Given a query Q the computation of the consistent
answer, Consistent
Ans, is performed as follows:
i) firstly, the relation Ans, obtained by evaluating the
query Q over the (partial) repaired database and con-
taining both “certain” and “undefined” tuples is con-
structed; ii) secondly, the relation Inconsistent
Ans
containing the tuples of Ans which do not sat-
isfy some of the functional dependency involv-
ing attributes in Q, is constructed; iii) finally, the
Consistent
Ans, is carried out by selecting tuples
of Ans which are not in Inconsistent
Ans. Con-
sider, for instance, the Example 1 with the functional
dependency Name → Age, Salary and suppose to
perform a query asking for the name and the age of
Employees. The relation Ans is obtained by trivially
selecting Name and Age from Employee, whereas
the relation Inconsistent
Ans can be obtained by
means of the following SQL view:
CREATE VIEW Inconsistent Ans AS
SELECT Ans.∗ FROM Ans, Employee E
WHERE Ans.Name = E.Name
AND Ans.Age <>E.Age
The consistent answer, Consistent R, can be ob-
tained by means of the following SQL view:
CREATE VIEW Consistent Ans AS
SELECT ∗ FROM Ans
EXCEPT
SELECT ∗ FROM Inconsistent
Ans
REFERENCES
Abiteboul, S., Hull, R., Vianu, V. Foundations of Data-
bases. Addison-Wesley, 1994.
Agarwal, S., Keller, A. M., Wiederhold, G., Saraswat,
K., Flexible Relation: an Approach for Integrating
Data from Multiple, Possibly Inconsistent Databases.
ICDE, 1995.
Arenas, M., Bertossi, L., Chomicki, J., Consistent Query
Answers in Inconsistent Databases. Proc. PODS
1999, pp. 68–79, 1999.
Baral, C., Kraus, S., Minker, J., Combining Multiple
Knowledge Bases. IEEE-TKDE, 3(2): 208-220 (1991)
Breitbart, Y., Multidatabase interoperability. Sigmod
Record 19(3) (1990), 53–60.
Bry, F., Query Answering in Information System with In-
tegrity Constraints,IICIS, pp. 113-130, 1997.
Cali, A., Calvanese, D., De Giacomo, G., Lenzerini, M.,
Data Integration under Integrity Constraints. CAiSE,
pp. 262-279, 2002.
Dung, P. M. ,Integrating Data from Possibly Inconsistent
Databases. COOPIS, pp. 58-65, 1996.
Grant, J., Subrahmanian, V. S., Reasoning in Inconsistent
Knowledge Bases. IEEE-TKDE, 7(1): 177-189, 1995.
Greco, S., Zumpano, E., Querying Inconsistent Database
LPAR, pp. 308-325, 2000.
Greco, G., Greco, S., Zumpano, E., A Logic Programming
Approach to the Integration, Repairing and Querying
of Inconsistent Databases. ICLP pp. 348-364, 2001.
Greco, S., Pontieri, L., Zumpano, E., Integrating and Man-
aging Conflicting Data. Ershov Memorial Conference
pp. 349-362, 2001.
Levy, A., Rajaraman, A., Ordille, J., Querying heteroge-
neous nformation sources using source descriptions.
VLDB, pp. 251–262, 1996.
Lin, J., Mendelzon, A. O., Knowledge Base Merging by
Majority, in R. Pareschi and B. Fronhoefer (eds.), Dy-
namic Worlds, Kluwer, 1999. Kluwer, 1999.
Lin, J., A Semantics for Reasoning Consistently in the Pres-
ence of Inconsistency. AI, 86(1), pp. 75-95, 1996.
Lin, J., Integration of Weighted Knowledge Bases. Artificial
Intelligence, Vol. 83, No. 2, pages 363-378, 1996.
Pradhan, S., J. Minker, J., Subrahmanian, V.S., Combining
Databases with Prioritized Information JIIS, 4(3), pp.
231-260, 1995.
Subrahmanian, V. S., Amalgamating Knowledge Bases.
ACM-TODS, Vol. 19, No. 2, pp. 291-331, 1994.
Yan, L.L., Ozsu, M. T., Conflict Tolerant Queries in Aurora
Coopis, pp. 279-290, 1999.
Ullman, J. D., Principles of Database and Knowledge-
Base Systems, Vol. 1, Computer Science Pressingness,
1998.
Wiederhold, G., Mediators in the architecture of future
information systems. IEEE Computer 25(3): 38–49,
1992.
MERGING, REPAIRING AND QUERYING INCONSISTENT DATABASES WITH FUNCTIONAL AND INCLUSION
DEPENDENCIES
45