TextServer
Company Structured Text Software Solutions Customers Support
Demonstrations Documentation Downloads Publications Acknowledgements



These queries are based on XML Query Use Cases by W3C. They demonstrate how the provided queries can be done using Textserver software. Cases shown in green were somewhat problematic, while those shown in red were not computable at all using our software.


Set 1: Queries and Results

Click here to view the DTD and XML files for Q1, Q2, Q3, Q4, Q6, Q7, Q8, Q11, and Q12.
Click here to view the DTD and XML files for Q5.
Click here to view the DTD and XML files for Q9.
Click here to view the DTD and XML files for Q10.

Q1 List books published by Addison-Wesley after 1991, including their year and title.
Q2 Create a flat list of all the title-author pairs, with each pair enclosed in a "result" element.
Q3 For each book in the bibliography, list the title and authors, grouped inside a "result" element.
Q4 For each author in the bibliography, list the author's name and the titles of all books by that author, grouped inside a "result" element.
Q5 For each book found at both bn.com and amazon.com, list the title of the book and its price from each source.
Q6 For each book that has at least one author, list the title and first two authors, and an empty "et-al" element if the book has additional authors.
Q7 List the titles and years of all books published by Addison-Wesley after 1991, in alphabetic order.
Q8 Find books in which some element has a tag ending in "or" and the same element contains the string "Suciu" (at any level of nesting). For each such book, return the title and the qualifying element.
Q9 In the document "books.xml", find all section or chapter titles that contain the word "XML", regardless of the level of nesting.
Q10 In the document "prices.xml", find the minimum price for each book, in the form of a "minprice" element with the book title as its title attribute.
Q11 For each book with an author, return the book with its title and authors. For each book with an editor, return a reference with the book title and the editor's affiliation.
Q12 Find pairs of books that have different titles but the same set of authors (possibly in a different order).

Set 2: Queries that preserve hierarchy

Click here to view the DTD and XML files for Q1, Q2, Q3, Q4, and Q5.

Q1 Prepare a (nested) table of contents for Book1, listing all the sections and their titles. Preserve the original attributes of each <section> element, if any
Q2 Prepare a (flat) figure list for Book1, listing all the figures and their titles. Preserve the original attributes of each <figure> element, if any.
Q3 How many sections are in Book1, and how many figures?
Q4 How many top-level sections are in Book1?
Q5 Make a flat list of the section elements in Book1. In place of its original attributes, each section element should have two attributes, containing the title of the section and the number of figures immediately contained in the section.
Q6 Make a nested list of the section elements in Book1, preserving their original attributes and hierarchy. Inside each section element, include the title of the section and an element that includes the number of figures immediately contained in the section.

Set 3: Queries based on Sequence

Click here to view the DTD and XML files Q1, Q2, Q3, Q4, and Q5.

Q1 In the Procedure section of Report1, what instruments were used in the second incision?
Q2 In the Procedure section of Report1, what are the first two instruments used?
Q3 In Report1, what instruments were used in the first two Actions after the second Incision?
Q4 In Report1, frind "Procedure" sections where no Anesthesia element occurs before the first Incision
Q5 In Report1, what happened between the first and the second Incision?

Set 4: Access to relational data

Click here to view the DTD and XML files for the following questions.
Click here to view the views created for the following questions.

The following results assume that the queries were executed on Feb. 1, 1999.

Q1 List the item number and description of all bicycles that currently have an auction in progress, order by item number.
Q2 For all bicycles, list the item number, description, and highest bid (if any), ordered by item number.
Q3 Find cases where a user with a rating worse (alphabetically greater) than "C" is offering an item with a reserve price of more than 1000.
Q4 List item numbers and descriptions of items that have no bids.
Q5 For bicycle(s) offered by Tom Jones, list the item number, description, highest bid(if any), and name of the highest bidder, order by item number.
Q6 For each item whose highest bid is more than twice it's reserve price, list the item number, description, reserve price, and highest bid.
Q7 Find the highest bid ever made for a bicycle or a tricycle.
Q8 How many items were auctioned (auction ended) in March 1999?
Q9 List the number of items auctioned each month in 1999 for which data is availabe, ordered by month.
Q10 For each item that has received a bid, list the item number, the highest bid, and the name of the highest bidder, order by item number.
Q11 List the item number and description of the item(s) that received the highest bid ever recorded, and the amount of that bid.
Q12 List the item number and description of the item(s) that received the largest number of bids, and the number of bids it (or they) received.
Q13 For each user who has placed a bid, give the userid, name, number of bids, and average bid, order by userid.
Q14 List item numbers and average bids for items that have received three or more bids, in descending order by average bid.
Q15 List names of users who have placed multiple bids of at least $100 each.
Q16 List all registered users in order by userid; for each user, include userid, name, and an indication of whether the user is active (has at least one bid on record) or inactive (has no bid on record).
Q17 List the names of users, if any, who have bid on every item.
Q18 List all users in alphabetic order by name. For each user, include descriptions of all the items (if any) that were bid on by that user, in alphabetic order.

