Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Using Command Relationships in an English Query Model

SQL Server 2000

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 database objects. These entities may simply be a static part of the phrasing, for example, "the Recycle Bin" in the command "Move <file> into the Recycle Bin". Or, these entities may correspond to command arguments that are obtained from the user's question rather than from the database (for example, in the command, "Raise the temperature of vat 6 by 12 degrees"). The command phrasing that is used would be "Raise the_temperature of vats by temperature_increase_amounts". The entity "the_temperature" is not represented by a database object and does not correspond to a command argument. So, you specify this by selecting "None" as the parameter type. The entity "temperature_increase_amounts" (also not represented by a database object) does correspond to a parameter of the command. As a result, you must indicate the data type of the parameter by using the Parameter Type property.

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

Model Editor

See Also

Command Phrasing Dialog Box

Defining Entities in an English Query Model

<Role Name> Role In Command Dialog Box

Verbs to Avoid in Command Relationships

Show:
© 2015 Microsoft