# Patent

## Title
Method and apparatus for automatic notification and response based on communication flow expressions having dynamic context

## Abstract

Methods and apparatus are disclosed for automatic notification and response based on communication flow expressions having dynamic context. A message is provided from a sender to at least one recipient in accordance with a communication flow having a plurality of potential paths. The communication flow is controlled by a communication flow expression having a dynamic context, wherein the communication flow expression contains at least one primitive keyword indicating how the message should be processed. The dynamic context of the communication flow expression may be established using one or more labels or a context function. A number of primitive keywords are provided that allow a communication flow expression to react to a dynamic context.

## Background
CROSS REFERENCE TO RELATED APPLICATIONS
This application claims the benefit of U.S. Provisional Application No. 60/554,232, filed Mar. 18, 2004, and is related to U.S. patent application Ser. No. 10/184,236, filed Jun. 26, 2002, entitled “Method and Apparatus for Automatic Notification and Response;” and U.S. patent application Ser. No. 10/184,325, filed Jun. 26, 2002, entitled “Method and Apparatus for Automatic Notification and Response Based on Communication Flow Expressions,” and U.S. patent application Ser. No. 11/083,068, entitled “Method and Apparatus for Dynamically Adjusting Membership of a Communication Flow Expression,” U.S. patent application Ser. No. 11/083,070, entitled “Method and Apparatus for Just In Time Education,” and U.S. patent application Ser. No. 11/083,069, entitled “Method and Apparatus for Subscribing to Dynamic Attributes,” each filed contemporaneously herewith, and each incorporated by reference herein.


FIELD OF THE INVENTION
The present invention relates generally to communication methods and systems, and more particularly, to methods and systems that notify one or more users of information.
BACKGROUND OF THE INVENTION
Enterprise applications need to contact people and have requirements for how the contact is done and what responses, if any, are collected. For example, applications may need to contact all people who have certain interests, or a particular list of people or a single person. Applications may need to contact someone immediately in a crisis or they may want to remind someone of a task at an appropriate time. Enterprise applications also have requirements about what to do when the contact is unsuccessful, where success is something defined by the enterprise.
Recipients, on the other hand, have their own preferences about how and when they are contacted. For example, recipients may want particular people, such as a boss or family member, or people who represent particular interests, such as an executive from a Fortune 500 Company, to be given more flexibility in establishing real-time contact. In addition, recipients may routinely delay contact about known tasks, such as weekly status or expense updates, until a convenient time or place. Oftentimes, the preferences of recipients are at odds with the preferences of an enterprise or the implementation of a specific application. In those cases, recipients find creative ways to work around the application constraints, in order to satisfy their preferences, or find the enterprise's processes frustrating or even annoying.
A number of notification systems have been proposed or developed to enable applications to communicate with one or more recipients. U.S. patent application Ser. No. 10/184,236, filed Jun. 26, 2002, entitled “Method and Apparatus for Automatic Notification and Response;” and U.S. patent application Ser. No. 10/184,325, filed Jun. 26, 2002, entitled “Method and Apparatus for Automatic Notification and Response Based on Communication Flow Expressions,” disclose notification and response systems. Generally, the disclosed notification and response systems (i) send requests to one or more recipients, using the medium specified by each individual recipient; (ii) collect and processes responses; and (iii) forward the responses to their final destination by means of the medium specified by the final destination.
While communication flows in such notification and response systems elicit responses from recipients and may follow different paths based on a response, they can only react to responses at the point at which they were elicited or at a subsequent point. In addition, such notification and response systems are unable to dynamically add or remove participants in a communication flow.
A need therefore exists for notification and response systems that can react dynamically to responses in a variety of locations in a communication flow, different from the location that elicited the response. A further need exists for notification and response systems that can react to changes in the data of the request. Yet another need exists for notification and response systems that understand the context of the communication flow execution and make decisions that are context dependent in the communication flow and in the rendering of information to applications.
SUMMARY OF THE INVENTION
Generally, methods and apparatus are provided for automatic notification and response based on communication flow expressions having dynamic context. A message is provided from a sender to at least one recipient in accordance with a communication flow having a plurality of potential paths. The communication flow is controlled by a communication flow expression having a dynamic context, wherein the communication flow expression contains at least one primitive keyword indicating how the message should be processed. The message is processed based on the communication flow expression.
The dynamic context of the communication flow expression may be established using one or more labels or a context function. The labels are inherited by each child node of the node to which the one or more labels are applied. The labels can optionally be used as a condition in a communication rule or tested by a conditional expression in a communication flow. The context function allows an application to set a context for the communication flow expression that is executed at the root level.
In addition, a number of primitive keywords are provided that allow a communication flow expression to react to a dynamic context. An evaluation function specifies data being watched that will trigger evaluation of a specified conditional. The evaluation function acts on changes to one or more of data and responses associated with the communication flow expression, and allows an application to dynamically add one or more nodes to the communication flow during execution of the communication flow as a result of data updates or receipt of responses.
Another primitive keyword, a watch operand, has an associated test expression that is evaluated at runtime, and the watch operand will block until the associated test expression evaluates to true, and then the watch operand will evaluate to true. The watch operand evaluates the associated test expression the first time the associated test expression is encountered and if the associated test expression is false, then the associated test expression is evaluated each time the request data is modified or a response is submitted. The watch operand can monitor a specific element in the data associated with the communication flow expression, or the responses associated with the communication flow expression and allow iterations over all values.
A pair of primitive keywords, advises or informs, cause an out-of-band communication flow expression to be evaluated outside of the scope of the main communication flow expression. A response received to the out-of-band communication flow expression is treated as a comment and does not affect the truth-value of the main communication flow expression. A consult operator evaluates all of its children and waits for one of them to result in a true or false value. For the consult operator, the result is returned as the value of the operator, but the remaining operands are placed out-of-band so that they can continue operation without affecting an outcome of the communication flow expression. A contact function allows a media contact to be defined directly in the communication flow expression.
A more complete understanding of the present invention, as well as further features and advantages of the present invention, will be obtained by reference to the following detailed description and drawings.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 illustrates an exemplary notification and response system;
FIGS. 2A through 2J, collectively, are an operator table that lists a number of exemplary communication flow operators;
FIGS. 3A through 3T illustrate the truth tables for the operators indicated in FIGS. 2A through 2J;
FIG. 4 illustrates an exemplary interface for ordering subscriptions based on labels, in accordance with the present invention;
FIG. 5 illustrates the identification of phases of a communication using labels, in accordance with the present invention;
FIGS. 6 and 7 illustrate an exemplary parse tree and a corresponding modified parse tree for a communication flow expression that contains an eval function;
FIG. 8 illustrates a parse tree for a communication flow expression that contains an extension of the communication flow language;
FIGS. 9 through 17 illustrate a number of variations of a parse tree to illustrate recursion in accordance with the present invention; and
FIGS. 18 through 20 illustrate a memory management optimization for the pager example illustrated in FIGS. 11 through 13.



