We will declare 4 facts (objects):

  1. Fire - this is an input event sent by fire censors
  2. Alarm - this is a fact we send as output to turn on the alarm (by external system)
  3. ActivateSprinkler - this is a fact we send as output to turn on the sprinkler (by external system)
  4. CeaseFire - this is an input event sent by fire brigade when the fire is stopped

Fire and CeaseFire must be declared with @role(event), see fact roles for details.

Fire

package com.fire;

declare Fire
    @role(event)
    room: int;
end

Alarm

package com.fire;

declare Alarm
end

ActivateSprinkler

package com.fire;

declare ActivateSprinkler
    room: int;
end

CeaseFire

package com.fire;

declare CeaseFire
    @role(event)
    room: int;
end

When complete, you should have something like this:

BinaryFile


Next: Declaring rules