Ex260 - John, Mary and R2D2

Background: NLI
Related: Examples, Ex330, Ex335

This example stores the following:

john is a person whose profession is gardener.
mary is a horse whose breed is mustang.
r2d2 is a robot whose cpu is 8051.
mary bite r2d2 before breakfast.
r2d2 zap mary during lunch.
(r2d2 zap mary during lunch) because (mary bite r2d2 before breakfast).
john reset r2d2 after dinner.
(john reset r2d2 after dinner) because (r2d2 zap mary during lunch).

NLI Script

(; Create db items)
(new 'profession)
(new 'breed)
(new 'cpu)

(; Create a person named john whose profession is gardener)
(new 'john 'person)
(set+ (it) profession 'gardener)

(; Create a horse named mary whose breed is mustang)
(new 'mary 'horse)
(set+ (it) breed 'mustang)

(; Create a robot named r2d2 whose cpu is 8051)
(new 'r2d2 'robot)
(set+ (it) cpu '8051)

(; Create verbs)
(new 'like 'verb)
(new 'bite 'verb)
(new 'zap 'verb)
(new 'reboot 'verb)

(; Create prepositions)
(new 'because 'preposition)
(new 'before 'preposition)
(new 'during 'preposition)
(new 'after 'preposition)

(; Create meals breakfast, lunch and dinner)
(new 'breakfast 'meal)
(new 'lunch 'meal)
(new 'dinner 'meal)

(; Create a story)
(set mary like john)
(set john like mary because (get mary like john))
(set mary bite r2d2 before breakfast)
(set r2d2 zap mary during lunch 
     because (get mary bite r2d2 before breakfast))
(set john reboot r2d2 after dinner 
     because (get r2d2 zap mary during lunch))

(; Who did mary bite?)
(; Gets r2d2)
(get mary bite *)

(; Who zap mary?)
(; Gets r2d2)
(get * zap mary)

(; What did r2d2 do to mary?)
(; Gets zap)
(get r2d2 * mary)

(; What type of thing likes john?)
(; Gets horse)
(get * instance (get * like john))

(; Why did r2d2 zap mary during lunch?)
(; Gets mary bite r2d2 before breakfast)
(get r2d2 zap mary during lunch because *)

(; What did john do to r2d2 after dinner?)
(; Gets reboot)
(get john * r2d2 after dinner)


Download Database:
Ex260.zip (23 KB)
The creation of rolex replica the watch is inspired by the retro and elegant money of rolex replica watches the brand's round watch. The chronograph is omega replica simple and stylish, with the line features of rolex replica uk the watch series.

CM ©2000-2007