Order in Datalog with Applications to Declarative Output 1
Order in Datalog with Applications to Declarative Output
Stefan Brass University of Halle, Germany
Stefan Brass Datalog 2.0, 11.09.2012
Order in Datalog with Applications to Declarative Output Stefan - - PowerPoint PPT Presentation
Order in Datalog with Applications to Declarative Output 1 Order in Datalog with Applications to Declarative Output Stefan Brass University of Halle, Germany Stefan Brass Datalog 2.0, 11.09.2012 Order in Datalog with Applications to
Order in Datalog with Applications to Declarative Output 1
Stefan Brass Datalog 2.0, 11.09.2012
Order in Datalog with Applications to Declarative Output 2
✬ ✫ ✩ ✪
Stefan Brass Datalog 2.0, 11.09.2012
Order in Datalog with Applications to Declarative Output 3
That turned out to be no “quantum leap”.
SQL is declarative, but lacks the programming part. Therefore, data- base applications are developed today using a mixture of languages, e.g. a combination with PHP or other non-declarative languages. Stefan Brass Datalog 2.0, 11.09.2012
Order in Datalog with Applications to Declarative Output 4
In this way they differ from programs that do a complicated computa- tion and then print a short result. For such programs, a non-declarative solution for output might be ok. For database applications, it is not.
Therefore actions, such as output, should be done in the head.
Stefan Brass Datalog 2.0, 11.09.2012
Order in Datalog with Applications to Declarative Output 5
Stefan Brass Datalog 2.0, 11.09.2012
Order in Datalog with Applications to Declarative Output 6
Stefan Brass Datalog 2.0, 11.09.2012
Order in Datalog with Applications to Declarative Output 7
Stefan Brass Datalog 2.0, 11.09.2012
Order in Datalog with Applications to Declarative Output 8
The original list-valued ordering argument cannot be accessed in the
Stefan Brass Datalog 2.0, 11.09.2012
Order in Datalog with Applications to Declarative Output 9
Stefan Brass Datalog 2.0, 11.09.2012
Order in Datalog with Applications to Declarative Output 10
Stefan Brass Datalog 2.0, 11.09.2012
Order in Datalog with Applications to Declarative Output 11
✬ ✫ ✩ ✪
Stefan Brass Datalog 2.0, 11.09.2012
Order in Datalog with Applications to Declarative Output 12
^Sal is an abbreviation for desc(Sal).
Stefan Brass Datalog 2.0, 11.09.2012
Order in Datalog with Applications to Declarative Output 13
These constructs were recently added to SQL. From SQL-2003 to SQL-2008, the ORDER BY clause was added to view definitions (corresponding to derived predicates).
Stefan Brass Datalog 2.0, 11.09.2012
Order in Datalog with Applications to Declarative Output 14
Stefan Brass Datalog 2.0, 11.09.2012
Order in Datalog with Applications to Declarative Output 15
Stefan Brass Datalog 2.0, 11.09.2012
Order in Datalog with Applications to Declarative Output 16
Stefan Brass Datalog 2.0, 11.09.2012
Order in Datalog with Applications to Declarative Output 17
If one wants to pass bindings as in the magic set method, this is helpful (of course, if the concrete index values are not needed, but
extension).
Stefan Brass Datalog 2.0, 11.09.2012
Order in Datalog with Applications to Declarative Output 18
✬ ✫ ✩ ✪
Stefan Brass Datalog 2.0, 11.09.2012
Order in Datalog with Applications to Declarative Output 19
If p(b) is the first element in the sorted list p, then p(a) is true, which would then come first. But then p(b) is no longer the first element. Stefan Brass Datalog 2.0, 11.09.2012
Order in Datalog with Applications to Declarative Output 20
(and the same for a predicate used negated in the body), and
greater than or equal to all predicate levels in the body. Thus the extension of a predicate can be fully computed before row numbers must be assigned. Stefan Brass Datalog 2.0, 11.09.2012
Order in Datalog with Applications to Declarative Output 21
Stefan Brass Datalog 2.0, 11.09.2012
Order in Datalog with Applications to Declarative Output 22
✬ ✫ ✩ ✪
Stefan Brass Datalog 2.0, 11.09.2012
Order in Datalog with Applications to Declarative Output 23
Of course, standard aggregation functions should be directly suppor- ted in the syntax, but this example is interesting for questions of expressive power. Similar to solution in LDL (XY-stratification). Stefan Brass Datalog 2.0, 11.09.2012
Order in Datalog with Applications to Declarative Output 24
✬ ✫ ✩ ✪
Stefan Brass Datalog 2.0, 11.09.2012
Order in Datalog with Applications to Declarative Output 25
Or at least an essential part of the system.
Stefan Brass Datalog 2.0, 11.09.2012
Order in Datalog with Applications to Declarative Output 26
Duplicates can be handled with the additional argument, too.
Stefan Brass Datalog 2.0, 11.09.2012