<?xml version="1.0" encoding="utf-8"?>
<spec xmlns:e="http://www.w3.org/1999/XSL/Spec/ElementSyntax" 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-20050915</w3c-designation>
<w3c-doctype>W3C Working Draft</w3c-doctype>
<pubdate>
<day>15</day>
<month>September</month>
<year>2005</year>
</pubdate>
<publoc>
<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">http://www.w3.org/TR/2005/WD-xmlquery-full-text-use-cases-20050915/</loc>
</publoc>
<altlocs>
  <loc xmlns:xlink="http://www.w3.org/1999/xlink" href="http://www.w3.org/TR/2005/WD-xmlquery-full-text-use-cases-20050915/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-20050404/" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">http://www.w3.org/TR/2005/WD-xmlquery-full-text-use-cases-20050404/</loc>
</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 <loc xmlns:xlink="http://www.w3.org/1999/xlink" href="http://www.w3.org/TR/" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">http://www.w3.org/TR/</loc>.</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 fourth version of this document. Some query solutions have been changed based on implementer feedback and Task Force decisions. The most significant change is to the score syntax. 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 issue tracking system 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>The patent policy for this document is specified in 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>. Patent disclosures relevant to this specification may be found on the 
  <loc xmlns:xlink="http://www.w3.org/1999/xlink" href="http://www.w3.org/2002/08/xmlquery-IPR-statements" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">XML Query Working Group's patent disclosure page</loc> 
  and the 
  <loc xmlns:xlink="http://www.w3.org/1999/xlink" href="http://www.w3.org/Style/XSL/Disclosures" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">XSL Working Group's patent disclosure page</loc> 
  . An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) with respect to this specification should 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>
<head>Full-Text Use Cases: Preliminaries</head>
<div2>
<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>
<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 which may not be written in XPath include those which contain element constructors, and 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>
<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 clause.

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 all the queries in the document may be written as scored 
queries with the addition of a score clause.

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>
<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>
<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 most 
            comfortable at their own workstation.
            &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 "usability"
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 "usability"]</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 most 
            comfortable at their own workstation.
            &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>
</item>
<item>
<p>Return: .</p>
</item>
<item>
<p>Comments: This query uses sounds-like support to identify words which sound
						like the word
						"Merrygould". It
						returns the word
						"Marigold". Examples of
						how this query is
						implemented include
						keeping a list of
						similar words (akin to
						a thesaurus) or using
						a system based on
						phonetic similarity. </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[. ftcontains "Merrygould" 
   with thesaurus at 
   "http://bstore1.example.com/UsabilitySoundex.xml" 
   relationship "sounds like"]
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(. ftcontains "Merrygould" 
with thesaurus at 
"http://bstore1.example.com/UsabilitySoundex.xml" 
relationship "sounds like")&gt;0]</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&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 <phrase role="found">Marigold</phrase>&lt;/author&gt;
      &lt;author&gt;Montana <phrase role="found">Marigold</phrase>&lt;/author&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 
         <phrase role="found">Marigold</phrase> remarked during a recent conference, 
         "Don't stop. Iterate, iterate, then iterate 
         again."&lt;/p&gt;
         ...
      &lt;/introduction&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 <phrase role="found">Marigold</phrase>&lt;/author&gt;
      &lt;author&gt;Morty <phrase role="found">Marigold</phrase>&lt;/author&gt;
      ...
   &lt;/metadata&gt;
   &lt;content&gt;
      ...   
   &lt;/content&gt;   
&lt;/book&gt;</eg>
</div3>
<div3 id="thesaurus-queries-results-q5">
<head>Q5 Query on Word Spelled Similarly to Other Words</head>
<p>	Find all books which contain words that are close in spelling to "sucessfull".</p>
<p>This query finds words using a dictionary of words that are spelled similarly.</p>
<ulist>
<item>
<p>Operands: "sucessfull"</p>
</item>
<item>
<p>Functionality: word query, similarly spelled 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>
</item>
<item>
<p>Return: .</p>
</item>
<item>
<p>Comments: This query uses support for similarly spelled words to identify words close in 
spelling to "sucessfull". It returns the word "successful". Examples of
						how this query is
						implemented include
						keeping a list of
						similar words (akin to
						a thesaurus) or using
						a system based on spelling
						similarities.</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[. ftcontains "sucessfull" 
   with thesaurus at 
   "http://bstore1.example.com/spellcheck.xml" 
   relationship "misspelling of"]
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(. ftcontains "sucessfull" 
with thesaurus at 
"http://bstore1.example.com/spellcheck.xml" 
relationship "misspelling of")&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 <phrase role="found">successful</phrase> 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;/introduction&gt;
      &lt;part number="1"&gt;
         &lt;title&gt;Expert Reviews&lt;/title&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 <phrase role="found">successful</phrase> in 
            completing a step in the process.&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;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 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 <phrase role="found">successful</phrase> 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-q6">
<head>Q6 Query on Subordinate Terms Identified by a Taxonomy</head>
<p>Find out whether John Wesley Usabilityguy included research on "AIDS" and "other infectious diseases" among the charities he supported.</p>
<p>This query finds words using a taxonomy to identify subordinate terms.</p>
<ulist>
<item>
<p>Operands: "AIDS"</p>
</item>
<item>
<p>Functionality: word query, case-sensitivity (limited to upper case), 
taxonomy 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/part/component</p>
</item>
<item>
<p>Return: .</p>
</item>
<item>
<p>Comments: This query uses a taxonomy to identify other infectious diseases: "Hepatitis" and "Tuberculosis". 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[@number="3"]
let $comp := $book//component[. ftcontains "AIDS" uppercase 
   with thesaurus at 
   "http://bstore1.example.com/OurTaxonomy.xml" 
   relationship "disease in this category"]
where count($comp)&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[@number="3" and count(.//component ftcontains "AIDS" 
uppercase with thesaurus at 
"http://bstore1.example.com/OurTaxonomy.xml" 
relationship "disease in this category")&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;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;Charitable Contributions
            &lt;/componentTitle&gt; 
            &lt;subComponent&gt;
               &lt;componentTitle&gt;Diseases: <phrase role="found">AIDS</phrase>, <phrase role="found">Hepatitis</phrase>, 
               <phrase role="found">Tuberculosis</phrase>&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;</eg>
</div3>
</div2>
</div1>
<div1 id="Stop-word">
<head>Use Case "STOP-WORD": Queries on Stop Words</head>
<div2 id="stop-word-description">
<head>Description</head>
<p>These use cases query a phrase, one word of which has been identified as a stop word via a stop word list. The first treats the stop word as a stop word. The second does not, making it available again for querying.</p>
<p>Words identified as stop words may be routinely eliminated from queries, allowing any word to be substituted.</p>
</div2>
<div2 id="Stop-word-queries-results">
<head>Queries and Results</head>
<div3 id="stop-word-queries-results-q1">
<head>Q1 Query on Stop Word Treated as a Stop Word</head>
<p>Find all books with the phrase "planning then conducting" in the text where "then" is treated as a stop word.</p>
<p>This query finds a phrase substituting any word for a word which has been identified as a stop word via a stop word list.</p>
<ulist>
<item>
<p>Operands: "planning then conducting"</p>
</item>
<item>
<p>Functionality: stop word (then), 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: Once the stop word "then" has been identified via the stop word list at http://bstore1.example.com/StopWordList.xml, this query is reduced to a query on the phrase "planning" any word "conducting", allowing any word as a substitute for the stop word. It finds both "planning and conducting" and "planning then conducting" 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 
   "planning then conducting" with stop words 
   at "http://bstore1.example.com/StopWordList.xml"]
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 "planning then 
conducting" with stop words at 
"http://bstore1.example.com/StopWordList.xml")&gt;0]</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&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 <phrase role="found">planning and</phrase> 
         <phrase role="found">conducting</phrase> 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;<phrase role="found">Planning then Conducting</phrase> Usability
            Tests&lt;/title&gt; 
            ...
         &lt;/chapter&gt;
      &lt;/part&gt; 
      ...
   &lt;/content&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="stop-word-queries-results-q2">
<head>Q2 Query on Stop Word Not Treated as a Stop Word</head>
<p>Find all books with the phrase "planning then conducting" in the text where "then" is not treated as a stop word.</p>
<p>This query does not eliminate a word from the query even though it has been identified as a stop word in the stop word list, making it available again for querying.</p>
<ulist>
<item>
<p>Operands: "planning then conducting"</p>
</item>
<item>
<p>Functionality: stop word (then), 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: Even though the word "then" has been identified as a stop word, this query makes it available again for querying. It finds only "planning then conducting" 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 
   "planning then conducting" without stop words]
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 "planning then 
conducting" without stop words)&gt;0]</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="2"&gt;
   &lt;metadata&gt;
      ...
   &lt;/metadata&gt; 
   &lt;content&gt;
      ...
      &lt;part number="1"&gt;
         &lt;chapter&gt;
            &lt;title&gt;<phrase role="found">Planning then Conducting</phrase> Usability
            Tests&lt;/title&gt; 
            ...
         &lt;/chapter&gt;
      &lt;/part&gt; 
      ...
   &lt;/content&gt;
&lt;/book&gt;</eg>
</div3>
</div2>
</div1>
<div1 id="Character">
<head>Use Case "CHARACTER": Queries Specifying Normalized Forms of Characters and Tokenized Words</head>
<div2 id="character-description">
<head>Description</head>
<p>These use cases illustrate queries on words entered with 
diacritics sometimes finding the same; other times finding words with and without diacritics. They query words 
entered in upper case sometimes finding the same; other times finding words in both upper and lower case.</p>
</div2>
<div2 id="character-queries-results">
<head>Queries and Results</head>
<div3 id="character-queries-results-q1">
<head>Q1 Query on Word with Characters with Diacritics</head>
<p>Verify the existence of a "résumé" in the papers of John Wesley Usabilityguy.</p>
<p>This query finds a word only when diacritics are present.</p>
<ulist>
<item>
<p>Operands: "résumé"</p>
</item>
<item>
<p>Functionality: word query, functionality requiring presence of characters with diacritics, 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: The desired results include only the words "résumé" and "résumés" with diacritics, not the
						more often used words "resume" (which is present in the sample data) and "resumes".</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 "résumé." 
   with wildcards with diacritics]
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 "résumé." 
with wildcards with diacritics)&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 correspondence, memoranda, journals, 
         speeches, article drafts, book drafts, notes, charts, 
         graphs, family papers, clippings, printed matter, 
         photographs, <phrase role="found">résumés</phrase> 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, 
            <phrase role="found">résumés</phrase> 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;/content&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="character-queries-results-q2">
<head>Q2 Query on Word with Characters with and Without Diacritics</head>
<p>Verify the existence of a résumé in the papers of John Wesley Usabilityguy.</p>
<p>This query finds a word whether its diacritics are present or not.</p>
<ulist>
<item>
<p>Operands: "resume"</p>
</item>
<item>
<p>Functionality: word query, functionality allowing substitution of characters with and without diacritics, 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: The desired results include either the words "résumé" or "résumés" with diacritics or the words "resume" or "resumes" without diacritics. The user wants to find résumé, but has entered resume possibly because the system does not allow the entry of diacritics, the user does not know how to 
						enter diacritics, or the user did not want to take the time to enter them.</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 "resume." 
   with wildcards diacritics insensitive]
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 "resume." 
with wildcards diacritics insensitive)&gt;0]</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="2"&gt;
   &lt;metadata&gt;
      ...
   &lt;/metadata&gt; 
   &lt;content&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;<phrase role="found">Resume</phrase> testing.&lt;/step&gt;&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;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, <phrase role="found">résumés</phrase> 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, 
            <phrase role="found">résumés</phrase> 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;/content&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="character-queries-results-q3">
<head>Q3 Query on Word with Upper Case Characters</head>
<p>	Find out whether John Wesley Usabilityguy included research on "AIDS" among the charities he supported.</p>
<p>This query finds a word in upper case characters.</p>
<ulist>
<item>
<p>Operands: "AIDS"</p>
</item>
<item>
<p>Functionality: case-sensitivity (limited to upper case), word query</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: .</p>
</item>
<item>
<p>Return: .</p>
</item>
<item>
<p>Comments: This query does not return the word "aids" with lower case characters 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[. ftcontains "AIDS" uppercase]   
where count($book) &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(. ftcontains "AIDS" 
uppercase)&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;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;Charitable Contributions
            &lt;/componentTitle&gt; 
            &lt;subComponent&gt;
               &lt;componentTitle&gt;Diseases: <phrase role="found">AIDS</phrase>, Hepatitis, 
               Tuberculosis &lt;componentDate normalize=
               "1990/1999"&gt;1990-1999&lt;/componentDate&gt;
               &lt;/componentTitle&gt;
            &lt;/subComponent&gt; 
            ...
         &lt;/component&gt;
      &lt;/part&gt;
   &lt;/content&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="character-queries-results-q4">
