My Prolog libraries

Frans A. Meijs

Introduction

Presented is a number of libraries, written in the Prolog logic programming language. Their application is management of personal databases and planning, but they have been applied to software engineering as well. Program-root files can be found in the folders named swiprolo. They have to be invoked using a SWI-Prolog interpreter [www.swi-prolog.org].

A library of planning theories

IPLPLAN is a set of executable 'theories' for making a plan, given a set of elementary activities. The IPLPLAN theories are stored in ZIP file iplplan.zip (zip). Program-root files have ".pro" in the file name. Sample data files can be found in folder testcases. File iplplan_cmds.txt contains the commands that have to be pasted in the window of the prolog-interpreter for building a plan.

A library of data base theories

IPLDB is a set of executable "theories" for maintaining a personal data base, e.g. about persons and addresses, music files and compact discs. The IPLDB theories are stored in ZIP file ipldb.zip (zip). Program-root files have ".dbm" in the file name. Sample data files can be found in folder testbed. The IPLDB_FM theories refer to a library of application-specific theories, which is stored in file matter_fm.zip [zip], and to the IPL_FM theories, which are documented below.

A sample dialogue, using a SWI Prolog interpreter

 ['dbve2.dbm'].       % Load the data base and the reporting code.
 contradiction(X).    % Check for consistency of the data base.
 ['adocl.dbm'].       % Production of a list of audio CD's from the data base.
 halt.

A sample data base for above:

% File adisc.prp

aDisc('ACD001','Chamber music','Ottorino Respighi').
aDisc('ACD002','Winds Of Space','P.Davison').

% File adisc2.prp

aDoc__e_aDisc('ADD0450','ACD002',1).
aDoc__e_aDisc('ADD0451','ACD002',2).
aDoc__e_aDisc('ADD0452','ACD001',1).
aDoc__e_aDisc('ADD0453','ACD001',2).

% File adoc.prp

aDoc('ADD0450','Winds Of Space','P.Davison').
aDoc('ADD0451','Turn to dust','P.Davison').
aDoc('ADD0452','Gli ucelli','I Solisti Veneti').
aDoc('ADD0453','Antiche Danze','I Solisti Veneti').

Using the sample data base, the dialogue produces an HTML page. A web-browser reading the page will show:

ACD001  1    Gli ucelli.      I Solisti Veneti.      ADD0452
ACD001  2    Antiche Danze.   I Solisti Veneti.      ADD0453
ACD002  1    Winds Of Space.  P.Davison.             ADD0450
ACD002  2    Turn to dust.    P.Davison.             ADD0451

(The data base is simplified for this introduction. Sample files in the full format can be found in testcases/approved)

The library of Interpreted Predicate Logic (IPL) theories

File structure

The IPL theories are stored in ZIP file ipl_fm.zip (zip). The program-root files have ".prg" in the file name. The IPL theories refer to a library of basic Prolog theories, which is documented below.

[Description]

The library of basic Prolog theories

File structure

The basic Prolog theories are stored in ZIP file prolog_fm.zip (zip). A number of them are adapted versions of elements of the Edinburgh Prolog library [www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/prolog/code/tools/edinbrgh/]. The program-roots have ".prg" in the file name.

[Programming conventions]