Details of the KR second lab in 2022

Allikas: Lambda

NB! It is recommended to do the 2nd and 3rd lab by teams of 2 or 3 people. Recommendation: connect to other students by Teams and ask to join you or propose to join others. The list of students who have presented the 1st lab is on the course teams under the "Files" tab with the name teadmised_prax1_nimekiri.txt

The task in the second lab is to use logic reasoners for question answering (pure symbolic ai):

  • present a selected large subset of your geodata int the reasoner usable form.
  • write rules for deriving new knowledge (facts) from the database. Write at least 20 rules.
  • write a number of interesting nontrivial queries (at least five different) and demonstrate how the reasoner solves them.

During the defence of the lab you will have to make a presentation of all these three parts and demonstrate how the reasoner can answer a number of questions.

NB! It is recommended (not obligatory) to convert the knowledge base and rules to the json-ld-logic format. Please experiment with the online json stuff first. Although inconvenient to use manually, there are two reasons for this recommendation:

  • It is easier to process fact/rule sets programmatically when they are in json, as oppesed to the "conventional" format.
  • We will use the json format in the third lab: this format incorporates ways to indicate confidences and exceptions to rules.

Importantly, you may want to convert "standard" logic representation to json automatically. Please open the "advanced" block of logictools and press "Convert to" "json". The same can be done using the command line version of gkc like this: ./gkc example.txt -convert -json . In this way you can avoid writing json rules by hand.

Bear in mind that in the third lab we will add two new parts:

  • Uncertain facts and rules with the approximate confidence: these can be handled by a special experimental reasoner gk . The version behind this gk link will be updated and made easier to use for the third lab.
  • A small natural language understanding component to automatically generate (a) some additional facts (b) the queries like the ones you manually write in this lab. You do not have to write this component: we will provide a python program doing this for you. You'll still have to convert the output of the component to match the style of encoding you are using.

In the second lab we will use a standard logic gkc reasoner (description in the GKC paper at page 538 but you do not need to read it). For specific examples about geography please look at

Please first:

  • If you have not done it before, try out the web version of the gkc reasoner from
  • Download and use the command line version from the release 0.6.0 and read the tutorial-style README in gkc/Examples explaining the use of the command line version. The release contains command line binaries for Linux, Windows and Mac: just download the self-contained executable and run it, no need to compile anything or install or fetch dependencies.

In the third lab we will additionally use a later version of the special commonsense-reasoning-with-confidences branch gk of gkc. We will not use it for the second lab.

Examples from the live prax 16 March