<!-- <!DOCTYPE spec SYSTEM "../schema/xsl-query.dtd" [ --><!-- <?xml-stylesheet type="text/xsl" href="http://lists.w3.org/Archives/Member/w3c-archive/2004Mar/att-0025/full-text.xsl"?> --><!-- <?xml-stylesheet type="text/xsl" href="full-text.xsl"?>--><!--  <?xml-stylesheet type="text/xsl" href="http://www.w3.org/TR/2003/WD-xmlquery-full-text-use-cases-20030214/full-text.xsl"?> --><?xml-stylesheet type="text/xsl" href="http://www.w3.org/XML/Group/xsl-query-specs/style/full-text.xsl"?><spec w3c-doctype="wd">
<header>
<title>XQuery 1.0 and XPath 2.0 Full-Text Use Cases</title>
<version/>
<w3c-designation>WD-xmlquery-full-text-use-cases-20060501</w3c-designation>
<w3c-doctype>W3C Working Draft</w3c-doctype>
<pubdate>
<day>1</day>
<month>May</month>
<year>2006</year>
</pubdate>
<publoc>
<loc xmlns:xlink="http://www.w3.org/1999/xlink" href="http://www.w3.org/TR/2006/WD-xmlquery-full-text-use-cases-20060501/" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">http://www.w3.org/TR/2006/WD-xmlquery-full-text-use-cases-20060501/</loc>
</publoc>
<altlocs>
  <loc xmlns:xlink="http://www.w3.org/1999/xlink" href="http://www.w3.org/TR/2006/WD-xmlquery-full-text-use-cases-20060501/full-text-use-cases.xml" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">XML</loc>
</altlocs>
<latestloc>
<loc xmlns:xlink="http://www.w3.org/1999/xlink" href="http://www.w3.org/TR/xmlquery-full-text-use-cases/" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">http://www.w3.org/TR/xmlquery-full-text-use-cases/</loc>
</latestloc>
<prevlocs>
<loc xmlns:xlink="http://www.w3.org/1999/xlink" href="http://www.w3.org/TR/2005/WD-xmlquery-full-text-use-cases-20051103/" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest"/>
<loc xmlns:xlink="http://www.w3.org/1999/xlink" href="http://www.w3.org/TR/2005/WD-xmlquery-full-text-use-cases-20050915/" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest"/>
<loc xmlns:xlink="http://www.w3.org/1999/xlink" href="http://www.w3.org/TR/2005/WD-xmlquery-full-text-use-cases-20050404/" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest"/>
<loc xmlns:xlink="http://www.w3.org/1999/xlink" href="http://www.w3.org/TR/2004/WD-xmlquery-full-text-use-cases-20040709/" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest"/>
<loc xmlns:xlink="http://www.w3.org/1999/xlink" href="http://www.w3.org/TR/2003/WD-xmlquery-full-text-use-cases-20030214/" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest"/>
</prevlocs>
<authlist>
<author>
<name>Sihem Amer-Yahia</name>
<affiliation>AT&amp;T Labs - Research</affiliation>
<email xmlns:xlink="http://www.w3.org/1999/xlink" href="mailto:sihem@research.att.com" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">sihem@research.att.com</email>
</author>
<author>
<name>Pat Case</name>
<affiliation>Library of Congress</affiliation>
<email xmlns:xlink="http://www.w3.org/1999/xlink" href="mailto:pcase@crs.loc.gov" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">pcase@crs.loc.gov</email>
</author>
</authlist>
<status>
<p>
<emph>This section describes the status of this document at the
time of its publication. Other documents may supersede this document.
A list of current W3C publications and the latest revision of this
technical report can be found in the <loc xmlns:xlink="http://www.w3.org/1999/xlink" href="http://www.w3.org/TR/" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">W3C technical reports index</loc> at http://www.w3.org/TR/.</emph>
</p>

<p>This is a public W3C Working Draft for review by W3C Members and other interested parties. Publication as a Working Draft does not imply endorsement by the
W3C Membership. This is a draft document and may be updated, replaced
or obsoleted by other documents at any time. It is inappropriate to
cite this document as other than work in progress.</p>

<p>This is the sixth version of this document. Three new use cases have been added: 1) a query calling a stop word list but excluding a word from the list,  2) a query with a weight declaration, and 3) a query with an embedded XQuery expression. Use Case 14.2.4 Q4 Distance Query Ignoring Content of Descendant Elements Level by Level has been revised. Other small corrections were made. See Appendix D <bibref ref="ChangeLog"/> for more information. </p>

