nested t ransactions in a logical language fo r active
play

Nested T ransactions in a Logical Language fo r Active - PowerPoint PPT Presentation

Nested T ransactions in a Logical Language fo r Active Rules Bertram Lud ascher W olfgang Ma y Geo rg Lausen Institut f ur Info rmatik Universit at F reiburg Germany Overview Intro duction


  1. Nested T ransactions in a Logical Language fo r Active Rules Bertram Lud � ascher W olfgang Ma y Geo rg Lausen Institut f� ur Info rmatik� Universit � at F reiburg� Germany Overview � Intro duction� Deductive vs Active Rules � Flat Statelog and F riends� Unifying Active and Deductive Rules � Pro cedures and Nested T ransactions � Conclusion and Outlo ok � LID���

  2. Intro duction Deductive Rules �ak a Datalog � � � p o w erful query language� �decla rative� semantics � IC checking � static description of the mo deled w o rld � no supp o rt fo r up dates and �re�active b ehavio r Active Rules � �re�active b ehavio r� esp ecially�up dates � view maintenance� IC enfo rcement � monito ring applications� ��� � semantics� p redictabilit y of rule e�ects� termination � a Uni�ed F ramew o rk fo r Active and Deductive Rules Up date � Logic � � � X Active Rules Datalog � � LID���

  3. Execution Mo del� Datalog vs Statelog Queries Answ ers Queries Answ ers tc�X�Y� � � � � del� Q�X� tc�X�Y� � S � events � � � � P � � � del� T�X�Y�� � P � � � � � � �S��� R�X� � S � actions � � f inal �S� ins� R�X�� � � � � � � � S � D � � � � � � � � S � D � � � S � �� D � � � � S � n � D � � � S � D � f inal BOT EOT �Flat� Statelog Datalog � LID���

  4. Flat Statelog� Syntax User�De�ned Rules Queries� � S � tc�X�Y� � tc�X�Z�� tc�Z�Y�� Integrit y Constraints� � S � ab o rt � ��� � emp�D REFERENCES dept�D ON DELETE CASCADE Up dates� � S � del� emp�E�Sal�D� � del� dept�D� �� emp�E�Sal�D�� System�De�ned Rules � S � �� R�X� � � S � R�X�� not del� R�X�� F rame Rules� � S � �� R�X� � � S � ins� R�X�� Integrit y Constraints� � S � � ab o rt � ins� R�X�� del� R�X��� � LID���

  5. Flat Statelog� Semantics � Exp ressive P o w er Standa rd LP Semantics � � � � � S � �� p�X� � S � not q�Y� p�succ�S��X� q�S�Y� � � � � p�X� q�Y�� � � Exp ressiveness�Complexit y � Flat Statelog � While�PFP � � PSP A CE on o rdered DBs� � ��monotone Statelog � Fixp oint�LFP � � PTIME on o rdered DBs� �termination gua ranteed� � Gua rded Statelog � Strati�ed Datalog � � PTIME on o rdered DBs� Related App roaches XY�Datalog �Zaniolo�� Datalog �T emplog �Chomicki�Baudinet�� � S ELS�Datalog �Kemp�Ramamohana rao�Stuck ey�� Datalog �� �Abiteb oul�Vianu�� Heraclitus�Alg�C� �Ghandeha rizadeh et�al�� ��� � LID���

  6. Flat Statelog� Problems Hire emplo y ee E with sala ry Sal fo r depa rtment Dept p rovided the average sala ry after the up date do es not exceed a certain limit� � S � ins� empsal�E�Sal�� ins� emp dep�E�Dept�� � S � �� checksal�Dept� � � S � hire�E� Sal� Dept�� � � S � check � ok checksal�Dept�� avg�Dept� Amt�� Amt � ������ � � S � �� del� empsal�E�Sal�� del� emp dep�E�Dept� � S � hire�E�Sal�Dept�� � S � �� not check ok� � Problems � Undoing the e�ect of changes has to b e p rogrammed explicitly � � There is no structure which allo ws grouping of semantically closely related rules� � The e�ects of ephemeral up dates �zaniolo�DOOD����� and hyp othetical up dates a re visible to other rules� since there is no encapsulation� � group rules into p ro cedures which execute as nested transactions � LID���

  7. Pro cedures and Nested T ransactions � A Statelog p ro cedure � is a set of lo cal Statelog rules� � A p ro cedure � de�nes a transaction T at runtime� The b ehavio r of � is encapsu� � lated� � If � calls � � then T executes as subtransaction � � � Simultaneously called p ro cedures � and � execute indep endently and in isolation � � �Sub��T ransactions execute atomically � all�o r�nothing �� � LID���

  8. User�De�ned Rules Pro cedures p ro c � A �� � � � � � � � � A O I � � � � � I O � � � � � O M � n � k � l initial� P � � �� alw a ys� P � � �� �nal� P � � � initial al w ay s f inal endp ro c R � imp o rt EDB�IDB relation R R � exp o rt EDB relation R O M Rules � Views� � S � V � X � � � � � V � I D B � P � � Change Requests� � S � ins� R � X � � � � � � � S � del� R � X � � � � � R � E D B � P � � � � S � mo d� R � X � X � � � � � � � Pro cedure Calls� � S � � � X � � � � � � � P r oc � P � � External Actions� � S � A � X � � � � � A � Act � P � � � T ransaction Control� � S � ab o rt � � � � ab o rt � C tl � P � � all user�de�ned rules a re lo cal � � LID���

  9. Nested T ransactions� State Space � F � � �� � � F � � ��� �� � F � � ���n � � F � �� � F � �� � F � �� � F � �� � � � �T ransaction� F rames� � F � � � F � � �� � � � F � � �� � � ��� � F � � �� � �� � F � � �� �m � States� � F � � �� � � F �n � � � F � � ���n � � � F � � �� �m � � �� � F � � �� � �� � F � � �� �m � �� � F � � �� � � ��� �� � F � � �� � � ���k � � F � � �� � � �� � � LID���

  10. System�De�ned Rules � � Deltas� � S � �� � � � � S � ins� � � � not EOT � R X R X � � � � S � �� � � � � S � � � � not del� R � � � not EOT R X R X X � � � � Proto col Relations� � S � �� insd� R � X � � S � ins� R � X � � not EOT � � � � � � S � �� insd� R � X � � S � insd� R � X � � not del� R � X � � not EOT � � � � S � �� deld� R � X � � � S � del� R � X � � not EOT � � � � � S � �� deld� R � X � � � S � deld� R � X � � not ins� R � X � � not EOT � � � Control� � S � running � � S � ins� R � X � � not R � X � � � � � S � running � � S � del� R � X � � R � X � � � S � EOT � � S � BOT � not running � � S � �� EOT � � S � running � not ab o rt � � S � �� not running � � � Pro cedures� � S�� � X � � �� BOT � � S � � � X � � � � � � S � committed� � � X � � � S � � � X � � � S�� � X � �N � EOT � not ab o rt � � � � � S � ab o rted� � � � � S � � � � � S�� � � �N � EOT � ab o rt � � X � X X � � � �� LID���

  11. Statelog� Compilation and T ermination � Statelog p rograms P can b e directly translated into logic p rograms �with function symb ols�� � S � �� R�X� � � S � ins� P�Y�� Q�X�Y�� �� R�� S � �� �X� � ins� P�� S � �Y�� Q�� S � �X�Y�� state �� S ��� � De�nition of states� state �� �� �� �� � � state �� S�� � X � � ��� � � �� S � � X �� state �� S � �� � � state �� S � �� alive �� S ��� � if �nitely many states a re created b y � � � E vent B ase�� then terminates � P E D B E B P alive �� S �� � BOT �� S � �� alive �� S � ��� � running �� S � �� not EOT �� S � �� � In every frame � F � there is at most one state � F �n � s�t� M � P � j � EOT �� F �n � � E D B � E B �� LID���

Recommend


More recommend