Web Data Management (WDM)

Exercise 2 (Submissions due to April 2)

  1. Textbook Exercise 2.7.1. In addition, draw the document of Figure 2.12 as
    an XPath tree. Test your expressions using some XPath evaluator. A simple
    command-line tool is given as a Java application xpathTest.
    It can be used as follows, say, form a Linux command line:
      $ javac xpathTest.java
      $ java xpathTest --nodes '//text()/..' ex_2_7_1.xml
      NODE #1:
      <b di="7" id="3">bli <c/>
      <c>
      <e>bla</e>
      </c>
      </b>
      NODE #2:
      <e>bla</e>
      NODE #3:
      <d>bou</d>
    
  2. Textbook Exercises 2.7.2 and 2.7.3.

  3. Textbook Exercise 2.7.6.

  4. (a) Is it true that the size or length of the result of an XPath query
    over an XML document of length n is at most linear, that is O(n)? Either give a
    counter-example or sketch an explanation for why this holds?
    (b) Explain why a naive evaluation of XPath expressions could require
    exponential time. As a concrete example, consider a simple document

    <a> <b /> <b /> </a>
    and the class of XPath queries qn, where

    q0 = /a/b

    q1 = /a/b/../b

    q2 = /a/b/../b/../b

    and qn consists of q0 followed by n pairs of parent-child steps of the form ../b .

  5. Express and test XPath queries 1 - 14 of Section 5.4.1 in the Textbook
    on the movies.xml document. The eXist database system is recommended for this, or
    you can use the xpathTest application as a (less user-friendly) alternative.

Viimeksi muutettu: perjantai, 22 maaliskuu 2013, 09:58