<head>Q4 Query on Word with Upper Case and Lower Case Characters</head>
<p>	Find out whether John Wesley Usabilityguy included research on "AIDS" among the charities he supported.</p>
<p>This query finds a word with upper or lower case characters.</p>
<ulist>
<item>
<p>Operands: "AIDS"</p>
</item>
<item>
<p>Functionality: word query, case-insensitivity</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: .</p>
</item>
<item>
<p>Return: .</p>
</item>
<item>
<p>Comments: This query returns the word "aids" with characters in upper or lower case.</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[. ftcontains "AIDS" case insensitive]   
where count($book) &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(. ftcontains "AIDS" case 
insensitive)&gt;0]</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="2"&gt;
   &lt;metadata&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 <phrase role="found">aids</phrase>&lt;/subject&gt;
      &lt;/subjects&gt;      
      ...
   &lt;/metadata&gt; 
   &lt;content&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;Charitable Contributions
            &lt;/componentTitle&gt; 
            &lt;subComponent&gt;
               &lt;componentTitle&gt;Diseases: <phrase role="found">AIDS</phrase>, Hepatitis, 
               Tuberculosis &lt;componentDate normalize=
               "1990/1999"&gt;1990-1999&lt;/componentDate&gt;
               &lt;/componentTitle&gt;
            &lt;/subComponent&gt; 
            ...
         &lt;/component&gt;
      &lt;/part&gt;
   &lt;/content&gt;
&lt;/book&gt;</eg>
</div3>
</div2>
</div1>
<div1 id="Logical">
<head>Use Case "LOGICAL": Queries with Logical Expressions (Or, And, and Not Queries)</head>
<div2 id="logical-description">
<head>Description</head>
<p>These use cases include queries containing logical expressions: <code>or</code>, <code>and</code>, the unary <code>not</code>, 
<code>and not</code>, and <code>mild not</code>.</p>
</div2>
<div2 id="logical-queries-results">
<head>Queries and Results</head>
<div3 id="logical-queries-results-q1">
<head>Q1 Or Query</head>
<p>Find all books with the words "web" or "software" in the text.</p>
<p>This query finds any or all of the words.</p>
<ulist>
<item>
<p>Operands: "web" "software"</p>
</item>
<item>
<p>Functionality: word query, <code>or</code> 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>Comment: The <code>or</code> query returns any or all of words queried.</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" 
   || "software"]
where fn: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" || "software")&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 usability of a <phrase role="found">Web</phrase> site is how well the 
         site supports the user in achieving specified 
         goals. A <phrase role="found">Web</phrase> 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;This book has been approved by the <phrase role="found">Web</phrase> 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 <phrase role="found">web</phrase> sites based 
            on research in human computer interaction 
            and their experience in the field.&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 <phrase role="found">Web</phrase> pages) or
            &lt;b&gt;w&lt;/b&gt;ireframes (electronic mockups) are 
            available. They should be conducted using 
            the hardware and <phrase role="found">software</phrase> 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 <phrase role="found">Web</phrase>  
            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 <phrase role="found">Web</phrase> 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;/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 tests on <phrase role="found">Web</phrase> 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 <phrase role="found">Web</phrase> Site
         Users Association.&lt;/p&gt;
      &lt;/introduction&gt;
      &lt;part number="1"&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 <phrase role="found">Web</phrase> 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 <phrase role="found">Web</phrase> 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;/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 <phrase role="found">software</phrase> 
         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;component&gt;&lt;container type="box"&gt;1&lt;/container&gt;
           &lt;componentTitle&gt;Computers&lt;/componentTitle&gt;
           &lt;subComponent&gt;
              &lt;componentTitle&gt;<phrase role="found">Software</phrase>, 
              &lt;componentDate normalize="1946/1947"&gt;1946-1947
              &lt;/componentDate&gt;
              &lt;/componentTitle&gt;
           &lt;/subComponent&gt;   
           ...
         &lt;/component&gt;
         &lt;component&gt;
           &lt;componentTitle&gt;<phrase role="found">Web</phrase> User Appreciation Award, 
           &lt;componentDate normalize="1956"&gt;1956&lt;/componentDate&gt;
           &lt;/componentTitle&gt;
         &lt;/component&gt;
         ...
      &lt;/part&gt;  
   &lt;/content&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="logical-queries-results-q2">
<head>Q2 And Query</head>
<p>Find all books with the words "web" "software" in the text.</p>
<p>This query finds all of the words.</p>
<ulist>
<item>
<p>Operands: "web" "software"</p>
</item>
<item>
<p>Functionality: word queries, <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: ./content</p>
</item>
<item>
<p>Return: .</p>
</item>
<item>
<p>Comments: The <code>and</code> query finds all the words.</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" 
   &amp;&amp; "software"]
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" &amp;&amp; "software")&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;author&gt;Elina Rose&lt;/author&gt;
         &lt;p&gt;The usability of a <phrase role="found">Web</phrase> site is how well the 
         site supports the user in achieving specified 
         goals. A <phrase role="found">Web</phrase> 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;This book has been approved by the <phrase role="found">Web</phrase> 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 <phrase role="found">web</phrase> sites based 
            on research in human computer interaction 
            and their experience in the field.&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 <phrase role="found">Web</phrase> pages) or
            &lt;b&gt;w&lt;/b&gt;ireframes (electronic mockups) are 
            available. They should be conducted using 
            the hardware and <phrase role="found">software</phrase> 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 <phrase role="found">Web</phrase>  
            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 <phrase role="found">Web</phrase> 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;/content&gt;
&lt;/book&gt;   
    
&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 <phrase role="found">software</phrase> 
         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;component&gt;&lt;container type="box"&gt;1&lt;/container&gt;
           &lt;componentTitle&gt;Computers&lt;/componentTitle&gt;
           &lt;subComponent&gt;
              &lt;componentTitle&gt;<phrase role="found">Software</phrase>, 
              &lt;componentDate normalize="1946/1947"&gt;1946-1947
              &lt;/componentDate&gt;
              &lt;/componentTitle&gt;
           &lt;/subComponent&gt;   
           ...
         &lt;/component&gt;
         &lt;component&gt;
           &lt;componentTitle&gt;<phrase role="found">Web</phrase> User Appreciation Award, 
           &lt;componentDate normalize="1956"&gt;1956&lt;/componentDate&gt;
           &lt;/componentTitle&gt;
         &lt;/component&gt;
         ...
      &lt;/part&gt;  
   &lt;/content&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="logical-results-q3">
<head>Q3 And Query Ordered</head>
<p>Find all book text containing the words "goal" "obstacles" "task" in this order.</p>
<p>This query finds multiple words in the order queried.</p>
<ulist>
<item>
<p>Operands: "goal" "obstacles" "task"</p>
</item>
<item>
<p>Functionality: ordered 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: This query finds multiple words in a specified 
order. It is more permissive than a phrase query. It is comparable to an 
ordered distance query where the number of intervening words is zero or more.</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 
   "goal" &amp;&amp; "obstacles" &amp;&amp; "task" ordered]
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 
"goal" &amp;&amp; "obstacles" &amp;&amp; "task" ordered)&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;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 <phrase role="found">goal</phrase> of 
            identifying any <phrase role="found">obstacles</phrase> to completing the 
            <phrase role="found">task</phrase> 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;/content&gt;
&lt;/book&gt;
</eg>
</div3>
<div3 id="logical-queries-results-q4">
<head>Q4 Unary Not Query</head>
<p>Find all books which do not belong in a collection on "usability testing".</p>
<p>This query finds books which do not contain a phrase in an element and its descendants.</p>
<ulist>
<item>
<p>Operands: "usability testing" </p>
</item>
<item>
<p>Functionality: phrase query, character wildcard (suffix) (0 or more), <code>unary not</code> query</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: .</p>
</item>
<item>
<p>Return: .</p>
</item>
<item>
<p>Comments: Unlike the <code>and not</code> query below, the <code>unary not</code> query 
requires only one operand. This query has value for information architects and data managers 
who will use it for checks such as this one: to find nonconforming data in a document or a 
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
let $not := $book[. ftcontains ! "us.* testing"
   with wildcards]
where count($not) &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(. ftcontains  ! "us.* testing" 
with wildcards)&gt;0]</eg>
<p>
<emph>Expected Result: No results returned.</emph>
</p>
</div3>
<div3 id="logical-queries-results-q5">
<head>Q5 And Not Query</head>
<p>Find all books with the word "usability" and not the word "plan" in the metadata.</p>
<p>This query finds a word only when another is not found in an element or its descendants.</p>
<ulist>
<item>
<p>Operands: "usability" "plan"</p>
</item>
<item>
<p>Functionality: word query, <code>and not</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</p>
</item>
<item>
<p>Return: .</p>
</item>
<item>
<p>Comments: The <code>and not</code> query is also called a <code>but</code>, <code>but not</code>, and 
<code>without</code> query. Unlike the <code>unary not</code> query above,this query requires two operands. Book 2
which contains the words "usability" and "plan" in the metadata is not returned.</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 $up := $book[./metadata ftcontains "usability" 
   &amp;&amp; ! "plan"]
where count($up) &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 ftcontains "usability" 
&amp;&amp; ! "plan")&gt;0]</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&gt;
   &lt;metadata&gt;				
      &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;/metadata&gt;
   &lt;content&gt;
   ...   
   &lt;/content&gt;   
&lt;/book&gt;

&lt;book number="3"&gt;
   &lt;metadata&gt;	
      ...			
      &lt;subjects xml:lang="en"&gt;
         ...  
         &lt;subject&gt;<phrase role="found">Usability</phrase> Testing&lt;/subject&gt;
         ... 
      &lt;/subjects&gt;  
      ...
   &lt;/metadata&gt;
   &lt;content&gt;
   ...   
   &lt;/content&gt;   
&lt;/book&gt;


</eg>
</div3>
<div3 id="logical-queries-results-q6">
<head>Q6 And Not Query Where Second Operand Is a Subset of the First Operand</head>
<p>Find all books with listings for "résumés", "drafts", or "correspondence", and not "book drafts" in the text.</p>
<p>This query finds books with multiple words and not a phrase containing one of those words.</p>
<ulist>
<item>
<p>Operands: "résumés" "drafts" "correspondence" "book drafts"</p>
</item>
<item>
<p>Functionality: word queries,  <code>or</code> query, phrase query, <code>and not</code> query, 
						functionality requiring presence of diacritics</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 will not return a result the user wants because that result 
						also includes what the user does not want, "book drafts".</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 
   (("résumés" with diacritics) || "drafts" 
   || "correspondence") &amp;&amp; ! "book drafts"]
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 (("résumés" 
with diacritics) || "drafts" || "correspondence") 
&amp;&amp; ! "book drafts")&gt;0]</eg>
<p>
<emph>Expected Result: No results returned.</emph>
</p>
</div3>
<div3 id="logical-queries-results-q7">
<head>Q7 Mild Not Query Where Second Operand Is a Subset of the First Operand</head>
<p>Find all books with listings for "résumés", "drafts", or "correspondence", and not "book 
						drafts", in the metadata or text.</p>
<p>This query finds books with multiple words and not a phrase which contains one of the words, while not eliminating a result if it contains the phrase as well as one of  the words searched.</p>
<ulist>
<item>
<p>Operands: "résumés" "drafts" "correspondence" "book drafts"</p>
</item>
<item>
<p>Functionality: word queries, <code>or</code> query, phrase query, <code>mild not</code> query, 
						functionality requiring presence of diacritics</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 will return a result
the user wants even though it contains the phrase the user
deprecated via the mild not, "book drafts". The user will not lose results which 
						contain what he wants when that book also contains what he does not want. Books containing 
						instances of "book drafts" (a subset of "drafts") are not excluded, merely not considered.</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 
   (("résumés" with diacritics) || "drafts" 
   || "correspondence") not in "book drafts"]
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 (("résumés" 
with diacritics) || "drafts" || "correspondence") 
not in "book drafts")&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 <phrase role="found">drafts</phrase>, book drafts, notes, charts, 
         graphs, family papers, clippings, printed matter, 
         photographs, <phrase role="found">résumés</phrase> and other materials.&lt;/p&gt;
         &lt;/introduction&gt;
      ...      
   &lt;/content&gt;
