Exercise 4.63: The following data base (see
Genesis 4) traces the genealogy of the descendants of Ada back to Adam, by way
of Cain:
(son Adam Cain) (son Cain Enoch)
(son Enoch Irad) (son Irad Mehujael)
(son Mehujael Methushael)
(son Methushael Lamech)
(wife Lamech Ada) (son Ada Jabal)
(son Ada Jubal)
Formulate rules such as “If S is the son of f, and f is the son of
G, then S is the grandson of G” and “If W is the wife of
M, and S is the son of W, then S is the son of M” (which
was supposedly more true in biblical times than today) that will enable the
query system to find the grandson of Cain; the sons of Lamech; the grandsons of
Methushael. (See Exercise 4.69 for some rules to deduce more complicated
relationships.)
练习 4.63:以下数据库(参见《创世记》第 4 章)通过该隐追溯了亚当后代亚大的家谱:
(son Adam Cain) (son Cain Enoch)
(son Enoch Irad) (son Irad Mehujael)
(son Mehujael Methushael)
(son Methushael Lamech)
(wife Lamech Ada) (son Ada Jabal)
(son Ada Jubal)
请制定如下规则:"若 S 是 F 的儿子,F 是 G 的儿子,则 S 是 G 的孙子";以及"若 W 是 M 的妻子,S 是 W 的儿子,则 S 是 M 的儿子"(这一说法在圣经时代据说比今天更为成立)。利用这些规则,使查询系统能找出该隐的孙子、拉麦的儿子们,以及米土沙利的孙子们。(参见练习 4.69 中推导更复杂关系的若干规则。)
(son Adam Cain) (son Cain Enoch)
(son Enoch Irad) (son Irad Mehujael)
(son Mehujael Methushael)
(son Methushael Lamech)
(wife Lamech Ada) (son Ada Jabal)
(son Ada Jubal)