<p>This document has been produced following the procedures set out for the W3C Process. 
This document was produced through the joint efforts of the W3C <loc xmlns:xlink="http://www.w3.org/1999/xlink" href="http://www.w3.org/XML/Query.html" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">XML Query Working Group</loc>
and the <loc xmlns:xlink="http://www.w3.org/1999/xlink" href="http://www.w3.org/Style/XSL/" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">XSL Working Group</loc>
(both parts of the <loc xmlns:xlink="http://www.w3.org/1999/xlink" href="http://www.w3.org/XML/Activity.html" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">XML Activity</loc>). 
It is designed to be read in conjunction with the following documents: 
W3C XQuery and XPath Full-Text Requirements <bibref ref="xquery-full-text-requirements"/>
and the W3C XQuery 1.0 and XPath 2.0 Full-Text <bibref ref="xquery-full-text"/>.</p>

<p>Public comments on this document and its open issues are invited.
Comments should be entered into the
<loc xmlns:xlink="http://www.w3.org/1999/xlink" href="http://www.w3.org/Bugs/Public/buglist.cgi?query_format=advanced&amp;product=XPath+%2F+XQuery+%2F+XSLT&amp;component=FT+Use+Cases&amp;component=Full+Text&amp;bug_status=NEW&amp;bug_status=ASSIGNED&amp;bug_status=REOPENED&amp;bugidtype=include&amp;cmdtype=doit&amp;order=Reuse+same+sort+as+last+time" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">issue tracking system</loc>
for this specification (instructions can be found at <loc xmlns:xlink="http://www.w3.org/1999/xlink" href="http://www.w3.org/XML/2005/04/qt-bugzilla" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">http://www.w3.org/XML/2005/04/qt-bugzilla</loc>).
If access to that system is not feasible, you may send your comments to the W3C mailing list,
<loc xmlns:xlink="http://www.w3.org/1999/xlink" href="mailto:public-qt-comments@w3.org" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">public-qt-comments@w3.org</loc>
(archived at
<loc xmlns:xlink="http://www.w3.org/1999/xlink" href="http://lists.w3.org/Archives/Public/public-qt-comments/" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">http://lists.w3.org/Archives/Public/public-qt-comments/</loc>). Please start
the subject line with “[FTUseCases]” so comments can be classified correctly.</p>

<p>This document was produced by a group operating under the <loc xmlns:xlink="http://www.w3.org/1999/xlink" href="http://www.w3.org/Consortium/Patent-Policy-20040205/" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">5 February 2004 W3C Patent Policy</loc>. W3C maintains a <loc xmlns:xlink="http://www.w3.org/1999/xlink" role="disclosure" href="http://www.w3.org/2002/08/xmlquery-IPR-statements" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">public list of any patent disclosures</loc> made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains <loc xmlns:xlink="http://www.w3.org/1999/xlink" href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">Essential Claim(s)</loc> must disclose the information in accordance with <loc xmlns:xlink="http://www.w3.org/1999/xlink" href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">section 6 of the W3C Patent Policy</loc>.</p>
</status>
<abstract>
<p>This document specifies usage scenarios for full-text
queries as part of XML Query  <bibref ref="xquery"/> and XPath 
<bibref ref="xpath20"/>. </p>
</abstract>
<langusage>
<language id="EN">English</language>
</langusage>
<revisiondesc>
<p/>
</revisiondesc>
</header>
<body>
<div1 id="FT_UC_Prelim">
<head>Full-Text Use Cases: Preliminaries</head>
<div2 id="FT_UC_Display">
<head>Proper Display of this Unicode Document</head>
<p>(1) Use a current operating system and browser.</p>
<p>(2) If necessary, set the character encoding in the browser manually to Unicode or UTF-8. Often this setting may be changed from the View menu.</p>
<p>(3) If after setting the character encoding to Unicode, the Chinese characters in the subject elements of the sample data still do not display, it is likely that the browser cannot locate a font that contains Chinese characters in Unicode encoding. It might be necessary to add a Unicode font, preferably Arial Unicode MS.</p>
</div2>
<div2 id="FT_UC_Intro">
<head>Introduction</head>
<p>The use cases listed below were created by the
<loc xmlns:xlink="http://www.w3.org/1999/xlink" href="http://www.w3.org/XML/Query/" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">XML Query Working Group</loc> and
the <loc xmlns:xlink="http://www.w3.org/1999/xlink" href="http://www.w3.org/Style/XSL/" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">XSL Working Group</loc> to
illustrate important applications of full-text
querying within an XML query language. Each use case exercises a specific functionality relevant to full-text querying. An XML Schema and sample input data 
are provided. Each use case specifies a query applied to the input data, a solution in XQuery, a solution in XPath (when possible), and the expected results.</p>
<p>The document supplements the XML Query Use Cases which can be found in the W3C
XML Query Use Cases <bibref ref="xquery-use-cases"/>. Use cases for character string querying are included in the XML Query Use Cases, not in this document.</p>
<p>The full-text queries in the following use cases are performed on text
which has been tokenized, i.e., broken into a sequence of words,
units of punctuation, and spaces.</p>
<p>A word is defined as any character, n-gram, or sequence of characters
returned by a tokenizer as a basic unit to be queried. Each instance of a word consists of zero or more
consecutive characters. Beyond that words are implementation-defined. Note that consecutive words need not be separated by either
punctuation or space, and words may overlap. A phrase is an ordered list of words. A phrase may contain any number of words.</p>
<p>Tokenization enables functions and operators which work with the relative positioning of words (e.g., proximity operators). 
Tokenization also enables functions and operators which operate on a part or the root of the word (e.g., wildcards, stemming).</p>
<p>These use cases:</p>
<p>(1) Present some possible functions and features for tokenized text support in XQuery and XPath. None are yet available in 
XQuery or XPath. Please comment on these use cases and recommend others.</p>
<p>(2) Illustrate simple and complex queries. The more complex queries would normally only be constructed by programmers, librarians, and other expert users.  
Sometimes they may be provided for novice users via saved queries and graphical user interfaces.  Each query illustrates a single functionality. Queries may overlap in their functionalities (e.g., phrases and ordered distance queries allowing no intervening words). Overlapping and similar functionalities are noted in 
the comments on query behavior.</p>
<p>(3) Draw from sample data which are almost entirely in English. Use cases in other languages are solicited, especially where they 
illustrate language-specific implementations of functions and features. Among the most sought after are use cases for queries 
using prefix and infix wild cards, proximity queries, and operators and queries requiring functionality which may not have Western language equivalents.</p>
<p>(4) Include queries which in most instances can be written with pure Boolean full-text predicates or 
with scoring (e.g., scoring on the number of occurrences of a word or phrase,
scoring on how close words are to one another within a distance
query, scoring on how similar a word is to the one being
stemmed) <bibref ref="BYR99"/>
<bibref ref="HTK00"/>. A few, those in Section 17 (SCORE), cannot be written with Boolean full-text predicates. Scoring methodologies will not be defined in this recommendation. Scoring will be 
implementation-defined. Results are provided in document order, except those in Section 17 (SCORE). 
Results could be returned ordered differently, such as by relevance (based on 
implementation-defined scoring) or explicitly by element.</p>
<p>(5) Query element content. See Section 4 (OTHER) for explicit queries on attribute values.</p>
<p>(6) Include queries which are case-insensitive. When
returning a paragraph, the text is returned as it occurs in the data model. This approach was chosen to keep the sample data short and the expected 
results meaningful. It would have been equally valid to return only the character queried. A case-sensitive query is found in Section 9 (CHARACTER). </p>
<p>(7) Include queries which when they target XML elements are understood,
unless otherwise stated, to query text within any text node descendant of the element.</p>
<p>(8) Include queries which return only elements and attributes which meet all the conditions specified in the query. In particular, pure Boolean full-text predicate queries return results 
where the Boolean conditions in the query are satisfied, i.e., are used to select what is being returned to users.</p>
<p>Query results may be returned in different ways. From a query for books containing the word "usability", users might be interested in returning, for each
book containing the word "usability", its number and its entire content. In another situation for the same query, users might be interested in
returning, for each book containing the word "usability", its number and only the elements and attributes in the content which contain the word "usability". As in this second situation, the queries in
these use cases return only elements and attributes which meet all the conditions specified in the query.</p>
<p>The Return clause may also include additional or different elements and attributes if specified, and may construct new elements. </p>
<p>(9) Include queries which provide some of the basic functionality of fuzzy match querying  (e.g., wildcards, stemming, thesaurus support, proximity).</p>
<p>(10) Provide highlighting of found words and phrases in the expected results of queries as an aid to users. 
The presence of highlighting says nothing about whether highlighting will be a 	feature of XQuery or XPath full-text querying.</p>
<p>(11) Display query solutions in XQuery and when possible in XPath. Queries that may not be written in XPath include those that contain element constructors and that cannot be written without let and order by clauses.</p>
<!---Several implementors have asked that we make the
            queries from these use cases available in a separate file
            to make it easier for them to test their parsers.  These
            queries may be found in <bibref ref="XQueryFullTextUseCaseQueries"/> and <bibref ref="XPathFullTextUseCaseQueries"/>. Also, the queries from the XQuery
            specification itself have been made available in <bibref ref="XQueryFullTextQueries"/>.-->
<p>Examples of full-text querying functionalities for XML query languages
can be found in <bibref ref="FGR01"/>, <bibref ref="HTK00"/>,
<bibref ref="MJK98"/>, <bibref ref="SCH01"/> and <bibref ref="TWE00"/>.</p>
<p>To make the output more readable, the output of queries has been 
formatted using white space which may not be returned by a query 
processor. This white space should not be considered normative 
for the correctness of results.</p>
<p>These use cases represent a snapshot of an ongoing work. Some
important operators and features are not yet adequately covered by a
use case. The XML Query and XSL Working Groups reserve the right to
add, delete, or modify individual queries or whole use cases as the
work progresses. The presence of a query in this set of use cases does
not necessarily indicate that the query will be expressible in XQuery
 <bibref ref="xquery"/> and/or XPath  <bibref ref="xpath20"/>
to be created by the XML Query and XSL Working Groups.</p>
</div2>
<div2 id="FT_UC_Presentation">
<head>Presentation of Use Cases</head>
<p>The queries in these use cases are presented in the following format:</p>
<p>Query number   Query title</p>
<p>User statement of query</p>
<p>Statement of functionality illustrated by query</p>
<ulist>
<item>
<p>Operands: Parts of words, words, phrases</p>
</item>
<item>
<p>Functionality: Operators, functions, collations, other functionality</p>
</item>
<item>
<p>Data context: One XPath expression locating the data being queried.</p>
</item>
<item>
<p>Query context: One or more XPath expressions locating the elements and attributes to be queried. The context of elements and attributes used in the Query context is relative to the Data context defined above.</p>
</item>
<item>
<p>Return: One or more XPath expressions which are returned only if the conditions specified in the query are met. Returned elements or attributes may differ from those specified in the Query context. Newly constructed elements might be returned. As in the Query context, the context of elements and attributes in Return statements is relative to the Data context defined above.</p>
</item>
<item>
<p>Comments: Comments on query behavior in general, and against the sample data in particular, plus the rationale for including 
				this query in the use cases.</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg xml:space="preserve">Solutions illustrating XQuery Full-Text syntax  
appear here. All queries may be written in XQuery.

Solutions are written with pure Boolean full-text predicates 
and not to invoke scoring, except for those in Section 17 (SCORE), 
however all the queries in the document may be written as scored 
queries with the addition of a score variable.

All queries are written assuming the default function namespace, 
without the fn: prefix.</eg>

<p>
<emph>Solution in XPath:</emph>
</p>
<eg xml:space="preserve">Solutions illustrating XPath Full-Text syntax appear 
(when the query may be written in XPath) here.

Solutions are written with pure Boolean full-text predicates 
and not to invoke scoring, except for those in Section 17 (SCORE), 
however most of the queries in the document may be written as 
scored queries with the addition of a score variable.

All queries are written assuming the default function namespace, 
without the fn: prefix.</eg>

<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">Results are provided here.
				
Found words and phrases are <phrase role="found">highlighted</phrase>. 
				
For brevity, only the elements and attributes which meet 
the conditions specified in the query are displayed. Others are
replaced with ...s.

Results are provided in document order, except those 
in Section 17 (SCORE)</eg>

<p>See Issue 1 <bibref ref="staticErrorTesting"/>: The queries in the Full-Text Use Cases have not yet been tested to ensure they do not cause static errors, such as cardinality errors.</p>
</div2>
<div2 id="FT_UC_Schema">
<head>Schema for Sample Data</head>
<p>The example queries in these use cases are based on a
                collection with the following XML Schema:</p>
<eg role="schema" xml:space="preserve">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
version="1.0"&gt;
&lt;xs:import namespace="http://www.w3.org/XML/1998/namespace" 
schemaLocation = "http://www.w3.org/2001/xml.xsd"/&gt;
   &lt;xs:element name="books"&gt;
      &lt;xs:annotation&gt;
         &lt;xs:documentation&gt;A possible XML Schema for Sample Data 
         in XQuery and XPath Full-Text Use Cases
         &lt;/xs:documentation&gt;
      &lt;/xs:annotation&gt;
      &lt;xs:complexType&gt;
         &lt;xs:sequence maxOccurs="unbounded"&gt;
            &lt;xs:element name="book"&gt;
               &lt;xs:complexType&gt;
                  &lt;xs:sequence&gt;
                     &lt;xs:element name="metadata" 
                     type="metadataType"/&gt;
                     &lt;xs:element name="content" 
                     type="contentType"/&gt;
                  &lt;/xs:sequence&gt;
                  &lt;xs:attribute name="number" type="xs:integer"/&gt;
               &lt;/xs:complexType&gt;
            &lt;/xs:element&gt;
         &lt;/xs:sequence&gt;
      &lt;/xs:complexType&gt;
   &lt;/xs:element&gt;
   &lt;xs:complexType name="anyXMLTextType" mixed="true"&gt;
      &lt;xs:annotation&gt;
         &lt;xs:documentation&gt;free text, contains any well-formed 
         XML&lt;/xs:documentation&gt;
      &lt;/xs:annotation&gt;
      &lt;xs:sequence&gt;
         &lt;xs:any processContents="skip" minOccurs="0" 
         maxOccurs="unbounded"/&gt;
      &lt;/xs:sequence&gt;
   &lt;/xs:complexType&gt;
   &lt;xs:complexType name="metadataType"&gt;
      &lt;xs:sequence&gt;
         &lt;xs:element name="title"&gt;
            &lt;xs:complexType&gt;
               &lt;xs:simpleContent&gt;
                  &lt;xs:extension base="xs:string"&gt;
                     &lt;xs:attribute name="shortTitle" 
                     type="xs:string"/&gt;
                  &lt;/xs:extension&gt;
               &lt;/xs:simpleContent&gt;
            &lt;/xs:complexType&gt;
         &lt;/xs:element&gt;
         &lt;xs:element name="author" type="xs:string" 
         minOccurs="0" 
         maxOccurs="unbounded"/&gt;
         &lt;xs:element name="publicationInfo" 
         type="publicationInfoType"/&gt;
         &lt;xs:element name="price" minOccurs="0"&gt;
            &lt;xs:simpleType&gt;
               &lt;xs:restriction base="xs:float"&gt;
                  &lt;xs:minInclusive value="0"/&gt;
                  &lt;xs:maxInclusive value="10000"/&gt;
               &lt;/xs:restriction&gt;
            &lt;/xs:simpleType&gt;
         &lt;/xs:element&gt;
         &lt;xs:element name="subjects" 
         maxOccurs="unbounded"&gt;
            &lt;xs:sequence&gt;
               &lt;xs:element name="subject" type="xs:string" 
               maxOccurs="unbounded"/&gt;
            &lt;/xs:sequence&gt;
               &lt;xs:attribute ref="xml:lang"/&gt;
         &lt;/xs:element&gt;
      &lt;/xs:sequence&gt;
   &lt;/xs:complexType&gt;
   &lt;xs:complexType name="publicationInfoType"&gt;
      &lt;xs:sequence&gt;
         &lt;xs:element name="place" type="xs:string" 
         minOccurs="0"/&gt;
         &lt;xs:element name="publisher" type="xs:string" 
         maxOccurs="unbounded"/&gt;
         &lt;xs:element name="dateIssued" type="xs:string"/&gt;
         &lt;xs:element name="dateRevised" type="xs:string"/&gt;
      &lt;/xs:sequence&gt;
   &lt;/xs:complexType&gt;
   &lt;xs:complexType name="contentType"&gt;
      &lt;xs:sequence&gt;
         &lt;xs:element name="introduction" 
         type="introductionType" 
         minOccurs="0"/&gt;
         &lt;xs:element name="part" type="partType" 
         maxOccurs="unbounded"/&gt;
      &lt;/xs:sequence&gt;
   &lt;/xs:complexType&gt;
   &lt;xs:complexType name="introductionType"&gt;
      &lt;xs:sequence&gt;
         &lt;xs:element name="author" type="xs:string" 
         minOccurs="0"/&gt;
         &lt;xs:element name="p" maxOccurs="unbounded"&gt;
            &lt;xs:complexType mixed="true"&gt;
               &lt;xs:choice minOccurs="0" 
               maxOccurs="unbounded"&gt;
                  &lt;xs:element name="b"/&gt;
                  &lt;xs:element name="emph"/&gt;
                  &lt;xs:element name="i"/&gt;
               &lt;/xs:choice&gt;
            &lt;/xs:complexType&gt;
         &lt;/xs:element&gt;
      &lt;/xs:sequence&gt;
   &lt;/xs:complexType&gt;
   &lt;xs:complexType name="partType"&gt;
      &lt;xs:sequence&gt;
         &lt;xs:element name="container" type="xs:string" 
         minOccurs="0"&gt;
             &lt;xs:complexType&gt;
               &lt;xs:simpleContent&gt;
                  &lt;xs:extension base="xs:string"&gt;
                     &lt;xs:attribute name="type" type="xs:string"/&gt;
                  &lt;/xs:extension&gt;
               &lt;/xs:simpleContent&gt;
            &lt;/xs:complexType&gt;
         &lt;/xs:element&gt;
         &lt;xs:element name="title" type="titleType" 
         minOccurs="0"/&gt;
         &lt;xs:element name="introduction" 
         type="introductionType" 
         minOccurs="0"/&gt;
         &lt;xs:element name="chapter" type="chapterType" 
         minOccurs="0" maxOccurs="unbounded"/&gt;
         &lt;xs:element name="component" 
         type="componentType" 
         minOccurs="0" maxOccurs="unbounded"/&gt;
      &lt;/xs:sequence&gt;
      &lt;xs:attribute name="number" type="xs:string"/&gt;
   &lt;/xs:complexType&gt;
   &lt;xs:complexType name="chapterType"&gt;
      &lt;xs:sequence&gt;
         &lt;xs:element name="title" type="xs:string"/&gt;
         &lt;xs:element name="p" type="anyXMLTextType" 
         maxOccurs="unbounded"/&gt;
      &lt;/xs:sequence&gt;
   &lt;/xs:complexType&gt;
   &lt;xs:complexType name="footnoteType" mixed="true"&gt;
      &lt;xs:sequence&gt;
         &lt;xs:element name="citation" type="xs:string"
         minOccurs="0" maxOccurs="unbounded"&gt;
            &lt;xs:complexType&gt;
               &lt;xs:simpleContent&gt;
                  &lt;xs:extension base="xs:string"&gt;
                     &lt;xs:attribute name="url" type="xs:anyURI"/&gt;
                  &lt;/xs:extension&gt;
               &lt;/xs:simpleContent&gt;
            &lt;/xs:complexType&gt;
         &lt;/xs:element&gt;
      &lt;/xs:sequence&gt;
   &lt;/xs:complexType&gt;
   &lt;xs:complexType name="componentType"&gt;
      &lt;xs:sequence&gt;
         &lt;xs:element name="container" type="xs:string" 
         minOccurs="0"&gt;
            &lt;xs:complexType&gt;
               &lt;xs:simpleContent&gt;
                  &lt;xs:extension base="xs:string"&gt;
                     &lt;xs:attribute name="type" type="xs:string"/&gt;
                  &lt;/xs:extension&gt;
               &lt;/xs:simpleContent&gt;
            &lt;/xs:complexType&gt;
         &lt;/xs:element&gt;
         &lt;xs:element name="componentTitle" 
         type="componentTitleType"/&gt;
         &lt;xs:element name="subComponent" 
         type="subComponentType" 
         minOccurs="0" maxOccurs="unbounded"/&gt;
      &lt;/xs:sequence&gt;
   &lt;/xs:complexType&gt;
   &lt;xs:complexType name="titleType" mixed="true"&gt;
      &lt;xs:all minOccurs="0"&gt;
         &lt;xs:element name="date" type="xs:string"&gt;
            &lt;xs:complexType&gt;
               &lt;xs:simpleContent&gt;
                  &lt;xs:extension base="xs:string"&gt;
                     &lt;xs:attribute name="normalize" 
                     type="xs:string"/&gt;
                  &lt;/xs:extension&gt;
               &lt;/xs:simpleContent&gt;
            &lt;/xs:complexType&gt;
         &lt;/xs:element&gt;
      &lt;/xs:all&gt;
   &lt;/xs:complexType&gt;
   &lt;xs:complexType name="componentTitleType" 
   mixed="true"&gt;
      &lt;xs:sequence&gt;
         &lt;xs:element name="componentDate" 
         type="xs:string" 
        minOccurs="0"&gt;
            &lt;xs:complexType&gt;
               &lt;xs:simpleContent&gt;
                  &lt;xs:extension base="xs:string"&gt;
                     &lt;xs:attribute name="normalize" 
                     type="xs:string"
                      use="optional"/&gt;
                  &lt;/xs:extension&gt;
               &lt;/xs:simpleContent&gt;
            &lt;/xs:complexType&gt; 
         &lt;/xs:element&gt;
      &lt;/xs:sequence&gt;
   &lt;/xs:complexType&gt;
   &lt;xs:complexType name="subComponentType"&gt;
      &lt;xs:sequence&gt;
         &lt;xs:element name="container" type="xs:string" 
         minOccurs="0"&gt;
            &lt;xs:complexType&gt;
               &lt;xs:simpleContent&gt;
                  &lt;xs:extension base="xs:string"&gt;
                     &lt;xs:attribute name="type" type="xs:string"/&gt;
                  &lt;/xs:extension&gt;
               &lt;/xs:simpleContent&gt;
            &lt;/xs:complexType&gt; 
        &lt;/xs:element&gt;
        &lt;xs:element type="componentTitleType"/&gt;
        &lt;xs:element name="subsubComponent" 
        type="subSubComponentType" 
        minOccurs="0" maxOccurs="unbounded"/&gt;
      &lt;/xs:sequence&gt;
   &lt;/xs:complexType&gt;
   &lt;xs:complexType name="subSubComponentType"&gt;
      &lt;xs:sequence&gt;
         &lt;xs:element name="container" type="xs:string" 
         minOccurs="0"&gt;
           &lt;xs:complexType&gt;
              &lt;xs:simpleContent&gt;
                 &lt;xs:extension base="xs:string"&gt;
                    &lt;xs:attribute name="type" type="xs:string"/&gt;
                 &lt;/xs:extension&gt;
              &lt;/xs:simpleContent&gt;
           &lt;/xs:complexType&gt; 
        &lt;/xs:element&gt;
        &lt;xs:element name="componentTitle" 
        type="componentTitleType"/&gt;
      &lt;/xs:sequence&gt;
   &lt;/xs:complexType&gt;
&lt;/xs:schema&gt;</eg>
</div2>
<div2 id="FT_UC_SampleData">
<head>Sample Data</head>
<p>The data consists of a collection of three books. Two are primarily instructive text. The third is a guide to a manuscript collection. All 
contain metadata and full text.</p>
<p>The sample data binds to this URL: "http://bstore1.example.com/full-text.html".</p>
<eg role="sample" xml:space="preserve">&lt;books&gt;
&lt;book number="1"&gt;
   &lt;metadata&gt;
      &lt;title shortTitle="Improving Web Site Usability"&gt;Improving 
      the Usability of a Web Site Through Expert Reviews and 
      Usability Testing&lt;/title&gt;
      &lt;author&gt;Millicent Marigold&lt;/author&gt;
      &lt;author&gt;Montana Marigold&lt;/author&gt;
      &lt;publicationInfo&gt;
         &lt;place&gt;New York&lt;/place&gt;
         &lt;publisher&gt;Ersatz Publications&lt;/publisher&gt;
         &lt;dateIssued&gt;2001&lt;/dateIssued&gt;
         &lt;dateRevised&gt;2002&lt;/dateRevised&gt;
      &lt;/publicationInfo&gt;
      &lt;price&gt;25.99&lt;/price&gt;   
      &lt;subjects xml:lang="en"&gt;
         &lt;subject&gt;Usability testing&lt;/subject&gt;
         &lt;subject&gt;Web site development&lt;/subject&gt;        
         &lt;subject&gt;Heuristic evaluation&lt;/subject&gt;
         &lt;subject&gt;Cognitive walk-through&lt;/subject&gt;
         &lt;subject&gt;Web site usability&lt;/subject&gt;
      &lt;/subjects&gt;
      &lt;subjects xml:lang="fr"&gt;        
         &lt;subject&gt;Tests d'ergonomie&lt;/subject&gt;
         &lt;subject&gt;Développement de site web&lt;/subject&gt;        
         &lt;subject&gt;Évaluation heuristique&lt;/subject&gt;
         &lt;subject&gt;Parcours cognitif&lt;/subject&gt;
         &lt;subject&gt;Ergonomie de site web&lt;/subject&gt;     
      &lt;/subjects&gt;
      &lt;subjects xml:lang="zh"&gt;    
         &lt;subject&gt;可用性测试&lt;/subject&gt;
         &lt;subject&gt;网站建置&lt;/subject&gt;        
         &lt;subject&gt;启发式评价&lt;/subject&gt;
         &lt;subject&gt;认知推演&lt;/subject&gt;
         &lt;subject&gt;网站可用性&lt;/subject&gt;
      &lt;/subjects&gt;
   &lt;/metadata&gt;
   &lt;content&gt;
      &lt;introduction&gt;
         &lt;author&gt;Elina Rose&lt;/author&gt;
         &lt;p&gt;The usability of a Web site is how well the 
         site supports the user in achieving specified 
         goals. A Web site should facilitate learning, 
         and enable efficient and effective task 
         completion, while propagating few errors. 
         Satisfaction with the site is also important. 
         The user must not only be well-served, but must 
         feel well-served.&lt;/p&gt; 
         &lt;p&gt;Expert reviews and usability testing are 
         methods of identifying problems in layout, 
         terminology, and navigation before they frustrate
         users and drive them away from your site.&lt;/p&gt;
         &lt;p&gt;The most successful projects employ multiple 
         methods in multiple iterations. As Millicent 
         Marigold remarked during a recent conference, 
         "Don't stop. Iterate, iterate, then iterate 
         again."&lt;/p&gt;
         &lt;p&gt;This book has been approved by the Web Site 
         Users Association.&lt;/p&gt;
      &lt;/introduction&gt;
      &lt;part number="1"&gt;
         &lt;title&gt;Expert Reviews&lt;/title&gt;
         &lt;introduction&gt;
            &lt;p&gt;Expert reviewers identify problems 
            and recommend changes to web sites based 
            on research in human computer interaction 
            and their experience in the field.&lt;/p&gt; 
            &lt;p&gt;Two expert review methods are discussed 
            here. They are heuristic evaluation and 
            cognitive walk-through.&lt;/p&gt; 
            &lt;p&gt;Expert review methods should be 
            initiated early in the development process, 
            as soon as paper &lt;b&gt;p&lt;/b&gt;rototypes 
            (hand-drawn pictures of Web pages) or 
            &lt;b&gt;w&lt;/b&gt;ireframes (electronic mockups) are 
            available. They should be conducted using 
            the hardware and software similar to that 
            employed by users.&lt;/p&gt;
         &lt;/introduction&gt;
         &lt;chapter&gt;
            &lt;title&gt;Heuristic Evaluation&lt;/title&gt;
            &lt;p&gt;Expert reviewers critique an interface to 
            determine conformance with recognized 
            usability principles. &lt;footnote&gt;One of the 
            best known lists of heuristics is &lt;citation 
            url="http://www.useit.com/papers/heuristic
            /heuristic_list.html"&gt;Ten Usability 
            Heuristics by Jacob Nielson&lt;/citation&gt;. Another 
            is &lt;citation url="http://usability.gov
            /guidelines/index.html"&gt; Research-Based Web 
            Design and Usability Guidelines&lt;/citation&gt;
            &lt;/footnote&gt;&lt;/p&gt; 
         &lt;/chapter&gt;
         &lt;chapter&gt;
            &lt;title&gt;Cognitive Walk-Through&lt;/title&gt;
            &lt;p&gt;Expert reviewers evaluate Web site 
            understandability and ease of learning while 
            performing specified tasks. They walk through 
            the site answering questions such as "Would a 
            user know by looking at the screen how to 
            complete the first step of the task?" and "If 
            the user completed the first step, would the 
            user know what to do next?," with the goal of 
            identifying any obstacles to completing the 
            task and assessing whether the user would 
            cognitively be aware that he was successful in 
            completing a step in the process.&lt;/p&gt;
         &lt;/chapter&gt;
      &lt;/part&gt;
      &lt;part number="2"&gt;
         &lt;chapter&gt;
            &lt;title&gt;Usability Testing&lt;/title&gt;
            &lt;p&gt;Once the problems identified by expert 
            reviews have been corrected, it is time to 
            conduct some tests of the site with your unique 
            audience or audiences by conducting usability 
            testing.&lt;/p&gt;
            &lt;p&gt;Users are asked to complete tasks which 
            measure the success of the information 
            architecture and navigational elements of the 
            site.&lt;/p&gt;
            &lt;p&gt;Then changes are made to improve service to 
            users.&lt;/p&gt;
         &lt;/chapter&gt;
      &lt;/part&gt; 
   &lt;/content&gt;
&lt;/book&gt;

&lt;book number="2"&gt;
   &lt;metadata&gt;
      &lt;title shortTitle="Usability Basics"&gt;Usability 
      Basics: How to Plan for and Conduct Usability Tests 
      on Web Site Thereby Improving the Usability of Your 
      Web Site&lt;/title&gt;
      &lt;publicationInfo&gt;
         &lt;place&gt;New York&lt;/place&gt;
         &lt;publisher&gt;Ersatz Publications&lt;/publisher&gt;
         &lt;publisher&gt;Electronic BookWorks&lt;/publisher&gt;         
         &lt;dateIssued&gt;2000&lt;/dateIssued&gt;
         &lt;dateRevised&gt;2001&lt;/dateRevised&gt;
      &lt;/publicationInfo&gt;
      &lt;price&gt;174.00&lt;/price&gt;   
      &lt;subjects xml:lang="en"&gt;
         &lt;subject&gt;Usability testing&lt;/subject&gt;
         &lt;subject&gt;Web site development&lt;/subject&gt;
         &lt;subject&gt;Guides and finding aids&lt;/subject&gt;
      &lt;/subjects&gt;
      &lt;subjects xml:lang="fr"&gt;
         &lt;subject&gt;Tests d'ergonomie&lt;/subject&gt;
         &lt;subject&gt;Développement de site web&lt;/subject&gt;
         &lt;subject&gt;Guides et outils de recherche&lt;/subject&gt;
      &lt;/subjects&gt;
      &lt;subjects xml:lang="zh"&gt;
         &lt;subject&gt;可用性测试&lt;/subject&gt;
         &lt;subject&gt;网站建置&lt;/subject&gt;
         &lt;subject&gt;指南和检索工具&lt;/subject&gt;
      &lt;/subjects&gt;
   &lt;/metadata&gt;
   &lt;content&gt;
      &lt;introduction&gt;
         &lt;p&gt;This is a basic handbook for planning and 
         conducting usability tests on Web sites. Usability 
         testing should be used in conjunction with other 
         expert review methods.&lt;/p&gt;
         &lt;p&gt;This book has not been approved by the Web Site 
         Users Association.&lt;/p&gt;
      &lt;/introduction&gt;
      &lt;part number="1"&gt;
         &lt;chapter&gt;
            &lt;title&gt;Planning then Conducting Usability 
            Tests&lt;/title&gt; 
            &lt;p&gt;Take the following steps to plan usability 
            testing. &lt;step number="1"&gt;Clarify and 
            articulate the goal of the usability testing.
            &lt;/step&gt; &lt;step number="2"&gt;Identify tasks which 
            are critical for users to be able to complete 
            successfully.&lt;/step&gt; &lt;step number="3"&gt;Compile 
            a script of questions or instructions which 
            will prompt the user to attempt those 
            tasks.&lt;/step&gt; &lt;step number="4"&gt;Identify your 
            users and begin recruiting them.&lt;/step&gt; &lt;step 
            number="5"&gt;Conduct a pretest on a few users.
            &lt;/step&gt; &lt;step number="6"&gt;Edit the script based 
            on insights gleaned from the pretest.&lt;/step&gt; 
            &lt;step number="7"&gt;Resume testing.&lt;/step&gt;&lt;/p&gt;
         &lt;/chapter&gt;
      &lt;/part&gt;
      &lt;part number="2"&gt;
         &lt;chapter&gt;
            &lt;title&gt;Conducting Usability Tests&lt;/title&gt; 
         &lt;p&gt;Users can be tested at any computer 
            workstation &lt;footnote&gt;They may be more 
            comfortable at their own workstation than in 
            a lab.&lt;/footnote&gt; or in a lab.&lt;/p&gt;
            &lt;p&gt;Give the user the script, then assure them 
            that you are testing the Web site, not them. 
            Users are asked to verbalize their thoughts as 
            they complete the tasks. The event is recorded 
            or someone takes notes. It is often preferable 
            to have two testers, &lt;footnote&gt;Usability 
            testing can be done at great expense or on a 
            shoe string, using &lt;testingProcedure&gt;in-house 
            expertise&lt;/testingProcedure&gt; or 
            &lt;testingProcedure&gt;contracting with human 
            computer interaction professionals
            &lt;/testingProcedure&gt;.&lt;/footnote&gt; one to ask the 
            questions, another to take notes. Testers should 
            offer no guidance or comments to the user. Mouse 
            movements, typing, expressions, and the user's 
            words should be recorded.&lt;/p&gt;
         &lt;/chapter&gt;
         &lt;chapter&gt;
            &lt;title&gt;Evaluating and Implementing Results&lt;/title&gt; 
            &lt;p&gt;Compile the results and review collectively. 
            Make changes to the site to alleviate the problems 
            found in Web site components which were propagating 
            the largest number of or the most devastating errors. 
            Begin new iterations of testing and changes, until 
            users are successful in the accomplishing the 
            tasks.&lt;/p&gt;
         &lt;/chapter&gt;
      &lt;/part&gt;
   &lt;/content&gt;
&lt;/book&gt;

&lt;book number="3"&gt;
   &lt;metadata&gt;
      &lt;title shortTitle="Usabilityguy Manuscript 
      Guide"&gt;John Wesley Usabilityguy: A Register of His 
      Papers&lt;/title&gt;
      &lt;author&gt;Millicent Marigold&lt;/author&gt;
      &lt;author&gt;Morty Marigold&lt;/author&gt;
      &lt;publicationInfo&gt;  
         &lt;place&gt;Washington, D.C.&lt;/place&gt;    
         &lt;publisher&gt;Ersatz Manuscript Library&lt;/publisher&gt;
         &lt;dateIssued&gt;1998&lt;/dateIssued&gt;
         &lt;dateRevised&gt;2002&lt;/dateRevised&gt;
      &lt;/publicationInfo&gt;
      &lt;price&gt;21.49&lt;/price&gt;   
      &lt;subjects xml:lang="en"&gt;
         &lt;subject&gt;Computers&lt;/subject&gt;
         &lt;subject&gt;Software evaluation&lt;/subject&gt;
         &lt;subject&gt;Usability testing&lt;/subject&gt;
         &lt;subject&gt;Manuscript collections&lt;/subject&gt;
      &lt;/subjects&gt;
      &lt;subjects xml:lang="fr"&gt;
         &lt;subject&gt;Ordinateurs&lt;/subject&gt;
         &lt;subject&gt;Évaluation de logiciels&lt;/subject&gt;
         &lt;subject&gt;Tests d'ergonomie&lt;/subject&gt;
         &lt;subject&gt;Collections de manuscrits&lt;/subject&gt;
      &lt;/subjects&gt;
      &lt;subjects xml:lang="zh"&gt;
         &lt;subject&gt;计算机&lt;/subject&gt;
         &lt;subject&gt;软件评价&lt;/subject&gt;
         &lt;subject&gt;可用性测试&lt;/subject&gt;
         &lt;subject&gt;手稿专藏&lt;/subject&gt;
      &lt;/subjects&gt;
   &lt;/metadata&gt;
   &lt;content&gt;
      &lt;introduction&gt;
         &lt;p&gt;The papers of John Wesley Usabilityguy span the 
         years 1946-2001, with the bulk of the items 
         concentrated in the period from 1985 to 2001. The 
         papers feature his career as a developer of software 
         applications and usability specialist. The collection 
         consists of correspondence, memoranda, journals, 
         speeches, article drafts, book drafts, notes, charts, 
         graphs, family papers, clippings, printed matter, 
         photographs, résumés and other materials.&lt;/p&gt;
      &lt;/introduction&gt;
      &lt;part number="1"&gt;&lt;container type="box"&gt;1-12&lt;/container&gt;
         &lt;title&gt;Subject File, &lt;date normalize="1930/1974"&gt;
         1930-1974&lt;/date&gt;&lt;/title&gt;
         &lt;introduction&gt;
            &lt;p&gt;Correspondence, telegrams, memoranda, journals, 
            logs, testimony, approved travel orders, invitations, 
            charts, graphs, forms, biographical data, photographs, 
            book drafts, clippings and other printed matter, 
            résumés and miscellaneous material. Organized by 
            name of person or organization, topic, or type of 
            material.&lt;/p&gt;
         &lt;/introduction&gt;
         &lt;component&gt;&lt;container type="box"&gt;1&lt;/container&gt;
           &lt;componentTitle&gt;Computers&lt;/componentTitle&gt;
           &lt;subComponent&gt;
              &lt;componentTitle&gt;Software, 
              &lt;componentDate normalize="1946/1947"&gt;1946-1947
              &lt;/componentDate&gt;
              &lt;/componentTitle&gt;
           &lt;/subComponent&gt;
           &lt;subComponent&gt;
              &lt;componentTitle&gt;Human Computer Interaction 
              research, &lt;componentDate normalize="1945/1952"&gt;
              1945-1952&lt;/componentDate&gt;
              &lt;/componentTitle&gt;
              &lt;subsubComponent&gt;
                 &lt;componentTitle&gt;Flow diagram, 
                 &lt;componentDate normalize="1950"&gt;1950
                 &lt;/componentDate&gt;
                 &lt;/componentTitle&gt;
              &lt;/subsubComponent&gt;
              &lt;subsubComponent&gt;
                 &lt;componentTitle&gt;General, 
                 &lt;componentDate normalize="1947/1951"&gt;1947-1951
                 &lt;/componentDate&gt;
                 &lt;/componentTitle&gt;
              &lt;/subsubComponent&gt;
              &lt;subsubComponent&gt;&lt;container type="box"&gt;2&lt;/container&gt;
                 &lt;componentTitle&gt;Eye Movement research,
                 &lt;componentDate normalize="1949/1950"&gt;1949-1950
                 &lt;/componentDate&gt;
                 &lt;/componentTitle&gt;
              &lt;/subsubComponent&gt; 
              &lt;subsubComponent&gt;
                 &lt;componentTitle&gt;User profiling, 
                 &lt;componentDate normalize="1950/1959"&gt;1950s
                 &lt;/componentDate&gt;
                 &lt;/componentTitle&gt;
              &lt;/subsubComponent&gt;
            &lt;/subComponent&gt;
         &lt;/component&gt;
         &lt;component&gt;
           &lt;componentTitle&gt;Web User Appreciation Award, 
           &lt;componentDate normalize="1956"&gt;1956&lt;/componentDate&gt;
           &lt;/componentTitle&gt;
         &lt;/component&gt;
      &lt;/part&gt;
      &lt;part number="2"&gt;&lt;container type="box"&gt;3-5&lt;/container&gt;
         &lt;title&gt;Writings File, 
         &lt;date normalize="1985/1999"&gt;1985-1999&lt;/date&gt;
         &lt;/title&gt;
         &lt;introduction&gt;
            &lt;p&gt;Correspondence, articles, book drafts, notes, 
            contracts, clippings, and printed matter. Arranged 
            alphabetically by type (articles, books, reports, 
            and miscellaneous) and therein alphabetically by 
            type of material, subject, or title.&lt;/p&gt;
         &lt;/introduction&gt;
         &lt;component&gt;
            &lt;componentTitle&gt;Writings by Usabilityguy
            &lt;/componentTitle&gt;
            &lt;subComponent&gt;
               &lt;componentTitle&gt;&lt;componentDate normalize="1996"&gt;
               1996&lt;/componentDate&gt;
               &lt;/componentTitle&gt; 
               &lt;subsubComponent&gt;
                  &lt;componentTitle&gt;"How Many Users Are Enough 
                  for User Testing?"&lt;/componentTitle&gt;
               &lt;/subsubComponent&gt; 
               &lt;subsubComponent&gt;
                  &lt;componentTitle&gt;"How to Evaluate Results from 
                  User Tests."&lt;/componentTitle&gt;
               &lt;/subsubComponent&gt;
               &lt;subsubComponent&gt;
                  &lt;container type="box"&gt;5&lt;/container&gt;
                  &lt;componentTitle&gt;"When Are You Done Testing?"
                  &lt;/componentTitle&gt;
               &lt;/subsubComponent&gt;
               &lt;subsubComponent&gt;
                  &lt;componentTitle&gt;"Do-It-Yourself User Testing"
                  &lt;/componentTitle&gt;
               &lt;/subsubComponent&gt; 
            &lt;/subComponent&gt;
         &lt;/component&gt;
         &lt;component&gt;
            &lt;componentTitle&gt;Charitable Contributions
            &lt;/componentTitle&gt; 
            &lt;subComponent&gt;
               &lt;componentTitle&gt;Diseases: AIDS, Hepatitis, 
               Tuberculosis &lt;componentDate normalize=
               "1990/1999"&gt;1990-1999&lt;/componentDate&gt;
               &lt;/componentTitle&gt;
            &lt;/subComponent&gt; 
            &lt;subComponent&gt;
               &lt;componentTitle&gt;Environmental Conservation: 
               Rivers &lt;componentDate normalize="1995"&gt;1995
               &lt;/componentDate&gt;
               &lt;/componentTitle&gt;
            &lt;/subComponent&gt;
         &lt;/component&gt;
      &lt;/part&gt;
   &lt;/content&gt;
&lt;/book&gt;
&lt;/books&gt;</eg>
</div2>
</div1>
<div1 id="Element">
<head>Use Case "ELEMENT": Queries on XML Elements with Simple Content</head>
<div2 id="element-description">
<head>Description</head>
<p>These use cases query words and phrases in XML elements with simple content.</p>
<p>These use cases begin with the simplest queries possible. They query a word or phrase in an element with simple content and no descendants. One of these queries is on Chinese characters. Some queries return additional or different elements than were queried. A query queries and returns the full document. Others find a phrase only when it starts an element and find a exact phrase when it is the entire content of an element, allowing full-text variations, such as case, diacritics, and wildcards.</p>
</div2>
<div2 id="element-queries-results">
<head>Queries and Results</head>
<div3 id="element-queries-results-q1">
<head>Q1 Word Query in an Element</head>
<p>Find all book titles containing the word "usability".</p>
<p>This query finds a word in an element.</p>
<ulist>
<item>
<p>Operands: "usability"</p>
</item>
<item>
<p>Functionality: word query</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./metadata/title</p>
</item>
<item>
<p>Return: ./metadata/title</p>
</item>
<item>
<p>Comments: This is the simplest query possible, a query on a word in an element. This
						query does not employ wildcards, stemming, or thesaurus support. While this query finds useful results in the sample 
						data, many queries such as one on the word "test" would not. A query on the word "test" would return no results, missing the word 
						variants which exist in the sample data: "pretest", "tested", "testers", "testimony", "testing", and "tests".</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
   /books/book/metadata/title[. ftcontains "usability"]</eg>
<p>
<emph>Solution in XPath:</emph>
</p>
<eg role="xpath" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
/books/book/metadata/title[. ftcontains "usability"]</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;title shortTitle="Improving Web Site Usability"&gt;Improving 
the <phrase role="found">Usability</phrase> of a Web Site Through Expert Reviews 
and <phrase role="found">Usability</phrase> Testing&lt;/title&gt;

&lt;title shortTitle="Usability Basics"&gt;<phrase role="found">Usability</phrase> 
Basics: How to Plan for and Conduct <phrase role="found">Usability</phrase> Tests 
on Web Site Thereby Improving the <phrase role="found">Usability</phrase> of Your 
Web Site&lt;/title&gt;</eg>
</div3>
<div3 id="element-queries-results-q2">
<head>Q2 Phrase Query in an Element</head>
<p>Find all book subjects containing the phrase "usability testing".</p>
<p>This query finds a phrase in an element.</p>
<ulist>
<item>
<p>Operands: "usability testing"</p>
</item>
<item>
<p>Functionality: phrase query</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./metadata/subjects/subject</p>
</item>
<item>
<p>Return: ./metadata/subjects/subject</p>
</item>
<item>
<p>Comments: This is a simple query on a phrase in an element. Like an ordered distance query allowing no intervening words, the words in this phrase query must be adjacent to each other and must appear in the order specified. While this query finds useful results in the sample data, many queries such as one on "software developer" would not. A query on the phrase "software developer" would return no results, missing "developer of software" which exists 
in the sample data.</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
   /books/book/metadata/subjects/subject[. ftcontains 
   "usability testing"]</eg>
<p>
<emph>Solution in XPath:</emph>
</p>
<eg role="xpath" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
/books/book/metadata/subjects/subject[. ftcontains 
"usability testing"]</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;subject&gt;<phrase role="found">Usability testing</phrase>&lt;/subject&gt;
						
&lt;subject&gt;<phrase role="found">Usability testing</phrase>&lt;/subject&gt;

&lt;subject&gt;<phrase role="found">Usability testing</phrase>&lt;/subject&gt;</eg>
</div3>
<div3 id="element-queries-results-q3">
<head>Q3 Phrase Query on Chinese Characters in an Element</head>
<p>Find all book subjects containing the phrase (n-gram) "网站".</p>
<p>This query finds a phrase (n-gram) in an element.</p>
<ulist>
<item>
<p>Operands: "网站"</p>
</item>
<item>
<p>Functionality: phrase query, language qualifier</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./metadata/subjects/subject</p>
</item>
<item>
<p>Return: ./metadata/subjects/subject</p>
</item>
<item>
<p>Comments: This query finds a phrase (n-gram) consisting of two Chinese characters. It assumes a specific language dependent tokenization.</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
   /books/book/metadata/subjects/subject[. ftcontains 
   "网站" language "zh"]</eg>
<p>
<emph>Solution in XPath:</emph>
</p>
<eg role="xpath" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
/books/book/metadata/subjects/subject[. ftcontains 
"网站" language "zh"]</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;subject&gt;<phrase role="found">网站</phrase>建置&lt;/subject&gt;  
					    
&lt;subject&gt;<phrase role="found">网站</phrase>可用性&lt;/subject&gt;

&lt;subject&gt;<phrase role="found">网站</phrase>建置&lt;/subject&gt;</eg>
</div3>
<div3 id="element-results-q4">
<head>Q4 Query in Different Elements</head>
<p>Find all books with "usability tests" in book or chapter titles.</p>
<p>This query finds a phrase in different elements.</p>
<ulist>
<item>
<p>Operands: "usability tests"</p>
</item>
<item>
<p>Functionality: phrase query</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./metadata/title, ./content/part/chapter/title</p>
</item>
<item>
<p>Return: .</p>
</item>
<item>
<p>Comments: This query is an example of a query in two different elements.</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">for $book in doc("http://bstore1.example.com/full-text.xml")
   /books/book
let $title := $book/metadata/title[. ftcontains "usability tests"] 
   or $book/content/part/chapter/title[. ftcontains "usability tests"] 
where count($title) &gt; 0
return $book</eg>
<p>
<emph>Solution in XPath:</emph>
</p>
<eg role="xpath" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
/books/book[count(./metadata/title[. ftcontains "usability tests"] 
or ./content/part/chapter/title[. ftcontains "usability tests"])&gt;0]</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="2"&gt;
   &lt;metadata&gt;
      ...
      &lt;title shortTitle="Usability Basics"&gt;Usability 
      Basics: How to Plan for and Conduct <phrase role="found">Usability Tests</phrase> 
      on Web Site Thereby Improving the Usability of 
      Your Web Site&lt;/title&gt; 
      ...
   &lt;/metadata&gt;
   &lt;content&gt;
      ...
      &lt;part number="1"&gt;
         &lt;chapter&gt;
            &lt;title&gt;Planning then Conducting <phrase role="found">Usability</phrase>
            <phrase role="found">Tests</phrase>&lt;/title&gt; 
            ...
         &lt;/chapter&gt;
      &lt;/part&gt;
      &lt;part number="2"&gt;
         &lt;chapter&gt;
            &lt;title&gt;Conducting <phrase role="found">Usability Tests</phrase>&lt;/title&gt;
            ...
         &lt;/chapter&gt;
      &lt;/part&gt;
      .... 
   &lt;/content&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="element-results-q5">
<head>Q5 Query in an Element Returning Different Elements</head>
<p>Find all books with the phrase "usability testing" in some subject.</p>
<p>This query finds a phrase in an element and returns different elements from the same document.</p>
<ulist>
<item>
<p>Operands: "usability testing"</p>
</item>
<item>
<p>Functionality: phrase query</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./metadata/subjects/subject</p>
</item>
<item>
<p>Return: ./metadata/title, ./metadata/author</p>
</item>
<item>
<p>Comments: This query queries the <code>subject</code> element, but does not return it. It returns two different elements.</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">for $book in doc("http://bstore1.example.com/full-text.xml")
   /books/book
where $book//subject ftcontains "usability testing"
return $book/metadata/(title|author)</eg>
<p>
<emph>Solution in XPath:</emph>
</p>
<eg role="xpath" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
/books/book[./metadata/subjects/subject 
ftcontains "usability testing"]/metadata/(title|author)</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;title shortTitle="Improving Web Site Usability"&gt;Improving 
the Usability of a Web Site Through Expert Reviews 
and Usability Testing&lt;/title&gt; 
&lt;author&gt;Millicent Marigold&lt;/author&gt;     
&lt;author&gt;Montana Marigold&lt;/author&gt; 
   
&lt;title shortTitle="Usability Basics"&gt;Usability 
Basics: How to Plan for and Conduct Usability Tests 
on Web Site Thereby Improving the Usability of Your 
Web Site&lt;/title&gt;
   
&lt;title shortTitle="Usabilityguy Manuscript 
Guide"&gt;John Wesley Usabilityguy: A Register of His 
Papers&lt;/title&gt;
&lt;author&gt;Millicent Marigold&lt;/author&gt;
&lt;author&gt;Morty Marigold&lt;/author&gt;</eg>
</div3>
<div3 id="element-queries-results-q6">
<head>Q6 Starts-with Query</head>
<p>Find all book titles which start with "improving" followed within 2 words by "usability".</p>
<p>This query finds an element which starts with specific words.</p>
<ulist>
<item>
<p>Operands: "improving" "usability"</p>
</item>
<item>
<p>Functionality: word queries, ordered distance (0 to 2 intervening words), starts-with functionality</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./metadata/title</p>
</item>
<item>
<p>Return: ./metadata/title</p>
</item>
<item>
<p>Comments: The starts-with functionality restricts the query to the first words or phrase in an element. It is especially useful in querying journal 
titles (e.g., <emph>Journal of Psychology</emph>) in large library collections. This query does not find Book 2 which contains the phrase 
"improving the usability" in the <code>title</code> element, because the <code>title</code> element does not start with "improving" followed within 2 words by "usability".</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">for $book in doc("http://bstore1.example.com/full-text.xml")
   /books/book
let $title := $book/metadata/title[. ftcontains 
"improving" &amp;&amp; "usability" distance at 
most 2 words ordered at start]
where count($title)&gt;0
return $title</eg>
<p>
<emph>Solution in XPath:</emph>
</p>
<eg role="xpath" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
/books/book/metadata/title[count(. ftcontains 
"improving" &amp;&amp; "usability" distance at 
most 2 words ordered at start)&gt;0]</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;title shortTitle="Improving Web Site Usability"&gt;<phrase role="found">Improving 
the Usability</phrase> of a Web Site Through Expert Reviews and 
Usability Testing&lt;/title&gt;</eg>
</div3>
<div3 id="element-queries-results-q7">
<head>Q7 Entire Element Content Query</head>
<p>Find all books with the entire title "improve the usability of a web site through expert reviews and 
usability testing", allowing any form of the word "improve".</p>
<p>This query finds the phrase when it is the entire content of an element.</p>
<ulist>
<item>
<p>Operands: "improve the usability of a web site through expert reviews and usability testing"</p>
</item>
<item>
<p>Functionality: phrase query, character wildcard (suffix) (0 or more), entire element content functionality</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./metadata/title</p>
</item>
<item>
<p>Return: ./metadata/title</p>
</item>
<item>
<p>Comments: This query insists that the element contains the entire phrase being queried, no more and no less. It allows full-text variations, such as case, diacritics, and wildcards.</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">for $book in doc("http://bstore1.example.com/full-text.xml")
   /books/book
let $exactTitle := $book/metadata/title[. ftcontains 
   "improv.* the usability of a web site through expert 
   reviews and usability testing" entire content]
where count($exactTitle)&gt;0
return $exactTitle</eg>
<p>
<emph>Solution in XPath:</emph>
</p>
<eg role="xpath" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
/books/book/metadata/title[count(. ftcontains 
"improv.* the usability of a web site through expert 
reviews and usability testing" entire content)&gt;0]</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;title shortTitle="Improving Web Site Usability"&gt;<phrase role="found">Improving 
the Usability of a Web Site Through Expert Reviews and 
Usability Testing</phrase>&lt;/title&gt;</eg>
</div3>
</div2>
</div1>
<div1 id="Across">
<head>Use Case "ACROSS": Queries Across XML Element Boundaries</head>
<div2 id="across-description">
<head>Description</head>
<p>These use cases by default query across XML element boundaries.</p>
<p>Boundaries include XML tags: Start-Tags, End-Tags, and Empty-Element Tags. Descendant XML tags and attribute values are removed from the string to be queried by tokenization before the query. At the XQuery Data Model level tags are a syntactic element.</p>
<p>Find queries in an element which do not query some or all of its descendant elements in Section 14 (IGNORE).</p>
</div2>
<div2 id="across-queries-results">
<head>Queries and Results</head>
<div3 id="across-queries-results-q1">
<head>Q1 Query Across Descendant Elements (No Element Content)</head>
<p>Find all book chapters containing the phrase "one of the best known lists of heuristics is Ten Usability Heuristics".</p>
<p>  This query crosses element boundaries.</p>
<ulist>
<item>
<p>Operands: "one of the best known lists of heuristics is Ten Usability Heuristics"</p>
</item>
<item>
<p>Functionality: phrase query</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./content/part/chapter</p>
</item>
<item>
<p>Return: .</p>
</item>
<item>
<p>Comments: Querying across element boundaries is similar to an XQuery and XPath character string function converting the sub-tree 
under an element into a string by removing all markup. The <code>citation</code> element tags, including element name and attribute values, have been removed by tokenization.</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">for $book in doc("http://bstore1.example.com/full-text.xml")
   /books/book
let $chap := $book//chapter[. ftcontains 
   "one of the best known lists of heuristics is 
   Ten Usability Heuristics"]
where count($chap) &gt; 0
return $book</eg>
<p>
<emph>Solution in XPath:</emph>
</p>
<eg role="xpath" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
/books/book[count(.//chapter ftcontains "one of 
the best known lists of heuristics is Ten Usability 
Heuristics")&gt;0]</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&gt;
   &lt;metadata&gt;
      ...
   &lt;/metadata&gt;
   &lt;content&gt;
      ...
      &lt;part number="1"&gt;
         ...
         &lt;chapter&gt; 
            &lt;title&gt;Heuristic Evaluation&lt;/title&gt; 
            &lt;p&gt;Expert reviewers critique an interface to
            determine conformance with recognized 
            usability principles. &lt;footnote&gt;<phrase role="found">One of the</phrase>
            <phrase role="found">best known lists of heuristics is</phrase> &lt;citation
            url="http://www.useit.com/papers/heuristic
            /heuristic_list.html"&gt; <phrase role="found">Ten Usability</phrase> 
            <phrase role="found">Heuristics</phrase> by Jacob Nielson&lt;/citation&gt;. Another
            is &lt;citation url="http://usability.gov
            /guidelines/index.html"&gt; Research-Based Web
            Design and Usability Guidelines&lt;/citation&gt;
            &lt;/footnote&gt;&lt;/p&gt; 
         &lt;/chapter&gt;
         ...
      &lt;/part&gt;
      ...
   &lt;/content&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="across-queries-results-q2">
<head>Q2 Query Across Descendant Elements (Highlighting Tags)</head>
<p>Find all part introductions containing the word "prototypes".</p>
<p>This query crosses element boundaries.</p>
<ulist>
<item>
<p>Operands: "prototypes"</p>
</item>
<item>
<p>Functionality: word query</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./content/part/introduction</p>
</item>
<item>
<p>Return: .</p>
</item>
<item>
<p>Comments: Querying across element boundaries is similar to an XQuery and XPath character string function converting the sub-tree 
under an element into a string by removing all markup. The <code>bold</code> element tags, including element name, have been removed by tokenization.</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">for $book in doc("http://bstore1.example.com/full-text.xml")
   /books/book
let $intro := $book/content/part/introduction[. ftcontains 
   "prototypes"]
where count($intro)&gt;0
return $book</eg>
<p>
<emph>Solution in XPath:</emph>
</p>
<eg role="xpath" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
/books/book[count(./content/part/introduction ftcontains 
"prototypes")&gt;0]</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&gt; 
   &lt;metadata&gt;
      ...
   &lt;/metadata&gt;
   &lt;content&gt;
      ...
      &lt;part number="1"&gt;
         &lt;introduction&gt;
            &lt;p&gt;Expert review methods should be
            initiated early in the development process, 
            as soon as paper &lt;b&gt;<phrase role="found">p</phrase>&lt;/b&gt;<phrase role="found">rototypes</phrase>
            (hand-drawn pictures of Web pages) or
            &lt;b&gt;w&lt;/b&gt;ireframes (electronic mockups) are
            available. They should be conducted using
            the hardware and software similar to that 
            employed by users.&lt;/p&gt;
         &lt;/introduction&gt;
         ...
      &lt;/part&gt;
      ...
   &lt;/content&gt;  
&lt;/book&gt;</eg>
</div3>
<div3 id="across-queries-results-q3">
<head>Q3 Query Across Descendant Elements (Substantive Tags)</head>
<p>Find all book text with the word "tests".</p>
<p>This query finds a word in an element and its descendants.</p>
<ulist>
<item>
<p>Operands: "tests"</p>
</item>
<item>
<p>Functionality: word query</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./content</p>
</item>
<item>
<p>Return: .</p>
</item>
<item>
<p>Comments: Querying across element boundaries is similar to an XQuery and XPath character string function converting the sub-tree 
under an element into a string by removing all markup.  Element tags, including element name and attribute values, have been removed by tokenization, including <code>part</code>, 
<code>chapter</code>, <code>title</code>, <code>p</code>, <code>component</code>, and <code>componentTitle</code> tags.</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">for $book in doc("http://bstore1.example.com/full-text.xml")
   /books/book
let $cont := $book/content[. ftcontains "tests"]
where count($cont)&gt;0
return $book</eg>
<p>
<emph>Solution in XPath:</emph>
</p>
<eg role="xpath" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
/books/book[count(./content ftcontains "tests")&gt;0]</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&gt;
   &lt;metadata&gt;
      ...
   &lt;/metadata&gt;
   &lt;content&gt;
      ...
      &lt;part number="2"&gt;
         &lt;chapter&gt;
            &lt;title&gt;Usability Testing&lt;/title&gt;
            &lt;p&gt;Once the problems identified by expert 
            reviews have been corrected, it is time to 
            conduct some <phrase role="found">tests</phrase> of the site with your unique 
            audience or audiences by conducting usability 
            testing.&lt;/p&gt;
            ...
         &lt;/chapter&gt;
      &lt;/part&gt; 
      ...
   &lt;/content&gt;
&lt;/book&gt;      
   
&lt;book number="2"&gt;
   &lt;metadata&gt;
      ...
   &lt;/metadata&gt;
   &lt;content&gt;
      &lt;introduction&gt;
         &lt;p&gt;This is a basic handbook for planning and 
         conducting usability <phrase role="found">tests</phrase> on Web sites. Usability 
         testing should be used in conjunction with other 
         expert review methods.&lt;/p&gt;
          ...
      &lt;/introduction&gt;
      &lt;part number="1"&gt;
         &lt;chapter&gt;
            &lt;title&gt;Planning then Conducting Usability 
            <phrase role="found">Tests</phrase>&lt;/title&gt;   
            ...
         &lt;/chapter&gt;
      &lt;/part&gt;   
      ...
   &lt;/content&gt;
&lt;/book&gt;   

&lt;book number="3"&gt;
   &lt;metadata&gt;
      ...
   &lt;/metadata&gt;     
   &lt;content&gt;
      ...
      &lt;component&gt;
         &lt;componentTitle&gt;Writings by Usabilityguy
         &lt;/componentTitle&gt;
         &lt;subComponent&gt;
           &lt;componentTitle&gt;&lt;componentDate normalize="1996"&gt;
           1996&lt;/componentDate&gt;
           &lt;/componentTitle&gt; 
           ...
           &lt;subsubComponent&gt;
           &lt;componentTitle&gt;"How to Evaluate Results from 
           User <phrase role="found">Tests</phrase>."&lt;/componentTitle&gt;
           &lt;/subsubComponent&gt;
         &lt;/subComponent&gt;
         ...
      &lt;component&gt;
      ...
   &lt;/content&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="across-queries-results-q4">
<head>Q4 Query Across Siblings</head>
<p>Find all book text with the phrase "usability testing once the problems".</p>
<p>This query finds a phrase which begins in one element and ends in a sibling.</p>
<ulist>
<item>
<p>Operands: "usability testing once the problems"</p>
</item>
<item>
<p>Functionality: phrase query</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./content</p>
</item>
<item>
<p>Return: .</p>
</item>
<item>
<p>Comments: Querying across element boundaries is similar to an XQuery and XPath character string function converting the sub-tree 
under an element into a string by removing all markup. Element tags, including element name and attribute values, have been removed by tokenization, including <code>title</code> and <code>p</code> tags.</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">for $book in doc("http://bstore1.example.com/full-text.xml")
   /books/book
let $cont := $book//content[. ftcontains 
   "usability testing once the problems"]
where count($cont)&gt;0
return $book</eg>
<p>
<emph>Solution in XPath:</emph>
</p>
<eg role="xpath" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
/books/book[count(.//content ftcontains "usability 
testing once the problems")&gt;0]</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&gt;
   &lt;metadata&gt;
      ...
   &lt;/metadata&gt; 
   &lt;content&gt;
      ...   
      &lt;part number="2"&gt;
         &lt;chapter&gt;
            &lt;title&gt;<phrase role="found">Usability Testing</phrase>&lt;/title&gt;
            &lt;p&gt;<phrase role="found">Once the problems</phrase> identified by expert 
            reviews have been corrected, it is time to 
            conduct some tests of the site with your unique 
            audience or audiences by conducting usability 
            testing.&lt;/p&gt;
            ...
         &lt;/chapter&gt;
      &lt;/part&gt; 
   &lt;/content&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="across-queries-results-q5">
<head>Q5 Query in Different Sub-Trees</head>
<p>Find all books with word "identify" in book introductions or part introductions.</p>
<p>This query finds a word in an element in different sub-trees.</p>
<ulist>
<item>
<p>Operands: "identify"</p>
</item>
<item>
<p>Functionality: word query, character wildcard (suffix) (0 or more)</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./content/introduction, ./content/part/introduction</p>
</item>
<item>
<p>Return: .</p>
</item>
<item>
<p>Comments: This query looks for a word in multiple instances of the <code>introduction</code> element which appear as children 
of the <code>content</code> or <code>part</code> elements.</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">for $book in doc("http://bstore1.example.com/full-text.xml")
   /books/book
let $bi := $book/content/introduction[./p ftcontains 
   "identif.*" with wildcards]
let $pi := $book/content/part/introduction[./p ftcontains 
   "identif.*" with wildcards]
where count($bi)&gt;0 and count($pi)&gt;0
return $book</eg>
<p>
<emph>Solution in XPath:</emph>
</p>
<eg role="xpath" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
/books/book[count(./content/introduction ftcontains 
"identif.*" with wildcards and ./content/part/introduction 
ftcontains "identif.*" with wildcards)&gt;0]</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&gt;  
   &lt;metadata&gt;
      ...
   &lt;/metadata&gt;
   &lt;content&gt;					    
      &lt;introduction&gt;
         ...
         &lt;p&gt;Expert reviews and usability testing are 
         methods of <phrase role="found">identifying</phrase> problems in layout, 
         terminology, and navigation before they frustrate
         users and drive them away from your site.&lt;/p&gt;
         ...
      &lt;/introduction&gt;
      &lt;part number="1"&gt;
         &lt;title&gt;Expert Reviews&lt;/title&gt;    
         &lt;introduction&gt;
             &lt;p&gt;Expert reviewers <phrase role="found">identify</phrase> problems 
             and recommend changes to web sites based 
             on research in human computer interaction 
             and their experience in the field.&lt;/p&gt; 
             ...
         &lt;/introduction&gt;
         ...
      &lt;/part&gt; 
   &lt;/content&gt;
&lt;/book&gt; </eg>
</div3>
<div3 id="across-queries-results-q6">
<head>Q6 Query on Entire Document</head>
<p>Find all books if any one contains the word "mouse".</p>
<p>This query finds a word in a document (anywhere in the document), crossing all element boundaries</p>
<ulist>
<item>
<p>Operands: "mouse"</p>
</item>
<item>
<p>Functionality: word query</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books</p>
</item>
<item>
<p>Query context: .</p>
</item>
<item>
<p>Return: .</p>
</item>
<item>
<p>Comments: It queries the root element and all its descendants. Querying across element boundaries is similar to an XQuery and XPath character string function converting the sub-tree under an element into a string by removing all markup. Element tags, including element name and attribute values, have been removed by tokenization. This query looks for a word inside an entire document and returns the entire document if the word exists. It does not employ wildcards, stemming, or thesaurus support. It is similar to search engine queries that search a collection of documents and return a subset of the searched collection.</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">for $book in doc("http://bstore1.example.com/full-text.xml")
   /books/book
where $book ftcontains "mouse"
return $book</eg>
<p>
<emph>Solution in XPath:</emph>
</p>
<eg role="xpath" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
/books/book[. ftcontains "mouse"]</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&gt;
   &lt;metadata&gt;
      ...
   &lt;/metadata&gt;
   &lt;content&gt;
      ...
   &lt;/content&gt;
&lt;/book&gt;

&lt;book number="2"&gt;
   &lt;metadata&gt;
      ...
   &lt;/metadata&gt;
   &lt;content&gt;
      ...
      &lt;part number="2"&gt;
         &lt;chapter&gt;
            &lt;title&gt;Conducting Usability Tests&lt;/title&gt; 
            ...
            &lt;p&gt;Give the user the script, then assure them 
            that you are testing the Web site, not them. 
            Users are asked to verbalize their thoughts as 
            they complete the tasks. The event is recorded 
            or someone takes notes. It is often preferable 
            to have two testers, &lt;footnote&gt;Usability 
            testing can be done at great expense or on a 
            shoe string, using &lt;testingProcedure&gt;in-house 
            expertise&lt;/testingProcedure&gt; or 
            &lt;testingProcedure&gt;contracting with human 
            computer interaction professionals
            &lt;/testingProcedure&gt;.&lt;/footnote&gt; one to ask the 
            questions, another to take notes. Testers should 
            offer no guidance or comments to the user. <phrase role="found">Mouse</phrase> 
            movements, typing, expressions, and the user's 
            words should be recorded.&lt;/p&gt;
         &lt;/chapter&gt;
         ...
      &lt;/part&gt;
   &lt;/content&gt;
&lt;/book&gt;

&lt;book number="3"&gt;
   &lt;metadata&gt;
      ...
   &lt;/metadata&gt;
   &lt;content&gt;
      ...
   &lt;/content&gt;
&lt;/book&gt;</eg>
</div3>
</div2>
</div1>
<div1 id="Other">
<head>Use Case "OTHER": Queries on Attribute Values</head>
<div2 id="other-description">
<head>Description</head>
<p>Unlike all the other use cases in this document which query element content implicitly, these use cases query XML attribute values. Attribute values are not queried implicitly; they are queried explicitly.</p>
</div2>
<div2 id="other-queries-results">
<head>Queries and Results</head>
<div3 id="other-queries-results-q1">
<head>Q1 Query on Attribute</head>
<p>Find all books with "improve" "web" "usability" in the short title.</p>
<p>This query finds multiple words in an attribute allowing word variants and allowing the words in any order with up to a specified number of intervening words.</p>
<ulist>
<item>
<p>Operands: "improve" "web" "usability" </p>
</item>
<item>
<p>Functionality: word queries, stemming, unordered distance (0 to 2 intervening words)</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./metadata/title/@shortTitle</p>
</item>
<item>
<p>Return: ./metadata/title</p>
</item>
<item>
<p>Comments: This query illustrates full-text querying in an attribute.</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">for $book in doc("http://bstore1.example.com/full-text.xml")
   /books/book
where $book/metadata/title/@shortTitle ftcontains "improve" 
   &amp;&amp; "web" &amp;&amp; "usability" with stemming distance at most 2 words    
return $book/metadata/title</eg>
<p>
<emph>Solution in XPath:</emph>
</p>
<eg role="xpath" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
/books/book[count(./metadata/title/@shortTitle ftcontains 
"improve" &amp;&amp; "web" &amp;&amp; "usability" with stemming  
distance at most 2 words)&gt;0]/metadata/title</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;title shortTitle="<phrase role="found">Improving</phrase> <phrase role="found">Web</phrase> 
Site <phrase role="found">Usability</phrase>"&gt;Improving the Usability of a 
Web Site Through Expert Reviews and Usability Testing&lt;/title&gt;</eg>
</div3>
<div3 id="other-queries-results-q2">
<head>Q2 Query on Element and Attribute</head>
<p>Find all books with the phrase "manuscript guides" in the short title and the phrase "user profiling" in a component title.</p>
<p>This query finds a phrase in an attribute and a phrase in an element.</p>
<ulist>
<item>
<p>Operands: "manuscript guides" "user profiling"</p>
</item>
<item>
<p>Functionality: phrase queries, stemming, <code>and</code> query</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./metadata/title/@shortTitle, ./componentTitle</p>
</item>
<item>
<p>Return: ./metadata/title/@shortTitle/text()</p>
</item>
<item>
<p>Comments: This query combines querying in an element with querying in an attribute.</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">for $book in doc("http://bstore1.example.com/full-text.xml")
   /books/book
let $stitle := $book/metadata/title[./@shortTitle ftcontains 
   "manuscript guides" with stemming]
let $cont := $book//componentTitle[. ftcontains 
   "user profiling" with stemming]
where count($stitle)&gt;0 and count($cont)&gt;0
return data($book/metadata/title/@shortTitle)</eg>
<p>
<emph>Solution in XPath: None</emph>
</p>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">Usabilityguy <phrase role="found">Manuscript Guide</phrase>
</eg>
</div3>
</div2>
</div1>
<div1 id="Wildcard">
<head>Use Case "WILDCARD": Character Wildcard Queries</head>
<div2 id="wildcard-description">
<head>Description</head>
<p>These use cases illustrate queries which use wildcards to append or insert a character or sequence of characters to a word or a part of a word. Character wildcards may be prefix (appended before the first character), infix (inserted into a word), or suffix (appended after the last character).</p>
</div2>
<div2 id="wildcard-queries-results">
<head>Queries and Results</head>
<div3 id="wildcard-queries-results-q1">
<head>Q1 One Character Suffix Wildcard Query</head>
<p>Find all books with the word "test" with a one character suffix in the text.</p>
<p>This query finds a word with a one character suffix (one character after the last character).</p>
<ulist>
<item>
<p>Operands: "test"</p>
</item>
<item>
<p>Functionality: word query, character wildcard (suffix) (1)</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./content</p>
</item>
<item>
<p>Return: .</p>
</item>
<item>
<p>Comments: This query finds "tests", but not "pretest, "tested", "testers", "testimony", 
and "testing" which also appear in the sample data. There is no "test" in the sample data, but if there was, this query would not have found it.</p>
</item>
</ulist>
<p>
<emph>solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">for $book in doc("http://bstore1.example.com/full-text.xml")
   /books/book
let $cont := $book/content[. ftcontains "test." 
  with wildcards]
where count($cont)&gt;0
return $book</eg>
<p>
<emph>Solution in XPath:</emph>
</p>
<eg role="xpath" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
/books/book[count(./content ftcontains "test." 
with wildcards)&gt;0]</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&gt;
   &lt;metadata&gt;
      ...
   &lt;/metadata&gt; 
   &lt;content&gt;
      ...   
      &lt;part number="2"&gt;
         &lt;chapter&gt;
            &lt;title&gt;Usability Testing&lt;/title&gt;
            &lt;p&gt;Once the problems identified by expert 
            reviews have been corrected, it is time to 
            conduct some <phrase role="found">tests</phrase> of the site with your unique 
            audience or audiences by conducting usability 
            testing.&lt;/p&gt;
            ...
         &lt;/chapter&gt;
      &lt;/part&gt;   
   &lt;/content&gt;
&lt;/book&gt;      

&lt;book number="2"&gt;
   &lt;metadata&gt;
      ...
   &lt;/metadata&gt; 
   &lt;content&gt;
      &lt;introduction&gt;
         &lt;p&gt;This is a basic handbook for planning and 
         conducting usability <phrase role="found">tests</phrase> on Web sites. Usability 
         testing should be used in conjunction with other 
         expert review methods.&lt;/p&gt;
         &lt;p&gt;This book has not been approved by the Web Site 
         Users Association.&lt;/p&gt;
      &lt;/introduction&gt;
      &lt;part number="1"&gt;
         &lt;chapter&gt;
            &lt;title&gt;Planning then Conducting Usability 
            <phrase role="found">Tests</phrase>&lt;/title&gt; 
             ...
         &lt;/chapter&gt;
      &lt;/part&gt;
      &lt;part number="2"&gt;
         &lt;chapter&gt;
            &lt;title&gt;Conducting Usability <phrase role="found">Tests</phrase>&lt;/title&gt;  
            ...  
         &lt;/chapter&gt;
         ...  
      &lt;/part&gt;      
      ...        				  
   &lt;/content&gt; 
&lt;/book&gt;     
   
&lt;book number="3"&gt;
   &lt;metadata&gt;
      ...
   &lt;/metadata&gt; 
   &lt;content&gt;
      ...   
     &lt;part number="2"&gt;&lt;container type="box"&gt;3-5&lt;/container&gt;
         &lt;title&gt;Writings File, 
         &lt;date normalize="1985/1999"&gt;1985-1999&lt;/date&gt;
         &lt;/title&gt;
         ...
         &lt;component&gt;
            &lt;componentTitle&gt;Writings by Usabilityguy
            &lt;/componentTitle&gt;
            &lt;subComponent&gt;
               &lt;componentTitle&gt;&lt;componentDate normalize="1996"&gt;
               1996&lt;/componentDate&gt;
               &lt;/componentTitle&gt; 
               ...
               &lt;subsubComponent&gt;
                  &lt;componentTitle&gt;"How to Evaluate Results from 
                  User <phrase role="found">Tests</phrase>."&lt;/componentTitle&gt;
               &lt;/subsubComponent&gt;
               ...
            &lt;/subComponent&gt;
            ...
         &lt;/component&gt;
         ...
      &lt;/part&gt;
      ...
   &lt;/content&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="wildcard-queries-results-q2">
<head>Q2 Zero or One Character Prefix Wildcard Query</head>
<p>Find all books with the word "way" with no prefix or a one character prefix in the text.</p>
<p>This query finds a word with no prefix or a one character prefix (zero or one character before the first character).</p>
<ulist>
<item>
<p>Operands: "way"</p>
</item>
<item>
<p>Functionality: word query, character wildcard (prefix) (0 or 1)</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./content</p>
</item>
<item>
<p>Return: .</p>
</item>
<item>
<p>Comments: There is no "way" in the sample data but if there was, this query would have found it.</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">for $book in doc("http://bstore1.example.com/full-text.xml")
   /books/book
let $cont := $book//content[. ftcontains ".?way" 
   with wildcards]
where count($cont)&gt;0
return $book</eg>
<p>
<emph>Solution in XPath:</emph>
</p>
<eg role="xpath" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
/books/book[count(.//content ftcontains ".?way" 
with wildcards)&gt;0]</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&gt;
   &lt;metadata&gt;
      ...
   &lt;/metadata&gt; 
   &lt;content&gt;
      &lt;introduction&gt;
         ... 
         &lt;p&gt;Expert reviews and usability testing are 
         methods of identifying problems in layout, 
         terminology, and navigation before they frustrate
         users and drive them <phrase role="found">away</phrase> from your site.&lt;/p&gt;
         ...		    
      &lt;/introduction&gt;
      ...
   &lt;/content&gt;	
&lt;/book&gt;</eg>
</div3>
<div3 id="wildcard-queries-results-q3">
<head>Q3 Zero or More Character Infix Wildcard Query</head>
<p>Find all books with the words "serve" or "service" in the text.</p>
<p>This query finds words with no infix character or any number of infix characters (zero or more characters inserted in the middle of a word).</p>
<ulist>
<item>
<p>Operands: "serv", "e"</p>
</item>
<item>
<p>Functionality: word query, character wildcard (infix) (0 or more)</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./content</p>
</item>
<item>
<p>Return: ./@number, ./metadata/title/text(), ./content</p>
</item>
<item>
<p>Comments: This query returns the word "service" and would return the word "serve" if it existed in the sample 
data. It does not return the word "served" which exists in the sample data.</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">for $book in doc("http://bstore1.example.com/full-text.xml")
   /books/book
let $cont := $book//content[. ftcontains "serv.*e" 
   with wildcards]
where count($cont)&gt;0
return $book/@number, $book/metadata/title/text(), $cont</eg>
<p>
<emph>Solution in XPath:</emph>
</p>
<eg role="xpath" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
/books/book[count(.//content ftcontains "serv.*e" 
with wildcards)&gt;0]/(@number|./metadata/title/text()
|./content)</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&gt;&lt;/book&gt;
&lt;title&gt;Improving the Usability of a Web Site Through 
Expert Reviews and Usability Testing&lt;/title&gt;
&lt;content&gt;
   ... 	    
   &lt;part number="2"&gt;
      &lt;chapter&gt;
        &lt;title&gt;Usability Testing&lt;/title&gt;
        ...
        &lt;p&gt;Then changes are made to improve <phrase role="found">service</phrase> to 
        users.&lt;/p&gt;
      &lt;/chapter&gt;
   &lt;/part&gt; 
&lt;/content&gt;
</eg>
</div3>
<div3 id="wildcard-queries-results-q4">
<head>Q4 One or More Character Suffix Wildcard Query on Part of a Word</head>
<p>Find all books with the phrases "usability testing" or "user testing" in the text.</p>
<p>This query finds a phrase allowing a suffix of one or more characters (one or more characters after the last character) on a part of 
						one of the words.</p>
<ulist>
<item>
<p>Operands: "us testing"</p>
</item>
<item>
<p>Functionality: phrase query, character wildcard (suffix) (1 or more)</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./content</p>
</item>
<item>
<p>Return: ./@number, ./metadata/title/text(), ./content</p>
</item>
<item>
<p>Comments: This is a suffix query on a part of a word "us" which is not one of the words or one of the roots of the words desired in the results. The query on
"us" will find "usability" and "user". Where stemmed queries (Section 6 (STEMMING)) attempt to return linguistic variants of a word or the root of a word, wildcards may be applied to any part of a word and will return all character combinations found.</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">for $book in doc("http://bstore1.example.com/full-text.xml")
   /books/book
let $cont := $book//content[. ftcontains "us.+ testing" 
   with wildcards]
where count($cont)&gt;0
return $book/@number, $book/metadata/title/text(), $cont</eg>
<p>
<emph>Solution in XPath:</emph>
</p>
<eg role="xpath" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
/books/book[count(.//content ftcontains "us.+ testing" 
with wildcards)&gt;0]/(@number|./metadata/title/text()|./content)</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&gt;&lt;/book&gt;  
&lt;title&gt;Improving the Usability of a Web Site Through 
Expert Reviews and Usability Testing&lt;/title&gt;
&lt;content&gt;
   &lt;introduction&gt;
      ...
      &lt;p&gt;Expert reviews and <phrase role="found">usability testing</phrase> are 
      methods of identifying problems in layout, 
      terminology, and navigation before they frustrate
      users and drive them away from your site.&lt;/p&gt;
      ...
   &lt;/introduction&gt;
   ...
   &lt;part number="2"&gt;
      ...
      &lt;chapter&gt;
         &lt;title&gt;<phrase role="found">Usability Testing</phrase>&lt;/title&gt;
         &lt;p&gt;Once the problems identified by expert 
         reviews have been corrected, it is time to 
         conduct some tests of the site with your unique 
         audience or audiences by conducting <phrase role="found">usability</phrase> 
         <phrase role="found">testing</phrase>.&lt;/p&gt;
         ...
      &lt;/chapter&gt;
   &lt;/part&gt; 
&lt;/content&gt;
   
&lt;book number="2"&gt;&lt;/book&gt;  
&lt;title&gt;Usability Basics: How to Plan for and Conduct 
Usability Tests on Web Site Thereby Improving the 
Usability of Your Web Site&lt;/title&gt; 
&lt;content&gt;
   &lt;introduction&gt;
      &lt;p&gt;This is a basic handbook for planning and 
      conducting usability tests on Web sites. <phrase role="found">Usability</phrase>
      <phrase role="found">testing</phrase> should be used in conjunction with other 
      expert review methods.&lt;/p&gt;
      ...
   &lt;/introduction&gt;
   &lt;part number="1"&gt;
      ...
      &lt;chapter&gt;
         &lt;p&gt;Take the following steps to plan <phrase role="found">usability</phrase>
         <phrase role="found">testing</phrase>. &lt;step number="1"&gt;Clarify and 
         articulate the goal of the <phrase role="found">usability testing</phrase>. 
         &lt;step number="1"&gt;Clarify and 
         articulate the goal of the usability testing.
         &lt;/step&gt; &lt;step number="2"&gt;Identify tasks which 
         are critical for users to be able to complete 
         successfully.&lt;/step&gt; &lt;step number="3"&gt;Compile 
         a script of questions or instructions which 
         will prompt the user to attempt those 
         tasks.&lt;/step&gt; &lt;step number="4"&gt;Identify your 
         users and begin recruiting them.&lt;/step&gt; &lt;step 
         number="5"&gt;Conduct a pretest on a few users.
         &lt;/step&gt; &lt;step number="6"&gt;Edit the script based 
         on insights gleaned from the pretest.&lt;/step&gt; 
         &lt;step number="7"&gt;Resume testing.&lt;/step&gt;&lt;/p&gt;
      &lt;/chapter&gt;
   &lt;/part&gt;
   &lt;part number="2"&gt;
      &lt;chapter&gt;
         &lt;title&gt;Conducting Usability Tests&lt;/title&gt; 
         ...
         &lt;p&gt;Give the user the script, then assure them 
         that you are testing the Web site, not them. 
         Users are asked to verbalize their thoughts as 
         they complete the tasks. The event is recorded 
         or someone takes notes. It is often preferable 
         to have two testers, &lt;footnote&gt;<phrase role="found">Usability</phrase>
         <phrase role="found">testing</phrase> can be done at great expense or on a 
         shoe string, using &lt;testingProcedure&gt;in-house 
         expertise&lt;/testingProcedure&gt; or 
         &lt;testingProcedure&gt;contracting with human 
         computer interaction professionals
         &lt;/testingProcedure&gt;.&lt;/footnote&gt; one to ask the 
         questions, another to take notes. Testers should 
         offer no guidance or comments to the user. Mouse 
         movements, typing, expressions, and the user's 
         words should be recorded.&lt;/p&gt;
      &lt;/chapter&gt;
      ...
   &lt;/part&gt;
&lt;/content&gt;

&lt;book number="3"&gt;&lt;/book&gt;  
&lt;title&gt;John Wesley Usabilityguy: A Register of His 
Papers&lt;/title&gt;   
&lt;content&gt;
   ...
   &lt;part number="2"&gt;&lt;container type="box"&gt;3-5&lt;/container&gt;
      &lt;title&gt;Writings File, 
      &lt;date normalize="1985/1999"&gt;1985-1999&lt;/date&gt;
      &lt;/title&gt;
      ...
      &lt;component&gt;
         &lt;componentTitle&gt;Writings by Usabilityguy
         &lt;/componentTitle&gt;
         &lt;subComponent&gt;
            &lt;componentTitle&gt;&lt;componentDate normalize="1996"&gt;
            1996&lt;/componentDate&gt;
            &lt;/componentTitle&gt; 
            &lt;subsubComponent&gt;
               &lt;componentTitle&gt;"How Many Users Are Enough 
               for <phrase role="found">User Testing</phrase>?"&lt;/componentTitle&gt;
            &lt;/subsubComponent&gt; 
            ...
            &lt;subsubComponent&gt;
               &lt;subsubComponent&gt;&lt;componentTitle&gt;"Do-It-
               Yourself <phrase role="found">User Testing</phrase>"
               &lt;/componentTitle&gt;
            &lt;/subsubComponent&gt; 
         &lt;/subComponent&gt;
      &lt;/component&gt;
      ...
   &lt;/part&gt;      
&lt;/content&gt;</eg>
</div3>
<div3 id="wildcard-queries-results-q5">
<head>Q5 Specified Range of Characters Suffix Wildcard Query</head>
<p>Find all books with the word "test" with a three to four character suffix in the text.</p>
<p>This query finds a word with a number of characters within a specified range in a suffix (specified range of characters after the last character).</p>
<ulist>
<item>
<p>Operands: "test"</p>
</item>
<item>
<p>Functionality: word query, character wildcard (suffix) (3 to 4)</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./content</p>
</item>
<item>
<p>Return: ./@number, ./content</p>
</item>
<item>
<p>Comments: This query allows any three or four character suffix. It returns "testers" and "testing", but not "pretest" "tests" and "tested" 
						which also appear in the sample data. There is no "test" in the sample data, but if there was, this query would not have found it.</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">for $book in doc("http://bstore1.example.com/full-text.xml")
   /books/book
let $cont := $book//content[. ftcontains "test.{3,4}" 
   with wildcards]
where count($cont)&gt;0
return $book/@number, $cont</eg>
<p>
<emph>Solution in XPath:</emph>
</p>
<eg role="xpath" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
/books/book[count(./content ftcontains "test.{3,4}" 
with wildcards)&gt;0]/(@number|./content)</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&gt;&lt;/book&gt;
&lt;content&gt;
   &lt;introduction&gt;
      ...
      &lt;p&gt;Expert reviews and usability <phrase role="found">testing</phrase> are 
      methods of identifying problems in layout, 
      terminology, and navigation before they frustrate
      users and drive them away from your site.&lt;/p&gt;
      ...
   &lt;/introduction&gt;
   ...
   &lt;part number="2"&gt;
      &lt;chapter&gt;
         &lt;title&gt;Usability <phrase role="found">Testing</phrase>&lt;/title&gt;
         &lt;p&gt;Once the problems identified by expert 
         reviews have been corrected, it is time to 
         conduct some tests of the site with your unique 
         audience or audiences by conducting usability 
         <phrase role="found">testing</phrase>.&lt;/p&gt;
         ...
      &lt;/chapter&gt;
   &lt;/part&gt; 
&lt;/content&gt;
     						
&lt;book number="2"&gt;&lt;/book&gt;
&lt;content&gt;
   &lt;introduction&gt;
      &lt;p&gt;This is a basic handbook for planning and 
      conducting usability tests on Web sites. Usability
      <phrase role="found">testing</phrase> should be used in conjunction with other 
      expert review methods.&lt;/p&gt;
      ...
   &lt;/introduction&gt;
   &lt;part number="1"&gt;
      &lt;chapter&gt;
         &lt;p&gt;Take the following steps to plan &gt;usability
         <phrase role="found">testing</phrase>. &lt;step number="1"&gt;Clarify and 
         articulate the goal of the &gt;usability <phrase role="found">testing</phrase>. 
         &lt;step number="1"&gt;Clarify and 
         articulate the goal of the usability testing.
         &lt;/step&gt; &lt;step number="2"&gt;Identify tasks which 
         are critical for users to be able to complete 
         successfully.&lt;/step&gt; &lt;step number="3"&gt;Compile 
         a script of questions or instructions which 
         will prompt the user to attempt those 
         tasks.&lt;/step&gt; &lt;step number="4"&gt;Identify your 
         users and begin recruiting them.&lt;/step&gt; &lt;step 
         number="5"&gt;Conduct a pretest on a few users.
         &lt;/step&gt; &lt;step number="6"&gt;Edit the script based 
         on insights gleaned from the pretest.&lt;/step&gt; 
         &lt;step number="7"&gt;Resume testing.&lt;/step&gt;&lt;/p&gt;
      &lt;/chapter&gt;
   &lt;/part&gt;
   &lt;part number="2"&gt;
      &lt;chapter&gt;
         &lt;title&gt;Conducting Usability Tests&lt;/title&gt; 
         ...
         &lt;p&gt;Give the user the script, then assure them 
         that you are testing the Web site, not them. 
         Users are asked to verbalize their thoughts as 
         they complete the tasks. The event is recorded 
         or someone takes notes. It is often preferable 
         to have two <phrase role="found">testers</phrase>, &lt;footnote&gt;Usability
         <phrase role="found">testing</phrase> can be done at great expense or on a 
         shoe string, using &lt;testingProcedure&gt;in-house 
         expertise&lt;/testingProcedure&gt; or 
         &lt;testingProcedure&gt;contracting with human 
         computer interaction professionals
         &lt;/testingProcedure&gt;.&lt;/footnote&gt; one to ask the 
         questions, another to take notes. <phrase role="found">Testers</phrase> should 
         offer no guidance or comments to the user. Mouse 
         movements, typing, expressions, and the user's 
         words should be recorded.&lt;/p&gt;
      &lt;/chapter&gt;
      &lt;chapter&gt;
         &lt;title&gt;Evaluating and Implementing Results&lt;/title&gt; 
         &lt;p&gt;Compile the results and review collectively. 
         Make changes to the site to alleviate the problems 
         found in Web site components which were propagating 
         the largest number of or the most devastating errors. 
         Begin new iterations of <phrase role="found">testing</phrase> and changes, until 
         users are successful in the accomplishing the 
         tasks.&lt;/p&gt;
      &lt;/chapter&gt;
   &lt;/part&gt;
&lt;/content&gt;

&lt;book number="3"&gt;&lt;/book&gt;
&lt;content&gt;
   ...
   &lt;part number="2"&gt;&lt;container type="box"&gt;3-5&lt;/container&gt;
      &lt;title&gt;Writings File, 
      &lt;date normalize="1985/1999"&gt;1985-1999&lt;/date&gt;
      &lt;/title&gt;
      ...
      &lt;component&gt;
         &lt;componentTitle&gt;Writings by Usabilityguy
         &lt;/componentTitle&gt;
         &lt;subComponent&gt;
            &lt;componentTitle&gt;&lt;componentDate normalize="1996"&gt;
            1996&lt;/componentDate&gt;
            &lt;/componentTitle&gt; 
            &lt;subsubComponent&gt;
               &lt;componentTitle&gt;"How Many Users Are Enough 
               for User <phrase role="found">Testing</phrase>?"&lt;/componentTitle&gt;
            &lt;/subsubComponent&gt; 
            ...
            &lt;subsubComponent&gt;
               &lt;componentTitle&gt;"When Are You Done <phrase role="found">Testing</phrase>?"
               &lt;/componentTitle&gt;
            &lt;/subsubComponent&gt;
            &lt;subsubComponent&gt;
               &lt;componentTitle&gt;"Do-It-Yourself User <phrase role="found">Testing</phrase>"
               &lt;/componentTitle&gt;
            &lt;/subsubComponent&gt; 
         &lt;/subComponent&gt;
      &lt;/component&gt;
      ...
   &lt;/part&gt;      
&lt;/content&gt;</eg>
</div3>
</div2>
</div1>
<div1 id="Stemming">
<head>Use Case "STEMMING": Word Stemming Queries</head>
<div2 id="stemming-description">
<head>Description</head>
<p>These use cases invoke a stemming algorithm (e.g., Porter) which returns noun, verb, adjective, and adverb 
forms of a word or root of a word in singular and plural.</p>
</div2>
<div2 id="stemming-queries-results">
<head>Queries and Results</head>
<div3 id="stemming-queries-results-q1">
<head>Q1 Query Stemming on Word Root</head>
<p>Find all books with the word "test" in the text.</p>
<p>This query finds a word and its variants applying a stemming algorithm.</p>
<ulist>
<item>
<p>Operands: "test"</p>
</item>
<item>
<p>Functionality: word query, stemming</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./content</p>
</item>
<item>
<p>Return: .</p>
</item>
<item>
<p>Comments: Unlike the wildcard queries in Section 5 (WILDCARD) which allow any suffix, this query will 
						not return the word "testimony" which occurs in the sample data.</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">for $book in doc("http://bstore1.example.com/full-text.xml")
   /books/book
let $cont := $book//content[. ftcontains "test" 
   with stemming]
where count($cont)&gt;0
return $book</eg>
<p>
<emph>Solution in XPath:</emph>
</p>
<eg role="xpath" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
/books/book[count(.//content ftcontains "test" 
with stemming)&gt;0]</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&gt;
   &lt;metadata&gt;
      ...
   &lt;/metadata&gt; 
   &lt;content&gt;
      &lt;introduction&gt;
         ...
         &lt;p&gt;Expert reviews and usability <phrase role="found">testing</phrase> are 
         methods of identifying problems in layout, 
         terminology, and navigation before they frustrate
         users and drive them away from your site.&lt;/p&gt;
         ...
      &lt;/introduction&gt;
      ...
      &lt;part number="2"&gt;
         &lt;chapter&gt;
            &lt;title&gt;Usability <phrase role="found">Testing</phrase>&lt;/title&gt;
            &lt;p&gt;Once the problems identified by expert 
            reviews have been corrected, it is time to 
            conduct some <phrase role="found">tests</phrase> of the site with your unique 
            audience or audiences by conducting usability 
            <phrase role="found">testing</phrase>.&lt;/p&gt;
            ...
         &lt;/chapter&gt;
      &lt;/part&gt; 
   &lt;/content&gt;
&lt;/book&gt;     						

&lt;book number="2"&gt;
   &lt;metadata&gt;
      ...
   &lt;/metadata&gt; 
   &lt;content&gt;
      &lt;introduction&gt;
         &lt;p&gt;This is a basic handbook for planning and 
         conducting usability <phrase role="found">tests</phrase> on Web sites. Usability 
         <phrase role="found">testing</phrase> should be used in conjunction with other 
         expert review methods.&lt;/p&gt;
         ...
      &lt;/introduction&gt;
      &lt;part number="1"&gt;
         &lt;chapter&gt;
            &lt;title&gt;Planning then Conducting Usability 
            <phrase role="found">Tests</phrase>&lt;/title&gt; 
            &lt;p&gt;Take the following steps to plan usability 
            <phrase role="found">testing</phrase>. &lt;step number="1"&gt;Clarify and 
            articulate the goal of the usability <phrase role="found">testing</phrase>.
            &lt;/step&gt; &lt;step number="2"&gt;Identify tasks which 
            are critical for users to be able to complete 
            successfully.&lt;/step&gt; &lt;step number="3"&gt;Compile 
            a script of questions or instructions which 
            will prompt the user to attempt those 
            tasks.&lt;/step&gt; &lt;step number="4"&gt;Identify your 
            users and begin recruiting them.&lt;/step&gt; &lt;step 
            number="5"&gt;Conduct a pretest on a few users.
            &lt;/step&gt; &lt;step number="6"&gt;Edit the script based 
            on insights gleaned from the pretest.&lt;/step&gt; 
            &lt;step number="7"&gt;Resume <phrase role="found">testing</phrase>.&lt;/step&gt;&lt;/p&gt;
         &lt;/chapter&gt;
      &lt;/part&gt;
      &lt;part number="2"&gt;
         &lt;chapter&gt;
            &lt;title&gt;Conducting Usability <phrase role="found">Tests</phrase>&lt;/title&gt; 
            &lt;p&gt;Users can be <phrase role="found">tested</phrase> at any computer 
            workstation &lt;footnote&gt;They may be more 
            comfortable at their own workstation than in 
            a lab.&lt;/footnote&gt; or in a lab.&lt;/p&gt;
            &lt;p&gt;Give the user the script, then assure them 
            that you are <phrase role="found">testing</phrase> the Web site, not them. 
            Users are asked to verbalize their thoughts as 
            they complete the tasks. The event is recorded 
            or someone takes notes. It is often preferable 
            to have two <phrase role="found">testers</phrase>, &lt;footnote&gt;Usability 
            <phrase role="found">testing</phrase> can be done at great expense or on a 
            shoe string, using &lt;testingProcedure&gt;in-house 
            expertise&lt;/testingProcedure&gt; or 
            &lt;testingProcedure&gt;contracting with human 
            computer interaction professionals
            &lt;/testingProcedure&gt;.&lt;/footnote&gt; one to ask the 
            questions, another to take notes. <phrase role="found">Testers</phrase> should 
            offer no guidance or comments to the user. Mouse 
            movements, typing, expressions, and the user's 
            words should be recorded.&lt;/p&gt;
         &lt;/chapter&gt;
         &lt;chapter&gt;
            &lt;title&gt;Evaluating and Implementing Results&lt;/title&gt; 
            &lt;p&gt;Compile the results and review collectively. 
            Make changes to the site to alleviate the problems 
            found in Web site components which were propagating 
            the largest number of or the most devastating errors. 
            Begin new iterations of <phrase role="found">testing</phrase> and changes, until  
            users are successful in the accomplishing the 
            tasks.&lt;/p&gt;
         &lt;/chapter&gt;
      &lt;/part&gt;
   &lt;/content&gt;
&lt;/book&gt;    

&lt;book number="3"&gt;
   &lt;metadata&gt;
      ...
   &lt;/metadata&gt; 
   &lt;content&gt;
      ...   
      &lt;part number="2"&gt;&lt;container type="box"&gt;3-5&lt;/container&gt;
         &lt;title&gt;Writings File, 
         &lt;date normalize="1985/1999"&gt;1985-1999&lt;/date&gt;
         &lt;/title&gt;
         ...
         &lt;component&gt;
            &lt;componentTitle&gt;Writings by Usabilityguy
            &lt;/componentTitle&gt;
            &lt;subComponent&gt;
               &lt;componentTitle&gt;&lt;componentDate normalize="1996"&gt;
               1996&lt;/componentDate&gt;
               &lt;/componentTitle&gt; 
               &lt;subsubComponent&gt;
                  &lt;componentTitle&gt;"How Many Users Are Enough 
                  for User <phrase role="found">Testing</phrase>?"&lt;/componentTitle&gt;
               &lt;/subsubComponent&gt; 
               &lt;subsubComponent&gt;
                  &lt;componentTitle&gt;"How to Evaluate Results from 
                  User <phrase role="found">Tests</phrase>."&lt;/componentTitle&gt;
               &lt;/subsubComponent&gt;
               &lt;subsubComponent&gt;
                  &lt;container type="box"&gt;5&lt;/container&gt;
                  &lt;componentTitle&gt;"When Are You Done <phrase role="found">Testing</phrase>?
                  &lt;/componentTitle&gt;
               &lt;/subsubComponent&gt;
               &lt;subsubComponent&gt;
                  &lt;componentTitle&gt;"Do-It-Yourself User <phrase role="found">Testing</phrase>"
                  &lt;/componentTitle&gt;
               &lt;/subsubComponent&gt; 
            &lt;/subComponent&gt;
         &lt;/component&gt;
         ...
      &lt;/part&gt;   
   &lt;/content&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="stemming-queries-results-q2">
<head>Q2 Query Stemming on Multiple Word Roots</head>
<p>Find all books with the phrases "usability testing" or "user testing" in the text.</p>
<p>This query finds phrases applying a stemming algorithm to selected words within the phrases.</p>
<ulist>
<item>
<p>Operands: "usability testing" "use testing" </p>
</item>
<item>
<p>Functionality: phrase queries, stemming</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./content</p>
</item>
<item>
<p>Return: ./@number, ./metadata/title/text(), ./content</p>
</item>
<item>
<p>Comments: This query applies stemming to one word in a phrase. Unlike the wildcard queries in Section 5 (WILDCARD) which allow any suffix, a stemmed query on "us" will not 
return "user" and "usability", because they do not share the share root. This query uses an <code>or</code> query introduced in Section 10 (LOGICAL).</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">for $book in doc("http://bstore1.example.com/full-text.xml")
   /books/book
let $cont := $book//content[. ftcontains 
   (("usable" with stemming) &amp;&amp; "testing" phrase) 
   || (("use" with stemming) &amp;&amp; "testing" phrase)]
where count($cont)&gt;0
return $book/@number, $book/metadata/title/text(), $cont</eg>
<p>
<emph>Solution in XPath:</emph>
</p>
<eg role="xpath" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
/books/book[count(.//content ftcontains (("usable" with stemming) 
&amp;&amp; "testing" phrase) || (("use" with stemming) 
&amp;&amp; "testing" phrase))&gt;0]/(@number|./metadata/title/text()
|./content)</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&gt;&lt;/book&gt;  
&lt;title&gt;Improving the Usability of a Web Site Through 
Expert Reviews and Usability Testing&lt;/title&gt;
&lt;content&gt;
   &lt;introduction&gt;
      ...
      &lt;p&gt;Expert reviews and <phrase role="found">usability testing</phrase> are 
      methods of identifying problems in layout, 
      terminology, and navigation before they frustrate
      users and drive them away from your site.&lt;/p&gt;
      ...
   &lt;/introduction&gt;
   ...
   &lt;part number="2"&gt;
      &lt;chapter&gt;
         &lt;title&gt;<phrase role="found">Usability Testing</phrase>&lt;/title&gt;
         &lt;p&gt;Once the problems identified by expert 
         reviews have been corrected, it is time to 
         conduct some tests of the site with your unique 
         audience or audiences by conducting <phrase role="found">usability</phrase> 
         <phrase role="found">testing</phrase>.&lt;/p&gt;
         ...
      &lt;/chapter&gt;
   &lt;/part&gt; 
&lt;/content&gt;
    
&lt;book number="2"&gt;&lt;/book&gt;  
&lt;title&gt;Usability Basics: How to Plan for and Conduct 
Usability Tests on Web Site Thereby Improving the 
Usability of Your Web Site&lt;/title&gt; 
&lt;content&gt;
   &lt;introduction&gt;
      &lt;p&gt;This is a basic handbook for planning and 
      conducting usability tests on Web sites. <phrase role="found">Usability</phrase>
      <phrase role="found">testing</phrase> should be used in conjunction with other 
      expert review methods.&lt;/p&gt;
      ...
   &lt;/introduction&gt;
   &lt;part number="1"&gt;
      &lt;chapter&gt;
         &lt;p&gt;Take the following steps to plan <phrase role="found">usability</phrase>
      <phrase role="found">testing</phrase>. &lt;step number="1"&gt;Clarify and 
          articulate the goal of the <phrase role="found">usability testing</phrase>. 
         &lt;step number="1"&gt;Clarify and 
         articulate the goal of the usability testing.
         &lt;/step&gt; &lt;step number="2"&gt;Identify tasks which 
         are critical for users to be able to complete 
         successfully.&lt;/step&gt; &lt;step number="3"&gt;Compile 
         a script of questions or instructions which 
         will prompt the user to attempt those 
         tasks.&lt;/step&gt; &lt;step number="4"&gt;Identify your 
         users and begin recruiting them.&lt;/step&gt; &lt;step 
         number="5"&gt;Conduct a pretest on a few users.
         &lt;/step&gt; &lt;step number="6"&gt;Edit the script based 
         on insights gleaned from the pretest.&lt;/step&gt; 
         &lt;step number="7"&gt;Resume testing.&lt;/step&gt;&lt;/p&gt;
      &lt;/chapter&gt;
   &lt;/part&gt;
   &lt;part number="2"&gt;
      &lt;chapter&gt;
         &lt;title&gt;Conducting Usability Tests&lt;/title&gt; 
         ...
         &lt;p&gt;Give the user the script, then assure them 
         that you are testing the Web site, not them. 
         Users are asked to verbalize their thoughts as 
         they complete the tasks. The event is recorded 
         or someone takes notes. It is often preferable 
         to have two testers, &lt;footnote&gt;<phrase role="found">Usability</phrase>
         <phrase role="found">testing</phrase> can be done at great expense or on a 
         shoe string, using &lt;testingProcedure&gt;in-house 
         expertise&lt;/testingProcedure&gt; or 
         &lt;testingProcedure&gt;contracting with human 
         computer interaction professionals
         &lt;/testingProcedure&gt;.&lt;/footnote&gt; one to ask the 
         questions, another to take notes. Testers should 
         offer no guidance or comments to the user. Mouse 
         movements, typing, expressions, and the user's 
         words should be recorded.&lt;/p&gt;
      &lt;/chapter&gt;
      ...
   &lt;/part&gt;
&lt;/content&gt;

&lt;book number="3"&gt;&lt;/book&gt;  
&lt;title&gt;John Wesley Usabilityguy: A Register of His 
Papers&lt;/title&gt;   
&lt;content&gt;
   ...
   &lt;part number="2"&gt;&lt;container type="box"&gt;3-5&lt;/container&gt;
      &lt;title&gt;Writings File, 
      &lt;date normalize="1985/1999"&gt;1985-1999&lt;/date&gt;
      &lt;/title&gt;
      ...
      &lt;component&gt;
         &lt;componentTitle&gt;Writings by Usabilityguy
         &lt;/componentTitle&gt;
         &lt;subComponent&gt;
            &lt;componentTitle&gt;&lt;componentDate normalize="1996"&gt;
            1996&lt;/componentDate&gt;
            &lt;/componentTitle&gt; 
            &lt;subsubComponent&gt;
               &lt;componentTitle&gt;"How Many Users Are Enough 
               for <phrase role="found">User Testing</phrase>?"&lt;/componentTitle&gt;
            &lt;/subsubComponent&gt; 
            ...
            &lt;subsubComponent&gt;
               &lt;subsubComponent&gt;&lt;componentTitle&gt;"Do-It-
               Yourself <phrase role="found">User Testing</phrase>"
               &lt;/componentTitle&gt;
            &lt;/subsubComponent&gt; 
         &lt;/subComponent&gt;
      &lt;/component&gt;
      ...
   &lt;/part&gt;      
&lt;/content&gt;</eg>
</div3>
</div2>
</div1>
<div1 id="Thesaurus">
<head>Use Case "THESAURUS": Queries Which Use Thesauri, Dictionaries, and Taxonomies</head>
<div2 id="thesaurus-description">
<head>Description</head>
<p>These use cases illustrate queries which return synonyms or related words identified by thesauri, dictionaries, and taxonomies.</p>
</div2>
<div2 id="thesaurus-queries-results">
<head>Queries and Results</head>
<div3 id="thesaurus-queries-results-q1">
<head>Q1 Query on Synonyms Identified by a Thesaurus</head>
<p>Find all introductions which quote someone.</p>
<p>This query finds words and phrases using a thesaurus to return synonyms.</p>
<ulist>
<item>
<p>Operands: "quote"</p>
</item>
<item>
<p>Functionality: word query, thesaurus support</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: .//introduction</p>
</item>
<item>
<p>Return: .</p>
</item>
<item>
<p>Comments: This query uses thesaurus support to identify synonyms for the word "quote" 
						via preferred and used for terms: "said", "says", "stated", "states", 
						"spoke", "speaks", "replied", "replies", "reply", "remarks", "remarked", "responded", "response", "reports", "reported", 
						"quotes", "quoted", "according to",	"commented", "discussed", "expressed", and "told". These words and phrases become additional 
						operands.</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">for $book in doc("http://bstore1.example.com/full-text.xml")
   /books/book
let $intro := $book//introduction[. ftcontains "quote" 
   with thesaurus at
   "http://bstore1.example.com/UsabilityThesaurus.xml" 
   relationship "synonyms"]
