From: Neo
Subject: Modelling Complex Sentences
Date: 
Message-ID: <1146778738.808972.303130@e56g2000cwe.googlegroups.com>
How can one use LISP to model the following 4 complex sentences in a
systematic manner by building them from smallers ones having a
subject-verb-object format.

1. flower1's brightest color is fluorescent red.
2. flower1's brightest color was fluorescent green on monday.
3. flower1's brightest color willBe fluorescent blue on friday.
4. john says line 3.

In normal speech/writing, relators that indicate the relationship
between adjectives and nouns are frequently dropped or are implied by
modification of the adjective. For example:
"hot modifies milk" becomes "hot milk",
or "bright modifies color" becomes "brightest color".

And sometimes the relator between subject and object is appended with
the subject, for example
"flower attribute color" becomes "flower's color".

Representing the sentences seem fairly straight forward in Prolog and
dbd, but how does LISP implement it? Below is dbd's script to model the
4 complex sentences based on smallers ones having a subject-verb-object
format.

(; Create a flower named flower1)
(new 'flower1' 'flower')

(; Create colors red, green and blue)
(new 'red' 'color')
(new 'green' 'color')
(new 'blue' 'color')

(; Create adjectives bright and fluorescent)
(new 'bright' 'adjective')
(new 'fluorescent' 'adjective')

(; Create weekdays monday and friday)
(new 'monday' 'weekday')
(new 'friday' 'weekday')

(; Create flower1 attribute brightest color is fluorescent red)
(; Long method)
(create bright modify color)
(create flower1 attribute (select bright modify color))
(create fluorescent modify red)
(create (select flower1 attribute (select bright modify color))
        is
        (select fluorescent modify red))

(; Create flower1 attribute brightest color was fluorescent green
    on monday)
(; Shorter method)
(create flower1
          attribute
            (create bright modify color)
              was
                (create fluorescent modify green)
                   on monday)

(; Create flower1 attribute brightest color willBe fluorescent blue
    on friday)
(create flower1
          attribute
            (create bright modify color)
               willBe
                 (create fluorescent modify blue)
                    on friday)

(; Create a person named john)
(new 'john' 'person')

(; Create a verb named say)
(new 'say' 'verb')

(; Create john says
   "flower1 attribute brightest color willBe fluorescent blue
    on friday")
(create john
        say
        (select flower1
                  attribute
                    (select bright modify color)
                      willBe
                        (select fluorescent modify blue)
                          on friday))

From: Neo
Subject: Re: Modelling Complex Sentences
Date: 
Message-ID: <1146855924.345627.198550@j33g2000cwa.googlegroups.com>
> I'm not replying to the post; I'm simply trying to grok this.

:) Ok, now pretend you are not reading my responses.

>> (; Create a flower named flower1)
>> (new 'flower1' 'flower')
>
> So "new <literal> <type>" creates something?

In dbd, each expression/statement/sentence starts with "(" and ends
with ")".  An expression can contain 1 to many elements. The first
element is the function/command which in this case is "new". This
causes dbd to create a new "node" (similar to an atom in Prolog,
similar to a con in LISP, similar to a table/tuple in RM). I call it a
"node" mainly because it becomes part of a network (yeah I know, I am
re-inventing the network data model). The remaining elements are called
parameters. The new function can have 0 to many parameters. The first
parameter (if present) is a string that symbolizes a word that names
the thing being represented. The remaining parameters (if present)
relate the new thing to specified classes. If those classes don't
exist, they are created.

>> (; Create flower1 attribute brightest color is fluorescent red)
>> (; Long method)
>> (create bright modify color)
>
> and "create <something> [attribute|modify]" creates something?

Yes, it creates a "node" to represent the specified relationship. In
RM, it might be similar to INSERT INTO T_Relationship (bright, modify,
color).

>> (create (select flower1 attribute (select bright modify color))
>>         is
>>         (select fluorescent modify red))
>
> and "create <a selected something> is <a selected something>"
> creates something?

Similar to above except, the subject and object are determined by
select queries. And each subexpression within select is similar to a
join in RM.

> and "is" and "was" and "on" are... what?  how 'bout "willBe?"

Good observation. When a new db is created, dbms enters basic things
which includes "is", "was" and "willBe" which are classified as tense
currently.

>> (; Create john says
>>    "flower1 attribute brightest color willBe fluorescent blue
>>     on friday")
>
> so the expression in double quotes is _______.

An expression with the function named ";" is a comment. This is similar
to LISP however they do not include the surrounding parentheses.

> and the magic words "flower," "person," etc. are...  what? declared? defined?

They were created by the new function as described above.

>   but the magic "attribute" and "verb" aren't?

Good observation. When a new db is created, dbms enters basic things
which includes "attribute" and "verb".

>> (create john
>>         say
>>         (select flower1
>>                   attribute
>>                     (select bright modify color)
>>                       willBe
>>                         (select fluorescent modify blue)
>>                           on friday))
>
> "select" denotes <something?>

Select selects a "node" that represents that specified by parameters
which in this case is a relationship. This is similar to SELECT * FROM
T_Relationships WHERE subject=bright, verb=modify, object=color;

> I'm not throwing rocks.

Then what does the comment "For some reason the phrase 'box of rocks'
keeps popping into my thoughts." mean?

> I tried the links to db-whatever.com and got nowhere.

I haven't been stating the website as many c.d.t. members accuse me of
being an snake oil salesman.

> Have you got any guide to the grammar?

Yes.

> Semantic decoder?

Not sure exactly what you mean but most likely the answer is no;
however, this doesn't prevent dbd from answering complex queries when
formed correctly by app/user.

> I mean, comment after comment says "create," but I can't figure out what's being created.

Are you familiar with the CREATE and INSERT commands in RM? The concept
is similar.

> Are "new," "create," and "select" all there is?

No, there are a few more, but new, select, create, update and delete
are the core functions currently.
From: Neo
Subject: Re: Modelling Complex Sentences
Date: 
Message-ID: <1146946925.072243.227930@y43g2000cwc.googlegroups.com>
> A node.  Similar to many things, I take it -- but what is it?

You can think of it as a super-charged, multi-dimensional relation
running on nitro :)

