Tài liệu Module 8: Using XQuery to Link and Query XML Documents - Pdf 84



Contents
Overview 1
Lesson: What Is XQuery? 2
Lesson: Using XQuery 11
Lab 8: Using Simple and Advanced
XQuery Expressions 17
Review 22
Course Evaluation 23

Module 8: Using
XQuery to Link and
Query XML Documents
Information in this document, including URL and other Internet Web site references, is subject to
change without notice. Unless otherwise noted, the example companies, organizations, products,
domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious,
and no association with any real company, organization, product, domain name, e-mail address,
logo, person, places or events is intended or should be inferred. Complying with all applicable
copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part
of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted
in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or

possible to devote a full five-day course to XQuery after it is fully specified and
achieves W3C Recommendation status.
Stress that XQuery is still in development by the World Wide Web Consortium
(W3C) and is not yet finalized. Participants may ask why the module is
included, considering the state of development of XQuery. It is included,
because XQuery is expected to be a W3C Recommendation by the end of 2001
and heavily used in the Internet and environments like Microsoft
®
.NET when it
is a stable Recommendation.
XQuery is important, because to effectively do data-centric work on the
Internet, you need to have XQuery or its equivalent. Without such a language
and set of capabilities, the use of XML is severely limited. Because XML is
fundamentally about representing data and metadata, XQuery is essential.
After completing this module, participants will be able to:
!
Understand the key concepts behind XQuery.
!
Design simple and advanced XQuery expressions.
!
Identify solutions where XQuery is the suitable technology.
!
Describe how you might apply XQuery expressions to query an XML
document.
!
Relate XQuery to the broader Microsoft .NET Framework and strategy.

Presentation:
50 Minutes


changes. It is best to review it before each class.
!
Review as many XQuery use cases as you can to consolidate your
understanding of XQuery.
!
Work out additional examples of where XQuery can be used in your
location and with your clients.

Required Materials
Preparation Tasks
Module 8: Using XQuery to Link and Query XML Documents v Instructor Setup for the Lab
For this lab, the instructor computer and all student computers must be
connected to the Internet. The lab enables participants to use the MSDN
XQuery demonstration site to gain more familiarity with the capabilities of
XQuery. Become thoroughly familiar with the demonstration site and be
prepared to answer questions.
!
Prepare for the lab
1. Download and review the data files from the XQuery demonstration site.
These are for ease of reference only.
2. Review the lab steps and be prepared to explain the XQuery syntax if
required. Participants are likely to find some of the queries, particularly the
advanced queries, somewhat confusing.

Demonstration
There are only two demonstrations in this module. The first demonstration
gives a quick example of how easy it is to do an SQL query with a good

SQL and Access
vi Module 8: Using XQuery to Link and Query XML Documents 3. (Optional) If you have time, repeat the demonstration, this time using
Access.
a. Using Access, open the pubs.mdb file located in the install_folder\
Democode\Mod08 folder.
b. Maximize the Access window and the database container window.
c. In the database objects list, click Tables and then click the publishers
table.
d. On the toolbar, click New Object, and then click Query.
e. Choose Design View from the list.
f. On the toolbar, click Show Table to add the titles, titleauthor, and
authors tables.
The tables show the relationship links that have been defined between
the primary and foreign keys.
g. Drag the pub_name, title, price, au_lname, and au_fname columns
from the tables into the first row of the query grid, and then click the
Run icon.
h. Show that you get the same results as you did when you used
SQL Server.
i. Switch back to Design view, and in the criteria cell for pub_name, type
New Moon Books.
j. Rerun the query.
k. Now select the SQL View of the query, and then compare it with the
SQL query.

The second demonstration introduces the participants to the MSDN XQuery
language demonstration site so that they will not have to spend much time

this module:
!
What Is XQuery?
This lesson is built around a number of questions that almost anyone who
approaches XQuery will have.
Move through the topics at a comfortable pace and stop to discuss questions
that the participants may have. Be prepared to work through the examples
and the concepts as needed.
Stress that XQuery is incomplete, as long as that remains true. When
XQuery reaches W3C Recommendation status, you will need to adjust the
presentation of the module if the course is not revised. Be sure to explain
FLWR expressions. These will be seen in the examples in the second lesson
and in the lab.
Work through each of the topic slides and discuss the central concepts and
associated ideas. The class may want to discuss some topics in more depth.
Keep an eye on the time.
Be sure that you are comfortable with the complexities of the XQuery
examples. The best way to prepare for this is to read the W3C papers
carefully and to spend adequate time with the XQuery demonstration site to
get a good idea of how these queries look and behave.
!
Using XQuery
This lesson is designed to focus attention on examples of XQuery syntax,
which you can work through in detail with the class.
Be ready to expand upon these examples with what you learned from the
W3C documents and the XQuery demonstration site. Focus on the basics
and try not to discuss the very advanced features of XQuery, because they
will likely be too difficult for newcomers to the topic.
Discuss the similarities and differences between SQL queries and XML
queries. Emphasize the differences between SQL and XML in their ability

Understand the key concepts behind XQuery.
!
Design simple and advanced XQuery expressions.
!
Identify solutions where XQuery is the suitable technology.
!
Describe how you might apply XQuery expressions to query an
XML document.
!
Relate XQuery to the broader Microsoft
®
.NET Framework and strategy.

Introduction
Ob
jectives
2 Module 8: Using XQuery to Link and Query XML Documents Lesson: What Is XQuery?
!
Why Do You Need XQuery?
!
XQuery Expression Basics
!
XQuery and SQL

*****************************
ILLEGAL FOR NON
-

!
Simultaneously query XML
sources and relational data
!
Run complex queries
XML Example XQuery Expression SQL Query

*****************************
ILLEGAL FOR NON
-
TRAINER USE
******************************
Every day more data is made available formatted in XML. Still much of the
world’s data is stored in relational databases. There is a need for an efficient
query language that can extend a query across a variety of XML sources and to
relational data sources. The World Wide Web Consortium (W3C) has been
working on a specification to address this need. The specification that has
emerged has sometimes been called XML Query but is more commonly known
simply as XQuery.

For more information about XML Query, see the XML Query page at XPath is inadequate to extend queries across multiple XML sources. You
cannot use XPath to query relational data. You can only use XPath to and this
has helped to drive the efforts to find a better query language. As XQuery is
developed, both the XPath and Extensible Stylesheet Language (XSL) working
groups are engaged in revisions to their respective technologies to take account
of the power and functionality of XQuery.
As currently conceived by W3C, XQuery will ultimately be able to work across

particular value.
!
List all parts produced by a manufacturer and then group them by category
inside an output element.
!
Find all parts of the same type produced by Manufacturer A and
Manufacturer B and then produce a combined listing.

The development of XQuery will lead to the enhancement of the XPath
language after the working groups finish their work on XPath 2.0. According to
W3C, XQuery must be able to handle the following:
!
Data and data types
!
Projection
!
Iteration
!
Selection
!
Quantification
!
Joins
!
Restructuring and grouping
!
Querying order
!
Sorting
!


Nhờ tải bản gốc

Tài liệu, ebook tham khảo khác

Music ♫

Copyright: Tài liệu đại học © DMCA.com Protection Status