DETAILED DESCRIPTION
FIG. 1 illustrates an exemplary notification and response system 100. The exemplary notification and response system 100 may be embodied, for example, as the XuiTM notification and response system, commercially available from Avaya, Inc. of Basking Ridge, N.J. and as described, for example, in U.S. patent application Ser. No. 10/184,236, filed Jun. 26, 2002, entitled “Method and Apparatus for Automatic Notification and Response;” and U.S. patent application Ser. No. 10/184,325, filed Jun. 26, 2002, entitled “Method and Apparatus for Automatic Notification and Response Based on Communication Flow Expressions,” each incorporated by reference herein.
Generally, as shown in FIG. 1, the notification and response system 100 enables one or more applications 110-1 through 110-N, collectively referred to as applications 110, to communicate with one or more recipients 120-1 through 120-N, hereinafter, collectively referred to as recipients 120, by a number of different media, such as electronic mail, telephone, web page, pager or facsimile. Generally, the notification and response system 100 (i) sends requests to one or more recipients 120, using the media specified by each individual recipient 120 in accordance with the individual's preferences (and recorded for example, in a recipient preference and role database 115); (ii) collects and processes responses; and (iii) forwards the responses to their final destination by means of the medium specified by the final destination in accordance with the final destination's preferences. Roles provide a way of categorizing users and what they are allowed to do. The recipient preference and role database 115 also allows roles that are specified in a communication flow to be resolved to individual recipient names at the time the requests are transmitted.
The applications 110 create notification requests and submit them to the notification and response system 100. The notification requests must contain a communication flow to execute. Once the notification and response system 100 receives a notification request, the notification and response system 100 executes the communication flow logic to notify the recipients 120 and collect their responses.
According to one aspect of the invention, referred to herein as dynamic context adjustment, the context of a communication flow expression can be dynamically established or adjusted, using primitives, such as context and labels, discussed hereinafter, that provide dynamic context to the communication flow expression. As used herein, the “dynamic context” of a communication flow expression comprises updates that have been received to the data associated with the communication flow, responses received for the communication flow and the state of the executing communication flow. According to another aspect of the invention, referred to herein as dynamic context influence, communication flow expressions in accordance with the present invention may be processed based on their dynamic context. In one exemplary embodiment of the present invention, a number of primitives are employed that react to the dynamic context of communication flow expressions.
As discussed hereinafter, the dynamic context of a communication flow expression allows data in the request or one or more responses or labels associated with the request, to be processed and evaluated. The contextual information is available to the application for rendering its communication with the recipient. In a preferred embodiment, all data is represented in XML, and the application provides an XSLT stylesheet which the system employs for rendering. The data can trigger a particular action upon a predefined condition. The predefined condition may be, for example, data having a predefined value, the updating of the request or the receipt of a response. The triggered action may be, for example, a communication flow expression proceeding, for example, by sending one or more notifications. The present invention provides additional functionality to establish and adjust the communication flow expression, and to alter the processing of a communication flow expression based on the dynamic context.
Generally, a communication flow manager interprets the target communication flow defined in a request into a more efficient, tree structured internal representation. In addition, the communication flow manager traverses the tree representation and, in the process, expands non-terminal nodes, which represent recipients, and instantiates terminal nodes which are typically devices, but may also communicate with applications or perform internal processing. Thus, the string containing the communication flow expression is initially parsed into a parse tree, using known techniques. Generally, a parse tree is an in-memory representation of the expression composed of objects called nodes. Each node in the tree is either an operator or an operand. Operators determine a result based on their operands. Operands determine their result using logic and input from the system or a user. Operators can be operands to other operators.
After parsing, the tree is a connected set of nodes that do not have a value. In order for the tree to have a value, the tree must be evaluated. A method of the root node is invoked, and if it is an operator, the method fetches the value(s) of its operand(s) according to its functionality. If the operator completes, the value is passed back up the parse tree. Since each operand can be an operator, this evaluation will traverse down the tree until a leaf node is encountered. Each node evaluation can cause the tree to change, especially if a conditional operator is present and the condition returns a truth-value.
Communication Flow Primitives
As previously indicated, communication flow expressions specify the recipients that shall receive a request and how, when and where the recipients shall receive the request. The primitives included in a communication flow expression specify whether to contact the recipients simultaneously or sequentially, and when execution of the sub-expression should terminate by defining a logical combination of success test results. For a detailed discussion of a number of suitable communication flow primitives and their corresponding truth tables, see U.S. patent application Ser. No. 10/184,325, filed Jun. 26, 2002, entitled “Method and Apparatus for Automatic Notification and Response Based on Communication Flow Expressions,” incorporated by reference herein.
FIGS. 2A through 2J, collectively, are an operator table 200 that lists a number of exemplary communication flow operators. As shown in FIGS. 2A through 2J, for each communication flow operator identified in field 210, the operator table 200 identifies the corresponding operator type in field 220, and whether or not they have a binary form or can take a list as an operand in fields 230 and 240, respectively. If an operator is related to another operator, then the related operator is also listed in field 250. Two operators are related when they have similar truth tables, but one is sequential (seq.) and the other is parallel (par.).
The truth table that corresponds to the operator is identified in field 260, and examples of the operator are provided in field 270. It is noted that not all operators have actual tables, but instead have a description of how the truth value is determined. If a table is present, then F stands for FALSE, T for TRUE, and X for MAYBE. Also, since the order of evaluation does not matter for parallel operators, the left operand is the first operand to respond and the right operand is the second to respond.
FIGS. 3A through 3T illustrate the truth tables for a number of the operators indicated in FIGS. 2A through 2J. A number of operators can be grouped into parallel/sequential pairs. Parallel and sequential primitives differ in how the operands are evaluated. A sequential operator is one that will evaluate each operand in order from left to right and will only process the next operand when a truth-value is received for the current one. A parallel operator is one that will evaluate all of its operands at once and then will wait for a truth-value to be generated on one or more of them. A time operator is one that involves scheduling a communication flow expression to be evaluated at a particular time.
Advises
ADVISES is a binary operator that causes a communication flow expression to be evaluated outside of the scope of the main expression. The truth table for the ADVISES operator is given in FIG. 3A. The value of the operator is determined by the left operand. When the left operand resolves to a truth-value, then the right operand is evaluated and is attached to the request as operating OUT-OF-BAND and any response received to that expression is treated as a comment but does not affect the truth-value of the application communication flow.
The right operand has OUT-OF-BAND attached as a label to it when advises starts its evaluation, this label can be tested inside the application to provide additional context to the recipient or to mark a response as not affecting the outcome of the request. The parallel operator related to the ADVISES operator is the INFORMS operator.
The ADVISES operator is used as follows:

    
    
        cf_expression1 ADVISES cf_expression2
    
    


