# 4.3.2.2 Variables

## Introduction

A concept referent can be is a variable.

A variable is a name we give to a value. The value may change. This makes variables really useful.

## Example

```Entity > Animal, Fable.

Animal = Wolf, Lamb.
Fable = Fable1.

fab([Animal : Wolf]<-THME-[Fable : Fable1]).
fab([Animal : Lamb]<-THME-[Fable : Fable1]).

AnimalInFable(F,A) :- fab([Animal : A]<-THME-[Fable : F]).
```

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

## Explanation

First, we have the usual type-hierarchy and catalog of instances.

Then we have two facts called "fab" which specify two CGs.

Lastly, we have a rule called "AnimalInFable". It "calls" the "fab" facts with a special CG as the actual parameter.

The CG has two variables, called "A" and "F". When calling the "fab" facts, these two variables are "bound" to the corresponding values in the CGs in the "fab" facts.

Note how the CG in the rule has the same form as the CGs in the "fab" facts. This makes it possible for the Prolog+CG system to match the CGs.

## Usage

If we ask the following query:

`?- AnimalInFable(F,A).`

```{F = Fable1, A = Wolf}
{F = Fable1, A = Lamb}
```

As we can see, the variable "F" has been "bound" to the value "Fable1" in both "fab" facts. This corresponds with the actual CGs, where the referent of the "Fable" concepts is "Fable1" in both cases.

Likewise, the variable "A" has been bound to the value "Wolf" in one, and "Lamb" in the other result set. This also corresponds to the actual CGs.

PrevLite: 4.3.2.1 Identifiers and strings
NextLite: 4.3.2.3 Multi-referents

Prev: 4.3.2.1 Identifiers and strings
Up: 4.3.2 Referents
Next: 4.3.2.3 Multi-referents