30 likes | 238 Views
Assignment #2 Due: Nov. 06, 2013. 1. (20) The following is a DTD for books. Please produce an XML document conforming to the DTD. <!DOCTYPE AuthorBook [ <!ELEMENT AuthorBook (Author*, Book*)> <!ELEMENT Author (Name, Address+)> <!ATTLIST Author AuthorId ID #REQUIRED
E N D
Assignment #2 Due: Nov. 06, 2013 • 1. (20) The following is a DTD for books. Please produce an XML document conforming to the DTD. <!DOCTYPE AuthorBook [ <!ELEMENT AuthorBook (Author*, Book*)> <!ELEMENT Author (Name, Address+)> <!ATTLIST Author AuthorId ID #REQUIRED writing INREFS #IMPLIED > <!ELEMENT Name (#PCDATA)> <!ELEMENT Address (Street, City)> <!ELEMNT Street (#PCDATA)> <!ELEMENT City (#PCDATA)> <!ELEMENT Book (Title, Publisher, Year)> <!ATTLIST Book BookIn ID #REQUIRED authorOf IDREFS #REQUIRED > <!ELEMENT Title (#PCDATA)> <!ELEMENT Publisher (#PCDATA)> <!ELEMENT Year (#PCDATA)> ]> Yangjun Chen ACS-7102
(20) Define an XML-schema which is equivalent to the DTD shown in Question 1. • (25) Assume that for an attribute of a table, m bit maps (bit vectors) are created and then compressed using the following procedure: • a. Decompose each bit vector into a series of runs such that each contains a set consecutive 0’s followed by • a 1. • b. compress each run with i 0’s as below: • part 1: i expressed as a binary number, denoted as b1(i). • part 2: Assume that b(i) is j bits long. Then, part 2 is a sequence of (j – 1) 1’s followed by a 0, denoted a b2(i). • c. The compressed bit string is set to be b2(i) b1(i). • Let sj be the jth compressed bit vector. Putting all the compressed bit vectors together, we get a bit string: • s = s1s2…sj…sm • Please design a method to uncompress any compressed bit vector efficiently. Yangjun Chen ACS-7102
4. (20) The following is a DTD for a set of documents on books. • (a) Write an FLWR expression to find all the books authored by D. Knuth. • (b) Write an FLWR expression to find all books published by Addison Wesley Longman in 2007. <!DOCTYPE AuthorBook [ <!ELEMENT AuthorBook (Author*, Book*)> <!ELEMENT Author (Name, Address+)> <!ATTLIST Author AuthorId ID #REQUIRED writing INREFS #IMPLIED > <!ELEMENT Name (#PCDATA)> <!ELEMENT Address (Street, City)> <!ELEMNT Street (#PCDATA)> <!ELEMENT City (#PCDATA)> <!ELEMENT Book (Title, Publisher, Year)> <!ATTLIST Book BookIn ID #REQUIRED authorOf IDREFS #REQUIRED > <!ELEMENT Title (#PCDATA)> <!ELEMENT Publisher (#PCDATA)> <!ELEMENT Year (#PCDATA)> ]> • 5. (15) According to the above DTD, construct an Xpath expression to find the author’s name who published a book entitles “Art of Programming” in 1972. Yangjun Chen ACS-7102