Selecting software

Every creation is a benefit. But not always everyone may get these benefits or be aware of them. The key of sharing is knowing what is to share. Any creation should be free accessible for those who want to know how it works, those who want to contribute, and those who find it useful. On the other hand, it should still remain the property of its creator, unless the creator wishes otherwise.

The licenses for most software are designed to take away freedom to share and change it (according to [8]). By contrast, the GNU General Public License is intended to guarantee freedom to share and change software - to make sure the software is free for all its users. Software protected by such a license is called free software.

Speaking of free software refers to freedom, not price. The GNU General Public License is designed to make sure that anyone has the freedom to distribute copies of free software (and charge for this service if one wishes), that the source code may be received if it is wanted, and furthermore, the software may be changed or pieces of it may be used in new free programs.

In this spirit the ReDaReS project was created as free software and it is protected by GNU General Public License. What is more, it has been described, developed, implemented and documented using free software only, on the Debian/GNU Linux System. It can run on almost any POSIX compatible Operating System.

The following software have been chosen in order to create a system capable of the processing given in Figure 10.5:

Choosing software was conducted very carefully. It especially applies to the inference engine which was required to provide both time-efficient reasoning, and time-efficient compilation of the program. Furthermore, it had to have an ability to interact with other programming languages to make it possible to integrate it with the ODBC subsystem and a C language compiler.

Another requirement was compatibility with ISO Prolog, to provide the most standardized Prolog implementation possible. And last but not least, the ideological issue, it was to be a free software11.1. The choice was made to select SWI-Prolog [26]. It is extremely fast an capable. Preliminary experiments indicated, that compiling a program which consists of 1,000,000 simple clauses with two arguments of different types (an integer and an atom), takes about 25.04 seconds, using Linux 2.4.22 on Intel Mobile Celeron 1.5GHz. The source file, which contains the clauses is 29MB long. After loading the file, the inference engine occupies 100MB of memory.

Issuing a simple goal using an integer type argument, and finding the first satisfying result takes about 0.5 second. Subsequent goals, specified on the same clause, take unnoticeable amount of time (below 0.01 second). Issuing a similar goal on an atom type argument, takes 0.81 second and 0.21 for subsequent goals. Compiling the same input file with GNUProlog was not even possible.

Relaxing the problem to the size of 20,000 clauses (686kB of data) takes 26.9 seconds to compile with GNUProlog occupying 2.6MB of memory. The same operation, for SWI-Prolog, takes 0.3 second, occupying 2.5MB of memory. The response time is unmeasurable in this case due to its very short duration (less than 0.01 second), for both systems. For a better comprehension the results are presented in Table 11.1.


Table 11.1: GNUProlog and. SWI-Prolog, operation timings
Operation GNUProlog [s] SWI-Prolog [s]
compile 1M simple 2 argument clauses N/A 25.04
simple goal using an integer argument N/A 0.50
simple goal using an integer argument (subsequent) N/A $<0.01$
simple goal using an atom argument N/A 0.81
simple goal using an atom argument (subsequent) N/A 0.21
compile 20k simple 2 argument clauses 26.9 0.30


SWI-Prolog is an ISO compatible Prolog compiler. It has a good collection of built-in predicates, a large set of which is shared with Edinburgh C-Prolog, Quintus Prolog and SICStus Prolog. Among its features are: a very fast compiler, a Quintus-like module system, library autoloading, garbage collection, atom garbage collection, execution profiling, and one of the most important things, a fast bi-directional C language interface (according to [26]).

Concerning the ODBC Library there are two choices available: iODBC and unixODBC. The functionality of these two solutions is very similar, but the latter is better documented.

GCC is the GNU Compiler Collection, which currently contains front ends for C, C++, Objective-C, Fortran, Java, and Ada, as well as standard libraries for these languages (libstdc++, libgcj,...). "GCC" is a common shorthand term for the GNU Compiler Collection. This is both the most general name for the compiler, and the name used when the emphasis is on compiling C programs (as the abbreviation formerly stood for "GNU C Compiler"). GCC is universal, cross-platform and efficient, and that is why it was selected.

The scanner generator called Flex was used, for the query parsing. Flex reads a given input for as a description of the scanner to generate. The description is in the form of pairs of regular expressions and C code, called rules. Flex generates a C source file as output. This file is compiled and linked with the flex library to produce an executable. When the executable is run, it analyzes its input for occurrences of the regular expressions. Whenever it finds one, it executes the corresponding C code. Using Flex gives more flexibility for designing the parser and simplifies the implementation stage.

Igor Wojnicki 2005-11-07