> >  I call it a
> > "node" mainly because it becomes part of a network (yeah I know, I am
> > re-inventing the network data model). The remaining elements are called
> > parameters. The new function can have 0 to many parameters. The first
> > parameter (if present) is a string that symbolizes a word that names
> > the thing being represented.
>
> The head-scratching starts here: expression?
> function?  elements? no parameters?  no mention of arguments?

Excuse my sloppy use of standard terminology. An expression in dbd
starts with "(" and ends with corresponding "). Within the parentheses
are elements separated by at least one white space. The first and last
elements within the expression can be adjacent to the parantheses. Any
element can itself be a sub expression. Below is the prototype for an
expresssion with the new function:

(new  arg1 arg2 arg3 ...)

When actually called, arg1, arg2, arg3 ... are replaced by parameter1,
parameter2, parameter3, ...

>"(new)" does something;

It create a node the will be used to represent something. RMDBs create
a tuple to represent something using the INSERT command.

> "(new 'p1')" does something;

In addition to creating a new node, the node is related to its name
which is a word whose symbols are 'p1'. The first parameter names the
new node.

"(new 'p1' 'p2')"  does something else.

In addition to creating a new node and relating it to its name, the
node is classified by an existing node which represents the thing named
by 'p2'. If such as classifying node does not exist, it is created.
Parameters after p2, if present,  also classify the new thing in a
manner similar to p2.

Since people complained that dbd's scripts were too long, the script
used the extend form of new function to make it shorter. Here is the
more verbose form of the script for (new 'red' 'color') assuming the
node representing color did not already exist.

(create (new) name (word+ 'red'))
(create (new) name (word+ 'color'))
(create color instance red)

> Words like expression, function, parameter, element, and argument
> are being tossed into the mix without any sort of definition -- and,
> believe me, having seen these words used in a variety of languages,
> I can imagine *boatloads* of definitions for each.  What are yours?

See above.

> > Good observation. When a new db is created, dbms enters basic things
> > which includes "attribute" and "verb".
>
> I'm trying to stick with this: What question is being asked?  And what
> answer might the user expect?

Thanks, your precise questions are helpful.

> > Select selects a "node" that represents that specified by parameters
> > which in this case is a relationship. This is similar to SELECT * FROM
> > T_Relationships WHERE subject=bright, verb=modify, object=color;
>
> Okay, you've got to stop saying "similar to the RM CREATE, INSERT,
> DELETE" -- 'cause there ain't none.

Excuse my sloppy use of terminology, I meant similar to CREATE, INSERT,
UPDATE, DELETE commands which are typically found in implementations of
the Relational Data Model.

>>> I'm not throwing rocks.
>>
>> Then what does the comment "For some reason the phrase 'box of rocks'
>> keeps popping into my thoughts." mean?
>
> Because of that nonsense about "normalization... reduces performance,"
> "the time it takes to normalized data," and "the time it takes to retrieve
> normalized data."...

In general, the amount of processing time to simply enter a value for
some attribute, is less than the amount of time needed to first lookup
the value (ie in a lookup table) and then enter a reference to it. In
general, the same is true to when retrieving data. See normalized vs
unnormalized data in tables below:

T_Color
ID, Name
45, red

T_CarWithNormalizedData
Name, ColorID
corvette, 45

T_CarWithUnNormalizedData
Name, Color
corvette, red

> ... The "no response" to questions about "data mgmt."

This is incorrect. My post on Apr 30 in thread titled "Storing data and
code in a Db with LISP-like interface" near thread # 206 includes a
response to your question. I don't see the grounds for you inferring
that I am "a box of rocks".

> How does one know what a dbd expression means?

By reading the comments prior to the expressions. How would you prefer
to know what a dbd expression means?

> > > I mean, comment after comment says "create,"
> > > but I can't figure out what's being created.
>
> See, I'm trying to hang here a bit longer. You seem to have something
> on your mind and I'm enough of an optimist to think that, perhaps,
> you're just having trouble finding the words you need to explain your idea.

When you use an RMDB, you typically use the CREATE/INSERT commands to
create something in the db to represent something. The create function
in dbd is conceptually equivalent.
From: Neo
Subject: Re: Modelling Complex Sentences
Date: 
Message-ID: <1147101516.363934.178550@u72g2000cwu.googlegroups.com>
> > Neo: By reading the comments prior to the expressions.
> > How would you prefer to know what a dbd expression means?
>
> Tony: Well, y'know, me being me I like formal stuff - you know, denotational
> semantics, axiomatic semantics, hell even a well defined set of
> operational semantics would do. Otherwise we'll spend ages discussing
> our various uses of English. "You say to-may-to, I say to-mah-to..."
> But then, I'm kind of picky like that.

Can you give me an example of a formal method of representing things
that has denotational semantics, axiomatic semantics and a well defined
set of operational semantics?