Notes
Slide Show
Outline
1
Does Your Application Understand You?
Using English Query With VFP
  • Dave Bernard
  • The Intellection Group, Inc.
  • Duluth GA USA
2
Does Your Application Understand You?
Using English Query With VFP
  • Over 27 years as developer, manager, executive.
  • Developing in FoxPro family since 1990.
  • Vice President, Atlanta FoxPro Users Group.
  • MCSD (VFP), MCDBA (SQL 2000).
  • Develop custom extranets, EDI, PDA/eVC++, TabletPC apps.
  • VFP 9, COM+, SQL Server.
  • ASP/DHTML/CSS/JS, PHP/MySQL.
  • Emerging technology (SR, TTS, NLU, RFID) specialists.


  • There are no technical problems, only business problems.
3
Does Your Application Understand You?
  • How cool would it be if you could just TELL (spoken or written) an application the data you needed, and it actually went out and did it?
  • Natural Language Processing (NLP/NLU)
  • Query languages tend to be rigid and difficult to learn.
  • Getting data out of complex schemas or large data sets is tough and expensive. It takes a lot of code to create simple data access processes for non-technical users.
  • The ability to handle ad-hoc requests well is especially difficult to implement for anyone but power users.
  • “The High Cost of What Cannot Be Found”



4
The Agenda
  • Natural language understanding with Microsoft English Query.
  • Discuss and demonstrate a proof-of-concept application for an art museum.
  • Integrating NLU with VFP.
  • Discuss semantic modeling with Microsoft English Query.





5
Microsoft English Query
  • Component of SQL Server 2000
  • Provides the ability for users to query databases using plain English.
  • The closest thing we (developers) have to approximating human-to-human interaction.
  • Applies a semantic model to a data schema.
  • It’s not a set of canned questions and answers.
  • It does understand English in the context of your semantic model.
  • It’s not Google; it provides a direct answer, not a set of matches.
6
Microsoft English Query
  • Google: information regarding snow skiing techniques.
  • Purchase an airline ticket to take me to a ski resort: Use a travel site (or a real person).
  • Performing a search engine lookup on a particular topic is quite different from asking a reservations clerk, for example, “Which flights are available leaving Atlanta and going to Aspen next Wednesday night?” which would result in a discrete, finite answer.


7
Microsoft English Query
  • For natural language understanding to occur, the system must
    • understand the given question;
    • relate it to a stored knowledge base;
    • respond in a useful manner.

  • Natural language processing (NLP) must understand grammar (how words connect and how their definitions relate to one another).


  • In effect, you’re defining a semantic model that describes your data schema.


  • Because of this, you don’t have to know in advance the questions that will be asked; any question within the semantic model can be answered.




8
Microsoft English Query
  • In a museum database, for instance,  artists and artworks are related by primary and foreign keys (RI).
  • In a semantic model, semantic phrasings define entity relationships, e.g., artists “create” artworks.


  • You can then ask “What works were created by Van Gogh?”


  • The question is converted into a SQL query, which is then executed against the data store to return the result(s).


  • SELECT ArtWorkName
  •    FROM ArtWorks
  •    INNER JOIN Artists ON
  •          Artists.ID = ArtWorks.ArtistID AND
  •          Artists.Name LIKE ‘%van gogh%’




9
Microsoft English Query
  • Once you’ve built something like this, the ramifications become clear.


  • This structure can be laid on top of almost any well-defined data schema, enabling a non-sophisticated user (say, a CEO or CFO) to ask simple, direct questions (“What were our profit margins for the past eight quarters?”) without having to make lots of requests of an overworked IT department.


  • This capability can be used instead of building a large number of predefined reports and hoping that they meet user needs.



10
The Application
  • Proof-of-concept for a unique art accessibility application for a museum.
  • PDA-based, RFID-enabled (location-aware)
  • Voice-enabled, speaks the answer.
  • Distributed architecture; PDA is a weak platform, but a very good endpoint and data collector.
  • Speaker-independent.
  • Domain-specific data and semantic model.
11
The Platform Architecture
12
The Application


  • Demo!
13
VFP and English Query
  • loEQ = CREATEOBJECT("MSEQ.Session")
  • loEQ.InitDomain("EQDemo.eqd")


  • lcQuestion   = "Are there any artists that use oil?"
  • loEQResponse = loEQ.ParseRequest(lcQuestion)
  • loEQCmd      = loEQResponse.Commands(0)


  • =SQLEXEC(lnConn, loEQCmd.SQL)
  • BROWSE


  • MSEQ doesn’t actually execute the SQL call; you’ll have to do that separately, using the query it provides for you. It’s up to you what you do with the result set.


  • Demo!
