[alicebot-general] Please help with AIML connection to a database

musky muskvar at gmail.com
Sat Dec 22 18:39:30 PST 2007


thanks for your insight,

 i will surely try your valuable suggestions and get back to you.

please bear with me as i am a newbie to AIML and also my exams are going on
till 8th jan 2008.

but please keep watching on this thread and i will get back as as soon as
possible.

thanks,
good day.


mehri wrote:
> 
>> my question now is:
>> say a user(client) questions the bot:"retreive the
>> tuples from a restaurants
>> table"
>> the bot should then retrieve the tuples using an sql
>> query:"select * from
>> restaurants"
>> 
>> how do i program this in AIML?
>> 
> 
> That I would assume would be the generic
> AIML-to-programming part here.  Not really a specific
> RebeccaAIML question.  This could apply to any AIML
> language based interpreter.  So I'll answer this here
> in the general mailing list.
> 
> Many different ways to do this.  One way which would
> be elegant in my humble opinion would be to use a
> special symbol such as "@" as an annotation for what
> the bot responds.  You catch the response in your code
> and look to see if it starts with "@".  If it does,
> you turn around and parse the string as something
> programmatic you need to do.
> 
> For example your AIML would could like this:
> 
> <category>
> <pattern>show me all the restaurants</pattern>
> <template>@select * from restaurants@</template>
> </category>
> 
> In your code you would see if the bot response string
> starts with "@" and ends with "@" and if so parses the
> string in between as an SQL statement.
> 
> Symbolic reduction would really help here as you start
> adding more questions relating to restaurants.
> 
> <category>
> <pattern>show me all the restaurants</pattern>
> <template>@select * from restaurants@</template>
> </category>
> 
> <category>
> <pattern>please show me all restaurants</pattern>
> <template>
>   <srai>show me all the restaurants</srai>
> </template>
> </category>
> 
> Also wild cards could be used too in your AIML at this
> point to help narrow the search for the restaurant:
> 
> <category>
> <pattern>
>   show me all restaurants in the state *
> </pattern>
> <template>
>   @select * from restaurants where state = '<star/>'@
> </template>
> </category>
> 
> Now you're not limited to use "@" as your special
> symbol.  With most interpreters, RebeccaAIML included,
> you can also output XML and look for that as your
> special symbols.  You'd just have to use &lt;, &gt;
> etc.. for each symbol.
> 
> For example:
> 
> <category>
> <pattern>show me all the restaurants</pattern>
> <template>
>   &lt;sql&gt;select * from restaurants&lt;/&gt;
> </template>
> </category>
> 
> Which when you query your bot as in:
> 
> user>show me all the restaurants
> 
> your bot will say:
> 
> bot> <sql>select * from restaurants</sql>
> 
> But that should never reach the user as long as your
> program is looking at the bot responses for the <sql>
> XML tag and turning around and parsing the contents
> and then outputting it as a post processing step.
> 
> That's one way to do it.  Let me know if this helps. 
> I'd use the simpler "@" symbol if you can get by with
> it but if you need more complex structures and
> multiple different post processing steps I'd go with
> the XML approach.
> 
> If you need more clarification don't hesitate to ask.
> 
> 
> 
> --- musky <muskvar at gmail.com> wrote:
> 
>> 
>> i have installed rebecca AIML interpreter as an
>> eclipse plugin.
>> 
>> i have used rebecca since it came with an eclipse
>> plugin and i can also
>> program in java.
>> 
>> my question now is:
>> say a user(client) questions the bot:"retreive the
>> tuples from a restaurants
>> table"
>> the bot should then retrieve the tuples using an sql
>> query:"select * from
>> restaurants"
>> 
>> how do i program this in AIML?
>> 
>> of course i have assumed that in my java code i have
>> established a
>> connection to the database server(I am using Java
>> derby network server)
>> using the Derby network client driver and created a
>> database with tuples
>> entered into the restaurants table under the
>> database.
>> -- 
>> View this message in context:
>>
> http://www.nabble.com/Please-help-with-AIML-connection-to-a-database-tp14466543p14466543.html
>> Sent from the Alicebot General mailing list archive
>> at Nabble.com.
>> 
>> _______________________________________________
>> This is the alicebot-general mailing list
>> Reply to alicebot-general at list.alicebot.org
>> Unsubscribe and change preferences at
>>
> http://list.alicebot.org/mailman/listinfo/alicebot-general
>> Learn netiquette at
>> http://www.dtcc.edu/cs/rfc1855.html
>> Learn to read at http://www.literacy.org/
>> 
> 
> 
> 
>      
> ____________________________________________________________________________________
> Looking for last minute shopping deals?  
> Find them fast with Yahoo! Search. 
> http://tools.search.yahoo.com/newsearch/category.php?category=shopping
> _______________________________________________
> This is the alicebot-general mailing list
> Reply to alicebot-general at list.alicebot.org
> Unsubscribe and change preferences at
> http://list.alicebot.org/mailman/listinfo/alicebot-general
> Learn netiquette at http://www.dtcc.edu/cs/rfc1855.html
> Learn to read at http://www.literacy.org/
> 
> 

-- 
View this message in context: http://www.nabble.com/Please-help-with-AIML-connection-to-a-database-tp14466543p14475320.html
Sent from the Alicebot General mailing list archive at Nabble.com.



More information about the alicebot-general mailing list