Modelling Diary Events (with XDb3)

From: Neo <neo55592_at_hotmail.com>
Date: 28 Feb 2005 13:05:32 -0800
Message-ID: <1109624732.707284.205350_at_g14g2000cwa.googlegroups.com>



The script below models the following requirements using an experimental db (XDb3). The equivalent can be performed with an RMDB using nested relations and generic modelling.
  • A person has 0 to may diaries.
  • A diary contains 0 to many days.
  • A day has 0 to many events.
  • An event has a start time.
  • An event has 0 to many participants.

// Create directoy items to organize things.
(CREATE dir item *person)
(CREATE dir item *diary)
(CREATE dir item *day)
(CREATE dir item *event)
(CREATE dir item *time)
(CREATE dir item *participant)

// Create persons john, mary and bob.
(CREATE person inst *john)
(CREATE person inst *mary)
(CREATE person inst *bob)

// Log lunch with mary at 12PM on 2/25/05 in john's work diary.
(CREATE john diary *work day +2/25/05 event +lunch time +1200 )
(CREATE john diary work day +2/25/05 event +lunch participant mary)

// Log meeting with bob at 1PM on 2/25/05 in john's work diary.
(CREATE john diary work day +2/25/05 event +meeting time +1300)
(CREATE john diary work day +2/25/05 event +meeting participant bob)

// Log golf w/ mary and bob at 9AM on 2/26/05 in john's personal diary.
(CREATE john diary *personal day +2/26/05 event +golf time +900)
(CREATE john diary personal day +2/26/05 event +golf participant mary)
(CREATE john diary personal day +2/26/05 event +golf participant bob)

// Find all events in john's work diary for 2/25/05. // Finds lunch and meeting.
(SELECT john diary work day 2/25/05 event *)

// Find what are mary and bob participants of. // Finds golf on 2/26/05 logged in john's personal diary.
(SELECT * participant mary & * participant bob)
Received on Mon Feb 28 2005 - 22:05:32 CET

Original text of this message