14
Visual FoxPro is Key!
  • VFP is the glue...


  •    “It's the middle-tier, stupid...”
  •    It builds web pages
  •    It handles web-sourced requests
  •    It talks to SQL Server and English Query
  •    It creates spoken responses (TTS)
  •    It does all the heavy-lifting
  •    Expose all of the non-GUI power of VFP to the web
  •    We bow to Rick Strahl and Craig Berntson
15
Semantic Modeling
  • MSEQ-based applications work best and are easiest to create with databases that are as normalized as possible and that maximize the use of primary and foreign keys to fully define inter-table relationships.


16
Microsoft English Query
  • MSEQ provides wizards to automate a lot of the process of creating the semantic models required for English Query. All that’s required is a well-defined data schema, such as our example’s SQL Server data schema, but it can also be used against any OLE DB data source, including OLAP data stores, Oracle databases, VFP tables.


  • Think about the questions that users are likely to ask. What entities are typically involved? Make sure that the semantic model connects these entities together well.




17
Microsoft English Query
  • Create a model using the English Query Project Wizard, which uses the data schema to automatically create entities and relationships based on the tables, columns, primary keys, foreign keys, and joins.


  • Refine the model to accommodate questions that the wizard didn’t handle. Add necessary entities and relationships that the wizard missed. Proceed slowly and make maximum use of the Suggestion Wizard to test possible questions and tune the model.


18
Microsoft English Query
  • Once you’ve developed a model, the MSEQ authoring tool allows you to test it with sample English queries your users might pose. If a test query can’t be handled, the Suggestion Wizard helps you to define the relationship manually, and the question will be properly handled in the future.


  • Once you’ve got everything ready, you can build a portable English Query Domain file that contains the compiled MSEQ model for use by the runtime engine.


  • You could easily define many completely different MSEQ schemes based on different data schemas and have a single program switch among them at runtime.


19
Microsoft English Query
  • 1. Go to Start | Programs | Microsoft SQL Server | English Query | Microsoft English Query. This loads Visual Studio and puts you in the New Project dialog under English Query Projects. Make sure the SQL Project Wizard is highlighted and set the name and location as you wish, then click Open.
  • 2. In the Data Link Properties dialog, define a connection to your database.
  • 3. When the wizard presents a list of all the tables found, select everything and click OK.
  • 4. The next dialog presents the standard set of entities and relationships that the wizard gleaned from the schema. You can take it as is or uncheck the items you don’t want. Click OK.
  • 5. At this point, the basic model has been built and you can now make changes, test, and tune the model before building the final version.
20
Semantic Modeling
  • In English Query, a relationship associates one or more entities with each other and defines how they’re related. This can be accomplished via simple statements about entities (for example, “painters create artworks”) that involve phrasings.


  • Phrasing types include name, adjective, subset, preposition, verb, and trait phrasings.


  • Using different phrasings is a good way to expand a model. A full explanation of phrasing capabilities is beyond the scope of this session, article, but there’s a mind-boggling array of complex relationships that can be built into a model.






21
Microsoft English Query
  • MSEQ stores the model definition in two files: an English Query Module (with an EQM extension) and an English Query Project (with an EQP extension).
  • Both are XML files and can be edited by any text editor. MSEQ uses these files to build the portable English Query Domain (EQD) file that the COM object uses when interfacing with the English Query engine.


22
VFP Overcomes Model Imperfections
  • Use VFP middleware to disambiguate overlapping phrasings:
    • Events happen “in” a time frame.
    • People can be “in” a location, too.


  • Use Full-Text Indexing to disambiguate similar phrasings for multiple data targets:
    • “Which artists were born in Berlin?”
    • “Which artists were born in Germany?”


23
Geez, What’s Next?
  • What could we possibly do with all this?


  • You could write a FoxTalk article, for one thing
  • Hands-free, eyes-free applications on thin client devices
  • Simplified navigation of complex information on thin devices
  • Reduces application training costs
  • Improved accessibility to information
  • If you have an MSDN subscription, you can do this


  • You're looking at the future of almost all applications...
  • ...and the end of many UI approaches as we know them


  • You can do it with VFP!


  • The opportunity is HUGE!
24
The End
  • Thanks!


  • Dave Bernard
  • The Intellection Group, Inc.
  • http://www.IntellectionGroup.com
  • dbernard@IntellectionGroup.com


  • http://www.IntellectionGroup.com/SpeechWhitePaper.asp
  • http://www.IntellectionGroup.com/SBIR/SBIR%20AF05-061.ASP