WGENEVB -- Visual Basic Genealogical Sample

WGENEVB is an intelligent, genealogical application that illustrates the advantages of using Prolog rule-based modules in Visual Basic programs. The user interface is built entirely in Visual Basic, while the rules are written in Amzi! Prolog.

WGENEVB lets you load family trees, explore the relationships between people, add new people, and change existing people and relationships. The Prolog portion of the program does all the database manipulation, and ensures the integrity of the database, making sure that all the family members have relationships that make sense.

Loading and Saving Families

Querying Relationships

Adding / Changing Family Members

Application Architecture and Source Code

www.amzi.com - Additional demos, articles, freeware, evaluation copies and information about Amzi! Prolog + Logic Server.

We welcome any and all comments about this demo. Contact us at www.amzi.com

Building the Sample

To build it:

  1. Compile gene.pro
  2. Link gene.plm into gene.xpl.
  3. Open the VB project wgenevb and build wgenevb.exe.

Running the Sample

To run it:

  1. Run wgenevb.exe

Loading and Saving Families

File / Open This command loads a family database, which is actually a Prolog source code file containing the family data in the form of Prolog facts. The ruling families of England and Scotland are provided as an example.

File / Save (As) This command saves the current family into a file.

.FAM Files The following is an excerpt from the sample family:

Note, for each person we define their gender (male or female), their mother, their father, and their spouse or "single".


Querying Relationships

To find out the relationships between family members, simply click on a name in the first box, and on a relationship in the second box. The result is shown immediately in the third box.


Adding / Changing Family Members

Add This adds a new member to the family. A pop-up form lets you enter the name of the new person, their gender, parents and spouse (if any).

Change This allows you to modify an existing family member. The default is the currently highlighted person.

Delete This lets you delete a family member.


Application Architecture and Source Code

All the work of WGENEVB is done in Prolog. Each task is performed by a Prolog function, called a predicate. The major tasks are:

Represent each family member as relational-like record of the form: person(Name, Gender, Mother, Father, Spouse).

Add, save, delete and return information about family members. The add predicates call a set of rules that maintain the integretity of the database. For example, one rule makes sure a person is not their own ancestor or descendent.

Determining all the family members who have a specified relationship with a specified person. For example, sibling(Person, Sibling) can determine the siblings of the specified person.

The source code for WGENEVB is consists of these modules:

All the calls to the Visual Basic cover functions for the Logic Server API end with LS. A typical Prolog query looks like this: First, a string containing the query is constructed. In this case we are asking Prolog to tell us everyone who has a specific relationship to a specific person. So for example, if to determine siblings of James IV, the query would be: Next, we call Prolog using CallStrLS and RedoLS to get all the siblings, one at a time. As the siblings are returned in place of the X in the query, GetArgLS is used to get the value of the first argument to sibling. As the siblings are retrieved they are added to the RelatedPersonsLists.


Copyright ©1996-2000 Amzi! inc. All Rights Reserved.