where count($intro)&gt;0
return $book</eg>
<p>
<emph>Solution in XPath:</emph>
</p>
<eg role="xpath" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
/books/book[count(.//introduction ftcontains "quote" 
with thesaurus at 
"http://bstore1.example.com/UsabilityThesaurus.xml" 
relationship "synonyms")&gt;0]</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&gt;
   &lt;metadata&gt;
      ...
   &lt;/metadata&gt; 
   &lt;content&gt;
      ...   
      &lt;introduction&gt;
         ...
         &lt;p&gt;The most successful projects employ multiple 
         methods in multiple iterations. As Millicent 
         Marigold <phrase role="found">remarked</phrase> during a recent conference, 
         "Don't stop. Iterate, iterate, then iterate 
         again."&lt;/p&gt;
         ...
      &lt;/introduction&gt;
   &lt;/content&gt;      
&lt;/book&gt;</eg>
</div3>
<div3 id="thesaurus-queries-results-q2">
<head>Q2 Query on Narrower Terms Identified by a Thesaurus</head>
<p>Find all books with text on improving "web site components".</p>
<p>This query finds words using a thesaurus to identify narrower terms.</p>
<ulist>
<item>
<p>Operands: "web site components"</p>
</item>
<item>
<p>Functionality: phrase query, thesaurus support</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./content</p>
</item>
<item>
<p>Return: .</p>
</item>
<item>
<p>Comments: This query employs a thesaurus to identify web site components via narrower terms: "layout", 
						"terminology", "graphics", "menus", and "navigation".  These words become additional operands.</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">for $book in doc("http://bstore1.example.com/full-text.xml")
   /books/book
