WebFlex - Details

This document describes the availability of the flex expert system toolkit on the World Wide Web. Flex is an expressive and flexible AI toolkit, well established on the desktop. Flex provides a comprehensive and versatile set of facilities for programmers to construct sophisticated, readable and portable expert systems.

Access to Prolog

Furthermore, as Flex is implemented in Prolog, it can utilise those advanced features of the Prolog language such as, list processing, recursion, optimised backward-chaining, logical variables, automatic memory management and much more. In addition, you get access to all the special features of LPA Prolog such as scientific mathematical functions, high performance sorting and set-oriented functions, string manipulation, hashing, database access, memory files and various other features you may require in building industrial and scalable solutions.

Straightforward Delivery

WebFlex allows you to deliver your Flex-based expert systems onto Intranets and Extranets easily. Just create your rules, frames and questions as per normal using the English-Like Knowledge Specification Language provided in Flex, and WebFlex will construct a web server-based solution using ProWeb.

Automatic Form Generation

All questions will be automatically converted into HTML forms and sent pre-configured for standard browsers. WebFlex will automatically generate JavaScript code for checking answer types and ranges where specified in the Flex KSL. This makes optimal use of the client-side processing and helps ensure that once the data comes back to the server, it is valid and worth processing.


Being browser based, WebFlex lets you build expert systems where the user can change his/her mind, simply by using the back button and editing an answer previously given. They can then proceed on and maybe get a different result. Answers given first time round are remembered and used as prefill values where appropriate, so potentially saving end-users lots of time re-entering data.

Multiple Users

Like ProWeb, WebFlex can support multiple users querying the same knowledge-base and tracks their respective sessions. Answers to questions can be stored in standard relational databases if required. Calculated answers can be displayed using HTML, or files generated in various formats for integration within corporate processes such as document management systems.


In addition, you can specify various attributes about the way questions are presented to the user using the object-oriented frame features of Flex. If you want to include your own bespoke HTML, GIF, page layout instructions, then you can include these too with minimal additional work. This way you can develop rule-based diagnostic systems, business rules systems, decision-support aids, product selectors and configurators etc and have them adhere to your own house-style for web-based applications.

Simple Example

A simple program asking a basic question in Flex would be something like:

action run ;
   do  restart
   and ask simple_question_q .

question simple_question_q
   Choose an option ;
   choose one of option_group .

group option_group
   start, stop, 'go slow', 'go fast' .

Executing 'run' within WebFlex, would generate a page on the browser something like:

Simple Question

Advanced Example

By adding in some style information for the question, using Flex's frame system, and linking or grouping questions together on the same page, using Flex's group mechanism, we can get to a program such as:

action run ;
   do  restart
   and ask group_test1 .

% We can group questions together to appear all at once, on the same page

group group_test1
  multi_choice_q, single_choice_radio_q,
  single_choice_listbox_q, single_choice_dropdown_q .

% This frame describes the table, caption, header and footer
% for the grouped questions

frame group_test1_style
   default caption is 'Form 1' and
   default body is 'test1.htm' and
   default tablestyle is { bgcolor-'#FFccFF', border-1 } .

% Multiple choice question
% Because clauses become JavaScript alerts

question multi_choice
  Multi-choice listbox ;
  choose some of choices
  because I need to test a multi-choice listbox .

frame multi_choice_style ;
  default rows is 4 and
  default prefill is {bananas} .

% Single choice radio button question

question single_choice_radio
  Set of radio buttons ;
  choose one of choices
  because I need to test out radios .

frame single_choice_radio_style ;
  default method is radio and
  default prefill is apples and
  default infix is br .

% Single choice listbox question

question single_choice_listbox
  Single-choice listbox ;
  choose one of choices
  because I need to test a single-choice listbox .

frame single_choice_listbox_style ;
  default rows is 4 and
  default prefill is bananas .

question single_choice_dropdown
  Single choice dropdown ;
  choose one of choices
  because I need to test a single-choice drop down .

% With no number of rows specified, it defaults to dropdown

frame single_choice_dropdown_style ;
  default prefill is doughnuts .

% We are using the same group of items in all the questions

group choices
  apples, bananas, cheese, doughnuts .

Now, when we execute 'run' within WebFlex, we would get a page on the browser something like:

Grouped Questions

Ease of Use

Now you can combine rule-based and frame-based programs with a browser-based applications delivery system without having to get your hands too dirty. Why not test drive this now?

Check out the WebFlex demos!