Syntax for Set based DB

From: Neo <neo55592_at_hotmail.com>
Date: 1 Mar 2007 14:24:08 -0800
Message-ID: <1172787848.094332.202490_at_n33g2000cwc.googlegroups.com>



Comments/suggestions appreciated on syntax for an experimental db based on sets. The sample script creates a db equivalent to an RMDB with the following tables.
T_Person
T_Doctor
T_Name
T_Gender
T_Age
T_Weight
T_Qty
T_Unit

Below script creates/queries two things with different typing and attributes. The first is a person/doctor named John who is male, age 75 yr and weight 75 kg. The second is an untyped thing named Mary whose gender is female. Note: lines starting with "(;" are comments. Each expression begins with a function. For example "g" is short for Get. "g+" is short for Get Else Create. Sub expressions that do not specify a function default to that of parent expression.

(; Create a person/doctor named john)
(g+ (type 'person)

      (type 'doctor)
      (name 'john)
      ((type 'gender) 'male)
      ((type 'age) ((type 'qty) '75) ((type 'unit) 'yr))
      ((type 'weight) 75 (unit 'kg)

(; Create a female thing named mary)
(g+ (name 'mary)

      (gender 'female))

(; Get doctors who are 75 yr)
(; Gets john)
(g doctor (75 yr))

(; Get persons whose weight qty is 75 and unit is kg)
(; Gets john)
(g person (weight '75) (unit 'kg))

(; Get things that are female)
(; Gets mary)
(g female)

(; Get things that have a gender)
(; Gets john and mary)
(g (gender))
Received on Thu Mar 01 2007 - 23:24:08 CET

Original text of this message