&lt;/book&gt;</eg>
</div3>
</div2>
</div1>
<div1 id="Cardinality">
<head>Use Case "CARDINALITY": Queries in Same, Any, Every Instance of an Element, and Occurrence Count Query</head>
<div2 id="cardinality-description">
<head>Description</head>
<p>These use cases illustrate instance queries and occurrence count queries. They query words within the same, any, and every instance of an element. Another query finds a phrase only if it occurs over a specified number of times in a book.</p>
</div2>
<div2 id="cardinality-queries-results">
<head>Queries and Results</head>
<div3 id="cardinality-queries-results-q1">
<head>Q1 Query in Same Instance of an Element</head>
<p>Find all books with the phrase "web site" and the word "usability" in the same subject.</p>
<p>This query finds a word and a phrase in the same instance of an element.</p>
<ulist>
<item>
<p>Operands: "web site" "usability"</p>
</item>
<item>
<p>Functionality: phrase query, word query, <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/subjects/subject</p>
</item>
<item>
<p>Return: .</p>
</item>
<item>
<p>Comments: This query finds a word and a phrase in an instance of an element, not allowing one 
of the operands to be found in an instance of the element and the other operand in a different instance of 
the element. This query does not find Book 2 which has "usability" and "web site" in different instances of the <code>subject</code> element.</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 $subj := $book/metadata/subjects/subject[. ftcontains 
   "web site" &amp;&amp; "usability"]
where count($subj)&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/subjects/subject ftcontains 
"web site" &amp;&amp; "usability")&gt;0]</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&gt;
   &lt;metadata&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;<phrase role="found">Web site</phrase> <phrase role="found">usability</phrase>&lt;/subject&gt;
      &lt;/subjects&gt;
      ...
   &lt;/metadata&gt;
   &lt;content&gt;
      ...
   &lt;/content&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="cardinality-queries-results-q2">
<head>Q2 Query in Any Instance of an Element (Existential Quantification)</head>
<p>Find all books with the phrase "web site" and the word "usability" in any subject.</p>
<p>This query finds a word and a phrase in any instance of an element across the siblings of the same element. The word and the phrase may be in different elements.</p>
<ulist>
<item>
<p>Operands: "web site" "usability"</p>
</item>
<item>
<p>Functionality: phrase query, word query, <code>and</code> query, existential quantification</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: .</p>
</item>
<item>
<p>Comments: This query returns words and phrases in any instance of an 
						element, allowing one of the operands to be found in one sibling and the other operand 
						in a different sibling of the same element name.</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 $subj := $book/metadata/subjects/subject            
where (some $s1 in $subj satisfies $subj ftcontains "web site")    
   and (some $s2 in $subj satisfies $subj ftcontains "usability")
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(some $s1 in ./metadata/subjects/subject satisfies 
./metadata/subjects/subject ftcontains "web site") 
and (some $s2  in ./metadata/subjects/subject satisfies 
./metadata/subjects/subject ftcontains "usability")</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&gt;
   &lt;metadata&gt;
      ...  
      &lt;subjects xml:lang="en"&gt;
         &lt;subject&gt;<phrase role="found">Usability</phrase> testing&lt;/subject&gt;
         &lt;subject&gt;<phrase role="found">Web site</phrase> development&lt;/subject&gt;          
         &lt;subject&gt;Heuristic evaluation&lt;/subject&gt;
         &lt;subject&gt;Cognitive walk-through&lt;/subject&gt;
         &lt;subject&gt;<phrase role="found">Web site</phrase> <phrase role="found">usability</phrase>&lt;/subject&gt;
      &lt;/subjects&gt;
      ...
   &lt;/metadata&gt;
   &lt;content&gt;
      ...
   &lt;/content&gt;
&lt;/book&gt;
   
&lt;book number="2"&gt;
   &lt;metadata&gt;
      ...  
      &lt;subjects xml:lang="en"&gt;
         &lt;subject&gt;<phrase role="found">Usability</phrase> testing&lt;/subject&gt;
         &lt;subject&gt;<phrase role="found">Web site</phrase> development&lt;/subject&gt;
         &lt;subject&gt;Guides and finding aids&lt;/subject&gt;
      &lt;/subjects&gt;
      ...
   &lt;/metadata&gt;
   &lt;content&gt;
      ...
   &lt;/content&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="cardinality-queries-results-q3">
<head>Q3 Query in Every Instance of an Element (Universal Quantification)</head>
<p>Find all books with the words "ersatz" and "publications" in every publisher name.</p>
<p>This query finds two words in every instance of an element.</p>
<ulist>
<item>
<p>Operands: "ersatz" "publications"</p>
</item>
<item>
<p>Functionality: word query, <code>and</code> query, universal quantification</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./metadata/publicationInfo/publisher</p>
</item>
<item>
<p>Return: .</p>
</item>
<item>
<p>Comments: This query does not return a book if at least one of its publishers does not contain the words "ersatz" and 
"publications". Book 1 is returned because it has an instance of the <code>publisher</code> element which satisfies the full-text conditions (contains both "Ersatz" and
"Publications").  Book 2 is not returned because even though it has a publisher that satisfies the full-text conditions, it also has a publisher that
does not satisfy it. Book 3 is not returned because it has an instance of the <code>publisher</code> element which
does not satisfy the query (contains "Ersatz" but not "Publications").</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 every $pub in $book//publisher satisfies 
   ($pub ftcontains "ersatz" &amp;&amp; "publications")
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(every $pub in .//publisher 
satisfies ($pub ftcontains "ersatz" &amp;&amp; "publications"))</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&gt;
   &lt;metadata&gt;
      ...
      &lt;publicationInfo&gt;   
         &lt;publisher&gt;<phrase role="found">Ersatz Publications</phrase>&lt;/publisher&gt;
      &lt;/publicationInfo&gt;
      ...
   &lt;/metadata&gt;
   &lt;content&gt;
      ...
   &lt;/content&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="cardinality-queries-results-q4">
<head>Q4 Occurrence Count Query</head>
<p>Find all books which repeat the phrase "expert review methods" in the text at least two times.</p>
<p>This query finds a phrase which is repeated a specified number of times.</p>
<ulist>
<item>
<p>Operands: "expert review methods"</p>
</item>
<item>
<p>Functionality: phrase query, at least functionality</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 excludes books with 
only minor (single occurrence) references to "expert review methods".</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 
   "expert review methods" occurs at least 2 times]
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 "expert 
review methods" occurs at least 2 times)&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;title&gt;Expert Reviews&lt;/title&gt;
         &lt;introduction&gt;
            ...
            &lt;p&gt;Two <phrase role="found">expert review methods</phrase> are discussed 
            here. They are heuristic evaluation and 
            cognitive walk-through.&lt;/p&gt; 
            &lt;p&gt;<phrase role="found">Expert review methods</phrase> 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;/part&gt;      
   &lt;/content&gt;
&lt;/book&gt;</eg>
</div3>
</div2>
</div1>
<div1 id="Proximity">
<head>Use Case "PROXIMITY": Queries on Proximity Relationships Including Distance, Window, Sentence, and Paragraph</head>
<div2 id="proximity-description">
<head>Description</head>
<p>These use cases illustrate unordered and ordered distance queries which find  
					sequences of words allowing up to a specified number of intervening words. They also include a query 
					to find words within a window, within a sentence, and within a 
					paragraph.</p>
</div2>
<div2 id="proximity-queries-results">
<head>Queries and Results</head>
<div3 id="proximity-queries-results-q1">
<head>Q1 Unordered Distance Query</head>
<p>Find all books with information on "software developers".</p>
<p>This query finds multiple words in any order allowing up to a specified number of intervening words.</p>
<ulist>
<item>
<p>Operands: "software" "developer"</p>
</item>
<item>
<p>Functionality: word queries, stemming, unordered distance (0 to 3 intervening words)</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 returns "developer of software", 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 
   "software" &amp;&amp; "developer" with stemming 
   distance at most 3 words]
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 "software" 
&amp;&amp; "developer" with stemming distance at most 3 words)&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 <phrase role="found">developer</phrase> of <phrase role="found">software</phrase> 
         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;/content&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="proximity-queries-results-q2">
<head>Q2 Ordered Distance Query</head>
<p>Find all books with information on "efficient task completion".</p>
<p>This query finds multiple words in the order queried allowing up to a specified number 
						of intervening words.</p>
<ulist>
<item>
<p>Operands: "efficient" "task" "completion"</p>
</item>
<item>
<p>Functionality: word queries, ordered distance (0 to 10 intervening words)</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 is more permissive than an phrase query on "efficient task completion" 
which would return no results.</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 
   "efficient" &amp;&amp; "task" &amp;&amp; "completion" 
   distance at most 10 words ordered]
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 "efficient" 
&amp;&amp; "task" &amp;&amp; "completion" distance 
at most 10 words ordered)&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;content&gt;
      &lt;introduction&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 <phrase role="found">efficient</phrase> and effective <phrase role="found">task</phrase>
         <phrase role="found">completion</phrase>, 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;/introduction&gt;
      ...   
   &lt;/content&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="proximity-queries-results-q3">
<head>Q3 Ordered Window Query</head>
<p>Find all books about "users feeling well-served".</p>
<p>This query finds books with multiple words within an ordered window of up to a specified number of words.</p>
<ulist>
<item>
<p>Operands: "users" "feeling" "well served" "well-served"</p>
</item>
<item>
<p>Functionality: word queries, ordered window (0 to 15 words)</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 opens a window on the first found word (which must be the first word queried) and counts a specified number 
						of words from that first word within which it may find the remaining word or words, finding them 
						in the order queried.</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 
   "users" &amp;&amp; "feeling" &amp;&amp; ("well served" || "well-served")
   with stemming window 15 words ordered]
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 "users" 
&amp;&amp; "feeling" &amp;&amp; ("well served" || "well-served") with stemming 
window 15 words ordered)&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 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 <phrase role="found">user</phrase> must not only be well-served, but must
         <phrase role="found">feel</phrase> <phrase role="found">well</phrase>-<phrase role="found">served</phrase>.&lt;/p&gt;  
         ...
      &lt;/introduction&gt;
      ...   
   &lt;/content&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="proximity-queries-results-q4">
<head>Q4 Unordered Within a Sentence Query</head>
<p>Find all books which discuss "questions asked during cognitive walk-throughs".</p>
<p>This query finds books with multiple words in any order within a sentence.</p>
<ulist>
<item>
<p>Operands: "users" "would" "know" "step"</p>
</item>
<item>
<p>Functionality: word queries, stemming, unordered sentence 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: This query expects an implementation-defined tokenized sentence or a <code>sentence</code> element.</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 
   "users" &amp;&amp; "would" &amp;&amp; "know" &amp;&amp; "step" 
   with stemming same sentence]
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 "users" &amp;&amp; "would" 
&amp;&amp; "know" &amp;&amp; "step" with stemming same sentence)&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;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 "<phrase role="found">Would</phrase> a
            <phrase role="found">user</phrase> <phrase role="found">know</phrase> by looking at the screen how to
            complete the first <phrase role="found">step</phrase> 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;/content&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="proximity-queries-results-q5">
<head>Q5 Unordered Within a Paragraph Query</head>
<p>Find all paragraphs which define what "Web site usability" is.</p>
<p>This query finds books with multiple words and phrases in any order within a paragraph.</p>
<ulist>
<item>
<p>Operands: "usability" "web site" "efficiency" "satisfaction"</p>
</item>
<item>
<p>Functionality: word queries, phrase query, unordered paragraph 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: This query expects an implementation-defined tokenized paragraph or a <code>paragraph</code> element.</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" &amp;&amp; "web site" &amp;&amp; "efficiency" 
   &amp;&amp; "satisfaction" same paragraph]
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" 
&amp;&amp; "web site" &amp;&amp; "efficiency" &amp;&amp; "satisfaction" 
same paragraph)&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;content&gt;
      &lt;introduction&gt;
         ... 
         &lt;p&gt;The <phrase role="found">usability</phrase> of a <phrase role="found">Web site</phrase> is how well the 
         site supports the user in achieving specified 
         goals. A <phrase role="found">Web site</phrase> should facilitate learning, 
         and enable <phrase role="found">efficient</phrase> and effective task
         completion, while propagating few errors.         
         <phrase role="found">Satisfaction</phrase> with the site is also important.. 
         The user must not only be well-served, but must
         feel well-served.&lt;/p&gt;  
         ...
      &lt;/introduction&gt;
      ...   
   &lt;/content&gt;					
&lt;/book&gt;</eg>
</div3>
</div2>
</div1>
<div1 id="Axes">
<head>Use Case "AXES": Queries Using Relative XPath Axes</head>
<div2 id="axes-description">
<head>Description</head>
<p>These use cases illustrate queries traversing relative XPath axes.</p>
</div2>
<div2 id="axes-queries-results">
<head>Queries and Results</head>
<div3 id="axes-queries-results-q1">
<head>Q1 Query on Element and Its Children</head>
<p>Find all books with paragraphs containing the phrase "computer workstation" and footnotes 
within those paragraphs containing the word "comfortable".</p>
<p>This query finds a phrase in an element, then finds a word in a child element.</p>
<ulist>
<item>
<p>Operands: "computer workstation" "comfortable"</p>
</item>
<item>
<p>Functionality: phrase query, word query</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: .//p, .//p/footnote</p>
</item>
<item>
<p>Return: ./metadata/title, .//p</p>
</item>
<item>
<p>Comments: This query combines phrase and word search in different elements which have a parent-child relationship.</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 $para := $book//p[. ftcontains "computer 
   workstation"]
