Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering

User Tools

Site Tools

Getting started

Welcome to the ever growing family of PDT users! The chapters below will help you setting up and using the Prolog Development Tool.

Installing PDT

See Download for details.

Creating a Prolog Process

First of all, if you don't see the prolog console, you can open it by going to the menu “Prolog” > “Open Console”. It should look like this:

  • Create a new process by clicking the button on the left (with the green plus)
  • Switch to this process clicking the arrow next to the second button from the left, uncheck “Follow mode” (if it is checked) and select the process you just created

  • Now the console should look like this.

Set up the Prolog Editor

The create and consult Prolog files you should do the following:

  • Add a simple empty project to your workspace

  • Add a prolog file 1)
  • Select “No” if you're asked if you want to make your project a Prolog project. Working with the PDT-Nature is not supported at the moment and some features won't work if your project has a nature. 2)

  • Now you have all you need and you can start edit your prolog file in the Prolog Editor

Navigator: Displays and lets you work with projects, files and folders (open, copy, move, rename, delete, …).

Editor: Here you can write Prolog code. The editor supports syntax highlighting and the usual Eclipse markers for syntax errors and warnings.

Outline: Shows the predicates defined in the active editor and their arity. You can expand them to reveal the heads of the individual clauses. If the file is a Prolog module, public predicates are marked by green bullets and private ones by yellow diamonds. The AZ button at the top of the outline determines the sorting of predicates (textual or alphabetic order). The outline is updated, everytime a file is consulted.

Console: The Prolog Console is where you can type your queries and interact with the Prolog system. You can find more information about the console here.

Your first Prolog File

  1. Open the just created file in the prolog editor.
  2. Create a few simple facts: For instance, type 'likes(jack, kate).' and 'likes(sawyer, kate).' Don't forget the closing periods after each fact!
  3. Save the file.
  4. Consult the file : Use “Prolog > Consult” or press “F9” to “consult” the active editor window. Now you can see the outline.
  5. Run a query: To find out all the persons who like 'kate' type likes(A,kate). in the console. Don't forget the period ('.') at the end of the query! Terminate the query by typing <return>. The output should be A = jack.
  6. Ask for more results: Type a semicolon (“;”) and press <return>. The next (and last) result should be A = sawyer.
  7. If you run a query which has no results (in our example something like likes(kate, A).) the result will be: 'false.'.

Further Reading / FAQ

just select a normal file and use the extension .pl
You can also check “Remember my decision” and select no. You can always change this in the PDT preferences.
research/pdt/docs_archive/v0.x/getting_started_with_pdt.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2024