[alicebot-archcomm] Attributes vs Elements

Anne Kootstra alicebot-archcomm@alice.sunlitsurf.com
Sat, 6 Jul 2002 18:34:44 +0200


I think your idea to add "equal" as an attribute to the <condition> tag is
good since it won't break up existing code. The functionality to compare two
values is very useful and I think a lot of people have shown interest in it.
It's certainly a thing that's worthy of the ArchComm's attention.

Kind regards,

Anne

PS - whatever happened to the shuffle discussion?

-----Oorspronkelijk bericht-----
Van: alicebot-archcomm-admin@alice.sunlitsurf.com
[mailto:alicebot-archcomm-admin@alice.sunlitsurf.com]Namens Ernest
Lergon
Verzonden: vrijdag 5 juli 2002 21:41
Aan: alicebot-archcomm@alice.sunlitsurf.com
Onderwerp: Re: [alicebot-archcomm] Attributes vs Elements


LISP:

(category (template (srai "WHAT IS XML")) (pattern "XML"))

It's true, that Rich's example is compact compared to the verbose XML
form:

<category>
   <pattern>XML</pattern>
   <template>
      <srai>WHAT IS XML</srai>
   </template>
</category>

But something like

(category
 (template "I feed my beared dragon salads and bugs... crickets mostly."
  ((set name "topic") "Feeding lizards") "can be a lot of fun.")
 (pattern "_") (topic "* LIZARDS") (that "WHAT DO YOU FEED YOUR *"))

compared with

<topic name="* LIZARDS">
   <category>
      <pattern>_</pattern>
      <that>WHAT DO YOU FEED YOUR *</that>
      <template>
I feed my beared dragon salads and bugs... crickets mostly.
<set name="topic">Feeding lizards</set> can be a lot of fun.
      </template>
   </category>
</topic>

reminds me how we spelled LISP, while using it to program AUTOCAD: "Lots
of Irritating Silly Parenthesis".

So another downside might be the great realm of possibility to make
mistakes, if you get lost in those LISP.

I think, we are defining syntax and semantics for AIML using the rules
of XML and I don't want to imagine a more abstract level to achieve the
proposed syntax-independence. Of course we could set up a kind of
grammar for a complete new language, but I think, XML as base is a
better choice.

On the other hand there might be soon comfortable AIML editors saving
manual coding, in which case it would not matter, what the underlying
data format is.

But the big advantage of XML is, that you can look everytime at the
source, read and understand it. So let's stick to XML.


Attributes vs Elements:

Something like:

<condition><name><star/></name>
   <li><value><get><name><star
index="2"/></name></get></value>Samevalue!</li>
   <li>Different values!</li>
</condition>

comes near to illegibility for me.

We have lots of '><' ( LISAB ;-) in the text and this might be
ophthalmic powder compared with:

<think>
   <set name="star1val"><star/></set>
   <set name="star2val"><star index="2"/></set>
</think>

<condition name="star1val">
   <li equal="star2val">Same value</li>
   <li>Different values</li>
</condition>

Therefore I propose a new attribute 'equal' for the <condition> and the
<li> tag.

The comparison should be done caseless - more exact: based on
aiml-simple-pattern-expressions - as for the value attributes.

The <if> tag can remain deprecated - justly - and you could even say:

<think>
   <set name="star1val"><star/></set>
   <set name="star2val"><star index="2"/></set>
   <set name="vlove">LOVE *</set>
   <set name="vhate">_ HATE</set>
</think>

<!-- Block condition -->

<condition name="star1val" equal="star2val">
   Star1 has the same value as star2
</condition>

<condition name="star1val" equal="vlove">
   Star1 starts with "Love"
</condition>

<!-- Single-predicate Condition -->

<condition name="star1val">
   <li equal="star2val">Star1 has the same value as star2</li>
   <li equal="name">Star1 is equal to the user's name</li>
   <li equal="father">Star1 is equal to the user's father</li>
   <li equal="vlove">Star1 starts with "Love"</li>
   <li value="Love *">Star1 starts with "Love"</li>
   <li equal="vhate">Star1 ends with "Hate"</li>
   <li value="_ Hate">Star1 ends with "Hate"</li>
   <li>No match</li>
</condition>

<!-- Multi-predicate Condition -->

<condition>
   <li name="star1val" equal="star2val">Star1 equals star2</li>
   <li name="star2val" equal="star1val">Star2 equals star1</li>
   <li name="star1val" equal="name">Star1 equals user's name</li>
   <li name="name" equal="star1val">User's name equals star1</li>
   <li name="star1val" value="Love *">Star1 starts with "Love"</li>
   <li name="star1val" equal="vlove">Star1 starts with "Love"</li>
   <li name="vlove" equal="star1val">Star1 starts with "Love"</li>
</condition>

Does it make sense? I'm not shure about the commutative expressions in
the multi-predicate condition.

Ernest



--
              ProgramV - Alice on Perl - available at
               http://www.virtualitas.net/perl/aiml/

      VIRTUALITAS - Manufacturer of fine OOPPS - since 1996
*********************************************************************
* VIRTUALITAS Inc.               *      http://www.virtualitas.net  *
*                                *                                  *
* European Consultant Office     *                                  *
* Internationales Handelszentrum *                                  *
* Friedrichstraße 95             *   contact:Ernest Lergon          *
* 10117 Berlin / Germany         *    mailto:Ernest@virtualitas.net *
*********************************************************************
       PGP-Key http://www.virtualitas.net/Ernest_Lergon.asc

_______________________________________________
alicebot-archcomm mailing list
alicebot-archcomm@alice.sunlitsurf.com
http://alice.sunlitsurf.com/mailman/listinfo/alicebot-archcomm