Re: NULLs: theoretical problems?

From: Neo <>
Date: Mon, 20 Aug 2007 20:19:20 -0000
Message-ID: <>

> > ... NULLs ... There are better and more consistent ways
> > of describing missing values.
> Will you please elaborate on those methods you
> consider better and more consistent? Thank you.

Dbd, a lightweight db that represents things by creating a network of nodes (each equiv to an AND gate), has an alternative method of dealing with NULLs. It is simply, don't create nodes to signify that something is unknown because their absence already implies it.

Suppose we store a person named john whose age is 30. Later, we want to store a person named mary but her age is unknown. In RMDB, we can

1) Refuse to enter a tuple for mary.
2) Enter a tuple for mary but incurr a NULL for age.
3) Redesign schema, add table T_PersonAge, move data, update code/
queries, etc to avoid NULL.

Below is how dbd handles it. Note, it does not create nodes to specify that mary's age is unknown.

(new 'john 'person) (new '28 'age) (set john age 28)
(new 'mary 'person)

The above is shorthand for following:

(set (it) name 'person)
(set db item person)

(set (it) name 'john)
(set person instance (it))

(set (it) name 'age)
(set db item age)

(set (it) name '28)
(set age instance 28)

(set john age 28)

(set (it) name 'mary)
(set person instance (it))

Unlike the CODASYL network data model which is infact a hybrid relational/hierarchal data model, dbd represents things with a network of nodes where each node implements the fundamental unit of computation: the AND gate or a switch. A user models a thing by creating a node and relating it to existing nodes in db. Each db is ntialized with nodes for basic things such as symbols and common classes. Besides GUI/API, a user communicates with the db via expressions. The general syntax of an expression is "(func [inp1] [inp2] ...)". Each expression begins with a "(" and ends with corresponding ")". The first element after "(" is the function. The renaming elements, if any, are function inputs. An element of an expression can itself be a subexpression. Expressions starting with "(;" are comments. The expression "(new)" creates a new node in the db. The expression "(it)" refers to the last node created by "(new)". To relate a node, say to a string (sequence of symbols), use the expression "(set (it) name 'john)". Note that a string is indicated by preceeding it with a single quote. Once a node has been named by a string, it can be referenced by its name. See following example:

(; Create a node for a person to be named by the string 'john)

(; Relate new node to its name, the string 'john)
(set (it) name 'john)
(; We can now reference new node by simply by john)

(; Now we want to make john an instance of person)
(; Create new node for person)

(; Relate its name as the string 'person)
(set (it) name 'person)

(; In order to view item in GUI, relate new class to tree root)
(set db item person)

(; Set john is an instance of person)
(set person instance john)

(; The following expression is equivalent to that above)
(; The subexpressions are solved for *,

   prior to executing the main expression)
(set (get * name 'person) instance (get * name 'john))

(; create a person/doctor named mary using shortcut method)
(; Note that the new function's

   input1 is the name of the new node
   and remaining inputs classify it)
(new 'mary 'person 'doctor)

For more details, see Received on Mon Aug 20 2007 - 22:19:20 CEST

Original text of this message