pid | Name | Price | Description |
323 | gizmo | 22.99 | great |
233 | gizmo plus | 99.99 | more features |
312 | gadget | 59.99 | good value |
Stores:
sid | Name | Phone |
s282 | Wiz | 555-1234 |
s521 | Econo-Wiz | 555-6543 |
Sells:
pid | Markup | sid |
323 | 10% | s521 |
233 | 25% | s282 |
233 | 15% | s521 |
<db> <products>
<row> <pid>323
</pid>
<name> gizmo </name>
<price> 22.99
</price>
<description> great </description>
</row>
<row> ... <row>
<row> ... <row>
. . . .
</products>
<stores> <row> ... <row> ... </stores>
<sells> <row> ... </row> ... </sells>
</db>
Write an XQuery expression that, when given an input with this structure, constructs an XML document with the structure described in a.
[30 points] XML Storage. Consider the DTD below:
<!ELEMENT Parties (Party*)>
<!ELEMENT Party (Event, OrganizerPhone?, ((Time, Place)
| Recurring), Participant*)>
<!ELEMENT Participant (Name, Phone*,Email*)>
Elements that are not defined are #PCDATA. The order of
all elements in the document is irrelevant. Consider a data instance
X with 10 Party elements, each with one OrganizerPhone, a
Time, a Place, and 20 Participants, each with exactly one
Phone and one Email. Also consider the query Q below:
for $x in
/Parties/Party[Place/text()="Tom's house"],
$y in $x/Participant[Phone/text() = $x/OrganizerPhone/text()]
return
$y/Email/text()