| This is a simple agent program to demonstrate automatic generation and execution of SQL over a networked database | | Please note that, unlike the other agents in this demo, this one cannot be run properly unless you have | first made a DBMS, such as Oracle 9i, reachable over the internet. You must also fill in correct values | for the url, dbname, and so on. | | First, we set up a correspondence between a remote database table and an English sentence, | using a rule such as: | | url:12.345.67.89 dbms:9i dbname:ibldb tablename:EMP_DEPT port:1521 id:anonymous password:oracle | ----------------------------------------------------------------------------------------------------- | employee some-empnumber some-name works in some-department | | Then, we create two tables, fill them with sample data, and use the rule: | | employee some-empnumber some-name works in some-department | employee that-empnumber works on some-project | ---------------------------------------------------------- | that-name in that-department works on that-project | | to find out who works on which project. | | From the rule, the IBL system automatically generates and executes the following SQL statement: | | SELECT EMP_DEPT.NAME,EMP_DEPT.DEPT,EMP_PROJ.PROJ | from EMP_DEPT,EMP_PROJ | where EMP_DEPT.EMPNUM=EMP_PROJ.EMPNUM | order by EMP_DEPT.NAME,EMP_DEPT.DEPT,EMP_PROJ.PROJ; | | Note that no user or programmer need see the above generated SQL statement in normal use. We show | it here only to illustrate how the IBL system works. | | For a real example, in which the generated SQL is too complex to be written reliably by hand, please see | www.reengineeringllc.com/Oil_Industry_Supply_Chain_by_Kowalski_and_Walker.pdf | | | If you have comments or questions, please send email to internet.business.logic@gmail.com . url:12.345.67.89 dbms:9i dbname:ibldb tablename:EMP_DEPT port:1521 id:anonymous password:oracle --------------------------------------------------------------------------------------------------- employee some-empnumber some-name works in some-department url:12.345.67.89 dbms:9i dbname:ibldb tablename:EMP_PROJ port:1521 id:anonymous password:oracle --------------------------------------------------------------------------------------------------- employee some-empnumber works on some-project employee some-empnumber some-name works in some-department employee that-empnumber works on some-project ---------------------------------------------------------- that-name in that-department works on that-project the sql table some-table should be in tablespace some-tablespace the sql table that-table should have a column some-colnumber some-colname some-coltype create sql table : that-table that-colnumber that-colname that-coltype that-tablespace ------------------------------------------------------------------------------------- create the table that-table in tablespace that-tablespace that-colnumber that-colname that-coltype the sql table this-table should have a column this-number this-name this-type drop sql table : that-table ----------------------------------------------------------------------------------------- drop the the sql table that-table the sql table this-table should be in tablespace this-tablespace ============================================================================ employee some-empnumber some-name works in some-department users employee some-empnumber works on some-project users the sql table this-table should have a column this-number this-name this-type =============================================================================================== employee some-empnumber some-name works in some-department 1 EMPNUM NUMBER( 8 ) employee some-empnumber some-name works in some-department 2 NAME VARCHAR2( 100 ) employee some-empnumber some-name works in some-department 3 DEPT VARCHAR2( 100 ) employee some-empnumber works on some-project 1 EMPNUM NUMBER( 8 ) employee some-empnumber works on some-project 2 PROJ VARCHAR2( 100 ) table one should contain an entry this-empnumber this-name this-department ========================================================================== 123 Adrian Web Apps 456 Theo Education 789 Martin Facilities Engineering 799 Barbara Finance table two should contain an entry this-empnumber this-project ======================================================================== 123 Internet Business Logic 123 Semantic Encoding 123 Confusion Encryption 456 Online Tutorial 789 Eathquake-proof Hosting Bunker 799 Business Plan table one should contain an entry some-empnumber some-name some-department add : employee that-empnumber that-name works in that-department -------------------------------------------------------------------------- add to table one the entry some-empnumber some-name some-department table two should contain an entry some-empnumber some-project add : employee that-empnumber works on that-project ------------------------------------------------------------- add to table two the entry some-empnumber some-project table one should contain an entry some-empnumber some-name some-department del : employee that-empnumber that-name works in that-department -------------------------------------------------------------------------- delete from table one the entry some-empnumber some-name some-department table two should contain an entry some-empnumber some-project del : employee that-empnumber works on that-project ------------------------------------------------------------- delete from table two the entry some-empnumber some-project