The XML version of our relational movie database
consists of a single XML document whose root element is called imdb
.
That root element has three child elements:
one called movies
, which has a nested movie
element for each
movie in the database. They each represent all of the information
about a given movie, including its director(s), actors, and Oscars
(if any). You can see what these elements look like by entering
the following query in BaseX:
//movie
one called people
, which has a nested person
element for each
person in the database. They each represent all of the information
about a given person, including any movies they have directed or
acted in, and any Oscars that they have won.
You can see what these elements look like by
entering the following query in BaseX:
//person
one called oscars
, which has a nested oscar
element for each
Oscar award in the database. The format of these oscar
elements is different than the format used in Problem 3. You
can see what these elements look like by entering the following
query in BaseX:
//oscar
Each movie
, person
, and oscar
element has an attribute called
id
that serves as a unique identifier for that element.
Additional details about each of these element types are provided below.
movie
elementsIn addition to its id
attribute, each movie
element can have
one or more attributes that capture the connections between the movie
and the people and Oscars associated with that movie. For example:
<movie id="M0120338" directors="P0000116" actors="P0000138 P0000701 P0000708 P0000870 P0000200" oscars="O19980000000 O19980000116"> <name>Titanic</name> <year>1997</year> <rating>PG-13</rating> <runtime>194</runtime> <genre>DR</genre> <earnings_rank>9</earnings_rank> </movie>
This element indicates that Titanic was directed by one person
in the database (the one whose XML id is listed in the value
of its directors
attribute), that its cast included five of the
people in the database (the ones whose XML ids are listed in
the value of its actors
attribute), and that it won
two of the Oscars in the database (the ones whose XML ids are
listed in the value of its oscars
attribute).
If there are no actors, directors, or Oscars associated with a given movie, the corresponding attribute is omitted from its element.
A movie
element also has one nested child element for each non-NULL
column value from its tuple in our relational Movie
table.
If the value of a given column is NULL
, the corresponding child
element is omitted.
person
elementsIn addition to its id
attribute, each person
element can have
one or more attributes that capture the connections between the person
and the movies and Oscars associated with that person. For example:
<person id="P0000243" directed="M2671706" actedIn="M0097441 M0107818 M0139654 M2671706" oscars="O20020000243 O19900000243"> <name>Denzel Washington</name> <dob>1954-12-28</dob> <pob>Mount Vernon, New York, USA</pob> </person>
This element indicates that Denzel Washington directed one of the
movies in the database (the one whose XML id is listed in the value of
his directed
attribute), that he acted in four of the movies in the
database (the ones whose XML ids are listed in the value of his
actedIn
attribute), and that he has won two of the Oscars in the
database (the ones whose XML ids are listed in the value of his
oscars
attribute).
If a person did not direct a movie, act in a movie, or win an Oscar recorded in the database, the corresponding attribute is omitted from their element.
A person
element also has one nested child element for each non-NULL
column value from its tuple in our relational Person
table.
If the value of a given column is NULL
, the corresponding child
element is omitted.
oscar
elementsImportant: As mentioned above, the format of these oscar
elements is different than the format used in Problem 3.
In addition to its id
attribute, each oscar
element can have
up to two other attributes that capture the connections between
the Oscar and the person and/or movie associated with the award.
For example:
<oscar id="O20230000409" movie_id="M1383368" person_id="P0000409"> <type>BEST-ACTOR</type> <year>2023</year> </oscar>
This element indicates that the 2023 Oscar for Best Actor was won
by the person with id "P0000409"
(Brendan Frasier) for his work
on the movie with id "M1383368"
(The Whale).
For Best Picture Oscars, the person_id
attribute is omitted.
All oscar
elements also have nested type
and year
elements that
capture those values from the Oscar’s tuple in our relational Oscar
table.
Last updated on October 8, 2024.