Re: how to assert into the db with rdbms
Kambiz Darabi <[email protected]> Sat, 19 May 2007 00:19:51 +0200
| Newsgroups | gmane.comp.ai.powerloom |
|---|---|
| Message-ID | <[email protected]> |
Thomas Russ <[email protected]> wrote: > > On May 18, 2007, at 8:29 AM, Kambiz Darabi wrote: > >> But, how can I assert facts into the database? > > This part of our database functionality is not yet completed. > We are having some technical difficulties with proper handling of > Function assertions. > > If you only use concepts and relations, we have something > experimental that works, but it isn't released, not even in the new > snapshots. > As I understand, powerloom is in use in projects with very large knowledge bases. Did you create the databases separately (using other DB interfaces) and just did the reasoning in PL? I would like to use PL to derive new facts from assertions which are entered into the system. PL would then be a semantic layer on top of the RDBMS, which would be capable of checking and augmenting the information on the way to the database. Is such a use feasible with the current capabilities of PL? Is there a chance of getting the part which allows to assert concepts and relations? >> >> Another problem is: I can use defquery to define queries involving one >> single table, but I don't manage to define sql table joins correctly. >> >> [...] >> >> 2) defquery with an SQL join > > Something like this should work: > > Assume DB tables > employees: employeeName employeeDepartment > departments: department managerName > > (DEFQUERY employeeBoss ((?employeeName STRING) (?bossName STRING)) > :QUERY-PATTERN > (RDBMS/SQL-QUERY our-db > "SELECT employeeName, managerName FROM employees, departments > WHERE #${employeeName='?employeeName'} > AND #${managerName='?managerName'} > AND employeeDepartment = department > ")) > > What are you trying that is failing? Given this: create table parents (id integer, name varchar(255)); create table child (id integer, parentid integer, name varchar(255)); insert into parents values (1, 'John'); insert into child values (1, 1, 'Kevin'); insert into child values (2, 1, 'Mary'); what would be the query pattern for: (DEFQUERY parent-child ((?parentid integer) (?parentname STRING) (?childname STRING)) ... ? Thanks a lot for your kind assistance! Kambiz