The left-most operand determines the truth-value of the primitive. The right-most operand is contacted after the left-most operand completes, and may respond depending on the controls of the application, for example, in an XSLT stylesheet. Responses, if received, are considered comments to the request, and are listed separately in response collations and in returned responses. Responses from the right operand do not affect the truth-value of the overall expression (or any expression containing it). The ADVISES primitive could be used to remind a recipient of commitments made in the initial response until the request completes or the commitment is satisfied.
After
AFTER is a time operator that indicates when a communication flow should begin execution. The truth table for the AFTER operator is given in FIG. 3B. When the time is reached, the AFTER operator replaces itself with its child communication flow and starts its evaluation.
The AFTER operator is used as follows:

    
    
        cf_expression AFTER time_expression
    
    


If the time_expression contains a time_domain and the starting point of an increment on a time_domain is after the end of the last interval in the time_domain, then cf_expression is evaluated immediately.
And
The AND operator is a parallel operator that will evaluate all of its operands and return TRUE if and only if all of its children return TRUE. The truth table for the AND operator is given in FIG. 3C. A MAYBE value for one of its operands does not immediately complete the operator, but the operator's value can never be TRUE. A FALSE value for one of its operands will complete the operator immediately and cause it to have a value of FALSE. The sequential operator related to AND is the operator ANDTHEN.
The AND operator is used as follows:

    
    
        cf_expression1 AND cf_expression2
        AND {cf_expression1, cf_expression2, . . . }
    
    


Andthen
The ANDTHEN operator is a sequential operator that evaluates its children starting from the left and will evaluate the next child only if the previous child evaluated to TRUE. The truth table for the ANDTHEN operator is given in FIG. 3D. The parallel operator related to ANDTHEN is the operator AND.
The ANDTHEN operator is used as follows:

    
    
        cf_expression1 ANDTHEN cf_expression2
        ANDTHEN {cf_expression1, cf_expression2, . . . }
    
    


Broadcast
The BROADCAST operator is a parallel list operator that evaluates all of its children and waits for them to complete. The truth table for the BROADCAST operator is given in FIG. 3E. The sequential operator related to BROADCAST is the operator SURVEY.
The BROADCAST operator is used as follows:

    
    
        BROADCAST {cf_expression1, cf_expression2, . . . }
    
    


The BROADCAST primitive waits until all expressions in the list have reached a final truth value (true, false, maybe). The BROADCAST primitive, however, is always true and its true value indicates that BROADCAST has completed. Sometimes a communication flow must complete contacting all members of a group irrespective of the truth-value of the responses by individuals. In this case the truth value may be used to control the communication flow of the individual exclusively. Questions in the notification might, for example, ask if the individual wishes to continue receiving reminders. An answer of no or false, might then shut off the reminders in the personal communication flow of the individual without affecting the overall communication to the group.
Consult
The CONSULT operator is a parallel list operator that evaluates all of its children and waits for one of them to result in a TRUE or FALSE. This result is returned as the value of the operator, but the remaining operands are placed OUT-OF-BAND so that they can continue operation but have no affect on the outcome of the overall expression. They are additionally tagged with the OUT-OF-BAND label. The truth table for the CONSULT operator is given in FIG. 3F.
The CONSULT operator is used as follows:

    
    
        CONSULT {cf_expression1, cf_expression2, . . . }
    
    


Delegates
The DELEGATES operator is a sequential operator that evaluates each operand starting with the left most, and then evaluates each subsequent one if and only if the previous operand evaluated to MAYBE. The truth table for the DELEGATES operator is given in FIG. 3G. The parallel operator related to DELEGATES is the operator RACES.
The DELEGATES operator is used as follows:

    
    
        cf_expression1 DELEGATES cf_expression2
        DELEGATES {cf_expression1, cf_expression2, . . . }
    
    


During
The DURING time operator causes its child cf_expression to be executed during the given time_domain. If the current time is within the specified time domain, then the expression evaluates immediately, otherwise it sets a timer to begin processing of the expression when the current time is within the time domain. The truth table for the DURING operator is given in FIG. 3H.
The DURING operator is used as follows:

    
    
        cf_expression DURING time_domain
    
    


From-To
The FROM-TO time operator indicates a start and end time for the evaluation of a communication flow. This is a convenience operator to make an expression more legible than it would be if AFTER and UNTIL were used. In fact, the exemplary notification and response system 100 converts a FROM-TO expression into an expression using AFTER and UNTIL. The truth table for the FROM-TO operator is given in FIG. 31.
The FROM-TO operator is used as follows:

    
    
        cf_expression FROM time_expression1 TO time_expression2

and is equivalent to:

        (cf_expression UNTIL time_expression2) AFTER time_expression1

If the starting point of an increment on a time_domain in time_expression1 does not exist within the time_domain, then cf_expression is evaluated immediately. If time_expression2 contains a time_domain that is empty or an error occurs when time_expression2 is evaluated, then cf_expression will not timeout.

    
    


If-Then-Else
The IF-THEN-ELSE operator provides a mechanism for conditional (cond.) branching within communication flows. If the IF expression evaluates to TRUE, then theN expression replaces the operator and will determine the truth value of the operator. If the IF expression evaluates to FALSE or MAYBE, then the ELSE expression replaces the operator and will determine the truth value of the operator. The truth table for the IF-THEN-ELSE operator is given in FIG. 3J.
The IF-THEN-ELSE operator is used as follows:
IF cf_expression1 THEN cf_expression2 ELSE cf_expression3
Informs
The INFORMS operator is a binary operator that causes a communication flow expression to be evaluated outside of the scope of the main expression. The value of the INFORMS operator is determined by the left operand. When the operator is first evaluated, both operands are evaluated, but the right operand is attached to the request as operating OUT-OF-BAND and any response received to that expression is treated as a comment and does not affect the truth-value of the main communication flow. The truth table for the INFORMS operator is given in FIG. 3K.
The right operand has OUT-OF-BAND attached as a label to it when INFORMS starts its evaluation, this label can be tested inside the application to provide additional context to the recipient or to mark a response as not affecting the outcome of the request.
The sequential operator related to INFORMS is the operator ADVISES. The INFORMS operator is used as follows:

    
    
        cf_expression1 INFORMS cf_expression2
    
    