let $fn := $para/footnote[. ftcontains "comfortable"]
where count($fn)&gt;0
return $book/metadata/title, $para</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(.//p ftcontains "computer workstation" 
and .//p/footnote ftcontains "comfortable")&gt;0]/(metadata/title 
| .//p)</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&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;p&gt;Users can be tested at any <phrase role="found">computer workstation</phrase>
&lt;footnote&gt;They may be most <phrase role="found">comfortable</phrase> 
at their own workstation.&lt;/footnote&gt; 
or in a lab.&lt;/p&gt;</eg>
</div3>
<div3 id="axes-queries-results-q2">
<head>Q2 Query on Element Returning Its First Two Children</head>
<p>Find the first two steps in chapters on "conducting usability tests."</p>
<p>This query finds words in an element, then returns its first two children elements.</p>
<ulist>
<item>
<p>Operands: "usability", "test"</p>
</item>
<item>
<p>Functionality: word 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/part/chapter/p</p>
</item>
<item>
<p>Return: ./metadata/title ./content/part/chapter/p/step[1], ./content/part/chapter/p/step[2]</p>
</item>
<item>
<p>Comments: This query finds words in a <code>p</code> element and uses XPath to return the first two children 
of the element.</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 $para := $book[.//chapter/p ftcontains "usability" 
   &amp;&amp; "test" with stemming]
where count($para) &gt; 0   
return $book/metadata/title, $para/step[1], $para/step[2]</eg>
<p>
<emph>Solution in XPath:</emph>
</p>
<eg role="xpath" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
/books/book//chapter/p[count(. ftcontains "usability" 
&amp;&amp; "test" with stemming)&gt;0]/(metadata/book 
| .//chapter/p/step[1] | .//chapter/p/step[2])</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&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;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;</eg>
</div3>
<div3 id="axes-queries-results-q3">
<head>Q3 Query on Element and Its Ancestors</head>
<p>Are there any "flow diagrams" of "human computer interaction" scenarios in John Wesley 
						Usabilityguy's papers?</p>
<p>This query finds a phrase in an element, then finds another phrase in an ancestor element.</p>
<ulist>
<item>
<p>Operands: "flow diagrams" "human computer interaction"</p>
</item>
<item>
<p>Functionality: phrase queries, character wildcard (suffix) (0 or one)</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/part/component/subcomponent/componentTitle, ./content/part/component/subcomponent/subsubcomponent/componentTitle</p>
</item>
<item>
<p>Return: ./metadata/title, ./content</p>
</item>
<item>
<p>Comments: 	This query looks for a phrase in an element and a different phrase in its ancestor 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[@number="3"]
let $comp := $book[./content/part/component/
   (subcomponent | subcomponent/subsubcomponent)/
   componentTitle ftcontains "flow diagram.?" 
   with wildcards]
let $parentComp := $book[ancestor::books//../$comp 
  ftcontains "human computer interaction"]
where count($comp) &gt; 0   
return $book/metadata/title, $book/content</eg>
<p>
<emph>Solution in XPath:</emph>
</p>
<eg role="xpath" xml:space="preserve">doc("http://bstore1.example.com/full-text.xml")
/books/book[@number="3" and count((./content/part/
component(subcomponent | subcomponent/subsubcomponent) 
ftcontains "flow diagram.?" with wildcards 
and ancestor::books//(subcomponent | subcomponent/
subsubcomponent) ftcontains "human computer 
interaction"))&gt;0]/(metadata/title | ./content)</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;title shortTitle="Usabilityguy Manuscript 
Guide"&gt;John Wesley Usabilityguy: A Register of His 
Papers&lt;/title&gt;
&lt;content&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;subComponent&gt;
           &lt;componentTitle&gt;<phrase role="found">Human Computer Interaction</phrase> 
           research, &lt;componentDate normalize="1945/1952"&gt;
           1945-1952&lt;/componentDate&gt;
           &lt;/componentTitle&gt;
           &lt;subsubComponent&gt;
              &lt;componentTitle&gt;<phrase role="found">Flow diagram</phrase>, 
              &lt;componentDate normalize="1950"&gt;1950
              &lt;/componentDate&gt;
              &lt;/componentTitle&gt;
           &lt;/subsubComponent&gt;
           ...
         &lt;/subComponent&gt;
      &lt;/component&gt;
   &lt;/part&gt;
&lt;/content&gt;</eg>
</div3>
<div3 id="axes-queries-results-q4">
<head>Q4 Query on Element and Its Right Siblings</head>
<p>Find all book chapters with paragraphs on "usability testing" followed by paragraphs on "information architecture".</p>
<p>This query finds a phrase in an element, then finds another phrase in one of its right siblings.</p>
<ulist>
<item>
<p>Operands: "usability testing" "information architecture"</p>
</item>
<item>
<p>Functionality: phrase queries</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</p>
</item>
<item>
<p>Return: ./metadata/title, .//content</p>
</item>
<item>
<p>Comments: This query returns book chapters if they contain paragraphs following each other 
as specified in the query.</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 $chapters := $book//chapter[./p ftcontains "usability 
   testing" and ./p/following-sibling::p ftcontains 
   "information architecture"]
where count($chapters)&gt;0
return ($book/metadata/title, $chapters)</eg>
<p>
<emph>Solution in XPath: None</emph>
</p>
<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;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;p&gt;Users are asked to complete tasks which 
            measure the success of the <phrase role="found">information</phrase> 
            <phrase role="found">architecture</phrase> and navigational elements of the 
            site.&lt;/p&gt;
         &lt;/chapter&gt;
      &lt;/part&gt; 
   &lt;/content&gt;
&lt;/book&gt;</eg>
</div3>
</div2>
</div1>
<div1 id="Ignore">
<head>Use Case "IGNORE": Queries Ignoring Descendant Element Content</head>
<div2 id="ignore-description">
<head>Description</head>
<p>These phrase and proximity queries cross element boundaries ignoring the
content of descendant elements. One query ignores the content of a
complete sub-tree. Other queries ignore only the content of specified
descendant elements.</p>
</div2>
<div2 id="ignore-queries-results">
<head>Queries and Results</head>
<div3 id="ignore-queries-results-q1">
<head>Q1 Distance Query Ignoring Content of All Descendant Elements</head>
<p>Find advice on whether the observer should "correct" or provide "guidance" to the user during usability "testing".</p>
<p>This query ignores the content of all descendant elements.</p>
<ulist>
<item>
<p>Operands: "testing" "correct" "guidance"</p>
</item>
<item>
<p>Functionality: phrase query, word queries, <code>or</code> query, ordered distance query (0 to 60 intervening words), ignore content of descendant elements</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: .//p</p>
</item>
<item>
<p>Return: .</p>
</item>
<item>
<p>Comments: This query ignores the content of all the descendant elements of the <code>p</code> element, so it ignores the <code>footnote</code> and <code>testingProcedure</code> elements. If the descendant elements were not ignored, the words searched would be too distant from each other to have been returned.</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 $p := $book//p [. ftcontains "testing" 
   &amp;&amp; ("guidance" || "correct") distance at 
   most 60 words without content *] 
where count($p) &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//p[count(. ftcontains "testing" 
&amp;&amp; ("guidance" || "correct") distance at 
most 60 words without content *)&gt;0]</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="2"&gt;
   &lt;metadata&gt;
      ...
   &lt;/metadata&gt; 
   &lt;content&gt;
      ...   					
      &lt;part number="2"&gt;
         &lt;chapter&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 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 <phrase role="found">guidance</phrase> 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&gt;</eg>
</div3>
<div3 id="ignore-queries-results-q2">
<head>Q2 Phrase Query Ignoring Content of Descendant Element Specified by XPath Expression</head>
<p>Find all book chapters containing "users can be tested at any computer
workstation or in a lab" ignoring footnotes.</p>
<p>This query finds book chapters containing the phrase "users can be
tested at any computer workstation or in a lab" ignoring the content of a descendant element explicitly specified by an XPath expression.</p>
<ulist>
<item>
<p>Operands: "users can be tested at any computer workstation or in a lab"</p>
</item>
<item>
<p>Functionality: phrase query, ignore content of <code>footnote</code> element</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: ./metadata/title, ./content/part/chapter</p>
</item>
<item>
<p>Comments: This query ignores the content of a descendant element, the <code>footnote</code> element.</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 
   "users can be tested at any computer workstation 
   or in a lab" without content .//footnote] 
where count($chap) &gt; 0
return $book/metadata/title, $chap</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 "users can be 
tested at any computer workstation or in a lab" 
without content .//footnote)&gt;0]/(metadata/title | .//chapter)</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&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;chapter&gt;
   &lt;p&gt;<phrase role="found">Users can be tested at any computer</phrase>  
   <phrase role="found">workstation</phrase> &lt;footnote&gt;They may be most 
   comfortable at their own workstation.
   &lt;/footnote&gt; <phrase role="found">or in a lab</phrase>.&lt;/p&gt; 
&lt;/chapter&gt;</eg>
</div3>
<div3 id="ignore-queries-results-q3">
<head>Q3 Phrase Query Ignoring Content of Descendant Element Specified by Full-Text Query</head>
<p>Find all book chapters containing the phrase "at any computer workstation or in a lab" ignoring footnotes on workstations.</p>
<p>This query ignores the content of a descendant element specified by a full-text query.</p>
<ulist>
<item>
<p>Operands: "at any computer workstation or in a lab", "workstations"</p>
</item>
<item>
<p>Functionality: phrase query, character wildcard (suffix) (1), ignore content of a descendant element found by a full-text 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: ./metadata/title, ./content/part/chapter</p>
</item>
<item>
<p>Comments: This query ignores the content of a descendant element identified dynamically by a full-text query.</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 
   "at any computer workstation or in a lab" 
   without content (.//footnote[. ftcontains 
   "workstation." with wildcards])]
where count($chap) &gt; 0
return $book/metadata/title, $chap</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 "at any computer 
workstation or in a lab" without content 
.//footnote[. ftcontains "workstation." with wildcards])&gt;0]
/metadata/title | .//chapter</eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&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;chapter&gt;
   &lt;p&gt;Users can be tested <phrase role="found">at any computer</phrase>
   <phrase role="found">workstation</phrase>&lt;footnote&gt;They may be most
   comfortable at their own workstation.
   &lt;/footnote&gt;<phrase role="found">or in a lab</phrase>.&lt;/p&gt;
&lt;/chapter&gt;</eg>
</div3>
<!-- <div3 id="ignore-queries-results-q4">
<head>Q4 Distance Query Ignoring Content of Descendant Elements Level By Level</head>
<p>Find all book chapters on "testing web sites in-house".</p>
<p>This query ignores the content of a descendant element, but not the descendant element's descendant elements. Its descendant elements are promoted and queried.</p>
<ulist>
<item>
<p>Operands: "testing" "web sites" "in-house"</p>
</item>
<item>
<p>Functionality: word queries, phrase query, character wildcard (suffix) (1), character wildcard (suffix) (0 or more), ordered distance (0 to 3 intervening words), ordered distance (0 to 40 intervening words), ignore the content of an element, not the descendant element's descendant element.</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: ./metadata/title, ./content/part/chapter</p>
</item>
<item>
<p>Comments: This query ignores the content of the <code>footnote</code> element, but not the content of its descendant <code>testingProcedure</code>. If this query had ignored the content of the <code>testingProcedure</code> element, which is a child of the <code>footnote</code> element, no results would have been returned. If this query did not ignore the content of the <code>footnote</code> element, no results would have been returned.</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery"><![CDATA[for $book in doc("http://bstore1.example.com/full-text.xml")
   /books/book
let $chap := $book//chapter[. ftcontains ("test.*" 
   && "web site." with wildcards distance at most 3 words)  
   && "in-house" distance at most 40 words 
   without content $book/chapter/p/footnote]
