Re: Argument for 1NF by counter-example

From: Neo <neo55592_at_hotmail.com>
Date: 25 Oct 2004 20:13:43 -0700
Message-ID: <4b45d3ad.0410251913.1ce4a3a9_at_posting.google.com>


> ... but if you give me tools that permit me to think > in sets or di-graphs, so much the better.

// Create classes for properties of persons

CREATE2 *age.cls = thing;
CREATE2 *gender.cls = thing;
CREATE2 *color.cls = thing;
CREATE2 *profession.cls = thing;

// Create person class and 4 persons

CREATE2 *person.cls = thing;
CREATE2 *johnathan.cls = person;    // Father
CREATE2 *martha.cls = person;       // Mother
CREATE2 *john.cls = person;         // Son
CREATE2 *mary.cls = person;         // Daugther

// Add a different property to each person
CREATE2 johnathan.age = +45;
CREATE2 martha.gender = +female;

CREATE2 john.color = +brown;
CREATE2 mary.profession = +student;
CREATE2 mary.profession = +artist;   // Add second "value"

// Relate parents and children
// Note: reciprocal child relations created automatically

CREATE2 john.parent = johnathan;
CREATE2 john.parent = martha;
CREATE2 mary.parent = johnathan;
CREATE2 mary.parent = martha;

// Get johnathan's children (john and mary)
SELECT2 johnathan.child = %;

// Get martha's children (john and mary)
SELECT2 martha.child = %;

// Get john's parents (johnathan and martha)
SELECT2 john.parent = %;

// Get mary's parents (johnathan and martha)
SELECT2 mary.parent = %;

// Get mary's profession(s) (student and artist)
SELECT2 mary.profession = %;

// Get a person whose age is 45 (johnathan)
SELECT2 %.cls=person & %.age=45;

// Add properties to the "value" student.
// XDb2 can do this because even a "value" is a thing
// and any thing can have properties.

CREATE2 *min.cls = adverb;
CREATE2 *max.cls = adverb;
CREATE2 student.min,age = +5;
CREATE2 student.max,age = +18;

One particular partial view of the above things looks like below when presented in a tree:

thing
  inst: person

     inst: johnathan
       age: 45
       child: john
       child: mary    // This node expands same as mary below
     inst: martha
       gender: female
       child: john
       child: mary    // This node expands same as mary below
     inst: john
       color: brown
     inst: mary
       profession: student
         min age: 5
         max age: 8
       profession: artist

Note: "cls" is short for class. "inst" is short for instance. "cls/inst" are reciprocal relationships similar to "parent/child". Received on Tue Oct 26 2004 - 05:13:43 CEST

Original text of this message