Part I: Foundations

Welcome

Welcome to Module II of the series of courses on Conceptual Graphs. Module I laid the foundation for Module II by introducing the general theory of conceptual graphs. In Module II, we will be using this theory to represent larger texts, and to reason about these texts. We will be using a specific computational tool for representing and reasoning about our texts, namely Prolog+CG.

Prolog+CG

Prolog+CG is an implementation in Java of the programming language Prolog, with extensions enabling easy use of conceptual graphs in Prolog+CG.

Conceptual graphs are first class datastructures in Prolog+CG, meaning that Prolog+CG treats conceptual graphs the way it treats any other data, and the same primitives are available for conceptual graphs as are available for any other data type in Prolog.

Thus writing and using conceptual graphs are easy to do using Prolog+CG.


Preliminaries

These notes

These notes are divided into six parts.

Part I, contains preliminary information which is good to know before starting to read the rest of the material.

Part II is about writing and using conceptual graphs in Prolog+CG. We will only say as much about Prolog as is necessary for understanding how to use Prolog+CG to represent conceptual graphs. Part II includes a number of examples that will highlight how conceptual graphs can be useful in a computational framework.

Part III, is a general introduction to Prolog. We will describe and explain Prolog in its basic, general form, only saying a little that is specific to Prolog+CG. Thus Part III should enable you to understand how Prolog works, and also how to write general Prolog programs.

Part IV, is about Peirce's rules of inference. Peirce developed five rules of inference using contexts which can be used as a general-purpose logic. Part IV introduces a variant of these rules that has been adapted for conceptual graphs. Using these five rules of inference, it is possible to reason using conceptual graphs.

Part V contains some exercises.

Part VI contains some reference materials.

Glossary

Scattered throughout the text of these notes will be links to the Glossary. Use these links whenever you want to. Some of the terms used are only defined in the glossary, while they are used with little or no explanation in the running text. Therefore, if there are any terms you don't know, using the glossary may prove to be a fruitful use of time.

You can see when a link points to the glossary by looking at the place in your browser where the URL of the link under the mouse is shown. If this URL contains the word "Glossary", it is a link to the glossary.

Summaries

On many of the following pages, there will be a short summary at the bottom of the page highlighting the main points of the page. Use these summaries to make sure you understand the main points.

Document hierarchy

The following pages are divided into parts, chapters, and pages. The table of contents lists all of the pages indented in such a way as to indicate the document hierarchy. Each chapter will start with a list of the pages in the chapter.

At the bottom of each page, there will be three links: Prev, Up, and Next. These take you to the previous, once upwards, and next pages in the document hierarchy. You will always be able to get to the table of contents by clicking "Up" a number of times.

"Lite" track

The course has a "lite" track which avoids advanced material. The links named "PrevLite" and "NextLite" at the bottom of each page will take you through this track.

The advanced sections can be reached either through the "Prev/Next" links described in the previous section, or through the navigation menu on the left. They are clearly marked with the symbol "(Ad)" in the title.

Quizzes

At the end of most chapters, there will be a quiz. This will be a multiple-choice quiz where you have to pick an answer from a number of possibilities. Only one possibility will be correct.

When you are done picking your answers, click the button at the bottom of the page. You will see a tally indicating how many questions you got right. Then those questions that you got wrong are printed again, with the correct answer and an explanation.

If you want to see all questions with correct answers and explanations, there is a possibility of displaying them by clicking another button. Otherwise, you can click "Next" to go on to the next chapter.

Feedback

If there is anything that is unclear in these pages, we would like to hear about it. You can write to Ulrik Petersen at "ulrikp at hum.aau.dk" (convert this to a valid e-mail address before sending the e-mail). It is most helpful if you indicate which page you are referring to by including its node number. This is the four- or five-digit number you see in the Address field of your browser.

Summary

These notes are about how to use conceptual graphs, both in a computational framework using Prolog+CG, and in a formal framework using Peirce's five rules of inference.