The left-most operand determines the truth-value of the primitive. The right-most operand is contacted in parallel, and may respond depending on the controls of the application, for example, in an XSLT stylesheet. Responses, if received, are considered comments to the request, and are listed separately in response collations and in returned responses. Responses from the right operand do not affect the truth-value of the overall expression (or any expression containing it). This INFORMS primitive could be used, for example, to keep colleagues, friends and family informed of notifications one receives.
Not
The NOT operator performs a logical negation on its operand. The truth table for the NOT operator is given in FIG. 3L. The NOT operator is used as follows:

    
    
        NOT cf_expression
    
    


Or
The OR operator is a parallel operator that evaluates all of its operands initially. The OR operator will complete as soon as one of its operands results in a truth-value of TRUE. The truth table for the OR operator is given in FIG. 3M. The sequential operator related to OR is the operator ORELSE. The OR operator is used as follows:

    
    
        cf_expression1 OR cf_expression2
        OR {cf_expression1, cf_expression2, . . . }
    
    


Orelse
The ORELSE operator is a sequential operator that evaluates its children starting from the left and will evaluate the next child only if the previous child evaluated to FALSE. The truth table for the ORELSE operator is given in FIG. 3N. The parallel operator related to ORELSE is the operator OR. The ORELSE operator is used as follows:

    
    
        cf_expression1 ORELSE cf_expression2
        ORELSE {cf_expression1, cf_expression2, . . . }
    
    


Polls
The POLLS operator is a sequential list operator that evaluates each of its children in order, its value is determined by the number (or percentage) of TRUE values required. Due to the preemptive evaluation of this operator, it is possible that all operands will not be evaluated. The POLLS operator is the only sequential operator that resolves all of its operands before evaluating the first operand. This allows the POLLS operator to determine an early termination point. The truth table for the POLLS operator is given in FIG. 3O. The parallel operator related to POLLS is the operator VOTES. The POLLS operator is used as follows:

    
    
        {cf_expression1, cf_expression2, cf_expression3, . . . } POLLS n
        {cf_expression1, cf_expression2, cf_expression3, . . . } POLLS p%

where n is the number of TRUE responses required by POLLS to return TRUE, and p% is the percentage of TRUE responses required by POLLS to return TRUE.

    
    


Races
The RACES operator is a parallel operator that evaluates all of its children and completes as soon as any operand results in a truth-value of TRUE or FALSE. The truth table for the RACES operator is given in FIG. 3P. The sequential operator related to RACES is the operator DELEGATES. The RACES operator is used as follows:

    
    
        cf_expression1 RACES cf_expression2
        RACES {cf_expression1, cf_expression2, . . . }
    
    


Survey
The SURVEY operator is a sequential list operator that evaluates each of its children in order from left to right regardless of the value of the preceding operand. All operands will eventually be evaluated until SURVEY completes, or is canceled. The truth table for the SURVEY operator is given in FIG. 3Q. The parallel operator related to SURVEY is the operator BROADCAST. The SURVEY operator is used as follows:

    
    
        SURVEY {cf_expression1, cf_expression2, . . . }
    
    


The SURVEY primitive contacts each expression in the list when the previous expression has reached a final truth value (true, false, maybe). The SURVEY primitive completes after the last expression completes. The SURVEY primitive, however, is always true and its true value indicates that SURVEY has completed.
Until
The UNTIL operator is the time operator that indicates when a communication flow should stop executing. The truth table for the UNTIL operator is given in FIG. 3R. The UNTIL operator is used as follows:

    
    
        cf_expression UNTIL time_expression

If time_expression contains a time_domain that is empty, or an error is generated while evaluating the time_expression, then cf_expression will not timeout.

    
    


Votes
The VOTES operator is a parallel list operator that evaluates all of its children, its value is determined by the number (or percentage) of TRUE values required. The truth table for the VOTES operator is given in FIG. 3S. The sequential operator related to VOTES is the operator POLLS. The VOTES operator is used as follows:

    
    
        {cf_expression1, cf_expression2, cf_expression3, . . . } VOTES n
        {cf_expression1, cf_expression2, cf_expression3, . . . } VOTES p%

where n is the number of TRUE responses required by VOTES to return TRUE, and p% is the percentage of TRUE responses required by VOTES to return TRUE.

    
    


When-IsTrue-IsFalse-IsMaybe
The WHEN-ISTRUE-ISFALSE-ISMAYBE operator allows conditional branching within an expression by allowing the user to specify what is to happen for each possible truth-value of the conditional. The truth table for the WHEN-ISTRUE-ISFALSE-ISMAYBE operator is given in FIG. 3T. The operand of the operator specified for the value of the conditional replaces the operator and evaluation continues with that operand. If an operand is not specified for a particular value, then the operator results in that value. The order in which the value-operand pairs are given does not matter. The WHEN-ISTRUE-ISFALSE-ISMAYBE operator is used as follows:

    
    
        WHEN cf_expression1
        [ISTRUE cf_expression2]
        [ISFALSE cf_expression3]
        [ISMAYBE cf_expression4]
    
    


Primitives that Provide Dynamic Context
As previously indicated, communication flow expressions in accordance with the present invention may be processed based on dynamic context. In one exemplary embodiment of the present invention, two language constructs, context and labels, discussed hereinafter, are employed to provide dynamic context to the communication flow expression.
Context Primitive: Setting Context for an Expression in the Root Flow
Some communication flow operands and test expression functions require a context in order to properly evaluate. The context is typically set when a user's name is resolved to a communication flow expression and it is the user. Therefore, application expressions have no context and any direct children that are not people, also have no context. This can be a problem for the EVAL function and the WATCH operand, each discussed below. Since the EVAL function and the WATCH operand (when it is interested in a specific data element) keep track of the last element viewed and this count is stored in a map keyed by the element name and the context, there could be collisions between the EVAL function and any other WATCH operands if they are all viewing the same data element. For example, the following application communication flow expression would have indeterminate results since there are two watch operands counting responses:














