User Tools

Site Tools


magik-demo:user:query_approximation:generalization

This is an old revision of the document!


A PCRE internal error occured. This might be caused by a faulty plugin

====== Generalization ====== After the elaboration MAGIK, will answer if the query given by the user, is complete or not with respect to schema constraints and TC-statements. If it is not complete, MAGIK will try to generate the generalized and specialized query. In this page it is explained how works the generalization algorithm. {{ :magik-demo:user:query_approximation:generalization.png?nolink&650 |}} This schema illustrates all the steps that the generalization algorithm does. In order to be more comprehensive, we will use and example. Suppose that: <code sql> Q = A1, A2, A3, A4 </code> where A1, A2, A3 and A4 are atoms and we have these TC-statements <code sql> TC1 - A1(a) = A1(i) TC2 - A2(a) = A2(i), A3(i) TC3 - A3(a) = A3(i), A4(i) </code> Running MAGIK on this query and given database schema and TC-statements, we get that this query is <fc red>NOT COMPLETE</fc> At this point the generalization algorithm enter in action.\\ The idea is at each iteration remove all the incomplete atoms. The algorithm will stop if there is no other atoms that are incomplete (we said that it reaches a **fixed point**). ** 1st iteration ** Looking the 3 tc-statements that we have, we see that there is no information about A4 (you have to look on the left side of the equal) so, the algorithm removes from the query the atom A4. New query is <code> Q1 = A1, A2, A3. </code> Obviously Q1 is not equal to Q, so the algorithm will start another iteration. ---- ** 2nd iteration ** Looking TC3 we have that the right part cannot be satisfied because we A4. Because of this, A3 will be removed from the query

magik-demo/user/query_approximation/generalization.1374585568.txt.gz · Last modified: 2017/07/06 15:24 (external edit)