


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Instructions for homework 3 of a db course in spring 2005. The assignment involves using xml documents, specifically saxon xquery processor, to answer various queries about the data structures of auction.xml and thatt.xml. The document also includes instructions for converting thatt.xml into a new format and designing a relation schema for thesaurus data.
Typology: Study notes
1 / 4
This page cannot be seen from the preview
Don't miss anything!



CPS 216 Spring 2005 Homework # Assigned: Tuesday, March 29 Due: Tuesday, April 12
Problem 1.
Consider an XML document (from a project called XMark) modeling the data maintained by an Internet auction site in /home/dbcourse/examples/xml-xmark/auction.xml. The main entities modeled are: items, persons, open auctions, closed auctions, and categories.
regions people open_auctions closed_auctions
{africa,asia,...}
iteminfo description
address
name
street
person name
city country
zipcode
open_auction bidder itemref seller date time personref
increase
initial
closed_auction itemref buyer seller
price
incategory
On rack40, use the following query with saxonxq
Write queries in XQuery to answer the following questions. Because Saxon does not have a sophisticated optimizer, query performance may be influenced by the way you write your queries. If a particular query takes forever to run, consider reordering loops and evaluating selections (filters) as early as possible.
For each question below, say (a), write your XQuery in a file named hw3-1-a.xquery, and generate the output file hw3-1-a.xml by running saxonxq hw3-1-a.xquery > hw3-1- a.xml. Turn in printout of all your .xquery and output .xml files. If the output file is too long, print out only the first page of the output.
(a) Find names of all items in “namerica” region. (b) Find names of all items that belong to “category0.” (c) Find names of all persons whose address is in “United States.” (d) Find all buyers who paid for more than $50 in a closed auction. (e) Find names of all person who has bidden in an open auction for an item whose name contains the string “cow.” (f) Find names of all persons with address in “United States” who never bought anything in closed auctions. (g) For each open auction whose seller's name is “Venkatavasu Takano,” print out the following information: <open_auction id=“...”>
Problem 2.
Consider an XML document describing a thesaurus (from http://zthes.z3950.org/) in /home/dbcourse/examples/xml-zthes/thatt.xml. The XML document contains a list of terms. Each term has a list of relations with other terms. For example, the following excerpt from thatt.xml means that the term INFORMATION ECONOMICS is related to terms INFORMATION, INFORMATION INDUSTRY, INFORMATION SYSTEMS, and INFORMATION THEORY:
Show the raw output generated by your code; do not manually edit the output (other than truncating it for printout).
(b) Design and create a relation schema to store the thesaurus data using the schema- aware approach discussed in lecture. Your design should not have the redundancy described in (a). Populate the tables with the data from thatt.xml. You should write a program or script to convert the data into flat files and import them into DB2. Do not use individual INSERT statements. The choice of programming/scripting language and XML API is up to you. Instructions on how to load a DB2 database can be found in the document “DB2 SQL Programming Notes” on the course Web site; examples can be found in /home/dbcourse/examples/db-*/ directories.
Turn in the following: