-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathps4_queries.txt
93 lines (81 loc) · 2.45 KB
/
ps4_queries.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#
# CS 460/660: Problem Set 4, Problem 6
# Querying an XML Database
#
# Put your name and email address below:
# name: Lucie Mugnier
# email: [email protected]
#
########################################################################
# REMEMBER:
# 1. You should include *both* a query and a print command for each
# problem, following the model shown in the sample query below.
# 2. You should *not* include the results of the queries.
# 3. You should test that the queries in this file are correct by
# executing all of the queries in the file from the command line.
# See the assignment for more details.
########################################################################
# Do not modify the following line.
openContainer imdb.dbxml
#
# Sample query: Find the names of all movies in the database from 1990.
#
echo "results of sample query"
echo "-----------------------"
query 'for $m in collection("imdb.dbxml")//movie
where $m/year = 1990
return $m/name'
print
echo ""
#
# part a. Add your query for this problem in the space provided below.
# Remember to include both a query command and a print command,
# putting them between the second and third echo commands.
#
echo "results for part a"
echo "------------------"
query 'for $m in collection ("imdb.dbxml")//movie
where $m[year>2010] and $m/rating = "R"
return $m/name'
print
echo ""
#
# part b. Add your query for this problem in the space provided below.
#
echo "results for part b"
echo "------------------"
query 'for $p in collection ("imdb.dbxml")//person
where contains ($p/pob, "Boston, Mass")
return $p[@actedIn]/name'
print
echo ""
#
# part c. Add your query for this problem in the space provided below.
#
echo "results for part c"
echo "------------------"
query 'for $m in collection ("imdb.dbxml")//movie
where $m/rating = "R" and contains($m/@oscars, "0000000")
return <winner>{$m/name/text()," (", $m/year/text(), ")"}</winner>'
print
echo ""
#
# part d. Add your query for this problem in the space provided below.
#
echo "results for part d"
echo "------------------"
query 'for $m in collection ("imdb.dbxml")//movie
where $m/earnings_rank>=1 and $m/earnings_rank<=10
return <top-grosser>
{
"\n\t",$m/name,
"\n\t", $m/earnings_rank,
for $p in collection("imdb.dbxml")//person
where contains($m/@actors, $p/@id)
return ("\n\t",<big-star>{$p/name/text()}</big-star>),"\n"
}
</top-grosser>'
print
echo ""
# Do not modify the following line.
quit