Table of Contents
- Microsoft SQL Server Defined
- Microsoft SQL Server Features
- Microsoft SQL Server Administration
- Microsoft SQL Server Programming
- Performance Tuning
- Choosing the Back End
- The DBA's Toolbox, Part 1
- The DBA's Toolbox, Part 2
- Scripting Solutions for SQL Server
- Building a SQL Server Lab
- Using Graphics Files with SQL Server
- Enterprise Resource Planning
- Customer Relationship Management (CRM)
- Building a Reporting Data Server
- Building a Database Documenter, Part 1
- Building a Database Documenter, Part 2
- Data Management Objects
- Data Management Objects: The Server Object
- Data Management Objects: Server Object Methods
- Data Management Objects: Collections and the Database Object
- Data Management Objects: Database Information
- Data Management Objects: Database Control
- Data Management Objects: Database Maintenance
- Data Management Objects: Logging the Process
- Data Management Objects: Running SQL Statements
- Data Management Objects: Multiple Row Returns
- Data Management Objects: Other Database Objects
- Data Management Objects: Security
- Data Management Objects: Scripting
- Powershell and SQL Server - Overview
- PowerShell and SQL Server - Objects and Providers
- Powershell and SQL Server - A Script Framework
- Powershell and SQL Server - Logging the Process
- Powershell and SQL Server - Reading a Control File
- Powershell and SQL Server - SQL Server Access
- Powershell and SQL Server - Web Pages from a SQL Query
- Powershell and SQL Server - Scrubbing the Event Logs
- SQL Server 2008 PowerShell Provider
- SQL Server I/O: Importing and Exporting Data
- SQL Server I/O: XML in Database Terms
- SQL Server I/O: Creating XML Output
- SQL Server I/O: Reading XML Documents
- SQL Server I/O: Using XML Control Mechanisms
- SQL Server I/O: Creating Hierarchies
- SQL Server I/O: Using HTTP with SQL Server XML
- SQL Server I/O: Using HTTP with SQL Server XML Templates
- SQL Server I/O: Remote Queries
- SQL Server I/O: Working with Text Files
- Using Microsoft SQL Server on Handheld Devices
- Front-Ends 101: Microsoft Access
- Comparing Two SQL Server Databases
- English Query - Part 1
- English Query - Part 2
- English Query - Part 3
- English Query - Part 4
- English Query - Part 5
- RSS Feeds from SQL Server
- Using SQL Server Agent to Monitor Backups
- Reporting Services - Creating a Maintenance Report
- SQL Server Chargeback Strategies, Part 1
- SQL Server Chargeback Strategies, Part 2
- SQL Server Replication Example
- Creating a Master Agent and Alert Server
- The SQL Server Central Management System: Definition
- The SQL Server Central Management System: Base Tables
- The SQL Server Central Management System: Execution of Server Information (Part 1)
- The SQL Server Central Management System: Execution of Server Information (Part 2)
- The SQL Server Central Management System: Collecting Performance Metrics
- The SQL Server Central Management System: Centralizing Agent Jobs, Events and Scripts
- The SQL Server Central Management System: Reporting the Data and Project Summary
- Time Tracking for SQL Server Operations
- Migrating Departmental Data Stores to SQL Server
- Migrating Departmental Data Stores to SQL Server: Model the System
- Migrating Departmental Data Stores to SQL Server: Model the System, Continued
- Migrating Departmental Data Stores to SQL Server: Decide on the Destination
- Migrating Departmental Data Stores to SQL Server: Design the ETL
- Migrating Departmental Data Stores to SQL Server: Design the ETL, Continued
- Migrating Departmental Data Stores to SQL Server: Attach the Front End, Test, and Monitor
- Tracking SQL Server Timed Events, Part 1
- Tracking SQL Server Timed Events, Part 2
- Patterns and Practices for the Data Professional
- Managing Vendor Databases
- Consolidation Options
- Connecting to a SQL Azure Database from Microsoft Access
- SharePoint 2007 and SQL Server, Part One
- SharePoint 2007 and SQL Server, Part Two
- SharePoint 2007 and SQL Server, Part Three
- Querying Multiple Data Sources from a Single Location (Distributed Queries)
- Importing and Exporting Data for SQL Azure
- Working on Distributed Teams
- Professional Development
- Application Architecture Assessments
- Business Intelligence
- Tips and Troubleshooting
- Additional Resources
English Query - Part 3
Last updated Mar 28, 2003.
I'm continuing my previous tutorials on Natural Language Processing (NLP) technology in SQL Server, using Microsoft's English Query. In the first tutorial I introduced the product, and in the last couple I explained how to install the product, as well as the questions we need to answer in the application and the physical data structure we have to support the answers. I also covered the types of Phrasings we have available within the product that give us the structures for the application.
We now have the Physical model components as well as the Semantic model. We're ready to design the application. If you have installed the product, you can perform the same steps I have here to create this application. If you don't have English Query installed, just follow along with these example screens.
Beginning in the Windows Start menu select the All Programs | Microsoft SQL Server | English Query | Microsoft English Query item. You're shown the following opening screen:
You're actually using Visual Studio to design and build English Query Applications, so you'll need to select the English Query Objects and then SQL Project Wizard item at the first panel. Name the project as I have here, and then click the Open button to continue. Notice that you can design solutions against Analysis Services as well as SQL Server. In fact, using English Query with Analysis Services is one of the most common ways to deliver a Natural Language solution, since you're normally dealing with a non-technical audience in an OLAP environment. The two products are a natural mix.
In the first set of screens you're asked for the connection information to the server you're going to use as the physical structure of the data. I won't go through each of those screens here, but you should be aware that the wizard will lead you through selecting data from Oracle, SQL Server or any other ODBC-compliant connection. You're asked to provide the name of the server and the credentials you use to connect to that server, if that applies.
You'll also have to specify the names of the views or tables you need to satisfy the physical structure. You'll recall from my earlier tutorials that we need authors and titleauthors for the simple questions in this example. I'm ignoring the sales questions we talked about to make the example simple.
The next screen in the Wizard is where things really begin to get interesting. Each part of the screen is significant, from the column titles to the symbols and icons on the screen. Take a moment to review the screen before you read on:
The system has attempted to derive the Phrasings the project needs to answer questions. It does a pretty good job too – at least most of the time. Let's take a deeper look at what the parts of this screen in the Wizard represents.
The first element is that several objects have checkboxes beside them. If a box is selected, the Entities and Relationships (as I explained in the previous tutorials in this series) will be created. If it's not checked, the Wizard won't create that item or type of item.
Each of the Entities is highlighted in blue. Clicking on the blue Entity name takes you to a property tab for that object.
Beside each Entity is a small icon that represents a Trait Phrasing, which I explained in the last tutorial. To the right of the screen in the next column is the database object that ties in to those Entities.
Two things are important to remember about this panel before you push the OK button. The first is that you should take your time and edit all of the items you can think of while you're in this Wizard. The more complete you are here, the less work you have to do later. The second thing to remember is that nothing is fatal – you can change any of the items the Wizard creates, and even add others. We'll do both of those in the course of this series.
I'll begin some of the changes we need to make with the selection boxes. The Wizard defaults to authors having items. If we take our time and think this through, we'll see that authors don't have all of the Traits the Wizard has picked out. For instance, the Wizard thinks that the authors have states. That might be true if the value in the state field could contain the text active and inactive. The states in question, however, are American states such as Florida or South Carolina. So we see right away that authors don't have states, they are in states.
Before I move away from this point I want to re-iterate a statement I've made throughout this series. When you design an English Query project, it is essential that you understand the source data and the questions the users will ask. Because of the ambiguity of language (bear right versus bear, right) you might end up giving the wrong answer to a question. For a professional DBA it's actually worse to give incorrect data than it is to give no data at all. If you don't provide an answer, the user knows to keep looking. Depending on how the data is used, giving an incorrect answer might be life-threatening.
I've made several changes to my Traits, mostly dealing with addresses. Notice that I set authors to have an address but be in a state or city. Again, the selections you make have everything to do with the questions the users might ask.
Now let's turn our attention to the Entities. After I make the change to set authors to be in a state, I click on the author object. This is the screen that appears:
This screen shows the relationships between the Semantic model and the Database or Physical model. The Wizard has correctly guessed that an author is made up of two fields: au_fname and au_lname. That works for this example, but the Wizard isn't always this lucky. That's why I made sure that I could get the answers I needed from the database using standard Transact-SQL (T-SQL) statements in my earlier tutorials. Having those queries defined and handy helps you fill out this portion of the screen.
Notice also that the Wizard has also guessed at a few Synonyms for the word author. It's come up with biographer and cause. I'm OK with biographer, but I'm not so sure about the word cause. I'll leave it for now, and I'll add writer and novelist to the list using the pull-down menu. We'll revisit this selection later.
In the Entity type box I've changed the default selection from None to Who. Setting this box properly helps English Query answer even more types of questions, because it begins to "understand" that the author entity is a person, and as such gets a whole bunch of English attributes of ownership. This doesn't always apply, but you should check each item to make the project more complete. The more time you spend on these selections, the more questions the system can answer.
I'm going to move on using the default settings for the rest of the objects by closing this panel and then selecting OK at the main Wizard screen. We're dropped into the main design screen for English Query.
We're going to stop here for now. In the next tutorial we'll come back and begin to explore this interface. We'll also begin to edit the current design and then add more objects and relationships to it. We'll close out the series by asking our application a few questions and check the answers we get back.
Informit Articles and Sample Chapters
If you happen to still use SQL Server 7, you can check out this free chapter on English Query for that version.
Microsoft's site for English Query is here.