where fn:count($chap) > 0
return $b/metadata/title, $chap]]></eg>
<p>
<emph>Solution in XPath:</emph>
</p>
<eg role="xpath"><![CDATA[doc("http://bstore1.example.com/full-text.xml")
/books/book[count(.//chapter ftcontains ("test.*" 
&& "web site." with wildcards distance at most 3 words)  
&& "in-house" distance at most 40 words
without content .//chapter/p/footnote)>0]/(metadata/title 
| .//chapter)]]></eg>
<p>
<emph>Expected Result:</emph>
</p>
<eg>&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;chapter&gt;
   &lt;p&gt;Give the user the script, then assure them 
   that you are <phrase role="found">testing the Web site</phrase>, 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;<phrase role="found">in-house</phrase> 
   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;</eg>
</div3> -->
</div2>
</div1>
<div1 id="Full-Text-Composability">
<head>Use Case "FULL-TEXT-COMPOSABILITY": Queries Illustrating Composability of Full-Text with Itself</head>
<div2 id="full-text-composability-description">
<head>Description</head>
<p>The use cases illustrate a multi-lingual query and queries which use multiple full-text functionalities in conjunction with other XQuery and XPath functionalities.</p>
</div2>
<div2 id="full-text-composability-queries-results">
<head>Queries and Results</head>
<div3 id="full-text-composability-queries-results-q1">
<head>Q1 Query on Words and Phrases in Two Languages</head>
<p>Find all books with the subject "网站可用性", with an introduction written by "Elina Rose", 
which mention the name of the usability expert "Millicent Marigold".</p>
<p>This query finds words and a phrase in more than one language.</p>
<ulist>
<item>
<p>Operands: "网站可用性" "Elina" "Rose" "Millicent" "Marigold"</p>
</item>
<item>
<p>Functionality: phrase query, word queries, <code>and</code> query, unordered distance (0 to 3 intervening words), capacity to enter, query, and return multiple languages</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, ./content/introduction/author, ./content</p>
</item>
<item>
<p>Return: ./@number, ./metadata/title, ./metadata/subjects/subject, ./content/introduction/author, ./content</p>
</item>
<item>
<p>Comments: This query accepts multiple languages as input and returns multiple languages as output.</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 "网站可用性" language "zh"]
   and $book/content/introduction/author[. ftcontains 
   "Elina" &amp;&amp; "Rose" distance at most 3 words]
   and $book//content[. ftcontains "Millicent" &amp;&amp; "Marigold" 
   distance at most 3 words]
return &lt;book number="{$book/@number}"&gt; 
          {$book/metadata/title, $book//subject, 
          $book/content/introduction, $book//content} 
       &lt;/book&gt;</eg>
<p>
<emph>Solution in XPath: None</emph>
</p>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&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;subject&gt;<phrase role="found">网站可用性</phrase>&lt;/subject&gt;
   &lt;content&gt;
      &lt;introduction&gt;
         &lt;author&gt;<phrase role="found">Elina</phrase> <phrase role="found">Rose</phrase>&lt;/author&gt;
         ...   
         &lt;p&gt;The most successful projects employ multiple methods 
         in multiple iterations. As <phrase role="found">Millicent</phrase> <phrase role="found">Marigold</phrase> remarked 
         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="full-text-composability-queries-results-q2">
<head>Q2 Phrase and Distance Query in an Instance of an Element with Stemming</head>
<p>Find all paragraphs in books which discuss the role of "task performance" in "expert review methods".</p>
<p>This query finds multiple words close to each other and a phrase in one instance of an element. </p>
<ulist>
<item>
<p>Operands: "task" "performance" "expert review"</p>
</item>
<item>
<p>Functionality: word queries, stemming, phrase query, unordered distance (0 to 3 intervening words 
						between "task" and "performance")</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./content//p</p>
</item>
<item>
<p>Return: ./metadata/title, ./content//p</p>
</item>
<item>
<p>Comments: This query combines functionalities introduced in previous sections.</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 $para := $book/content//p[. ftcontains 
   ("task" &amp;&amp; "performance" with stemming distance 
   at most 3 words) &amp;&amp; "expert review" with stemming]
where count($para) &gt; 0
return $book/metadata/title, $book//content</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/p ftcontains ("task" 
&amp;&amp; "performance" with stemming distance 
at most 3 words) &amp;&amp; "expert review" with stemming)&gt;0]</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;content&gt;
   ...   
   &lt;part number="1"&gt;
      &lt;title&gt;Expert Reviews&lt;/title&gt;
      ...
      &lt;chapter&gt;
         &lt;title&gt;Cognitive Walk-Through&lt;/title&gt;
         &lt;p&gt;<phrase role="found">Expert reviewers</phrase> evaluate Web site 
         understandability and ease of learning while 
         <phrase role="found">performing</phrase> specified <phrase role="found">tasks</phrase>. 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;/content&gt;</eg>
</div3>
<div3 id="full-text-composability-queries-results-q3">
<head>Q3 Nested Distance Query with Wildcards, Stemming, and Thesaurus Support</head>
<p>Find all books on "usability testing" which "quote" "Millicent Marigold" on the value of multiple 
						"iterations".</p>
<p>This query finds multiple words in three nested levels of distance queries. It uses wildcards, stemming, and thesaurus support.</p>
<ulist>
<item>
<p>Operands: "usability testing" "quote" "millicent" "marigold" "iterations"</p>
</item>
<item>
<p>Functionality: phrase query, character wildcard (suffix) (0-5), word queries, thesaurus support, stemming, ordered distance 
						(0 to 3 intervening words between "millicent" and "marigold"), unordered distance (0 to 3 intervening words 
						between ("millicent ... marigold" and (one of the following from stemming: "quote", "quoted", "quotes", "quotation", "quotations" or one of the following from thesaurus support: "said", "says", "stated", "states", "statement", "spoke", "speaks", "replied', "replies", "reply", "remarks", "remarked", "responded", "response", 
						"reports ", "reported", "quotes", "quoted", "according", "commented", "discussed", "expressed", "told"), unordered distance (0 to 50 intervening words between ("millicent ... marigold" ... ("quote" or any of its wildcard- or thesaurus-derived substitutes) and ("usability testing" and "iterations")).</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 combines functionalities introduced in previous sections.</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 $quote := $book//content[. ftcontains (("millicent" 
   &amp;&amp; "marigold" distance at most 3 words ordered)
   &amp;&amp; "quote.{0-5}" with wildcards with thesaurus at  
   "http://bstore1.example.com/UsabilityThesaurus.xml"
   relationship "synonyms" distance at most 3 words) 
   &amp;&amp; "usability testing" &amp;&amp; "iterations" with stemming 
   distance at most 50 words]
where count($quote) &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 (("millicent" 
&amp;&amp; "marigold" distance at most 3 words ordered)
&amp;&amp; "quote.{0-5}" with wildcards with thesaurus at 
"http://bstore1.example.com/UsabilityThesaurus.xml"
relationship "synonyms" distance at most 3 words) 
&amp;&amp; "usability testing" &amp;&amp; "iterations" with stemming 
distance at most 50 words)&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 <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;p&gt;The most successful projects employ multiple 
         methods in multiple iterations. As <phrase role="found">Millicent</phrase>
         <phrase role="found">Marigold</phrase> <phrase role="found">remarked</phrase> during a recent conference, 
         "Don't stop. <phrase role="found">Iterate</phrase>, <phrase role="found">iterate</phrase>, then <phrase role="found">iterate</phrase>          
         again."&lt;/p&gt;
      &lt;/introduction&gt;
   &lt;/content&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="full-text-composability-queries-results-q4">
<head>Q4 Window Query with Wildcards and Stemming Ignoring Content of a Descendant Element</head>
<p>Find advice on whether an observer in a "usability test" should "correct" or provide "guidance" to the user in 
a book not authored by Montana Marigold.</p>
<p>This query uses synonyms supplied by the user, uses the unary not, nests a Boolean query and a phrase query within a window query, and ignores the tags and content of a descendant element.</p>
<ulist>
<item>
<p>Operands: "usability testing" "correct" "comment" "guidance" "help" "assistance" "montana" "marigold"</p>
</item>
<item>
<p>Functionality: phrase query, word queries, character wildcard (suffix) (0 or more), synonyms for "correct" and "guidance" provided by the user ("comment" or "assistance" or "help"), stemming, <code>or</code> query ("correct" or "comment" or "guidance" or "assistance" or "help"), <code>and</code> query ("montana" and "marigold"), <code>unary not</code> query (not "montana" and "marigold"),
unordered window (0 to 70 words within a window of "usability testing" and ("correct" or "comment" or "guidance" or "assistance" or "help"). Ignores content of descendant elements.</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./metadata/author, ./content</p>
</item>
<item>
<p>Return: ./@number, ./metadata/title, ./content</p>
</item>
<item>
<p>Comments: This query combines functionalities introduced in previous sections.</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 $au := $book/metadata/author[. ftcontains ! ("montana" 
  &amp;&amp; "marigold")]   
let $co := $book//content[. ftcontains (("correct" 
   || ("comment" with stemming) || "guidance" || "assistance" 
   || "help") &amp;&amp; "usability test.*" with wildcards) 
   window 70 words without content .//footnote]
