Using Command Relationships in an English Query Model
English Query interprets English questions (for example, "Who is the oldest patient?") and statements (for example, "Show the salespeople") as commands to display a set of data. In some applications, you may want to enhance English Query to understand other types of commands. Relationships that contain command phrasings are used to define these model-specific commands and are called command relationships. Command relationships do not use join tables or SQL conditions.
Similarly, entities used in command relationships do not use join paths or "how many" and "how much" properties. Entities in command relationships can be assigned mandatory roles, which means that they are required.
When command phrasings and entities are called in the object model, they require a command ID and a parameter ID, respectively.
Command Relationship Example
An English Query application tracks an art collection, in conjunction with a database that contains information about the artists. A user states, "Display the paintings by xxx artist that are watercolors." This statement is translated into two commands to be executed by the application:
- The first is an SQL command, which fetches information from the database about paintings by xxx artist that are watercolors.
- The second command instructs the client application to display the actual paintings identified by the first command, rather than a display of textual data from the database.
This application uses model knowledge about paintings, artists, and medium, and a relationship containing a command phrasing. The command phrasing in this example has the verb "display" and the direct object "painting."
Mandatory Roles
Mandatory roles is an enhancement to English Query that allows entities used as command relationship arguments to be required. Command relationships are not complete unless all (or a specific subset) of the parameters are specified. This is required for situations in which the target command has arguments that are mandatory.
For example, in the command, "ship (amounts of) products to customers on dates", the product and the customer and the amount must all be specified, or the command is incomplete.
For such roles, if the user does not specify a specific instance of the entity or a qualifier describing a subset of the entity, English Query prompts for such information. When a mandatory role has not been specified in the command or question, the English Query engine object model generates a clarification response with an InputText object for each missing mandatory role, using the prompt provided on the role by the author of the model. For example:
Question: Order 10 bottles of Coho Vineyard Merlot
InputText 1: Who should the order be sent to?
InputText 2: When should the order be sent?
In this example, the user provides a customer name for the first clarification and a date for the second clarification.
Command IDs and Parameter IDs
Command phrasings and entities require an ID when called in the object model. Command phrasings require a command ID, which is returned to the application and indicates which command relationship it is. Each entity used in a command phrasing requires a parameter ID. This ID is returned to the client application in a Parameter object and indicates which command parameter the object specifies.
Some command phrasings use entities that are not represented by
Parameters that correspond to nondatabase entities are returned to the client application through the object model as value Parameter objects, rather than as field Parameter objects. In the previous example, "12 degrees" would be sent as a Parameter with the Value property set to "12" and the Units property set to "degrees".
To create a command relationship