let $cont := $book/content[. ftcontains "web site components" 
   with thesaurus at 
   "http://bstore1.example.com/UsabilityThesaurus.xml" 
   relationship "narrower terms" at most 2 levels]
where count($cont)&gt;0
return $book</eg>
<p>
<emph>Solution in XPath:</emph>
</p>
<eg role="xpath" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
/books/book[count(./content ftcontains "web site components" 
with thesaurus at 
"http://bstore1.example.com/UsabilityThesaurus.xml" 
relationship "narrower terms" at most 2 levels)&gt;0]</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&gt;
   &lt;metadata&gt;
      ...
   &lt;/metadata&gt; 
   &lt;content&gt;
      &lt;introduction&gt;
         ...   
         &lt;p&gt;Expert reviews and usability testing are 
         methods of identifying problems in <phrase role="found">layout</phrase>, 
         <phrase role="found">terminology</phrase>, and <phrase role="found">navigation</phrase> before they frustrate
         users and drive them away from your site.&lt;/p&gt; 
         ... 
      &lt;/introduction&gt;                   
      ... 
   &lt;/content&gt;  
&lt;/book&gt;   
      
&lt;book number="2"&gt;
   &lt;metadata&gt;
      ...
   &lt;/metadata&gt; 
   &lt;content&gt;
      ... 
      &lt;part number="2"&gt;
         ...
         &lt;chapter&gt;
            &lt;title&gt;Evaluating and Implementing Results&lt;/title&gt;   
            &lt;p&gt;Compile the results and review collectively. 
            Make changes to the site to alleviate the problems 
            found in <phrase role="found">Web site components</phrase> which were propagating 
            the largest number of or the most devastating errors. 
            Begin new iterations of testing and changes, until 
            users are successful in the accomplishing the 
            tasks.&lt;/p&gt;  
         &lt;/chapter&gt;
      &lt;/part&gt;       
   &lt;/content&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="thesaurus-queries-results-q3">
