7.2.4 If/Then

Introduction

In many situations, one will want to write "If ... Then" structures.

The accepted way of doing this in the CG community is as follows:

  [If:
     [... the if-part ...]
     [Then:
        [... the then-part ...]
     ]
  ]

However, we cannot do it this way, since this would require two adjacent, non-connected graphs (namely the if-part and the Then-part).

Template

So we have to invent our own solution. One such is exemplified here:

  [If =
     [Propositon = ... the if-part ...
     ]-AND->[Then = ... the then-part ...]
  ]

The types If and Then are made to be subtypes of Proposition:

Entity > Physical, Abstract.
Abstract > Proposition.
Proposition > If, Then.

Example of template

// If-Then template example
//
// Available in the AAU directory as If-Then-template.plgCG
//
// Ulrik Petersen
// Created: mid-September, 2003
// Last update: September 18, 2003
//


// Type hierarchy
Entity > Physical, Abstract.
Abstract > Proposition, Act.
Proposition > If, Then.
Physical > Object.
Object > Ball, Person.

// Catalog of instances
Act = Drop, Fall.
Person = You.

// Graph fact: If you drop a ball, it falls
graph(IfThen1, [If =  
                   [Proposition = 
                        [Act: Drop]-
                            -AGNT->[Person: You],
                            -THME->[Ball : X]
                   ]-AND->[Then =
                             [Act: Fall]-AGNT->[Ball : X]
                          ]
               ]).

Note how this makes use of the Act template and the AND template.

Note also how it uses the variable "X" to show coreference.

Reference

This solution comes from Ulrik Petersen.

The general method described first is generally accepted in the CG community. See Sowa (2000), pp. 141, 280 for examples.


PrevLite: 7.2.3 AND
NextLite: 7.3 Examples

Prev: 7.2.3 AND
Up: 7.2 Templates
Next: 7.2.5 Non-literal expressions (Ad)