User Tools

Site Tools


magik-demo:school-usecase

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
magik-demo:school-usecase [2012/06/25 02:12]
cikm2012 [Example 4: TC-QC under Foreign Keys and Finite Domain Constraints]
magik-demo:school-usecase [2013/05/13 17:36]
admin removed
Line 12: Line 12:
 (meta-statements that states which parts of tables are certainly complete) (meta-statements that states which parts of tables are certainly complete)
  that hold over an instance  that hold over an instance
-of our school database, we can ask whether they entail that for+D, we can ask whether they entail that for
 a certain query Q the set of answers Q(D) is complete, that is, a certain query Q the set of answers Q(D) is complete, that is,
 whether Q(D) contains all answer records that one would expect if whether Q(D) contains all answer records that one would expect if
Line 29: Line 29:
 <code sql> <code sql>
 Q1=    SELECT p.name Q1=    SELECT p.name
-       ​FROM ​  pupila ​AS p+       ​FROM ​  pupil AS p
        ​WHERE ​ p.level='​1'​        ​WHERE ​ p.level='​1'​
 </​code>​ </​code>​
Line 79: Line 79:
 <code sql> <code sql>
 Q1=    SELECT p.name Q1=    SELECT p.name
-       ​FROM ​  pupila ​AS p+       ​FROM ​  pupil AS p
        ​WHERE ​ p.level='​1'​        ​WHERE ​ p.level='​1'​
 </​code>​ </​code>​
Line 99: Line 99:
 about the class ''​1b'',​ and to confirm it by adding the following TC-statement:​ about the class ''​1b'',​ and to confirm it by adding the following TC-statement:​
 <code sql> <code sql>
-TC4=   ​TABLE:​pupil(Name,1,b)  WHERE:+TC4=   ​TABLE:​pupil(P_Name,1,b)  WHERE:
 </​code>​ </​code>​
 We follow those instructions and we call {{:​magik-demo:​go.jpg?​nolink&​10| }}run query Q1, under the configuration of TC2,TC4 and FD1.  We follow those instructions and we call {{:​magik-demo:​go.jpg?​nolink&​10| }}run query Q1, under the configuration of TC2,TC4 and FD1. 
Line 190: Line 190:
 corresponding records in the ''​class''​ relation. Due to the FD1 this record has either ''​humanities''​ or ''​science''​ on the branch position. corresponding records in the ''​class''​ relation. Due to the FD1 this record has either ''​humanities''​ or ''​science''​ on the branch position.
 If the first is the case, then following TC8 the pupil record will exists in the available database. If the first is the case, then following TC8 the pupil record will exists in the available database.
-If the second is the case, then following ​TC89 the pupil record will exists in the available database again. +If the second is the case, then following ​TC9 the pupil record will exists in the available database again. 
-We {{:​magik-demo:​go.jpg?​nolink&​10| }} run query Q3 for the FK1, FD and TC4, and MAGIK inform us that +We {{:​magik-demo:​go.jpg?​nolink&​10| }} run query Q3 for FK1, FD2, TC8 and TC9, and MAGIK inform us that 
 {{:​magik-demo:​ok.jpg?​nolink&​10| }} <fc green> query is  complete</​fc>​. {{:​magik-demo:​ok.jpg?​nolink&​10| }} <fc green> query is  complete</​fc>​.
  
Line 228: Line 228:
  
 In addition to the standard SQL ''​select-project-join''​ queries, MAGIK allows use of ''​count(*)''​ and ''​GROUP BY''​. In addition to the standard SQL ''​select-project-join''​ queries, MAGIK allows use of ''​count(*)''​ and ''​GROUP BY''​.
-For example, a more elegant way of writing query Q5 can be:+For example, ​we can write a query, that prints the similar result as query Q5, but in a more elegant way:
 <code sql> <code sql>
 Q6=   ​SELECT ​  ​l1.name,​ count(*) AS number Q6=   ​SELECT ​  ​l1.name,​ count(*) AS number
Line 237: Line 237:
 </​code>​ </​code>​
  
-If we look at MAGIK suggestion ​for the query Q5 (the same for query Q6), MAGIK proposes to +Now, if we look at MAGIK suggestions ​for the query Q5 (the same will be for query Q6), MAGIK proposes to 
 to complete the learns tuples for the names of those pupils to complete the learns tuples for the names of those pupils
 who learn French: who learn French: