236 datalog comments and comments queries prolog is

This preview shows page 4 - 8 out of 11 pages.

236 Datalog: #-comments and #|…|#-comments Queries Prolog: | ?- is the interactive prompt, so | ?- p(Y). is the query 236 Datalog: not interactive, no prompt, just P(Y)?
Image of page 4

Subscribe to view the full document.

Discussion #20 Chapter 4, Sections 4.1 & 4.4.1-3 5/11 236 Datalog Prolog (Similarities…) Same syntax for Facts and Rules Comma means No semicolon for ( ) use 2 rules. parent(x,y) :- mother(x,y); father(x,y). changes to: parent(x,y) :- mother(x,y). parent(x,y) :- father(x,y). Recursive rules the same Derivations the same Instantiation Unification Resolution (derivations of empty clause) Backtracking Results same: “can be derived from database”
Image of page 5
Discussion #20 Chapter 4, Sections 4.1 & 4.4.1-3 6/11 Prolog Derivations Although derivations are the same, there is a different way of looking at the derivation in terms of Goals query and atomic formulas in the body of the rule. Success can be derived Failure cannot be derived We can use this same view in 236 Datalog. We’ll use the following database to explain these ideas. Facts: sister('ann','bob'). parent('bob','jay'). parent('bob','kay'). Rules: aunt(x,y) :- sister(x,z), parent(z,y). Queries: aunt('ann','jay')? aunt('ann',x)?
Image of page 6

Subscribe to view the full document.

Discussion #20 Chapter 4, Sections 4.1 & 4.4.1-3 7/11 Resolution 1. ¬ aunt('ann', 'jay' ) 2. aunt( 'ann' , 'jay' ) :- sister( 'ann' ,z), parent(z, 'jay' ).
Image of page 7
Image of page 8
You've reached the end of this preview.
  • Winter '12
  • MichaelGoodrich
  • Recursion, Backtracking, Lower case, Query language, Datalog

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern