vxi-discuss



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question about Event Handing in VXML



We are updating the event handling implementation in the VXI and actually have a question about the event model. Your comments would be appreciated.

------

[ VoiceXML 1.0 -  Chapter 11]

Events may occur as the result of document processing or recognition and my be explicitly thrown by the application. Both are functional equivalent to a statement of form

<throw event="event_name"/>

The event names must satisfy the rules of NMTOKEN (i.e. be composed of letters, digits, ':', '_', '-', and '.').  The OpenVXI will use '.' to determine prefix boundaries within events. This is important for the prefix matching rules in section 11.4. The prefix matching rules result in an inheritance among events. For instance,

<throw event="error.x"/>

may be caught by either

<catch event="error"/>
<error>

but not by

<catch event="err"/>
<catch event="error./">

as might be allowed by a liberal interpretation of the match criteria. When events are thrown, counts will be incremented for each event and prefix (i.e. foo.bar.ack will increment 'foo', 'foo.bar', and 'foo.bar.ack').

I'd like to examine two difficult cases and see how these play out. In each case, three events will be thrown and several handlers will be competing to catch each.


Case 1:
-------

This case uses the prefix and explicitly shows the event counts at each step.

1. <throw event="error.x"/>
2. <throw event="error.y"/>
3. <throw event="error.z"/>

A. <catch event="error">
B. <catch event="error.y" count="2">
C. <catch event="error" count="3">

The first event will be handled by A. There has only been one error and only A matches it.
--> The counts are (error=1, error.x=1)

The second event will be handled by A. There have not been three events and only one 'error.y' has occurred.
--> The counts are (error=2, error.x=1, error.y=1)

The third event will be handled by C. Even though this is the first error.z event, it is the third 'error' event.
--> The counts are (error=3, error.x=1, error.y=1, error.z=1)


Case 2:
-------

Notice that the third event is now an 'error.y' and that the event handlers have been reordered. The first two events follow case #1.

1. <throw event="error.x"/>
2. <throw event="error.y"/>
3. <throw event="error.y"/>

A. <catch event="error">
B. <catch event="error" count="3">
C. <catch event="error.y" count="2">


The first event will be handled by A. There has only been one error and only A matches it.
--> The counts are (error=1, error.x=1)

The second event will be handled by A. There have not been three events and only one 'error.y' has occurred.
--> The counts are (error=2, error.x=1, error.y=1)

The third event is more tricky. Both B and C are possible. This is the third error and the second 'error.y'. The criteria specified in section 11.4 requires that the interpreter "select the first element in the list with the 'correct count'". This makes sense for cases where duplicates occur. So

5. <throw event="foo">
J. <catch event="foo">
K. <catch event="foo">

event 5 would always be handled by J. However if

5. <throw event="foo.bar">
J. <catch event="foo">
K. <catch event="foo.bar">

would event 5 still be handled by J?

This is certainly true of C++ where the equivalent code looks something like this:

class foo;
class foo_bar : public foo;

try {
throw foo_bar();
}
catch (const foo &) {
// Code here will be run.
}
catch (const foo_bar &) {
// This will never be used.
}

This model, however, may not be valid. Certainly the inheritance of event handlers 'as if by copy' in VXML is quite different from C++. Likewise, this interpretation violates the goal of finding the 'best qualified catch element' as K is certainly more qualified than J.

We propose changing the selection criteria in 11.4 so that rule 4 reads: "Select the element in the list with the 'correct count' which best matches the name of the event. If two catches have the same name, the first element in the list will be chosen."

____________________________________________________________________
 Brian Eberman

Director of Engineering                         Open Speech and System Products
SpeechWorks International                  
http://www.speechworks.com
695 Atlantic Ave
Boston, MA 02111
(617) 428 4444

 



This page is maintained by Alan W Black (awb@cs.cmu.edu)
speechinfo.org is hosted on a machine donated by VA Linux Systems
VA Linux Systems