Suggestions for alternate UPDATE command syntax

From: Neo <neo55592_at_hotmail.com>
Date: 3 Apr 2005 13:14:33 -0700
Message-ID: <1112559273.775580.158850_at_g14g2000cwa.googlegroups.com>



Following script demos XDb3's UPDATE command where the general syntax is "UPDATE x > y". In the example below, John, Mary and Bob's colors are updated. Suggestions to improve the syntax appreciated.

// Create person and color types.

(CREATE type inst *person)
(CREATE type inst *color)

// Create a person named john whose color is blue.
(CREATE person inst *john

      & it color +blue)

// Create a person named mary whose colors are pink and yellow.
(CREATE person inst *mary

      & it color +yellow
      & it color +pink)

// Create a person named bob without color who is 34.
// Create age type on the fly.

(CREATE person inst *bob

      & it (CREATE type inst *age) +34)

// Find persons who are blue.
// Finds john.

(SELECT * color blue)

// Find persons who are yellow and pink.
// Finds mary.

(SELECT * color yellow

      & * color pink)

// Find persons with color.
// Finds john and mary.

(SELECT person inst *

      & * color)

// Update john's color(s) to yellow.

(UPDATE john color * > yellow)

// Update mary's color yellow to the new color purple.
(UPDATE mary color yellow > (CREATE color inst *purple))

// Create bob's color's same a john's.
// Creates bob's color is yellow.

(CREATE bob color (john color *))

// Update anyone whose age is 34 to color pink.
// Changes bob's color to pink.

(UPDATE (* age 34) color * > pink)

// Update everyone's color(s) to blue.

(UPDATE (person inst *) color * > blue) Received on Sun Apr 03 2005 - 22:14:33 CEST

Original text of this message