Path: utzoo!attcan!uunet!cs.utexas.edu!sun-barr!newstop!sun!quintus!jbeard From: jbeard@quintus.UUCP (Jeff Beard) Newsgroups: comp.lang.prolog Subject: Re: Need help in the differences between RDBMS and Expert Systems Keywords: RDBMS Message-ID: <1397@quintus.UUCP> Date: 18 Jul 90 15:26:59 GMT References: <1990Jul17.201309.5974@cbnewsh.att.com> Reply-To: jbeard@quintus.UUCP (Jeff Beard) Organization: Quintus Computer Systems, Inc. Mountain View, CA Lines: 62 > I have heard people saying relational > algebra cannot do recursion (I don't know what this means). > I would appreciate any clarification on this from the netters. To illustrate recursion, use the simple Prolog tail-recursion example: procHead([Head|Tail]) :- ... ... procHead(Tail). The procedure procHead/1 calls itself, or recurs. For relational DBMS, recursion is much more difficult. Take for example, a single table of employee info emp(EmpNum,EmpName,ManagerNum). To display the name of the manager for each employee requires a 'self-join' that is likened to recursion: select m.EmpName, e.EmpName, e.EmpNum from emp e, emp m where e.ManagerNum = m.EmpNum; the table emp/3 is qualified uniquely via {e,m} tags which give unique 'cursors' (or scan pointers if you will) to two instances of the single table. The WHERE constraint avoids the cartesian product and forces the correct pairing. The above SQL will produce a tabular report for every tuple(fact) of emp/3. But HOW does one create an organization tree for ALL managers at ALL levels AND in the proper organization hierarchy? eg: president:- vp1:- division1:- sales:- Western:- ... Eastern:- manager1:- ... managerN:- emp1 ... empN service:- division2:- ... ... ... vpN:- divisionN:- R&D:- mft:- ... -- ====== Opinions are the possession of the speaker and to assert otherwise is plagiarism. Jeff Beard, Quintus Computer Systems, Inc. e-mail ...!sun!quintus!jbeard or jbeard%quintus.com@sun.com