CS 3200 Introduction to Database Management Assignment #5

This assignment uses the following XML document for all of the problems:

<edmx:Edmx Version="1.0"
  xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx"
  xmlns:edm="http://docs.oasis-open.org/odata/ns/edm">
 <edmx:DataServices DataServiceVersion="4.0">
  <edm:Schema Namespace="University">
   <edm:EntityType Name="Student">
    <edm:Key>
     <edm:PropertyRef Name="sid"/>
    </edm:Key>
    <edm:Property Name="major" Type="Edm.String" Nullable="true"/>
    <edm:Property Name="name" Type="Edm.String" Nullable="false"/>
    <edm:Property Name="matriculated" Type="Edm.DateTime" Nullable="true"/>
    <edm:Property Name="sid" Type="Edm.String" Nullable="false"/>
    <edm:Property Name="college" Type="Edm.String" Nullable="false"/>
    <edm:NavigationProperty Name="takes" Relationship="University.takes" FromRole="University.Student" ToRole="University.Section"/>
   </edm:EntityType>
   <edm:EntityType Name="Section">
    <edm:Key>
     <edm:PropertyRef Name="number"/>
    </edm:Key>
    <edm:Property Name="number" Type="Edm.String" Nullable="false"/>
    <edm:NavigationProperty Name="course" Relationship="University.course" FromRole="University.Section" ToRole="University.Course"/>
   </edm:EntityType>
   <edm:EntityType Name="Course">
    <edm:Key>
     <edm:PropertyRef Name="code"/>
    </edm:Key>
    <edm:Property Name="code" Type="Edm.String" Nullable="false"/>
    <edm:Property Name="title" Type="Edm.String" Nullable="false"/>
   </edm:EntityType>
   <edm:EntityContainer Name="University">
    <edm:EntitySet Name="Students" EntityType="University.Student"/>
    <edm:EntitySet Name="Sections" EntityType="University.Section"/>
    <edm:EntitySet Name="Courses" EntityType="University.Course"/>
   </edm:EntityContainer>
  </edm:Schema>
 </edmx:DataServices>
</edmx:Edmx>

In the first two problems of this assignment, the XML document above is the CSDL schema for an OData endpoint at:

  http://tubful.well.edu/registrar

In the other problems of this assignment, the XML document above is just an XML document.

  1. Specify an OData Version 4.0 query to find the following information: Find the courses that are being taken by "Mary".

  2. Specify an OData Version 4.0 query to find the following information: Find the names of all students who are in the "Engineering" college and who are taking the "Databases" course.

  3. Specify an XPath 2.0 query that will retrieve the following information from the XML document above: Get all entity types that have a nullable property named "college".

  4. Specify an XPath 2.0 query that will retrieve the following information from the XML document above: Get the name of the key of every entity type with a recursive navigation property. A navigation property is recursive if it associates a type with the same type.

To check your OData Version 4.0 queries you can use the OData Version 4.0 Query Verifier.