CORAL-Deductive Database-Lecture Notes, Study notes of Deductive Database Systems

Dr. Deependu Saripella provided this handout at Aligarh Muslim University for Deductive Database course. its main points are: Programmer, Declare, Strategies, Exodus, Data, Manager, Algorithm, Cpp, CORAL, Recursive, Magic, Sets, Handling, Negation

Typology: Study notes

2011/2012

Uploaded on 07/15/2012

saidullah
saidullah 🇮🇳

4.7

(7)

32 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS345 Notes for Lecture 11/27/96
CORAL
Developed by Raghu Ramakrishnan at Wisconsin.
Similar in many respects to NAIL/GLUE, but:
All modules are declarative (no GLUE-style
control ow).
Programmer can declare the approachtobe
used to evaluate the predicates of a module.
Strategies include:
a) Seminaive + magic-sets.
b) Seminaive + tail-recursion elimination as
in Ch. 15 of PDKS-II.
c) Top-down, using Prolog-like algorithm.
Built on top of Exodus data manager. Sup-
ports transactions, but like NAIL it is really
a main-memory system.
Store tuples with variables. Allows facts like
anc
(
X X
)=\everyone is his/her own ances-
tor." Also gives a magic-sets algorithm that
avoids the need for subgoal rectication (see
Sect. 13.6 of PDKS-II).
C++ interface.
1. C++ extended with classes for relations.
2. Subgoals in CORAL can be C++ proce-
dures.
Negation in CORAL
Supports mo dularly stratied negation and
takes advantage of magic-sets.
Trick: work on lowest module possible at all
times.
A rule for a magic predicate belongs to the
module of the rule that spawned the magic
rule (by the Group I construction).
1
docsity.com
pf3
pf4
pf5

Partial preview of the text

Download CORAL-Deductive Database-Lecture Notes and more Study notes Deductive Database Systems in PDF only on Docsity!

CS Notes for Lecture 

CORAL

Develop ed by Raghu Ramakrishnan at Wisconsin Similar in many resp ects to NAILGLUE but

All mo dules are declarative no GLUEstyle control ow 

Programmer can declare the approach to b e used to evaluate the predicates of a mo dule Strategies include

a Seminaive magicsets

b Seminaive tailrecursion elimination as in Ch of PDKSI I

c Topdown using Prologlike algorithm

Built on top of Exo dus data manager Sup p orts transactions but like NAIL it is really a mainmemory system

Store tuples with variables Allows facts like ancX  X everyone is hisher own ances tor Also gives a magicsets algorithm that avoids the need for subgoal rectication see Sect  of PDKSI I 

C interface

 C extended with classes for relations

 Subgoals in CORAL can b e C pro ce dures

Negation in CORAL

Supp orts mo dularly stratied negation and takes advantage of magicsets

Trick work on lowest mo dule p ossible at all times

A rule for a magic predicate b elongs to the mo dule of the rule that spawned the magic rule by the Group I construction 

Ab ove rule OK even though there may b e intermo dule recursions that result b ecause we will judiciously order the ring of rules

Example Here are nonrecursive rules that b e come recursive when magicsets is applied

qXY  qXZ  pZY pXY  aXY

Query q bf^ 

If we use simplied magicsets and skip the supplementary predicate we get m pZ  m qX  qXZ qXY  m qX  qXZ  pZY pXY  m pX  aXY

There is a recursive cycle

m p  p  q  m p

Handling Negation Magic Sets

Simple example  just plain stratied

onlyXY  arcXY  not path XY path XY  arcXZ  arcZY

onl y X  Y means there is an arc from no de X to Y  but no path of length  from X to Y 

Stratum  far c pathg Stratum fonl y g

Query onl y f^ f^ 

Note m onl y has  arguments in eect the initializer is m only  true We can just drop m onl y instead r  m path XY  arcXY r  path XY  m path XY  arcXZ  arcZY r  onlyXY  m path XY  not path XY

Supp ose EDB f       g

 Tuples have ob jectIDs

One can reference tuples by a reference variable eg p  Name for the Name comp onent of the tuple referenced by p

 There is a conventional OO typ e system in cluding typ es that are lists sets bags or ar rays of other typ es

 There is inheritance by sub classes

 Classes can have metho ds

 Atoms are written with their arguments as attribute  value

Example

eponame sally  phone P office O

An argument whose value is a variable ap p earing only once in a rule need not app ear

Language Structure

Similar to GLUENAIL an imp erative com p onent and a declarative comp onent

Declarative rules lo ok like Datalog but with the style of atoms indicated ab ove  instead of  and logical connectives as words eg AND

Example

pathfirst X last Y  arctail X head Z AND arctail Z head Y

Imp erative statements include insert delete if switch create for classespredicates  new for creating new ob jects  and the foreach iterator construct illustrated b elow

Example Supp ose we have a class emp with at tributes that include salary of typ e integer and mgr of typ e refemp ie a reference to an em ployee ob ject 

The following deletes all employees who make more than their managers  FOREACH erefemp IN SET OF X  FROM XempsalaryS mgrm DO  IFS m salary DELETE e

Line  declares X to range over the emp ob jects that have a salary and manager attribute if there are sub classes p erhaps some do not  It also gives names S to the salary and m to the reference to the manager

Line  declares e to b e a p ointer refer ence ranging over all the tuples in the set constructed in line  

Line  tests whether the salary of the em ployee is greater than the salary of the man ager employee p ointed to by m and deletes the employee ob ject if so