English Query

Deploying an English Query Application

You can deploy an English Query application in several ways, including within a Microsoft® Visual Basic® or Microsoft Visual C++® application and on a Web page running on the Microsoft Internet Information Server (IIS). In the Web scenario, the interface of the application is with a set of Microsoft Active Server Pages (ASP).

Note  English Query domain files (*.eqd) are built to work with a specific version of the English Query engine. If you are upgrading from an earlier version of English Query, you must rebuild your English Query domain files from the project (*.eqp) using the Model Editor.

After the English Query application is deployed, Question Builder helps the end user determine the information that is available in the English Query model.

To deploy an application to the Web

Model Editor

Model Editor

To set the sample data option

Model Editor

Model Editor

Embedding an English Query Application into Active Server Pages (or COM-Based) Application

You can integrate an English Query application into other ASP applications (for example, to make an English query text box available on a search page).

The following code fragment shows how to convert the users' supplied questions into SQL. Code like this could be embedded into the ASP page that processed the users' queries:

Set objEQSession = Server.CreateObject("Mseq.Session")
objEQSession.InitDomain("Northwind.eqd")
Set objEQResponse = objEQSession.ParseRequest(Request("EQQuestion"))

Select Case objEQResponse.Type
Case nlCommandResponse
   Set objCommands = objEQResponse.Commands
   For intCommand = 0 To objCommands.Count - 1
      Set objCommand = objCommands(intCommand)
      Select Case objCommand.CmdID
      Case nlQueryCmd
         DoSQLCommand objCommand
      Case nlAnswerCmd
         Response.Write objCommand.Answer
   Next
Case nlUserClarifyResponse
   DoClarification objEQResponse, Request("EQQuestion")
Case nlErrorResponse
   Response.Write objEQResponse.Description & "<BR>"
   Response.End
End Select

In this sample, the English Query object is created with Server.CreateObject("Mseq.Session"). To load the domain, the InitDomain method is called with the name of the .eqd file. A response object is returned by calling the ParseRequest() method with the user's question. The response can be a command response, which is a set of commands that are either SQL commands or direct answers that English Query can supply without the accompanying SQL commands.

The SQL command is executed against the database, and the result is generally displayed as a table in a Web page. The process of executing the SQL command using Microsoft ActiveX® Data Objects (ADO) and displaying the result in a table is embedded in the DoSQLCommand function (available in \Program Files\Microsoft English Query\EQProjects\Web Pages\Common.inc).

If the command is an answer, it is displayed directly to the user. The response might also be a request for clarification. For example, the question might be "how much was sold in Washington last year", and the clarification might ask whether Washington was a city or a state. The DoClarification call (also available in Common.asp) encapsulates the code necessary to prompt the user to clarify the question, by displaying possible values from the UserInputs collection on the Response object. If there is an error, it is displayed using the Description property of the Response object.

See Also

Adding Question Builder to an English Query Application

Automatic Clarification of Questions

Compiling an English Query Application

Redistributing the English Query Run-time DLLs

Run-Time Environment for English Query Applications

Sample Applications and Client Interfaces

Testing an English Query Model