A Non-Relational Representation (Cont.)


Automobiles
It is composed of a drive and car body, with the drive consisting of an engine and gearing, and the engine being characterized by its horse-power and cubic capacity.
OttoEngine: [
  HP: Integer,
  cc: Integer ]

Automobile is-a Vehicle: [
  Drive: VehicleDrive,
  Carbody: String ]
VehicleDrive: [
  Engine: OttoEngine,
  Gearing: String ]

The Query Problem Solved
The query from the previous slide to know whether an employee named Pokemon is employed in the Detroit subsidiary of the Ford company is displayed again:

SELECT  EmplNo
  FROM  Company, Subsidiary, SubsEmpl, Employee
  WHERE  Company.Name = 'Ford'  AND
         Company.CompanyID = Subsidiary.CompanyID  AND
         Subsidiary.Location = 'Detroit'  AND
         Subsidiary.CompanyID = SubsEmpl.CompanyID  AND
         Subsidiary.NameSubs = SubsEmpl.NameSubs  AND
         SubsEmpl.Empl = Employee.EmplNo  AND
         Employee.Name = 'Pokemon';

This query could be stated in an object-oriented adaptation of SQL using path expressions:

SELECT  e
  FROM  e IN Employee, c IN Company, s IN Subsidiary
  WHERE  c.Name = 'Ford'  AND
         s IN c.Subsidiaries  AND
         s.Office.Location = 'Detroit'  AND
         e IN s.Employees  AND
         e.Name = 'Pokemon';