Set 5: Standard Generalized Markup Language

Click here to view the DTD and XML files for the following questions.

Q1 Locate all paragraphs in the report (all "para" elements occuring anywhere within the "report" element).
Q2 Locate all paragraph elements in an introduction (all "para" elements directly contained within an "intro" element).
Q3 Locate all paragraphs in the introduction of a section that is in the chapter that has no introduction (all "para" elements directly contained within an "intro" element directly contained in a "section" element directly contained in a "chapter" element. The "chapter" element must not directly contain an "intro" element).
Q4 Locate the second paragraph in the third section in the second chapter (the second "para" element occuring in the third "section" element occuring in the second "chapter" element occuring in the "report").
Q5 Locate all classified paragraphs (all "para" elements whose "security" attribute has the value "c").
Q6 List the short titles of all sections (the values of the "shorttitle" attributes of all "section" elements, expressing each short title as the value a new element.)
Q7 Locate the initial letter of the initial paragraph of all introductions (the first character in the content [character content as well as the element content] of the first "para" element contained in an "intro" element).
Q8a Locate all sections with a title that has "is SGML" in it (all "section" elements that contain a "title" element that has the consecutive characters "is SGML" in its content). The string can be interrupted by sub-elements.
Q8b Same as (Q8a), but the string cannot be interrupted by sub-elements.
Q9 Locate all the topics referenced by a cross-reference anywhere in the report (all the "topic" elements whose "topicid" attribute value is the same as an "xrefid" attribure value of any "xref" element).
Q10 Locate the closest title preceding the cross-reference ("xref") element whose "xrefid" attribute is "top4" (the "title" element that would be touched last before this "xref" element when touching each element in document order).

Set 6: Full Text Search

Click here to view the DTD and XML files for company.
Click here to view the DTD and XML files for news.

Q1 Find all news items where the name "Foobar Corporation" appears in the title.
Q2 Find news items where the Foobar Corporation and one or more of it's partners are mentioned in the same paragraph and/or title. List each news item by its title and date.
Q3 Find titles of news items where Foobar Corporation and one or more of it's partners are mentioned in the same sentence, but none of its competitors are mentioned in the news item. (The "." designates the end of a sentence.)
Q4 Find news items where a company and one of its partners is mentioned in the same news item and the news item is not authorized by the company itself.
Q5 For each news item that is relevant to the Gorilla Corporation, create an "item summary" element. The content of the item summary is the content of the title, date, and first paragraph of the news item, seperated by periods. A news item is relevant if the name of the company is mentioned anywhere within the content of the news item.
Q6 Find news items where two company names and some form of the word "aquire" appear in the title or in the same sentence in one of the paragraphs. A company name is defined as the content of a <name>, <partner>, or <competitor> element within a <company> element.

Set 7: Queries using Namespaces

Click here to view the XML file used in these queries.
Q1 List all unique namespaces used in the sample data.
Q2 Select the title of each record that is for sale.
Q3 Select all elements using datatypes from "XML Schema: Part 2" datatypes.
Q4 List the target URI's of all XLinks in the document.
Q5 Select all records that have a remark in German.
Q6 Select the closing time elements of all AnyZone auctions currently monitored.
Q7 Select the homepage of all auctions where both seller and high bidder are registered at the same auctioneer.
Q8 Select all traders (either seller or high bidder) without negative comments.

Set 8: Recursive parts explosion

Click here to view the DTD and input data set.

Q1 Convert the sample document from "partlist" format to "parttree" format (see DTD section for definitions). In the result document, part containment is represented by containment of one <part> element inside another. Each part that is not part of any other part should appear as a separate top-level element in the output document.

Set 9: Queries based on References

Click here to view the DTD and input data set.

Q1 Find Martha's spouse.
Q2 Find Joe's children.
Q3 Find parents of athletes.
Q4 Find people who have the same job as one of their parents.
Q5 List names of parents and children who have the same job, and their jobs.
Q6 Find Bill's grandchildren.
Q7 List name-pairs of grandparents and grandchildren.
Q8 Find Dave's parents-in-law (parents of his spouse, if any).
Q9 Find people with no children.
Q10 Find single parents (people with children but no spouse).
Q11 List the names of all Joe's descendants. Show each descendant as an element with the descendant's name as content and his or her marital status and number of children as attributes. Sort the descendants in descending order by number of children, and secondarily in alphabetical order by name.

Maintainer
webmaster@textserver.com
Back