<head>Q3 Query on Broader Terms Identified by a Thesaurus</head>
<p>Are there any "letters" or "holiday cards" in John Wesley Usabilityguy's papers?</p>
<p>This query finds words and phrases using a thesaurus to identify broader terms.</p>
<ulist>
<item>
<p>Operands: "letters" "holiday cards"</p>
</item>
<item>
<p>Functionality: word query, phrase query, thesaurus support</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book[@number="3"]</p>
</item>
<item>
<p>Query context: ./content</p>
</item>
<item>
<p>Return: .</p>
</item>
<item>
<p>Comments: This query employs a thesaurus to identify the broader term "correspondence". It becomes an additional operand.</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">for $book in doc("http://bstore1.example.com/full-text.xml")
   /books/book[@number="3"]
let $cont := $book/content[. ftcontains 
   "letters" || "holiday cards" with thesaurus at 
   "http://bstore1.example.com/UsabilityThesaurus.xml" 
   relationship "BT" exactly 1 levels]
where count($cont)&gt;0
return $book</eg>
<p>
<emph>Solution in XPath:</emph>
</p>
<eg role="xpath" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
/books/book[count(./content ftcontains "letters" 
|| "holiday cards" with thesaurus at 
"http://bstore1.example.com/UsabilityThesaurus.xml" 
relationship "BT" exactly 1 levels)&gt;0]</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="3"&gt;
   &lt;metadata&gt;
      ...
   &lt;/metadata&gt; 
   &lt;content&gt;
      &lt;introduction&gt;
         &lt;p&gt;The papers of John Wesley Usabilityguy span the 
         years 1946-2001, with the bulk of the items 
         concentrated in the period from 1985 to 2001. The 
         papers feature his career as a developer of software 
         applications and usability specialist. The collection 
         consists of <phrase role="found">correspondence</phrase>, memoranda, journals, 
         speeches, article drafts, book drafts, notes, charts, 
         graphs, family papers, clippings, printed matter, 
         photographs, résumés and other materials.&lt;/p&gt;
      &lt;/introduction&gt;
      &lt;part number="1"&gt;&lt;container type="box"&gt;1-12&lt;/container&gt;
         &lt;title&gt;Subject File, &lt;date normalize="1930/1974"&gt;
         1930-1974&lt;/date&gt;&lt;/title&gt;
         &lt;introduction&gt;
            &lt;p&gt;<phrase role="found">Correspondence</phrase>, telegrams, memoranda, journals, 
            logs, testimony, approved travel orders, invitations, 
            charts, graphs, forms, biographical data, photographs, 
            book drafts, clippings and other printed matter, 
            résumés and miscellaneous material. Organized by 
            name of person or organization, topic, or type of 
            material.&lt;/p&gt;
         &lt;/introduction&gt;            
      &lt;/part&gt;
      &lt;part number="2"&gt;&lt;container type="box"&gt;3-5&lt;/container&gt;
         &lt;title&gt;Writings File, 
         &lt;date normalize="1985/1999"&gt;1985-1999&lt;/date&gt;
         &lt;/title&gt;
         &lt;introduction&gt;
            &lt;p&gt;<phrase role="found">Correspondence</phrase>, articles, book drafts, notes,
            contracts, clippings, and printed matter. Arranged 
            alphabetically by type (articles, books, reports, 
            and miscellaneous) and therein alphabetically by 
            type of material, subject, or title.&lt;/p&gt;
         &lt;/introduction&gt;    
         ...        
      &lt;/part&gt;
   &lt;/content&gt;    
&lt;/book&gt;</eg>
</div3>
<div3 id="thesaurus-queries-results-q4">
<head>Q4 Query on Word Which Sounds Like Other Words</head>
<p>	Find all books with words which sound like "Merrygould".</p>
<p>This query finds words using a dictionary of words which sound like the word queried.</p>
<ulist>
<item>
<p>Operands: "Merrygould"</p>
</item>
<item>
<p>Functionality: word query, sounds-like dictionary support</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: .</p>
<