Logical Equivalences Between KR Forms

Following is a set of representations of a simple employee table in different KR forms: Assertions are prefixed by "a:" and a rules (views) by "r:".


 a: CREATE TABLE Employee (id INT, name STRING, manager INT)
    INSERT INTO Employee VALUES (1, "Alice", NULL)
    INSERT INTO Employee VALUES (2, "Bob", 1)
 r: CREATE VIEW SecondLine (
     SELECT emp.name AS emp, man.name AS man
       FROM Employee AS emp
 INNER JOIN Employee AS man ON man.id=emp.manager )


 a: Employee(1, "Alice", 99999)
 r: SecondLine(EMP, MAN) :- Employee(X, MAN, _) Employee(_, EMP, X)


 a: emp:id.1 emp:name "Alice" .
    emp:id.2 emp:name "Bob" ; emp.manager emp:id.1 .


 r: CONSTRUCT { _:s1 SecondLine:emp ?emp ; SecondLine.man ?man }
        WHERE { ?x Employee:name ?man .
                ?y Employee:name ?emp ; Employee.manager ?x }

RIF (presentation syntax)

 r: SecondLine.emp(_:s1, ?emp) SecondLine(_:s1, ?man) := 
        Employee:name(?x, ?man)
        Employee:name(?y, ?emp) Employee:manager(?y, ?x)
Last modified on 22 March 2010, at 14:49