Part I gives useful background information. Part II introduces how to write and make use of conceptual graphs in Prolog+CG. Part III is a general introduction to Prolog. Part IV introduces Peirce's five rules of inference in a CG framework. Part V contains some exercises. Part VI contains reference materials.

Next

The next page gives hints on how to download and install the Prolog+CG environment if you want to do this on your own machine. The whole package has already been installed on the machines in the laboratories at Kroghstræde 3.


Downloading and installing the Prolog+CG environment

Java 1.5.0

First, download and install Java from java.com. It is important that you use Java 1.4.2 or later. If you download via the java.com link, you will get the latest version, so you'll be fine.

Prolog+CG

Next, download and install the latest version of Prolog+CG.


The Prolog+CG environment

Running Prolog+CG

If you have installed Prolog+CG in a Windows environment, all you have to do is go to the "Programs" menu and find the Prolog+CG folder, then run the program from there.


The Prolog+CG screen

Main screen

Once the Prolog+CG environment has been started, you will see a screen that looks like this:

There are two main sections of the Prolog+CG window. In the upper section (the program area), you write and edit your programs, while in the lower section (the query area), you write questions to ask the Prolog system. The splitter between the two sections can be dragged to make either section bigger or smaller.

Toolbar

The toolbar provides easy access to the most common commands. This button:

is the compile-button. Use it every time you have modified the program text. (The term 'compile' will be explained on the next page.)

This button:

is the query-button. You can use it to start the Prolog engine on the question you have written in the query-area.

This button:

is the stop-button. You can use it to stop the Prolog engine as it searches for solutions to your question, if it takes too long.

Summary

The Prolog+CG window is divided into main two areas:

The toolbar provides easy access to the most commonly used functions, such as:

Next

The next section explains the development cycle of Prolog.


The Prolog development cycle

Two states

When using Prolog, the system is fundamentally in one of two states:

  1. Either the state where you can write programs and questions, or
  2. the state where you are executing a query

In the latter state, you have no control over what is happening (although you can stop the process by pressing the stop-button). In this state, Prolog is answering the question you have typed beforehand. When Prolog has finished finding all solutions, it returns you to the state where you can edit your program and write a question.

The programming cycle

This can be represented as in the following cycle:

  1. Write program
  2. Compile
  3. Ask question
  4. Get answer
  5. Restart cycle.

The second stage, compiling the program, is a process whereby the Prolog+CG environment translates your program into object code, which is a form that can be more readily executed by the Prolog+CG engine than the bare text of your program.

Summary

The Prolog+CG environment is fundamentally in one of two states. In the first state, you can write programs and questions. In the second state, the environment executes your program and answers the question you have written.

This gives rise to the programming cycle as explained above.

Next

Next, we look at some common tricks you will need in your daily work with Prolog+CG.


Daily Prolog+CG usage

Cutting and pasting

You can use standard Windows procedures for cutting and pasting in the two windows. If you want to copy something from the lower section of the main window (the query-area), use the mouse to select what you want to copy. You will have to wait with letting go of the mouse-button until after you have pressed Ctrl-C.

Cutting and pasting can be very useful when writing similar queries one after the other.

After compilation

After compilation, the query-area will contain information on whether the compilation succeeded or failed. You will be told to "Please, click to switch to the console mode." This means that you should click either in the query-area or the program-area, and you will be returned to being able to write queries in the query-area.

However, sometimes this does not work, and the system is stuck without being able to write queries. If this happens, it is sometimes possible to bring it back to its normal state, but sometimes it is best to save and exit the system, then restart the system.


File manipulation

AAU Sample directory

After you install the Prolog+CG files, a number of example files will have been installed. They are in a directory called "AAU", beneath the "Samples" directory which opens every time you press the "Open" button on the toolbar.

Throughout these notes, we will be referring to files in "the AAU directory". In such cases, we are referring to these example files and this directory.

General

The usual Windows operations are available:


Summary

We have introduced the Prolog+CG environment, explaining the main areas of the screen. We have explained the Prolog development cycle, which is the operational framework within which you will work with Prolog+CG. We have given some hints for successful everyday usage of Prolog+CG. Finally, we have mentioned a few things about file manipulation.