Download presentation
Presentation is loading. Please wait.
Published byEthan Atkinson Modified over 8 years ago
1
eXist and XPath
2
General Announcements Examples (Books.xml) from the Lecture Slides Questions from the Movies.xml file Assignment Discussion Questions
3
Start up the “eXist-db Database” program. Go to: http://localhost:8080/exist/http://localhost:8080/exist/ Go to the “Collections” Drag in books.xml and Movies.xml to upload them. Go to the “eXide – Xquery IDE” to run the queries on the XML files. Once the XPath/XQuery queries are typed in, click “Run” to return results.
4
/bookstore/book //book[3]/author[2] //book[price<30] //book[title/@lang='en'] //book[author][price<‘30’]/t itle
5
/bookstore/book //book[3]/author[2] //book[price<30] //book[title/@lang='en'] //book[author][price<‘30’]/t itle This will return all the elements under the bookstore and book (all the element information for “Everyday Italian”, “Harry Potter”, “Xquery Kick Start” and “Learning XML”).
6
/bookstore/book //book[3]/author[2] //book[price<30] //book[title/@lang='en'] //book[author][price<‘30’]/t itle The will return the second author for the third book element (“Per Bothner”).
7
/bookstore/book //book[3]/author[2] //book[price<30] //book[title/@lang='en'] //book[author][price<‘30’]/t itle All the books where the price is less than 30 (the details for the “Harry Potter” book).
8
/bookstore/book //book[3]/author[2] //book[price<30] //book[title/@lang='en'] //book[author][price<‘30’]/t itle All the books that have a title, and under the title element, there is a lang element that has a value of “en” (all the books since they all fall under this category).
9
/bookstore/book //book[3]/author[2] //book[price<30] //book[title/@lang='en'] //book[author][price<'30']/t itle Note: This was changed slightly from the lecture. All the book titles that have an author element and a price under 30 – the title of “Harry Potter”.
10
Find the actors of the movie with title “Unforgiven”
11
//actor[../title='Unforgiven'] The details of Clint Eastwood, Gene Hackman and Morgan Freeman
12
Find movies directed by “Clint Eastwood”
13
//title[../director/first_name=' Clint'][../director/last_name=' Eastwood'] This will return “Unforgiven”
14
Find the year of the movie entitled “Spider- Man”
15
//year[../title='Spider-Man'] This will return “2002”
16
Find the first actor in each movie directed by some with firstname “Sofia”
17
//actor[1][../director/first_na me=’Sofia’] This will return the details for Scarlet Johansson and Kirsten Dunst from the movies “Lost in Translation” and “Marie Antoinette” respectively.
18
Find the roles played by the actor “Kirstan Dunst”
19
//role[../first_name='Kirstan'][../last_name='Dunst'] This will return nothing as there is no actress with the name “Kirstan Dunst”.
20
Find the roles played by the actor “Kirsten Dunst” //role[../first_name='Kirsten'][../last_name='Dunst'] This returns “Marie Antoinette” and “Mary Jane Watson” from the movies “Marie Antoinette” and “Spider-Man” respectively.
21
Find all movies that has a genre and country
22
//movie[genre][country] This returns all movies (“A History of Violence”, “Heat”, “Unforgiven”, “Match Point”, “Lost in Translation”, “Marie Antoinette” and “Spider-Man”) as they all have a genre and a country element each.
23
Find all movies that has a genre, country and summary //movie[genre][country][summ ary] This returns all movies except for “Lost in Translation” as it does not have a summary in the movie element.
24
Find the title and summary of movies produced in 1982.
25
//title[../year='1982'] | //summary[../year='1982'] This returns nothing as there were no movies produced in 1982.
26
Find the title and summary of movies produced in 1992. //title[../year='1992'] | //summary[../year='1992'] This returns the title and summary for the movie “Unforgiven” as that movie was produced (year) in 1992.
27
The assignment criteria sheets should be online on L@G. This includes: ◦ The report assignment sheet which is due in week 10. ◦ The presentation assignment sheet which is due in weeks 11 and 12. The report should follow the standard research paper structure and conform to a template such as the IEEE Transactions http://www.ieee.org/conferences_events/con ferences/publishing/templates.html http://www.ieee.org/conferences_events/con ferences/publishing/templates.html
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.