6.1 Atoms, Strings, and Numbers

Introduction

Prolog+CG has three kinds of constants. A constant is a value which does not change.

Atoms

An atom is simply an identifier. For example, the following are all atoms:

  • Entity
  • Act
  • Animal
  • Garfield
  • Albert
  • Aalborg

When writing CGs, atoms are used for concept types and concept type instances.

Strings

A string is a sequence of characters which is "enclosed in double quotes". For example:

  • "This is a string"
  • "Romeo said he was very much in love"
  • "Ouch!"

When writing CGs, strings can be used as referents of concepts.

For example:

// Type hiearchy
Entity > Outcry.

// Graph fact
gr([Outcry : "Ouch!"]).

Numbers

A number in Prolog+CG is either an integer or a real (decimal point) number.

For example:

  • Integer:
    • 1
    • 2
    • 3
    • -1
    • -3
    • ... etc.
  • Real (decimal point):
    • 1.3
    • 3.14
    • -2.78
    • 100.00
    • ... etc.

When writing CGs, numbers can be used as concept descriptors of concepts.

For example:

// Type hierarchy
Entity > Number.

// Catalog of instances
Number = Pi. 

// Graph fact
gr([Number : Pi = 3.141592]).

This example is available in the AAU directory as pi.plgCG.


PrevLite: 6 Prolog for CG users
NextLite: 6.2 Structures, relationships and terms

Prev: 6 Prolog for CG users
Up: 6 Prolog for CG users
Next: 6.2 Structures, relationships and terms