org.deri.iris.api.querycontainment
Interface IQueryContainment

All Known Implementing Classes:
QueryContainment

public interface IQueryContainment

This interface defines a query containment check, i.e. a check for whether one query is contained within another query. The query containment is checked using the 'Frozen Facts' algorithm (This algorithm is presented in Ramakrishnan, R., Y. Sagiv, J. D. Ullman and M. Y. Vardi (1989). Proof-Tree Transformation Theorems and their Applications. 8th ACM Symposium on Principles of Database Systems, pp. 172 - 181, Philadelphia).

The query containment check can only be performed over positive queries that do not contain built-ins and disjunctions.

Example:
In the following Query1 is contained within Query2:
Program: vehicle(?x) :- car(?x).
Query1: car(?x).
Query2: vehicle(?x).

An implementation of this interface is supposed to get an implementation of the IProgram as input parameter and to produce a boolean value as output of the query containment check.

Author:
Nathalie Steinmetz, DERI Innsbruck

Method Summary
 boolean checkQueryContainment(IQuery query1, IQuery query2)
           Checks whether query1 is contained within query2.
 IRelation getContainmentMappings()
           Return the containment mappings that result from the containment check.
 List<IVariable> getVariableBindings()
          Return the variables from the query in 'execution' order.
 

Method Detail

checkQueryContainment

boolean checkQueryContainment(IQuery query1,
                              IQuery query2)
                              throws Exception

Checks whether query1 is contained within query2.

Parameters:
query1 - The query for which to check whether it is contained within query2.
query2 - The query for which to check whether it contains query1.
Returns:
True if query1 is contained within query2, otherwise false.
Throws:
Exception

getContainmentMappings

IRelation getContainmentMappings()

Return the containment mappings that result from the containment check.

Returns:
a set of substitutions resulting from the query containment check.

getVariableBindings

List<IVariable> getVariableBindings()
Return the variables from the query in 'execution' order.

Returns:
The variables in order.