BROADCAST {



  ham, joann,



  WATCH “xui:response” ?



  data(“xui:response[%%INDEX%%]/@uid”) = “joann” ?



   ANDTHEN ham,



  WATCH “xui:response” ?



  data(“xui:response[%%INDEX%%]/@uid = “ham” ?



   ANDTHEN joann



}









If the application was trying to notify “ham” and “joann” and then send a notification when the other responded, this would not work. One of the watch operands would consume all of the responses not letting the other see them because they share the same context. In order to resolve this problem, a context function allows the application to set the context for a communication flow expression that is executed at the root level:

    
    
        CONTEXT(string userContext, cfexpression expr)
    
    


When the expression parser encounters a context function in its grammar, it calls a method on the root of the subtree created by parsing the second argument of the context function, in order to set the context. This method call causes the context to propagate down the subtree, setting the context on all nodes that do not currently have a context defined. If the “userContext” argument is NULL, then the context is unset for the entire subtree, allowing subsequent context functions to set the context on the entire subtree.
The above expression can now be rewritten as:












BROADCAST {


 ham, joann,


 CONTEXT(“uid=ham,ou=Research,o=Avaya”,


   WATCH “xui:response”


     ? data(“xui:response[%%INDEX%%]/@uid”) = “joann” ?


    ANDTHEN ham),


 CONTEXT(“uid=joann,ou=Research,o=Avaya”,


   WATCH “xui:response”


     ? data(“xui:response[%%INDEX%%]/@uid = “ham” ?


    ANDTHEN joann)


}









With the context set appropriately to the context of the appropriate user, there is now no longer any concern for a collision.
However, since the keys for the indices in the map are global to the active communication flow, if either “ham” or “joann” are watching responses in a personal communication flow expression, it is possible to still have a collision because the context would be the same as the one set in the application communication flow expression. In specifying the first WATCH parameter, applications and users can mitigate this effect by selecting a specific data element in the response to watch thereby reducing the probably of collisions.
There are security implications for setting the context. If there is no context, then it is assumed to be the application communication flow expression, and therefore all of the responses received are available to the WATCH operand and any data( ) function in the test expression. Setting a context can limit the set of responses if a system privacy flag is set on any of them and the user represented by the context is not authorized to view them. Since the setting of the privacy flag is application controlled, it is assumed that it would not be used when an application is using an expression similar to the given example.
Labels
As discussed hereinafter, a label provides a mechanism for an application to provide context through labels when a communication flow is generated. Labels are inherited by all of the child nodes of the node to which they are applied. When dynamic delegation occurs, i.e. a user replaces his/her personal communication flow with an alternate communication flow, the new communication flow for the user inherits the labels of its parent, but not any labels from the previous and now replaced user communication flow. Labels are also unique; if a label is applied more than once the duplicate is thrown away. This is important with regards to recursion and loop detection (as discussed herein).
U.S. patent application Ser. No. 10/999,890, filed Nov. 30, 2004, entitled “Method and Apparatus for a Publish-Subscribe System with Access Controls,” and incorporated by reference herein, discloses a subscription server that notifies users of information based on subscriptions that have been entered by the user. The subscription server provides a list of one or more subscribable objects to the users; and the users provide a subscription request based on at least one of the subscribable objects.
Generally, the subscription server matches data of events against subscriptions to get a list of recipients for each event. The list of recipients includes subscribers who subscribe to the event themselves and delegates who receive the delegation of the event from someone else. If the recipient list is not empty, a request will be sent out with a communication flow containing those recipients as its target. When the subscription server composes the communication flow, the subscription server includes the subscription ID, and/or delegation information in labels for each recipient in the list. For example:














( BROADCAST { NORESULT, [SubscriptionID: 26600092]



<uid=user1,ou=people,o=avaya.com>, [SubscriptionID: 49686824]



<uid=user2,ou=people,o=avaya.com> } ) ? response(‘submit’) = 



‘Yes’ || response(‘submit’) = ‘Watch’ ?









In another example:















( BROADCAST { NORESULT, [Delegationtype: SHARED]



[SubscriptionID: 26601102] ( 



[Delegatedby: UserA] <uid=UserB,ou=people,o=avaya.com>



RACES [Delegatedto: UserB]



<uid=UserA,ou=people,o=avaya.com> ) } ) ? response(‘submit’) =



‘Yes’ || response(‘submit’) = ‘Watch’ ?









Labels are the fragments enclosed in a pair of square brackets. They provide a context for the expression that follows. When the notifications for these subscriptions are delivered, the application or the system can use the context to tell the recipient the subscription that generated the message, and, if a delegation, information about the delegation.
The exemplary notification and response system 100 is a rule-based notification system. For a more detailed discussion of communication rules, see, U.S. patent application Ser. No. 10/184,236, filed Jun. 26, 2002, entitled “Method and Apparatus for Automatic Notification and Response;” and U.S. patent application Ser. No. 10/184,325, filed Jun. 26, 2002, entitled “Method and Apparatus for Automatic Notification and Response Based on Communication Flow Expressions,” each incorporated by reference herein. For example, recipients can specify rules for refining communication flow expressions with details of how, i.e., which devices to use, and when to contact them.
Generally, communication rules are used to describe the condition under which one notification profile will be used. Labels provide the context, so they are good candidates to be used in the communication rule as a condition. When users create subscriptions using the subscription portal, a web-based user interface, they also create communication rules, which associate notification profiles with certain subscriptions. Each communication rule is assigned a number. A communication flow engine evaluates each user's communication rules in numeric order and applies the first one that matches. Thus, labels simplify ordering of subscriptions to determine which preferences to use when multiple subscriptions match.
FIG. 4 illustrates an exemplary interface 400 for ordering subscriptions based on labels. As shown in FIG. 4, an exemplary user (userA) has subscription 55027102 (102) and subscription 55027113 (113). The user subscribes to Company One's high severity cases in subscription 102. Because Company One is his customer, he uses a more urgent profile “7×24 Profile” for this subscription. The user also subscribes to all top customers' high severity cases in subscription 113 using a less proactive profile called “Informational Profile.”
Because Company One is one of the top customers, both subscriptions will match Company One's high severity cases. The communication flow of the request of such a case includes the user, userA, as one of its recipients with two labels.














( BROADCAST { NORESULT, [SubscriptionID: 55027102]



[SubscriptionID: 55027113]



<uid=userA,ou=people,o=avaya.com> } ) ? response(‘submit’) =



‘Yes’ || response(‘submit’) = ‘Watch’ ?









The ordering of the rules will eventually decide which rule to pick. UserA can use arrows, as shown in FIG. 4, to order those communication rules. This simplifies the ordering of subscriptions and the rule matching process.
First, the labels provide one characteristic of the incoming message to match. In the absence of a facility for matching incoming messages against the subscription ID (i.e. labels), the rule processing software would need to match a more complex relational expression on the content of the message to see if it matched a given subscription. It has additional disadvantages besides complexity. The subscription server already matches the complex logical expression as part of determining that the subscription matches the incoming request. Having the communication flow rules also do this matching is redundant. Another disadvantage is that both the subscription server and the communication flow engine must have the text of the full logical expression, and they use different data stores. This can cause skew between the data stores.
Second, the labels for subscription IDs provide a set of disjoint rule conditions for evaluating which rule matches. Either the subscription for the rule generated the notification or not. Without the labels, users or the interface software would need to order a user's subscriptions based on the relational expressions satisfied by the subscription. They would need to order the overlapping subscriptions from the most specific to the least specific relational expression. This is the way that the subscriptions in FIG. 4 are ordered. Moreover, some subscriptions will partially overlap and further confuse the issue. For example, if the first subscription in FIG. 4 was changed to subscribe to high severity cases for Company One or Company Two, and only Company One was a Top Customer, the resulting two subscriptions would not completely overlap. Now, add a subscription to all cases for Company Two. There are no complete orderings from specific to general of the three subscriptions, and this is likely to confuse the user further. It is also likely to be difficult to manage if an attempt is made to aid the user. With labels, understanding how to order subscriptions from specific to general is not necessary. The intention of the user is clear, because the user is ordering unique subscription IDs where only one will apply in each test.
FIG. 5 illustrates the identification of phases of a communication using labels, in accordance with the present invention. Labels can also be used to provide context when applications generate a communication flow. For example, as shown in FIG. 5, assume an application has four different types of interactions that are planned with recipients depending on the phase of the communication or other criteria. In FIG. 5, a first group is contacted during step 510 and asked to confirm evacuation, a second group is sent checklists of actions to follow during step 520, a third group is asked for their location, condition and whether they need assistance during steps 530 and 532, and a fourth group receives reports on the condition of the third group during step 540. The communication flow subexpression for contacting each group can be preceded by a label identifying their role in the communication. The application can then use the label to determine which interaction to have with the recipient.
Labels also provide a tracking mechanism that helps to associate the result (this person is included in the communication flow) with the reason (he/she subscribed or is delegated to this event). This information is useful for users to maintain their profiles and subscriptions and for system administrators to monitor the system. It can be used for reporting and database analysis. Labels can also be tested in a conditional expression of a communication flow, for example, to trigger an action.
Primitives that React to Dynamic Context
As previously indicated, communication flow expressions in accordance with the present invention may be processed based on dynamic context. In one exemplary embodiment of the present invention, a number of primitives, discussed hereinafter, are employed that react to the dynamic context of communication flow expressions.
Eval Primitive
An EVAL function allows an application to extend the root communication flow using expressions added to the data or located in user responses. The function has the following form:

    
    
        EVAL(string watchString, test expression conditional, string evalString)

where “watchString” is an XPath expression that indicates the data being watched that will trigger evaluation of the conditional. If the conditional is true, then the “evalString” (also a XPath expression) is evaluated to fetch the expression from the data. Using known techniques, discussed briefly above, this expression is parsed into a subtree that is added as a child of the eval function's parent node. It is noted that “evalString” is optional, if it is not specified, it is assumed to be “(watchString)[%%INDEX%%]”. When EVAL begins execution, it iterates over all values of the watched expression. This may cause it to trigger several times for values that already exist, and then to trigger for new values as they arrive.

    
    


The EVAL function may only be used in the application root communication flow expression and then only as the child of a parallel list operator such as BROADCAST or RACES. If the EVAL function is used in the expression of a user, or its parent is not a parallel list operator, the EVAL function will replace itself in the parse tree with a MAYBE value.
Consider the following example:














BROADCAST { EVAL(‘commflow’, ? true ?,



‘commflow[%%INDEX%%]’),



     <ham>, <joann> }









This example says to contact the users “ham” and “joann” and every time a new “commflow” element is added to the data, take its value, parse it and add the new subtree as a child of BROADCAST (the parent node of the EVAL). In the example, the %%INDEX%% string is replaced with the index number of the element in the data that should be accessed. FIG. 6 illustrates a parse tree 600 built from this expression, it contains four nodes 611-614 with the root 611 of the tree 600 being the BROADCAST operator (for clarity, the names have not been further resolved in the example.)
FIG. 7 shows the modified parse tree 700 after a “commflow” element with a value of ‘yangqian’ was added to the data—a new name node 720 has been added to the tree 700.
Watch Primitive
The WATCH operand is always associated with a test_expression and it is evaluated at runtime. However, watch will block until its test_expression evaluates to true, and then it will evaluate to TRUE. There are two forms of WATCH.
The first form of the WATCH primitive is the simplest, it evaluates its test_expression the first time it is encountered and if test_expression is false, then it is evaluated each time the request data is modified or a response is submitted.
The second form of the WATCH primitive is monitoring a specific element in the data, or the responses and allows iteration over all values. It will evaluate its test_expression when a new value is added for the element being watched, or a new response is submitted. In addition to changes seen after watch has started, it will also iterate through all values for the watched element (or responses) that were posted before the watch was initially evaluated and evaluate the test_expression on each value. If %%INDEX%% is used in the test_expression, WATCH will replace it with the index of the value to test. If this form is not used in a recursive expression, then its behavior is the same as the first form.
The WATCH primitive is used as follows:

    
    
        WATCH test_expression
        WATCH string test_expression
    
    


In the second form of the WATCH operand, the string before the test_expression contains the name of the data element being watched. For example, the following expression:

    WATCH ? boolean(xui:response[xui:responder/@uid=‘John’])?

evaluates to true if the user John has submitted a response, if John has not submitted a response, then this will block until he does.



In a further example, the following expression:

    WATCH ‘status’? data(‘status[%%INDEX%%]’)==‘field’?

evaluates to true when the status element in the data contains a value of ‘field’.



Further Communication Flow Issues
Communication Flow Language Extensions
An EXTENSION( ) function provides a mechanism for a developer to add new communication flow constructs to the language without modifying the grammar of the language itself. It has the following form:

    
    
        EXTENSION(string extensionName, arg1, arg2, arg3, . . . )
    
    


The “extensionName” is the name of the implementation of the extension; this might be a shared object or dynamically loaded library, or a Java class. Each subsequent argument is either a string or a communication flow expression that the extension will operate upon. For example, if a user wanted to recreate the NOT operator, an implementation in Java might look like this in an expression:

    
    
        EXTENSION(‘com.bar.foo.Not’, ham RACES joann)

this would be equivalent to

        NOT (ham RACES joann)

if the appropriate logic was defined in the Java class “com.bar.foo.Not” to implement the NOT truth table.

    
    


FIG. 8 shows the parse tree 800 created by parsing the above extension example. This parse tree 800 is made up of four nodes 811-814 with the ‘com.bar.foo.Not’ node 811 as the root.
This Operand: Recursion and Loop Detection
A THIS operand allows the communication flow expression writer to use recursion without the need to know the name of the expression. The THIS operand can be either constant or dynamic depending on where it is used. If the THIS operand is used in an application communication flow expression, then it refers to the actual expression being processed (i.e., the text of the expression) and therefore is constant. Otherwise, if used in a user's communication flow expression, the THIS operand represents the name of the currently executing communication flow expression and allows the flow writer to change the expression of the flow while the communication flow is active and alter its behavior.
In order to prevent excessive consumption of resources, a loop detection scheme can be implemented. This algorithm allows only one occurrence of a particular name, SEARCH( ) function or THIS in the evaluation path of the parse tree. The evaluation path is the path taken through the tree from the root to a leaf node. Therefore, a name maybe used elsewhere in the tree, and may even be a sibling of itself, but it may not be a child of itself unless evaluation is halted by a time (see example below) or sequential operator. To determine if two nodes are equal, the name, SEARCH parameters or THIS, the context of the node, and the number of labels are compared. If they are equivalent, then a loop is considered to exist and the bad node is replaced by a MAYBE. Only the number of labels needs to be compared since each child node inherits the labels of its parent and they are unique, so there is no need to compare their actual values. Each time a name, SEARCH, or THIS node is encountered during evaluation, the node is pushed onto a stack. When a new name, SEARCH or THIS is encountered, the stack is checked to see if an equivalent node is in it. If there is an equivalent node, then the node being evaluated is replaced by a MAYBE and evaluation returns to the parent to continue with any other children. When a name, SEARCH or THIS node is finished being evaluated, it is popped off of the stack so that it can be used elsewhere in the parse tree. To catch a loop in the application communication flow expression, when the first expression is evaluated, it is pushed onto the stack.
A typical use of recursion with labels is to have a contact repeatedly “fire” at regular intervals:












IF TEST ? label(‘PageMe’) ?


 THEN ( <PagerContact> RACES ( THIS AFTER + 00:10 ) )


 ELSE ( <WebContact> RACES <MailContact> RACES [PageMe]


 THIS )









This expression says to contact the user via the web and electronic mail and to page him every 10 minutes.
FIG. 9 shows the initial parse tree 900 for this expression. The edges representing the links to the children of the IF operator are labeled with their functionality. The “PageMe” label is represented in superscript after the node name of the node(s) 917 to which it is attached. After parsing the expression into the tree 900, the expression is evaluated to determine a truth-value. This evaluation causes the conditional to be evaluated, which generates a FALSE since the “PageMe” label is not attached to the test node 912. The else clause then replaces the IF as the root of the expression and it is then evaluated. Evaluation of the name nodes 915, 916 results in a media contact node replacing the corresponding name node in the tree 900.
During evaluation, a new parse tree of the original expression replaces the THIS node, with one difference, the “PageMe” label is now applied to the tree and is attached to all leaf nodes—this label is what prevents the loop detection algorithm from halting evaluation. The new parse tree 1000 is shown in FIG. 10. Evaluation continues with the evaluation of the new test node 1015. This node 1015 now results in TRUE since the “PageMe” label is attached to it, therefore theN clause replaces the IF in the parse tree 1000. Evaluation continues with the “PagerContact” name 1020 resolving to a media contact node. Evaluation stops at the AFTER node 1021 since that indicates a time delay.
FIG. 11 displays the new parse tree 1100 after the AFTER node 1116 halted evaluation. Since evaluation was halted, the THIS node 1117 was not evaluated and no loop was detected. If the owner of this communication flow has not posted a response before 10 minutes have elapsed, then the after node 1116 replaces itself in the tree with its child and triggers evaluation of the THIS node 1117 resulting in the original parse tree 900 being added to the current parse tree 1100, as shown in FIG. 12. After evaluating the conditional you then have the parse tree 1300 depicted in FIG. 13. This growing of the parse tree will continue every 10 minutes until the user responds or the overall communication flow completes.
The following expression is an example of an application communication flow expression that contains an infinite loop, and the cycle detection algorithm stated above would prevent it from consuming resources (FIG. 14 shows the parse tree for this expression, and FIG. 15 shows the parse tree after the initial evaluation):

    
    
        ham RACES THIS
    
    


The pager example can be used to demonstrate a user communication flow with an infinite loop. If you remove the AFTER operator, you get the following expression (FIG. 16 shows the initial parse tree 1600, and FIG. 17 shows the parse tree 1700 after evaluation—skipping the step similar to that shown in FIG. 10):












IF TEST ? label(‘PageMe’) ?


 THEN ( <PagerContact> RACES THIS AFTER + 00:10 )


 ELSE ( <WebContact> RACES <MailContact> RACES [PageMe]


 THIS )









Memory Management
In order to improve memory management, several techniques are used. First, when a subtree of the communication flow parse tree evaluates to a truth-value, it is replaced by a node that represents that truth-value, allowing the memory consumed by the subtree to be released to the system. Additionally, there is only one allocated copy of each truth-value in the system and they are shared by all active communication flows.
Additionally, optimizations can be implemented to reduce the memory usage of the parse tree itself. The original parse tree was binary, that is, each operator had two children. The new parse tree allows the operators to have more than two children, removing the need to allocate structures for chained expressions with the same operator. The memory is further reduced by collapsing the parse tree during runtime, as each name is resolved, if it produces a subtree rooted with an operator equivalent to its parent, then the children of the root in the subtree are promoted to children of the parent of the name. FIGS. 18-20 show this optimization for the pager example and are replacements for FIGS. 11-13.
Inline Media Contacts
Typically, media contact specifications are stored in a communication flow data store (e.g., LDAP directory or database) and are accessed using the name of the object in the data store. However, there are certain times when the application (or a presence system) may want to create a media contact “on-the-fly”. This can be accomplished by using the CONTACT function, as follows:

    
    
        CONTACT(string contactType, string owner, string address, . . . )
    
    


The “contactType” is the name of the implementation of the media contact; this might be a shared object or dynamically loaded library, or a Java class. The “owner” argument is the identifier of the owner of the object and “address” is the address the device will use to contact the owner. After the “address” argument, any number of parameters can be defined. Each parameter is a string defining a name/value pair in the form: “name=value”.
When the contact function is parsed, a media contact of the given type is allocated and placed in the parse tree.














CONTACT(“com.avaya.xui.contact.EmailContact”,



  “nobody”,



  “nobody@avaya.com”,



  “protocol=HTML”)









This creates a new Java node in the parse tree that will send HTML e-mail to the address “nobody@avaya.com”. The string “protocol=HTML” is a parameter that the “com.avaya.xui.contact.EmailContact” Java object recognizes as meaning to send HTML formatted e-mail.
Among other benefits, inline media contacts enhance the dynamic delegation of communication flows. In this manner, communication flows can be dynamically altered when a request is received by replacing the media contact or the owner in the parse tree.
System and Article of Manufacture Details
As is known in the art, the methods and apparatus discussed herein may be distributed as an article of manufacture that itself comprises a computer readable medium having computer readable code means embodied thereon. The computer readable program code means is operable, in conjunction with a computer system, to carry out all or some of the steps to perform the methods or create the apparatuses discussed herein. The computer readable medium may be a recordable medium (e.g., floppy disks, hard drives, compact disks, or memory cards) or may be a transmission medium (e.g., a network comprising fiber-optics, the world-wide web, cables, or a wireless channel using time-division multiple access, code-division multiple access, or other radio-frequency channel). Any medium known or developed that can store information suitable for use with a computer system may be used. The computer-readable code means is any mechanism for allowing a computer to read instructions and data, such as magnetic variations on a magnetic media or height variations on the surface of a compact disk.
The computer systems and servers described herein each contain a memory that will configure associated processors to implement the methods, steps, and functions disclosed herein. The memories could be distributed or local and the processors could be distributed or singular. The memories could be implemented as an electrical, magnetic or optical memory, or any combination of these or other types of storage devices. Moreover, the term “memory” should be construed broadly enough to encompass any information able to be read from or written to an address in the addressable space accessed by an associated processor. With this definition, information on a network is still within a memory because the associated processor can retrieve the information from the network.
It is to be understood that the embodiments and variations shown and described herein are merely illustrative of the principles of this invention and that various modifications may be implemented by those skilled in the art without departing from the scope and spirit of the invention.

## Claims

1. A method for providing a message from a sender to at least one recipient in accordance with a communication flow having a plurality of potential paths, said method comprising:
receiving said message from said sender by a data-processing system in accordance with said communication flow;
evaluating said communication flow by said data-processing system, wherein said communication flow is controlled by a communication flow expression that comprises a dynamic context, wherein said dynamic context comprises one or more of an update to data in said communication flow, a response received for said communication flow, and a state of said communication flow, wherein said dynamic context is established via at least one of a label that provides context and a context function that sets said context in said communication flow expression, and wherein said communication flow expression further comprises at least one primitive keyword indicating how said message should be processed in response to said dynamic context, wherein said primitive keyword is an evaluation function that specifies data being watched that will trigger evaluation of a specified conditional, wherein said evaluation function acts on changes to one or more of data and responses associated with said communication flow expression, and wherein said evaluation function allows an application to dynamically add one or more nodes to said communication flow during execution of said communication flow as a result of data updates or receipt of responses;
processing said message by said data-processing system based on said communication flow expression and said dynamic context; and
sending said message to said at least one recipient in accordance with said communication flow.

2. The method of claim 1, wherein said dynamic context is established by said data-processing system.

3. The method of claim 2, wherein said one or more labels are inherited by each child node of the node to which said one or more labels are applied.

4. The method of claim 2, wherein said one or more labels are unique.

5. The method of claim 2, wherein said one or more labels are a condition in a communication rule.

6. The method of claim 2, wherein one or more of said labels are tested by a conditional expression in a communication flow.

7. The method of claim 2, wherein said one or more labels identify a subscription that generated a message.

8. The method of claim 2, wherein said data-processing system applies one or more communication rules to said one or more labels to determine the preferred communication flow for delivering messages based on one or more subscriptions.

9. The method of claim 2, wherein said one or more labels identify phases of a communication.

10. The method of claim 2, wherein said one or more labels identify roles of recipients of a communication.

11. The method of claim 2, wherein said one or more labels control a rendering of said message.

12. The method of claim 1, wherein said context function enables an application to set a context for said communication flow expression that is executed at the root level.

13. The method of claim 12, wherein said context function invokes a method on the root of a subtree created by parsing a second argument of said context function to set said context.

14. The method of claim 13, wherein said method causes said context to propagate down said subtree, setting a context on all nodes that do not currently have a defined context.

15. The method of claim 1, wherein said primitive keyword is a watch operand that has an associated test expression that is evaluated at runtime, and wherein said watch operand will block until said associated test expression evaluates to true, and then said watch operand will evaluate to true.

16. The method of claim 15, wherein said watch operand evaluates said associated test expression the first time said associated test expression is encountered and if said associated test expression is false, then said associated test expression is evaluated each time the request data is modified or a response is submitted.

17. The method of claim 15, wherein said watch operand monitors a specific element in the data associated with said communication flow expression, or the responses associated with said communication flow expression and allows iteration over all values, and wherein said watch operand evaluates said associated test expression for each existing value or response, and then when a new value is added for said element being watched, or a new response is submitted.

18. The method of claim 1, wherein said primitive keyword is an advises or informs operator that causes an out-of-band communication flow expression to be evaluated outside of the scope of said main communication flow expression.

19. The method of claim 18, wherein a response received to said out-of-band communication flow expression is treated as a comment and does not affect the truth-value of the said main communication flow expression.

20. The method of claim 1, wherein said primitive keyword is a consult operator that evaluates all of its children and waits for one of them to result in a true or false value.

21. The method of claim 20, wherein said result is returned as the value of the operator, but the remaining operands are placed out-of-band so that they can continue operation without affecting an outcome of said communication flow expression.

22. The method of claim 1, wherein said primitive keyword is a contact function that allows a media contact to be defined directly in said communication flow expression.

23. The method of claim 22, wherein said contact function allows a communication flow to be dynamically delegated to another recipient.

24. An apparatus for providing a message from a sender to at least one recipient in accordance with a communication flow having a plurality of potential paths, said apparatus comprising:
a memory that is non-transitory; and
at least one processor, coupled to the memory, operative to:
receive said message from said sender in accordance with said communication flow;
evaluate said communication flow by said data-processing system, wherein said communication flow is controlled by a communication flow expression that comprises a dynamic context, wherein said dynamic context comprises one or more of an update to data in said communication flow, a response received for said communication flow, and a state of said communication flow, wherein said dynamic context is established via at least one of a label that provides context and a context function that sets said context in said communication flow expression, and wherein said communication flow expression further comprises at least one primitive keyword indicating how said message should be processed in response to said dynamic context, wherein said primitive keyword is an evaluation function that specifies data being watched that will trigger evaluation of a specified conditional, wherein said evaluation function acts on changes to one or more of data and responses associated with said communication flow expression, and wherein said evaluation function allows an application to dynamically add one or more nodes to said communication flow during execution of said communication flow as a result of data updates or receipt of responses;
process said message based on said communication flow expression and said dynamic context; and
send said message to said at least one recipient in accordance with said communication flow.

25. The apparatus of claim 24, wherein said dynamic context is established using one or more labels.

26. The apparatus of claim 24, wherein said context function enables an application to set a context for said communication flow expression that is executed at the root level.

27. The apparatus of claim 24, wherein said primitive keyword is a watch operand that has an associated test expression that is evaluated at runtime, and wherein said watch operand will block until said associated test expression evaluates to true, and then said watch operand will evaluate to true.

28. The apparatus of claim 24, wherein said primitive keyword is an advises or informs operator that causes an out-of-band communication flow expression to be evaluated outside of the scope of said main communication flow expression.

29. The apparatus of claim 24, wherein said primitive keyword is a consult operator that evaluates all of its children and waits for one of them to result in a true or false value.

30. The apparatus of claim 24, wherein said primitive keyword is a contact function that allows a media contact to be defined directly in said communication flow expression.