AmziX Library

Version: 1.0 beta (written with Delphi 3.0 C/S for LS Engine 4.1)

Author: Thomas Steiner, University of Lausanne, BFSH1 / Inforge, 1015 Lausanne, Switzerland.

thomas.steiner@hec.unil.ch

http://www.hec.unil.ch/people/tsteiner

The AmziX Library is an ActiveX component around the Amzi!Prolog Logic Server. The approach outlined below requires MS Internet Explorer 3.X or higher.

The subject of Embedding and extending Amzi!Prolog has been treated here. Early in 1999, my PhD thesis will be available, which introduces and implements mid-level software agents with this ActiveX- version of Amzi!Prolog. I am convinced that linking the functionality of real-world software objects to a meta-level (Prolog) program - expressing the stable part of the engineer's knowledge - is a very inspiring philosophical subject and an elegant way to AOP which addresses the problem of legacy software - more about this in my PhD thesis!

Contents of this HTML page: supported methods, use of the AmziX component, comment for LSX developers, required file, sample files, example 1, example 2, disclaimer of warranty.

^ Supported methods are:

XInitLS(xplname:WideString)

Initializes the Logic Server (LS). xplname must be a valid .XPL file.

XAddLSX(lsxname:WideString)

Loads a LSX-file (special-purpose DLL with extended predicates).

XLoadXPL(xplname:WideString)

Loads a .XPL file.

XReset

Resets the LS.

XCloseLS

Closes the LS.

XGetStrArg(n:integer):WideString

Returns argument n of the actual term.

XExecStr(s:WideString):WordBool;

Executes the Prolog expression in s. Returns True if successful, False if not.

XCallStr(s:WideString):WordBool;

Calls the LS with s. Returns True if successful, False if not.

XRedo

Repeats the last LS call.

XClearCall

Clears the effects of the last LS call.

XAssertaStr(s:WideString)

Asserta of s to the LS.

XAssertzStr(s:WideString)

Assertz of s to the LS.

XRetractStr(s:WideString)

Retract of s from the LS.

Other methods to follow... 

^ Use of the AmziX component within HTML pages:

You may script the component with any scripting language supporting ActiveXs (VBScript, JavaScript, etc.). We have used Microsoft's ActiveX control pad in order to insert an AmziX into this demo page and VBScript to script it. Displays the source of this page to see how the component can be sripted.

^ Comment for LSX developpers:

You can develop LSXs as DLLs in any third-party language that supports function pointers. However, if you develop with Delphi, you might want to avoid whenever possible to make use of ShareMem in the uses clause of your DLL project: ShareMem requires delphimm.dll in your <WIN>\system directory!

A sample code for a LSX written in Delphi3 that works with LSEngine4.1 can be found here.

You will need the following ^ file in your <WIN>\system directory:

amzi4.dll

If you want to run the examples below, you also need to ^ download the files

Extend.LSX

Hello.XPL

to the directory C:\AmziXDemo


^ Example 1:

Click the button below to

  1. Initialize the AmziX LS.
  2. Load the Extend.LSX file.
  3. Load the Hello.XPL file.
  4. Asserta the following expression: sayHello(Name):-showMsg(Name).
  5. Execute the expression: sayHello(thomas).
  6. Close the AmziX LS.
showMsg/1 is uploaded by Extend.LSX


^ Example 2:

Click the button below to

  1. Initialize the AmziX LS.
  2. Load the Hello.XPL file.
  3. Assertz the following expression: whoWroteThis(Dummy,Name,Dummy):-copyright(Name).
  4. Execute the expression: whoWroteThis(Dummy,Name,Dummy).
  5. Use XGetStrParm(2) to extract the Name into a local variable.
  6. Show the contents of Name in a message box.
  7. Close the AmziX LS.
copyright/1 is contained in Hello.XPL


The component is provided as is. We ^ disclaim any responsibility for any damages or misbehavior resulting from the use of the AmziX library. By using the component, users accept this disclaimer of responsibility.