1 / 4

CPSC 534B – Assignment 3

CPSC 534B – Assignment 3. Question 1. Consider the spreadsheet containing quarterly sales figures for each salesman, along with annual totals. Devise a DTD for publishing this data in XML. What are the integrity constraints you can infer from your DTD?

marvaj
Download Presentation

CPSC 534B – Assignment 3

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CPSC 534B – Assignment 3 Question 1. Consider the spreadsheet containing quarterly sales figures for each salesman, along with annual totals. Devise a DTD for publishing this data in XML. What are the integrity constraints you can infer from your DTD? Suppose the spreadsheet data is published according to your DTD. Now, write a query in XQuery to transform this data into a format conforming to (the DTD for) relational format. How are the integrity constraints transformed? Repeat the whole exercise with XML schema.

  2. Question 2. This question concerns XPath. As illustrated in class, backward axes can sometimes be removed from XPath expressions, by rewriting them into equivalent ones. E.g., /book/*[parent:*/isbn]/author can be rewritten into: /book[isbn]/*/author. In this question, you are asked to come up with general criteria for rewriting XPath expressions into ones not involving backward axes. Using your criteria, can you develop an algorithm for rewriting? With the aid of DTD knowledge, we can turn more XPath expressions into those free of backward axes. Give an example illustrating this. Can you develop DTD-specific criteria for when such a rewriting is possible? Check whether your algorithm is complete (in either case). Why (not)?

  3. Question 3. We discussed several structural join algorithms in class. Can you modify these algorithms so as to compute the following operations: • Structural semi-join. • Structural semi-antijoin. • Structural (left) outerjoin. In each case, establish the time and space complexity of your modified algorithms.

  4. Question 4. Translate the following XQuery statement into an equivalent TAX expression (the major steps for a very similar query were actually outlined in class!): FOR $a IN distinct(document(“mybib.xml”)//author) WHERE $a/@hobby = “tennis” AND $a/affiliation=“UBC” RETURN <ubc-author-books> {$a/name} {FOR $b IN document(“mybib.xml”)//book WHERE $b/author = $a RETURN $b/title} </ubc-author-books>

More Related