Re: Suggestions for alternate UPDATE command syntax
Date: 3 Apr 2005 16:38:44 -0700
Message-ID: <1112571524.844216.286120_at_f14g2000cwb.googlegroups.com>
Following script demos XDb3 UPDATE command (shown near end).
// Create types.
(CREATE type inst *challenge & dir item it)
(CREATE type inst *solution)
(CREATE type inst *person)
(CREATE type inst *author)
(CREATE type inst *database)
(CREATE type inst *version)
(CREATE type inst *hardware)
(CREATE type inst *cpu)
(CREATE type inst *speed)
(CREATE type inst *"memory size")
(CREATE type inst *"execution time")
(CREATE type inst *"download location")
// Create titles.
(CREATE type inst *title)
(CREATE title inst *contender)
(CREATE title inst *winner)
(CREATE title inst *loser)
// Create persons with default titles updated near end.
(CREATE person inst *neo
& it title +contender)
(CREATE person inst *hugo
& it title +contender)
// Create a challenge and its solutions for different hardware.
(CREATE challenge inst *"common ancestor report"
& it solution (CREATE solution inst *"x#1a"
& it author neo
& it hardware (CREATE hardware inst *"dell server"
& it cpu (CREATE cpu inst *"P II"
& it speed +"500 Mhz"))
& it database (CREATE database inst *xdb1
& it version +4.5.9)
& it "execution time" +"1.63 ms"
& it "download location"
+"www.xdb1.com/Example/Ex076.asp")
& it solution (CREATE solution inst *"x#1b"
& it author neo
& it hardware (CREATE hardware inst *"pocket pc"
& it cpu (CREATE cpu inst *"ARM"
& it speed +"233 Mhz")
& it "memory size" +"32 MB")
& it database xdb1
& it "execution time" +"6.56 ms")
& it solution (CREATE solution inst *"rm#2"
& it author hugo
& it hardware (CREATE hardware inst *"desk top"
& it cpu (CREATE cpu inst *"P III"
& it speed +"1300 Mhz"))
& it database (CREATE database inst *"sql server"
& it version +2000)
& it "execution time" +"11.0 ms"))
// Find neo solution's execution time on hardware with 500 Mhz CPU.
// Finds 1.63 ms.
(SELECT (solution inst *
& * author neo
& * hardware (* cpu (* speed "500 Mhz"))) "execution time" *)
// Find hugo's solution's execution time on hardware with 1300 Mhz CPU.
// Finds 11.0 ms.
(SELECT (solution inst *
& * author hugo
& * hardware (* cpu (* speed "1300 Mhz"))) "execution time" *)
// Update neo's title.
(UPDATE neo title contender > winner)
// Update hugo's title.
(UPDATE hugo title * > loser)
Received on Mon Apr 04 2005 - 01:38:44 CEST