where count($au) &gt; 0 and  count($co) &gt; 0 
return &lt;book number="{$book/@number}"&gt; 
          {$book/metadata/title,
          $book//content}
       &lt;/book&gt;</eg>
<p>
<emph>Solution in XPath: None</emph>
</p>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="2"&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;content&gt;
      ...   					
      &lt;part number="2"&gt;
         &lt;chapter&gt;
            &lt;title&gt;Conducting <phrase role="found">Usability Tests</phrase>&lt;/title&gt; 
            &lt;p&gt;Users can be tested at any computer 
            workstation &lt;footnote&gt;They may be most 
            comfortable at their own workstation.
            &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 <phrase role="found">guidance</phrase> 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&gt;</eg>
</div3>
<div3 id="full-text-composability-queries-results-q5">
<head>Q5 Query on Different Elements in Different Sub-Trees with Conditional Return</head>
<p>For each book with a title containing the word "usability", a book introduction 
containing the word "satisfaction", and a part introduction containing the phrase "identify problems", return the book title and the authors if it has authors. Return the book title and publisher, if it has no authors.  Always return the content surrounding the found words.</p>
<p>This query finds words and a phrase in different elements in different sub-trees. It also contains a conditional return.</p>
<ulist>
<item>
<p>Operands: "usability" "satisfaction" "identify problems"</p>
</item>
<item>
<p>Functionality: word queries, phrase query, conditional 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/introduction, ./content/part/introduction</p>
</item>
<item>
<p>Return: ./@number, ./metadata/title, ./metadata/author, ./metadata/publicationInfo/publisher, ./content/introduction, 
./content/part/introduction</p>
</item>
<item>
<p>Comments: This query combines functionalities introduced in previous sections.</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"]
let $in := $book/content/introduction[. ftcontains 
   "satisfaction"]
let $pin := $book/content/part/introduction[. ftcontains 
   "identify problems"]
where count($title)&gt;0 and count($in)&gt;0 
   and count($pin)&gt;0
return &lt;book number="{$book/@number}"&gt; 
          {$title} 
          if (count($book/metadata/author) &gt; 0)
          then {$book/metadata/author, $in, $pin}
          else {$book/metadata/publicationInfo/publisher, $in, $pin}
       &lt;/book&gt;</eg>
<p>
<emph>Solution in XPath: None</emph>
</p>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&gt;
   &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;author&gt;Millicent Marigold&lt;/author&gt;  
   &lt;author&gt;Montana Marigold&lt;/author&gt;     
   &lt;introduction&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. <phrase role="found">Satisfaction</phrase> with the site is also important. 
      The user must not only be well-served, but must 
      feel well-served.&lt;/p&gt;
      ...
  &lt;/introduction&gt;
  &lt;introduction&gt;
      &lt;p&gt;Expert reviewers <phrase role="found">identify problems</phrase> 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;/book&gt;</eg>
</div3>
</div2>
</div1>
<div1 id="XQuery-XPath-Composability">
<head>Use Case "XQUERY-XPATH-COMPOSABILITY": Queries Illustrating Composability of Full-Text with Other XQuery and XPath Functionalities</head>
<div2 id="xquery-xpath-composability-description">
<head>Description</head>
<p>These queries combine full-text queries with other XQuery and XPath functionalities.</p>
</div2>
<div2 id="xquery-xpath-composability-queries-results">
<head>Queries and Results</head>
<div3 id="xquery-xpath-composability-queries-results-q1">
<head>Q1 Full-Text Query Constructing New Element</head>
<p>For books with "usability" in the title create a flat list of all title-author pairs, with each pair enclosed in a newly constructed element.</p>
<p>This query finds a word in an element and returns the element and another wrapped in a new element.</p>
<ulist>
<item>
<p>Operands: "usability"</p>
</item>
<item>
<p>Functionality: word query, construction of new element</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: result (constructed element), ./metadata/title, ./metadata/author</p>
</item>
<item>
<p>Comments: This query finds the word "usability" in the title of a book and building title-author pairs 
for those books returning them wrapped in a newly constructed result element.</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 $var := $book[./metadata/title ftcontains "usability"]
where count ($var) &gt; 0   
return &lt;result&gt; 
          {$book/metadata/title, $book/metadata/author} 
       &lt;/result&gt;</eg>
<p>
<emph>Solution in XPath: None</emph>
</p>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;result&gt;
   &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;author&gt;Millicent Marigold&lt;/author&gt;
   &lt;author&gt;Montana Marigold&lt;/author&gt;
&lt;/result&gt;
   
&lt;result&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;
&lt;/result&gt;</eg>
</div3>
<div3 id="xquery-xpath-composability-queries-results-q2">
<head>Q2 Full-Text Query Returning Count of Descendant Element Occurrences</head>
<p>Find all books with a chapter title on "usability tests". Return book title, chapter title, and the number of steps in chapters.</p>
<p>This query finds words then returns among other elements a constructed element reporting the number of occurrences of a descendant element.</p>
<ulist>
<item>
<p>Operands: "usability" "test"</p>
</item>
<item>
<p>Functionality: word queries, <code>and</code> query, stemming, count(), construction of new element</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/title, ./content/part/chapter/p/step</p>
</item>
<item>
<p>Return: ./@number, ./metadata/title, ./content/part/chapter/title, number-of-steps (constructed element)</p>
</item>
<item>
<p>Comments: This query finds the word "usability" and stemmed forms of the word "test" in the titles of 
book chapters. It returns chapter titles along with an occurrence count of descendant <code>step</code> elements. The query returns a number of steps equal to 
0 if the chapter is on usability testing but does not specify any steps (e.g., there are not descendant <code>step</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 $ct := $book/content/part/chapter/title[. ftcontains 
   "usability" &amp;&amp; ("test" with stemming)]
where count($ct)&gt;0
return &lt;book number="{$book/@number}"&gt; 
          {for $title in $ct
          return $title} 
             &lt;number-of-steps&gt; 
                {count($title/..//step)}
             &lt;/number-of-steps&gt;
       &lt;/book&gt;</eg>
<p>
<emph>Solution in XPath: None</emph>
</p>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&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;title&gt;<phrase role="found">Usability Testing</phrase>&lt;/title&gt;
   &lt;number-of-steps&gt;0&lt;/number-of-steps&gt;
 &lt;/book&gt;

&lt;book number="2"&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&gt;Planning then Conducting <phrase role="found">Usability</phrase>
   <phrase role="found">Tests</phrase>&lt;/title&gt;
   &lt;number-of-steps&gt;7&lt;/number-of-steps&gt;
   &lt;title&gt;Conducting <phrase role="found">Usability Tests</phrase>&lt;/title&gt;
   &lt;number-of-steps&gt;0&lt;/number-of-steps&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="xquery-xpath-composability-queries-results-q3">
<head>Q3 Full-Text Query with Conditional Return</head>
<p>For each book with "usability" in the book title, return the book title and a second element. Return the book 
title and a third element if the second element does not exist.</p>
<p>This query finds a word and contains a conditional return.</p>
<ulist>
<item>
<p>Operands: "usability"</p>
</item>
<item>
<p>Functionality: word query, conditional expression</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: ./@number, ./metadata/title, ./metadata/author, ./metadata/publicationInfo/publisher</p>
</item>
<item>
<p>Comments: This query finds the word "usability" in the title of a book, then returns title-author pairs 
for those books when there are <code>author</code> elements. If there are no <code>author</code> elements, it returns <code>publisher</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[./metadata/title ftcontains 
   "usability"]
return &lt;book number="{$book/@number}"&gt;
          {$book/metadata/title,
             if (count($book/metadata//author) &gt; 0) 
             then $book/metadata//author 
             else $book/metadata//publisher}
       &lt;/book&gt;</eg>
<p>
<emph>Solution in XPath: None</emph>
</p>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&gt;
   &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;author&gt;Millicent Marigold&lt;/author&gt;
   &lt;author&gt;Montana Marigold&lt;/author&gt;
&lt;/book&gt;

&lt;book number="2"&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;
   &lt;publisher&gt;Ersatz Publications&lt;/publisher&gt;
   &lt;publisher&gt;Electronic BookWorks&lt;/publisher&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="xquery-xpath-composability-queries-results-q4">
<head>Q4 Full-Text Query with Numeric Value Comparison</head>
<p>For each book with "usability" in the book title, return its book title and the round number of its suggested price if the price exceeds $25.</p>
<p>This query finds a word and contains a conditional return based on a function on a numeric value.</p>
<ulist>
<item>
<p>Operands: "usability"</p>
</item>
<item>
<p>Functionality: word query, round(), numeric value comparison, conditional expression</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./metadata/title, ./metadata/price</p>
</item>
<item>
<p>Return: ./@number, ./metadata/title, ./metadata/price</p>
</item>
<item>
<p>Comments: This query finds the word "usability" in the title of a book, then returns the round 
number of its price if the price exceeds a specified value.</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/books/book[./metadata/title ftcontains 
    "usability"]
return &lt;book number="{$book/@number}"&gt;
           {$book/metadata/title,  
             if ($book/metadata/price &gt; 25)
             then &lt;price&gt;{concat("$", round($book/metadata/price))}&lt;/price&gt;
             else ()
           }   
       &lt;/book&gt;</eg>
<p>
<emph>Solution in XPath: None</emph>
</p>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&gt;
   &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;price&gt;$26&lt;/price&gt;
&lt;/book&gt;

&lt;book number="2"&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;
   &lt;price&gt;$174&lt;/price&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="xquery-xpath-composability-queries-results-q5">
<head>Q5 Full-Text Query with Character String Query</head>
<p>Find all introductions in books, published in "Washington, D.C.", which include listings for 
"résumés", "drafts", and "correspondence".</p>
<p>This query finds words and a character string.</p>
<ulist>
<item>
<p>Operands: "résumés" "drafts" "correspondence" character string "Washington, D.C."</p>
</item>
<item>
<p>Functionality: word query, functionality requiring presence of characters with diacritics, <code>and</code> query, character string query</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./content/introduction, ./metadata/publicationInfo/place</p>
</item>
<item>
<p>Return: ./@number, ./metadata/title, ./content//introduction</p>
</item>
<item>
<p>Comments: This query performs a full-text query when it needs to find word variants in full text and performs a character string query when word variants are not possible.</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[.//publicationInfo/place/text() 
   = "Washington, D.C."]
let $intro := $book/content/introduction[. ftcontains 
   ("résumés" with diacritics) &amp;&amp; "drafts" &amp;&amp; "correspondence"]
where count($intro)&gt;0
return &lt;book number="{$book/@number}"&gt; 
           {$book/metadata/title, $intro}
        &lt;/book&gt;</eg>
<p>
<emph>Solution in XPath: None</emph>
</p>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="3"&gt;
   &lt;title shortTitle="Usabilityguy Manuscript 
   Guide"&gt;John Wesley Usabilityguy: A Register of 
   His Papers&lt;/title&gt; 
   &lt;introduction&gt;
      &lt;p&gt;The papers of John Wesley Usabilityguy span the 
      years 1946-1999, with the bulk of the items
      concentrated in the period from 1985 to 1999. 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 <phrase role="found">drafts</phrase>, book drafts, notes, charts, 
      graphs, family papers, clippings, printed matter, 
      photographs, <phrase role="found">résumés</phrase> and other materials.&lt;/p&gt;
   &lt;/introduction&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="xquery-xpath-composability-queries-results-q6">
<head>Q6 Full-Text Query with Conditional Return of Boolean Values</head>
<p>For each book on "usability" return the book title and a new <code>has-publishers</code> element with value <code>true</code> if the book has more than 1 publisher. Return the title and a new <code>has-publishers</code> element with value <code>false</code> if the book does not have more than one publisher.</p>
<p>This query finds a word, then returns Boolean values based on the number of occurrences of an element.</p>
<ulist>
<item>
<p>Operands: "usability"</p>
</item>
<item>
<p>Functionality: word query, construction of new Boolean values, construction of new element, count, &gt;, conditional expression</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: ./@number, ./metadata/title, has-publishers (constructed element)</p>
</item>
<item>
<p>Comments: This query finds "usability" in the title of a book, then returns the title and Boolean values 
showing whether the book has more than one publisher or not.</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[./metadata/title ftcontains 
   "usability"]
return &lt;book number="{$book/@number}"&gt;
          {$book/metadata/title} 
          &lt;has-publishers&gt; 
             {if (count($book//publisher) &gt; 1) 
             then "true" else "false"}
          &lt;/has-publishers&gt;
       &lt;/book&gt;</eg>
<p>
<emph>Solution in XPath: None</emph>
</p>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&gt;
   &lt;title&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;has-publishers&gt;false&lt;/has-publishers&gt;
&lt;/book&gt;

&lt;book number="2"&gt;
   &lt;title shortTitle="Improving Web Site Usability"&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;
   &lt;has-publishers&gt;true&lt;/has-publishers&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="xquery-xpath-composability-queries-results-q7">
<head>Q7 Full-Text Query with Date Comparison and Element Occurrence Count</head>
<p>Find all books about conducting "usability tests" which have more than one author and 
are published after "2000".</p>
<p>This query finds a phrase, counts the number of occurrences of an
element, runs a greater than comparison on dates, and combines the results.</p>
<ulist>
<item>
<p>Operands: "usability testing", "2000"</p>
</item>
<item>
<p>Functionality: phrase query,  character wildcard (suffix) (0 or more), count, &gt;</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, ./metadata/author, ./metadata/publicationInfo/dateIssued|dateRevised</p>
</item>
<item>
<p>Return: ./@number, ./metadata/title, ./metadata/author, ./metadata/subjects/subject</p>
</item>
<item>
<p>Comments: This is a full-text query on the phrase "usability testing" using a wildcard on the word "test", restricted to the <code>subject</code> element. The query 
counts the number of <code>author</code> elements, and runs a greater than comparison on dates.</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
   [(($book/metadata/publicationInfo/dateIssued &gt; "2000-12-31") 
   or ($book/metadata/publicationInfo/dateRevised &gt; "2000-12-31")) 
   and count($book/metadata/author) &gt; 1]
let $subj := $book//subject[. ftcontains "usability test.*" 
   with wildcards]
where count($subj)&gt;0
return &lt;book number="{$book/@number}"&gt; 
          {$book/metadata/title, $book/metadata/author, $subj}
       &lt;/book&gt;</eg>
<p>
<emph>Solution in XPath: None</emph>
</p>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&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;Morley Marigold&lt;/author&gt;
   &lt;subject&gt;<phrase role="found">Usability testing</phrase>&lt;/subject&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="xquery-xpath-composability-queries-results-q8">
<head>Q8 Query with XQuery Expression Within Full-Text Expression</head>
<p>Find all books published after "2001" which share a subject with the book with the short title "Usability Basics".</p>
<p>This query finds words using an XQuery expression to identify the words queried and looks for a publication date after the one specified.</p>
<ulist>
<item>
<p>Operands: "Usability Basics", "2001"</p>
</item>
<item>
<p>Functionality: phrase query, <code>and</code> query, date comparisons, XQuery expression to identify the words queried.</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, ./metadata/subjects/subject, ./metadata/publicationInfo/dateIssued|dateRevised</p>
</item>
<item>
<p>Return: ./metadata/title, ./metadata/author</p>
</item>
<item>
<p>Comments: This query returns a book if its last date of
publication is after 2001 and one of its subjects is
the same as a subject of the book with the short title "Usability
Basics". This query uses an XQuery expression to dynamically find the
subjects of books.</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 $bookSubject := doc("http://bstore1.example.com/full-text.xml")
   /books/book/metadata[./title/@shortTitle 
   ftcontains "Usability Basics"] /subjects/subject
where $book/metadata/publicationInfo/dateIssued  &gt; 2001 or
     $book/metadata/publicationInfo/dateRevised &gt; 2001 and
     $book/metadata/subjects/subject ftcontains {$bookSubject} any
return
        &lt;book number="{$book/@number}"&gt;
           {$book/metadata/title,
           $book/metadata/author}
        &lt;/book&gt;</eg>
<p>
<emph>Solution in XPath: None</emph>
</p>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&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;Morley Marigold&lt;/author&gt;
&lt;/book&gt;

&lt;book number="3"&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;book&gt;</eg>
</div3>
</div2>
</div1>
<div1 id="Score">
<head>Use Case "SCORE": All Queries May Be Written with Score, Queries in this Section Must Be Written with Score</head>
<div2 id="score-description">
<head>Description</head>
<p>All the queries in these Use Cases may be written with or without score. The Use Cases in this section are merely a small subset that focuses on score.</p>
<p>These queries exploit score and can not be written as queries with pure Boolean full-text predicates. Among these queries are a query that computes and returns only scores, a query which returns only results over a specified threshold, a query which filters by score, and a query which returns all the documents ordered. </p>
<p>Scoring methodologies will not be defined in this recommendation. Scoring is implementation-defined. </p>
</div2>
<div2 id="score-queries-results">
<head>Queries and Results</head>
<div3 id="score-queries-results-q1">
<head>Q1 Query Returning Scores</head>
<p>Find all books which mention "usability" in the title or the text. Return book titles and scores.</p>
<p>This query performs a word query and returns scores, highest scores first.</p>
<ulist>
<item>
<p>Operands: "usability"</p>
</item>
<item>
<p>Functionality: word query, implementation-defined scoring, returns score, construction of new element</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</p>
</item>
<item>
<p>Return: ./@number, ./metadata/title, score (constructed element)</p>
</item>
<item>
<p>Comments: This query is only possible as a scored query. Scores are included between 0 and 1. The scoring methodology in this use case is for illustrative purposes only. Scoring methodologies will be implementation-defined. This query returns the same results as a query with a pure Boolean full-text predicate. The difference is that the results are scored and the results are returned displaying the score and ranked by score.</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 score $s := ($book/metadata/title ftcontains 
   "usability" or $book/content ftcontains "usability") 
where $s &gt; 0  
order by $s descending 
return &lt;book number="{$book/@number}"&gt; 
          {$book/metadata/title},  &lt;score&gt;{$s}&lt;/score&gt; 
       &lt;/book&gt;</eg>
<p>
<emph>Solution in XPath: None</emph>
</p>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="2"&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;
   &lt;score&gt;0.9&lt;/score&gt;
&lt;/book&gt;

&lt;book number="1"&gt;
   &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;score&gt;0.8&lt;/score&gt;
&lt;/book&gt;
   
&lt;book number="3"&gt;
   &lt;title shortTitle="Usabilityguy Manuscript 
   Guide"&gt;John Wesley Usabilityguy: A Register of His 
   Papers&lt;/title&gt;    
   &lt;score&gt;0.12&lt;/score&gt;
&lt;/book&gt;</eg>
</div3>
<div3 id="score-queries-results-q2">
<head>Q2 Query Returning Results with Top Scores</head>
<p>Find the best two books on "usability".</p>
<p>This query performs a word query and returns only the results with the two top scores.</p>
<ulist>
<item>
<p>Operands: "usability"</p>
</item>
<item>
<p>Functionality: word query, implementation-defined scoring, returns books with the top two scores, conditional expression</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: .</p>
</item>
<item>
<p>Return: ./@number, ./metadata/title</p>
</item>
<item>
<p>Comments: This query returns results only for the two books with the highest scores. This query is only possible as a scored query. The scoring methodology in this use case is for illustrative purposes only. Scoring methodologies will be implementation-defined. This query returns the same results as a query with a pure Boolean full-text predicate. The difference is that the results are scored and through the introduction of a third variable only the two results with the highest scores are returned.</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">for $result at $i in
     for $book score $s in 
        doc("http://bstore1.example.com/full-text.xml")
        /books/book[. ftcontains "usability"]
      order by $s descending
      return $book
   where $i &lt;= 2
   return &lt;book number="{$result/@number}"&gt; 
      $result/metadata/title&lt;/book&gt;</eg>
<p>
<emph>Solution in XPath: None</emph>
</p>
<p>
<emph>Expected Result:</emph>
</p>
<eg xml:space="preserve">&lt;book number="1"&gt;
   &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;/book&gt;
   
&lt;book number="2"&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; 
&lt;/book&gt;</eg>
</div3>
<div3 id="score-queries-results-q3">
<head>Q3 Query Filtering on Scores</head>
<p>Find all books that focus on "usability".</p>
<p>This query performs a word query and filters on scores.</p>
<ulist>
<item>
<p>Operands: "usability"</p>
</item>
<item>
<p>Functionality: word query, implementation-defined scoring, filters on scores (accepts only those with score over 0.1)</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: .</p>
</item>
<item>
<p>Return: ./@number, ./metadata/title</p>
</item>
<item>
<p>Comments: This query is only possible as a scored query. The scoring methodology in this use case is for illustrative purposes only. Scoring methodologies will be implementation-defined. This query returns the same results as a query with a pure Boolean full-text predicate. The difference is that the results are scored and then filtered on the scores.</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">for $book score $s in 
   doc("http://bstore1.example.com/full-text.xml")
   /books/book[. ftcontains "usability"]
where $s &gt; 0.1
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[(for $i score $s in .[. ftcontains "usability"]
return $s) &gt; 0.1]/metadata/title</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="score-queries-results-q4">
<head>Q4 Query Combining Score and XML Structure with a Conditional Return</head>
<p>Find all books with parts about "usability testing".</p>
<p>This query finds books which contain parts about usability testing, returning entire books, but without <code>part</code> elements identified as irrelevant via score.</p>
<ulist>
<item>
<p>Operands: "usability testing"</p>
</item>
<item>
<p>Functionality: phrase query, character wildcard (suffix) (0 or more), implementation-defined scoring, filters on scores (under .05), conditional return</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: ./content/part</p>
</item>
<item>
<p>Return: ./@number, ./metadata/title, ./content/part/@number, ./content/part//title, ./content/part/p</p>
</item>
<item>
<p>Comments: This query is only meaningful as a scored query. The scoring methodology in this use case is for illustrative purposes only. Scoring methodologies will be implementation-defined. This query returns the same results as a query with a pure Boolean full-text predicate. The difference is that this query filters the <code>part</code> elements. They are included or excluded from the results depending on their score.</p>
</item>
</ulist>
<p>
<emph>Solution in XQuery:</emph>
</p>
<eg role="xquery" xml:space="preserve">declare function local:filter ( $nodes 
   as node()*, $exclude as element()* ) as node()*
   {
      for $node in $nodes except $exclude
      return
         typeswitch ($node)
            case $e as element()
               return 
                 element {node-name($e)}
                   {
                       $e/@*,
                      filter( $e/node() except $exclude, 
                      $exclude )
                   }
            default 
               return $node
   };

for $book in doc("http://bstore1.example.com/full-text.xml")
   /books/book
let $irrelevantParts := 
   for $part in $book//part
   let score $score := $part ftcontains "usability test.*" 
      with wildcards
   where $score &lt; 0.5
   return $part
where count($irrelevantParts) &lt; count($book//part)
return filter($book, $irrelevantParts)</eg>
<p>
<emph>Solution in XPath: None</emph>
</p>
<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;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 <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;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="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;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;/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 <phrase role="found">Usability</phrase> 
            <phrase role="found">Tests</phrase>&lt;/title&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&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 <phrase role="found">Usability Tests</phrase>&lt;/title&gt; 
            &lt;p&gt;Users can be tested at any computer 
            workstation &lt;footnote&gt;They may be most 
            comfortable at their own workstation.
            &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;<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;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;</eg>
</div3>
<div3 id="score-queries-results-q5">
<head>Q5 Query Returning All Books Ordered by Score</head>
<p>Return all books, listing books with text on "software" first.</p>
<p>This query performs a word query, returns all the documents in the database, and orders them returning those with found word first, those without last.</p>
<ulist>
<item>
<p>Operands: "software"</p>
</item>
<item>
<p>Functionality: word query, implementation-defined scoring</p>
</item>
<item>
<p>Data context: doc("http://bstore1.example.com/full-text.xml")/books/book</p>
</item>
<item>
<p>Query context: .</p>
</item>
<item>
<p>Return: ./@number, ./metadata/title, .</p>
</item>
<item>
<p>Comments: This query is only meaningful as a scored query. The scoring methodology in this use case is for illustrative purposes only. Scoring methodologies will be implementation-defined. This query returns the more results than a parallel query with a pure Boolean full-text predicate. In a parallel query with a pure Boolean full-text predicate, the last result would have a Boolean value of false and would not be returned. In this scored query the last result receives a score and is returned.</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 score $s := $book//content ftcontains "software"
order by $s descending
return $book</eg>
<p>
<emph>Solution in XPath: None</emph>
</p>
<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;title&gt;Expert Reviews&lt;/title&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;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 <phrase role="found">software</phrase> similar to that 
            employed by users.&lt;/p&gt;
         &lt;/introduction&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;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 <phrase role="found">software</phrase> 
         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;/content&gt;
&lt;/book&gt;

&lt;book number="2"&gt;
   &lt;metadata&gt;
      ...
   &lt;/metadata&gt;
   &lt;content&gt;	
      ...
   &lt;content&gt;	
&lt;/book&gt;</eg>
</div3>
</div2>
</div1>
</body>
<back>
<div1 id="Acknowledgements">
<head>Acknowledgements</head>
<p>The editors thank the members of the Full-Text Task Force of the XML Query and XSL Working Groups, which produced
the material in this document. Special thanks to Stephen Buxton for contributing the first version of the schema.</p>
<p>The editors thank the following staff at the Library of Congress for providing and improving
			sample data and queries: Ardith Bausenbach, Caroline Arms, Marla Banks, Susan David, Ray Denenberg,  
			Louis Drummond, Bohdan Kantor, Mary A. Lacy, Joe Pagano, Betsy Reifsnyder, Belinda D. Urquiza,
			and Anne Washington.</p>
<p>Thanks also to Bohdan Kantor, Foster Zhang, François Yergeau, and Michel Biezunski for assistance in translating the subjects in the sample data into Chinese and French.</p>
<p>The editors also wish to thank the members of the W3C Internationalization Working Group for their assistance.</p>
</div1>
<div1 id="References">
<head>References</head>
<div2 id="primary">
<head>References (Primary)</head>

<p>The following references are some of the works considered by the
Working Groups in deriving its use cases. </p>

<blist>
<bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="xpath-functions" key="XQuery 1.0 and XPath 2.0 Functions and Operators" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest"/>

<bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="xml-infoset" key="Infoset" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest"/>

<bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="Maier98" key="Maier98" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">
<emph>
<loc href="http://www.w3.org/TandS/QL/QL98/pp/maier.html" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">Database Desiderata for an XML Query Language</loc>, </emph>David Maier, 1998. In Query Languages 98 (QL'98). This paper is at http://www.w3.org/TandS/QL/QL98/pp/maier.html.</bibl>

<bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="REC-xml" key="XML" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest"/>

<bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="xmlschema-0" key="XMLSchema0" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest"/>
<bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="xmlschema-1" key="XMLSchema1" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest"/>
<bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="xmlschema-2" key="XMLSchema2" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest"/>

<bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="xquery" key="XQuery 1.0: An XML Query Language" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest"/>

<bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="xquery-use-cases" key="XML Query Use Cases" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest"/>

<bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="xquery-full-text" key="XQuery 1.0 and XPath 2.0 Full-Text" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest"/>

<bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="xquery-full-text-requirements" key="XQuery and XPath Full-Text Requirements" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest"/>

<bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="xpath20" key="XML Path Language (XPath) 2.0" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest"/>

<bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="xslt20" key="XSL Transformations (XSLT) Version 2.0" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest"/>

</blist>
</div2>
<div2 id="background">
<head>References (Background)</head>
<blist>
<bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="BYR99" key="BYR99" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">
<emph>Modern
     Information Retrieval, </emph>R.Baeza-Yates, B. Ribeiro-Neto. Addison Wesley, 1999.
					</bibl>
<bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="FGR01" key="FGR01" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">
<emph>XIRQL: An Extension of
     XQL for Information Retrieval, </emph>N. Fuhr, K. Grossjohann. 
     Proceedings of SIGIR, 2001.
					</bibl>
<bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="HTK00" key="HTK00" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">
<emph>Searching Text-Rich XML
     Documents with Relevance Ranking, </emph>Y. Hayashi, J. Tomita,
     G. Kikui. Proceedings of SIGIR Workshop on XML
     and Information Retrieval, 2000.
					</bibl>
<bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="MJK98" key="MJK98" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">
<emph>A Flexible
     Model for Retrieval of SGML Documents, </emph>S. Myaeng, D.-H. Jang,
     M.-S. Kim, Z.-C. Zhoo.  Proceedings of SIGIR, 1998.
					</bibl>
<bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="SCH01" key="SCH01" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">
<emph>Similarity Search in XML Data Using Cost-Based Query Transformations, </emph>T. Schlieder.
Proceedings of SIGMOD WebDB Workshop, 2001.
					</bibl>
<bibl xmlns:xlink="http://www.w3.org/1999/xlink" id="TWE00" key="TWE00" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">
<emph>Adding
          Relevance to XML, </emph>A. Theobald and G. Weikum. Proceedings of
          SIGMOD WebDB Workshop,
          2000.
					</bibl>
</blist>
</div2>
</div1>
<div1 id="Issues">
<head>Issues</head>
<issue id="staticErrorTesting" status="open">
<head>1. Testing queries for static errors</head>
<p>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>
<p>Raised by Michael Rys, Full-Text Redwood Shores meeting, March 30.</p>
<resolution>
<p>None.</p>
</resolution>
</issue>
</div1>
<div1 id="ChangeLog">
<head>Change Log</head>
<table border="0" summary="Change Log Table">
<tbody>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2003-06-18</td>
<td rowspan="1" colspan="1">Added a Change Log</td>
<td rowspan="1" colspan="1"/>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2003-06-18</td>
<td rowspan="1" colspan="1">Statements of Functionality Illustrated by Query Modified</td>
<td rowspan="1" colspan="1">Added a Data Context to the Statement of Functionality Illustrated by Query for each query. Made XPath expressions in Query Context and Return relative to the XPath expression in Data Context.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Sihem Amer-Yahia</td>
<td rowspan="1" colspan="1">2003-06-18</td>
<td rowspan="1" colspan="1">Schema Modified</td>
<td rowspan="1" colspan="1">Replaced schema with a shorter one which defines more shared types.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Sihem Amer-Yahia</td>
<td rowspan="1" colspan="1">2003-06-18</td>
<td rowspan="1" colspan="1">New Use Cases Added</td>
<td rowspan="1" colspan="1">Added the following Use Cases: 3.2.11 Q11 Query on Entire Document, 14.2.11 Q11 Phrase Query Ignoring Explicit List of Tags and Content of Descendant Elements.              						</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2003-06-23</td>
<td rowspan="1" colspan="1">New Use Case Added</td>
<td rowspan="1" colspan="1">Added the following Use Case: 16.2.7 Q7 Query on Full-Text Combined with Conditional on Date and Full-Text.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2004-02-24</td>
<td rowspan="1" colspan="1">Solutions in XQuery Added</td>
<td rowspan="1" colspan="1">Added Solutions in XQuery authored by Full Text Task Force Members.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2004-02-24</td>
<td rowspan="1" colspan="1">Use Case Removed</td>
<td rowspan="1" colspan="1">Removed the following Use Case: 2.2.3 Q3 Single Phrase Query on Long Text Excerpt.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2004-02-24</td>
<td rowspan="1" colspan="1">Switched Use of Proximity and Distance</td>
<td rowspan="1" colspan="1">Proximity is now the broader term, distance (proximity counting intervening words) and window are the narrower terms.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2004-02-24</td>
<td rowspan="1" colspan="1">Added Definition of the Word "Tag"</td>
<td rowspan="1" colspan="1">Added definition of the word "tag" to the introduction to the Ignore Section (subsequently moved to the Across Element Boundaries Section).</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2004-03-15</td>
<td rowspan="1" colspan="1">Edited Solutions in XQuery</td>
<td rowspan="1" colspan="1">Made changes such as removing operators and unnecessary parentheses, made stopwords stop words, etc.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2004-03-15</td>
<td rowspan="1" colspan="1">Query Statements and Expected Results Changed</td>
<td rowspan="1" colspan="1">Made extensive changes to statements of query functionality and expected results to correlate with the new solutions.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2004-04-26</td>
<td rowspan="1" colspan="1">Use Cases Removed</td>
<td rowspan="1" colspan="1">Removed the following use cases: 3.2.1 Q1 Query on Element, 4.2.1 Q1 Query on Word Ignoring Single Stop Word, 4.2.3 Q3 Query on Phrase Word, 4.2.4 Q4 Query on Phrase Ignoring Multiple Stop Words, 4.2.5 Q5 Query on Phrase Overriding Multiple Stop Words, 6.2.3 Q3 Single Infix Character Wildcard Query, 6.2.5 Q5 0 or More Suffix Character Wildcard Query, 6.2.9 Q9 Word Wildcard Query, 6.2.10 Q10 Specified Range Word Wildcard Query, 9.2.2 Q2 Or Query on More Than Two Words, 9.2.3 Q3 Or Query on Phrases, 9.2.5 Q5 And Query on More Than Two Words, 9.2.6 Q6 And Query on Phrases, 10.2.3 Q3 Unordered Window Query, 10.2.5 Q5 Unordered Within a Sentence Query, 10.2.7 Q7 Unordered Within a Paragraph Query, 12.2.1 Q1 Multiple Word Query, 12.2.2 Q2 Phrase Word Query, 13.2.3 Q3 Query on Element and Its Descendants, 13.2.4 Q4 Query on Element and Its Parent, 13.2.7 Q7 Query on Element and Its Siblings, 13.2.8 Q8 Query on Same Element in Different Sub-Trees, 14.2.2 Q2 Query Ignoring !
 Tags Within Multiple Words, 14.2.4 Q4 Phrase Query Ignoring Explicit List of Tags of Descendant Elements, 14.2.8 Q8 Phrase Query Ignoring Tags and Content of Descendant Elements Identified by an XPath Query, 14.2.10 Q10 Distance Query Ignoring All Tags and Content of Descendant  Elements, 14.2.11 Q11 Phrase Query Ignoring Explicit List of Tags and Content of Descendant Elements.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2004-04-26</td>
<td rowspan="1" colspan="1">Reorganized sections, moved and reworked numerous use cases.</td>
<td rowspan="1" colspan="1">Removed the Querying Words and Phrases Section and the Advanced Word and Phrase Query Section. Added sections for Querying Across XML Element Boundaries, Querying on Attribute Values, and Querying Instances of Elements. Reorganized the sections so functionality is introduced before it is used. Revised titles of sections and titles of queries.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2004-04-26</td>
<td rowspan="1" colspan="1">Use Cases Added</td>
<td rowspan="1" colspan="1">Added the following Use Cases:13.2.6 Q6 Query Combining Score and XML Structure with a Conditional Return, 16.2.8 Q8 Query with an XQuery Expression Within the Full-Text Expression.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2004-04-26</td>
<td rowspan="1" colspan="1">&lt;authors&gt; Elements Removed</td>
<td rowspan="1" colspan="1">Removed the unnecessary &lt;authors&gt; elements from the sample data, schema, and use cases.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2004-04-26</td>
<td rowspan="1" colspan="1">Solutions in XPath Added</td>
<td rowspan="1" colspan="1">Added Solutions in XPath authored by Full Text Task Force Members.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2004-04-26</td>
<td rowspan="1" colspan="1">Query Statements and Expected Results Changed</td>
<td rowspan="1" colspan="1">Made extensive changes to statements of query functionality and expected results to correlate with the new solutions.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2004-05-19</td>
<td rowspan="1" colspan="1">Renamed and Reversed Order of Sections</td>
<td rowspan="1" colspan="1">The INSTANCE Section was renamed CARDINALITY. The COMPOSABILITY Section was renamed XQUERY-XPATH-COMPOSABILITY and the COMPLEX Section was renamed FULL-TEXT-COMPOSABILITY, and their order in the document was reversed.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2004-09-17</td>
<td rowspan="1" colspan="1">Removed Version Statements</td>
<td rowspan="1" colspan="1">Removed the "For consideration in v.1" and "For consideration after v.1 version" statements from the Statements of functionality illustrated by query.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2004-09-17</td>
<td rowspan="1" colspan="1">Changed queries</td>
<td rowspan="1" colspan="1">Changed query statements, solutions, and results based on implementer feedback and Task Force decisions in the following use cases: Use case 14.2.1. Q1 Distance Query Ignoring Content of All Descendant Elements (changed the element whose descendants are ignored to one with content; without content keywords must be followed by an Exp so to ignore all of the descendants added *), Use Case 16.2.8 Q8 Query with XQuery Expression Within Full-Text Expression (changed all to any), Use Case 10.2.5  Q5 And Not Query (added Book 3 as a result), Use Case 15.2.5 Q5 Query on Different Elements in Different Sub-Trees with Conditional Return (added an "s" to problems in a let statement, corrected the $i(s) to $in(s), corrected the book number on the result to 1), Use Case 16.2.4 Q4 Full-Text Query with Numeric Value Comparison (added missing curly brace in element constructor), Use Case 16.2.5 Q5 Full-Text Query with Character String Query (changed metadata for Book 3 and the query to look for Washington, D.C. to make the result valid), Use Case 16.2.8 Q8 Query with XQuery Expression Within Full-Text Expression (Changed the query statement to search the book short title, improved the query and the comment statement), Use Case 13.2.4 Q4 Query on Element and Its Right Siblings (improved query).</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2004-09-18</td>
<td rowspan="1" colspan="1">Added FTUnit to window function</td>
<td rowspan="1" colspan="1">Added the FTUnit "word" to query solutions using the window function.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2004-09-22</td>
<td rowspan="1" colspan="1">Changed query in XQUERY-XPATH-COMPOSABILITY Section</td>
<td rowspan="1" colspan="1">Changed query statements, solutions, and results based on implementer feedback and Task Force decisions in Use Case 16.2.8 Q8 Query with XQuery Expression Within Full-Text Expression. (made it search any document not only $book, collapsed where clauses).</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2005-01-17</td>
<td rowspan="1" colspan="1">Changed score functionality</td>
<td rowspan="1" colspan="1">Changed the score functions (ft:score) to score clauses in the SCORE Section.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2005-01-17</td>
<td rowspan="1" colspan="1">Removed use cases from CHARACTER Section</td>
<td rowspan="1" colspan="1">Removed 9.2.5 Query on Word with Special Character and 9.2.6 Query on Word with Special Character or Phrase with Space from the CHARACTER Section.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2005-01-17</td>
<td rowspan="1" colspan="1">Updated syntax</td>
<td rowspan="1" colspan="1">Updated the syntax for wildcards, stop words, starts-with, entire content, and thesauri.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2005-02-01</td>
<td rowspan="1" colspan="1">Added XPath example of score functionality</td>
<td rowspan="1" colspan="1">Added XPath example of score clauses in the SCORE Section Q3 Filtering on Scores.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2005-02-02</td>
<td rowspan="1" colspan="1">Removed explicit unordered</td>
<td rowspan="1" colspan="1">Removed the "unordered" keyword from unordered queries. The default is unordered; the presence of the "ordered" keyword overrides the default.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2005-02-10</td>
<td rowspan="1" colspan="1">Updated distance and window syntax</td>
<td rowspan="1" colspan="1">Updated distance queries removing the no longer acceptable "with" keyword. Updated window queries removing the no longer acceptable "within" keyword.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2005-03-09</td>
<td rowspan="1" colspan="1">Updated FTTimes syntax</td>
<td rowspan="1" colspan="1">Updated the FTTimes syntax from "at least 2 occurrences" to "occurs at least 2 times".</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2005-03-09</td>
<td rowspan="1" colspan="1">Added syntax for embedded XQuery</td>
<td rowspan="1" colspan="1">Added syntax (curly braces "{}") around XQuery expressions embedded in XQuery Full-Text expressions.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2005-03-09</td>
<td rowspan="1" colspan="1">Reformatted URLs in solutions</td>
<td rowspan="1" colspan="1">Reformatted URLs in solutions to enable automatic parsing.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2005-03-09</td>
<td rowspan="1" colspan="1">Updated thesaurus and stop words syntax</td>
<td rowspan="1" colspan="1">Updated thesaurus and stop words syntax to include the keyword "at" before URLs.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2005-08-08</td>
<td rowspan="1" colspan="1">Changed FTMildNegation syntax</td>
<td rowspan="1" colspan="1">Changed "mild not" to "not in" in 10.27 Q7 Mild Not Query Where Second Operand Is a Subset of the First Operand.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2005-08-08</td>
<td rowspan="1" colspan="1">Changed FTIgnore</td>
<td rowspan="1" colspan="1">Edited introductory text to remove level by level ignore which has been postponed until VNext. Deleted 14.2.4 Q4 Distance Query Ignoring Content of Descendant
Elements Level by Level.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2005-08-25</td>
<td rowspan="1" colspan="1">Changed score syntax</td>
<td rowspan="1" colspan="1">Changed to new scoring syntaxes in Section 17. Use cases 1-4 illustrate scored queries returning the same results as a parallel pure Boolean full-text predicate query. 17.2.5 Q5 Query Returning All Books Ordered by Score illustrates a scored query returning more results than a parallel pure Boolean full-text predicate query.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2005-08-25</td>
<td rowspan="1" colspan="1">Corrected 15.2.4 Q4</td>
<td rowspan="1" colspan="1">Changed the title of 15.2.4 Q4 Distance and Boolean Queries Ignoring Content of a Descendant Element with Wildcards and Stemming to 15.2.4 Q4 Window Query with Wildcards and Stemming Ignoring Content of a Descendant Element. Rewrote the query.</td>
</tr>
<tr>
<td rowspan="1" colspan="1">Pat Case</td>
<td rowspan="1" colspan="1">2005-08-25</td>
<td rowspan="1" colspan="1">Changed window syntax</td>
<td rowspan="1" colspan="1">Changed to new window syntax, removing FTRange. Changed the syntax in 12.2.3 Q3 Ordered Window Query and 15.2.4 Q4 Window Query with Wildcards and Stemming Ignoring Content of a Descendant Element.</td>
</tr>
</tbody>
</table>
</div1>
</back>
</spec>