30
Unisys Server Enterprise Division SIM Example: Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager Employees-Managed Projects-Managing Project-Manager Dept-Assigned Project-Of Assignment-History Staff-Assigned Assignment-Record Dept-Staff Dept-In Interim-Manager Project-Team Current-Project Dept-Managers Managers-Department Start-Date Assignment-No End-Date Rating Est-Person-Hours S u b - P r o j e c t s S u b - P r o j e c t - O f Project (Next-Project-No) Project-No Project-Title Manager-Title Bonus Interim-History (Start-Date, End-Date) MV Employee-ID Employee-Hire-Date Employee-Salary Employee-Status Dept-No Dept-Title Dept-Location Title Overall-Rating Termination-Reason Leave-Status Last-Work-Date Hire-Date Name (First-Name, Mid-Initial, Last-Name) Current-Residence (Street, City, State, ZipCode) Education (Degree-Obtained, Year-Obtained, GPA) MV Next-of-Kin (Relationship, Phone, Name-Of-Kin (First-Name, Mid_Initial, Last-Name)) Marital-Status US-Citizen Soc-Sec-No Birth-Date Gender Age

Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Embed Size (px)

Citation preview

Page 1: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

SIM Example: Organization Schema

Person

Project-Employee Manager

Department

Assignment

EmployeePrevious-Employee

SpouseChild

Parent

Employee-Manager

Employees-Managed

Projects-ManagingProject-Manager

Dept-Assigned

Project-Of

Assignment-HistoryStaff-Assigned

Assignment-Record

Dept-StaffDept-In

Interim-Manager

Project-Team

Current-Project

Dept-Managers

Managers-Department

Start-Date Assignment-No

End-Date RatingEst-Person-Hours

Sub-P

rojects

Sub-P

roject-Of

Project(Next-Project-No)Project-NoProject-Title

Manager-TitleBonus

Interim-History (Start-Date, End-Date) MV

Employee-IDEmployee-Hire-DateEmployee-SalaryEmployee-Status

Dept-NoDept-TitleDept-Location

TitleOverall-Rating

Termination-ReasonLeave-StatusLast-Work-Date Hire-Date

Name (First-Name, Mid-Initial, Last-Name)Current-Residence (Street, City, State, ZipCode)Education (Degree-Obtained, Year-Obtained, GPA) MVNext-of-Kin (Relationship, Phone, Name-Of-Kin (First-Name, Mid_Initial, Last-Name))Marital-Status US-Citizen Soc-Sec-NoBirth-Date Gender Age

Page 2: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

SIMOrigins and Evolution

Doug TolbertUnisys CorporationMission Viejo, CA

Unisys ServerEnterprise

Division

Page 3: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

SIM Motivations: Objectives (1983)

Ease of Use

Productivity

Data Integrity

Coexistence

Performance

• Integrated, high level interface• Query & schema flexibility• Data Independence

• Set-oriented, non-procedural interface

• Naturally handle complexity

• Easy to learn• Minimal programming effort• Retrieval without programming

• System enforced integrity• Shared data definitions• Referential integrity

• No impact on DMS II customer base

• New capabilities for existing data

• Must support production level transaction processing systems

• Fast• Fast• Fast

Page 4: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

SIM Motivations: Options (1983)

Enhance DMS II Relational System Something New

• Improve ease of use

• Gain productivity & data integrity without sacrificing installed base

• Performance thought to be near architectural limits (but wasn’t true!)

• Not likely to expand customer base

• Ease of use would improve

• Productivity gains marginal

• Data integrity very limited

• Extensive data engine rework

• No migration path for customer base

• Performance?

• Late to market

• Designed to meet Ease of use, productivity, and data integrity goals

• New features for existing databases without migration

• Performance based on proven DMS II algorithms

• Semantic Data Model provided best framework

Page 5: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

SIM: Something New!

Artificial Intelligence

Semantic NetworksQuillian, Brachman

SIMGraphical Data Models

Entity RelationshipChen

Set Data Models

RM/TCodd

Query Languages

GORDASEl-Masri

Semantic Models

SDMHammer & McLeod

Programmatic Model

DAPLEXShipman

Page 6: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

SIM: A Semantic Data ModelWhat makes a data model

“semantic”?

“During the last few years numerous investigations have been aimed at capturing (in a reasonably formal way) more of the meaning of the data, while preserving independence of implementation. This activity is sometimes called semantic data modelling. Actually, the task of capturing the meaning of data is a never-ending one. So the label ‘semantic’ must not be interpreted in a absolute way.”

-- E. F. Codd, 1979

• SDMs capture the meaning of data, not just its physical representation

• So, the more meaning a data model captures, the more “semantic” it is

What makes a data model “semantic”?

“During the last few years numerous investigations have been aimed at capturing (in a reasonably formal way) more of the meaning of the data, while preserving independence of implementation. This activity is sometimes called semantic data modelling. Actually, the task of capturing the meaning of data is a never-ending one. So the label ‘semantic’ must not be interpreted in a absolute way.”

-- E. F. Codd, 1979

• SDMs capture the meaning of data, not just its physical representation

• So, the more meaning a data model captures, the more “semantic” it is

How does a semantic data model capture meaning?

“... it is appropriate that the structure of a database mirror the structure of the system that it models. A database whose organization is based on naturally occurring structures will be easier for a database designer to construct and modify than one that forces him to translate the primitives of his problem domain into artificial specification construction.”

-- Hammer & McLeod, 1981

• Schema objects should look like corresponding real world objects

• Meaning captured by object types, relationships, attribute types, cardinality constraints, active rules

How does a semantic data model capture meaning?

“... it is appropriate that the structure of a database mirror the structure of the system that it models. A database whose organization is based on naturally occurring structures will be easier for a database designer to construct and modify than one that forces him to translate the primitives of his problem domain into artificial specification construction.”

-- Hammer & McLeod, 1981

• Schema objects should look like corresponding real world objects

• Meaning captured by object types, relationships, attribute types, cardinality constraints, active rules

Page 7: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

SIM Concepts: Entities & Attributes

Entity– An object or idea of interest in the application environment

– Does not imply a particular physical implementationBut functional analogs are records and tuples in other data models

– e.g., The employee named John Doe

The Accounting department

Attribute– A characteristic of an entity

– John Doe has an address, an employee ID, a salary, ...

Page 8: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

SIM Concepts: Classes & Subclasses

Class– A collection of entities of the

same type

– Employee, the set of all employees working for a company

Subclass– A subset of entities in a class

– Project-Employees are employees that work on projects

Employee

Project-Employee

ISA

Page 9: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

SIM Concepts: AttributesAttribute Inheritance

– Subclasses inherit attributes from all their superclasses

– Subclasses may declare additional attributes

Attribute Types– Data-Valued Attributes (DVA)

Have a printable value

– Entity-Valued Attributes (EVA)Entities in another class

Model relationships

EmployeeName

EmployeeID

Project-EmployeeTitle

DepartmentDept-In

Page 10: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

SIM Concepts: Extended Attributes

Perspective Class– A point of view class chosen

for a query

– Same data may have different meanings from different perspective classes

Extended Attributes– Attributes of related entities

may be considered extended attributes of the perspective class

EmployeeName

EmployeeID

Project-EmployeeTitle

DepartmentDept-No

Dept-In

Dept-No of Dept-In of Project-Employee = 123

Dept-No of Department = 123

Page 11: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

SIM Concepts: Constraints & Relations

Attribute Constraints– Isomorphic for EVA/DVA

– Single-Valued

– Multi-Valued

– Required

– Unique

Relationships (EVAs)– Always bi-directional

– Automatic referential integrity

– Transitive closure function

EmployeeName

EmployeeID

Project-EmployeeTitle

DepartmentDept-No

Dept-In

Title of INVERSE(Dept-In) of Department

Title of Dept-Staff of Department

Dept-Staff

Page 12: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

SIM Concepts: Data Types

Class Attributes– One value per class, not associated with any entity, DVA only

Data Types– Similar to Pascal, with relaxed string type checking

System DefinedSystem Defined User DefinedUser Defined• Integer• Real• Boolean• Date• Time• Character

• Number• String (fixed)• String (variable)• Kanji• Symbolic• Ordered Symbolic

• Based on system defined types• Set membership for strings

WeekDay : String(“Mon”, ..., “Fri”)• Enforced subrange

Employee-Age : Integer(18..70)

Page 13: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

SIM Concepts: Verify

Verify– General constraints not related to schema structure– Full power of SIM expression syntax in WHERE clause– For example

Spouses of employees hired after December 31, 1995, may not work for the company

VERIFY NoCouples ON Employee

ASSERT Not (Spouse ISA Employee)

WHERE Employee-Hire-Date > 12/31/95

ELSE “Spouse may not work for company”

Page 14: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

SIM Concepts: Security

Security– Accesses limit visibility of and operations on attributes

– Permissions associate Accesses with users or programs

– For exampleThe Accounting Department may examine but not change the salary of journeyman and higher employees

ACCESS LookButDontTouch ON Employee (Employee-Salary) RETRIEVE

WHERE Employee-Status >= Journeyman

PERMISSION USERCODE = Accounting, ACCESS = LookButDontTouch

Page 15: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

SIM Concepts: Indexes

Indexes– Multiple DVA keys, ascending or descending

– For performance improvement

– Visible to database administrators & query optimizer

– Not visible to programmers or query users

INDEX (Employee-ID) ON Employee ASCENDING

Page 16: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

SIM Concepts: ExpressionsOperators

Arithmetic +, -, *, /, DIV, MOD, **Boolean NOT, AND, ORRelational <, >, =, <=, >=, <>String &, pattern matchingExistence EXISTS

OperatorsArithmetic +, -, *, /, DIV, MOD, **Boolean NOT, AND, ORRelational <, >, =, <=, >=, <>String &, pattern matchingExistence EXISTS

FunctionsArithmetic ABS, ROUND, TRUNC, SQRTString LENGTH, EXT, POS, RPTSymbolic PRED, SUCCDate YEAR, MONTH, DAY, ELAPSED_DAYS, ADD_DAYS, DAY_OF_WEEK,

MONTH_NAME, CURRENT_DATETime HOUR, MINUTE, SECOND, ELAPSED_TIME, ADD_TIME, CURRENT_TIMERelationships INVERSE, TRANSITIVE

FunctionsArithmetic ABS, ROUND, TRUNC, SQRTString LENGTH, EXT, POS, RPTSymbolic PRED, SUCCDate YEAR, MONTH, DAY, ELAPSED_DAYS, ADD_DAYS, DAY_OF_WEEK,

MONTH_NAME, CURRENT_DATETime HOUR, MINUTE, SECOND, ELAPSED_TIME, ADD_TIME, CURRENT_TIMERelationships INVERSE, TRANSITIVE

Multi-Valued Operators INCLUDE, EXCLUDEAggregates AVG, SUM, COUNT, MIN, MAXQuantifiers SOME, ALL, NO

Multi-Valued Operators INCLUDE, EXCLUDEAggregates AVG, SUM, COUNT, MIN, MAXQuantifiers SOME, ALL, NO

Page 17: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

SIM Concepts: Advanced Query Topics

Subrole Attribute (Readonly enumeration of subclasses in a class)

Role Testing

Role Qualification

Retrieve the names of employees that are managers.

RETRIEVE Name of EmployeeWHERE Profession = Manager

Retrieve the names of employees that are managers.

RETRIEVE Name of EmployeeWHERE Profession = Manager

Retrieve the names of employees whose spouses are managers.

RETRIEVE Name of EmployeeWHERE Spouse ISA Manager

Retrieve the names of employees whose spouses are managers.

RETRIEVE Name of EmployeeWHERE Spouse ISA Manager

Retrieve the names of US citizens and the employee IDs of their spouses.

RETRIEVE Name of Person, Employee-ID of Spouse AS EmployeeWHERE US-Citizen

Retrieve the names of US citizens and the employee IDs of their spouses.

RETRIEVE Name of Person, Employee-ID of Spouse AS EmployeeWHERE US-Citizen

Page 18: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

SIM Concepts: Advanced Query Topics

Multiple Perspective Queries (aka Joins)

Reference Variables

Local Selection

Retrieve the names of project employees and managers that are the same age.

RETRIEVE Name of Project-Employee, Name of ManagerWHERE Age of Project-Employee = Age of Manager

Retrieve the names of project employees and managers that are the same age.

RETRIEVE Name of Project-Employee, Name of ManagerWHERE Age of Project-Employee = Age of Manager

Retrieve the names of all managers who manage employees making more than$40,000 and employees making less than $20,000.

RETRIEVE Name of ManagerWHERE Employee-Salary of Employees-Managing > 40000AND Employee-Salary of Employees-Managing CALLED Underpaid < 20000

Retrieve the names of all managers who manage employees making more than$40,000 and employees making less than $20,000.

RETRIEVE Name of ManagerWHERE Employee-Salary of Employees-Managing > 40000AND Employee-Salary of Employees-Managing CALLED Underpaid < 20000

Retrieve the names of managers of all departments and the salaries of onlythe division managers.

RETRIEVE Name of Dept-Managers of Department, Employee-Salary of Dept-Managers WITH

(Manager-Title of Dept-Managers = Division-Manager)

Retrieve the names of managers of all departments and the salaries of onlythe division managers.

RETRIEVE Name of Dept-Managers of Department, Employee-Salary of Dept-Managers WITH

(Manager-Title of Dept-Managers = Division-Manager)

Page 19: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

SIM Concepts: Update

Insert Entity: Create a new employee named John Doe and assign him to the manager named Smith.

INSERT Employee(Name := (First-Name := “John”, Last-Name := “Doe”), Gender := Male, Soc-Sec-No := 123-45-6789, US-Citizen := True, Employee-ID := 726478, Spouse := Person WITH (First-Name of Name = “Mary” AND Last-Name of Name = “Doe”), Child := INCLUDE Person WITH (First-Name of Name = “Junior” AND Last-Name of Name = “Doe”), Employee-Manager := Manager WITH (Last-Name of Name = “Smith”)

Insert Entity: Create a new employee named John Doe and assign him to the manager named Smith.

INSERT Employee(Name := (First-Name := “John”, Last-Name := “Doe”), Gender := Male, Soc-Sec-No := 123-45-6789, US-Citizen := True, Employee-ID := 726478, Spouse := Person WITH (First-Name of Name = “Mary” AND Last-Name of Name = “Doe”), Child := INCLUDE Person WITH (First-Name of Name = “Junior” AND Last-Name of Name = “Doe”), Employee-Manager := Manager WITH (Last-Name of Name = “Smith”)

Insert Role: Promote John Doe to department manager with a bonus of $5000.

INSERT Manager FROM Employee WHERE Last-Name of Name = “Doe”(Manager-Title := Department-Manager, Bonus := 5000)

Insert Role: Promote John Doe to department manager with a bonus of $5000.

INSERT Manager FROM Employee WHERE Last-Name of Name = “Doe”(Manager-Title := Department-Manager, Bonus := 5000)

Modify: Reassign all Journeyman Project-Employees in the Construction Department to the Maintenance Department.

MODIFY Project-Employee (Dept-In := Department WITH (Dept-Title = “Maintenance”))WHERE Title = Journeyman AND Dept-Title of Dept-In = “Construction”

Modify: Reassign all Journeyman Project-Employees in the Construction Department to the Maintenance Department.

MODIFY Project-Employee (Dept-In := Department WITH (Dept-Title = “Maintenance”))WHERE Title = Journeyman AND Dept-Title of Dept-In = “Construction”

Delete: Remove all projects assigned to managers that manage departments located in Los Angeles.

DELETE ProjectWHERE Dept-Location of Managers-Department of Project-Manager = “Los Angeles”

Delete: Remove all projects assigned to managers that manage departments located in Los Angeles.

DELETE ProjectWHERE Dept-Location of Managers-Department of Project-Manager = “Los Angeles”

Page 20: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

SIM Example

Organization: a projects and employee database

Database descriptions– DMS II A record oriented DBMS

– DB2 A relational DBMS

– SIM A semantic DBMS

Query Comparisons– Three retrieval queries of increasing complexity

– Application program sizes

Page 21: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

SIM Example

Organization Basic Facts– Employees are People

– Project-Employees are Employees who are assigned to Projects

– Managers are Employees who manage Projects

– Sometimes a Project-Employee can act as a Manager on an interim basis

– Projects may have Subprojects

– Historical records of Previous Employees must be retained

Page 22: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

SIM Example: DMS II Schema

Soc-Sec-NoSpouse-SSNManagers-SSNAssignment-NoDept-NoEmployedEmployee-ID

Soc-Sec-NoSpouse-SSNManagers-SSNAssignment-NoDept-NoEmployedEmployee-ID

Person

Person-Set Employee-IDProject-NoEmployee-IDProject-No

Project-Person

ProjPerson-Set

Soc-Sec-NoSoc-Sec-No

Education

Education-Set

Assignment-NoProject-NoAssignment-NoProject-No

Assignment

Assignment-Set

Dept-NoDept-No

Department

Department-Set

Parent-SSNChild-SSNParent-SSNChild-SSN

Family

Family-Set

Employee-IDEmployee-ID

Interim-Manager

Interim-Set

StartDateEndDateStartDateEndDate

Duration

InterimHist-Set

Project-NoDept-NoSuperProject-No

Project-NoDept-NoSuperProject-No

Project-Set

Project

AttributesAttributes

Data Set Name

Primary Index

Legend

Page 23: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

SIM Example: DB2 Schema

Soc-Sec-NoSpouse-NoManagers-SSNAssignment-NoDept-NoEmployedEmployee-ID

Person

Soc-Sec-No

Education

Assignment-NoProject-No

Assignment

Dept-No

Department

Parent-SSNChild-SSN

Family

Project-NoDept-NoSuperProject-No

Project

Employee-IDStartDateEndDate

Interim-History

Employee-IDProject-No

Project-Person

Column Name

Table Name

Legend

Page 24: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

SIM Example: Organization Schema

Person

Project-Employee Manager

Department

Assignment

EmployeePrevious-Employee

SpouseChild

Parent

Employee-Manager

Employees-Managed

Projects-ManagingProject-Manager

Dept-Assigned

Project-Of

Assignment-HistoryStaff-Assigned

Assignment-Record

Dept-StaffDept-In

Interim-Manager

Project-Team

Current-Project

Dept-Managers

Managers-Department

Start-Date Assignment-No

End-Date RatingEst-Person-Hours

Sub-P

rojects

Sub-P

roject-Of

Project(Next-Project-No)Project-NoProject-Title

Manager-TitleBonus

Interim-History (Start-Date, End-Date) MV

Employee-IDEmployee-Hire-DateEmployee-SalaryEmployee-Status

Dept-NoDept-TitleDept-Location

TitleOverall-Rating

Termination-ReasonLeave-StatusLast-Work-Date Hire-Date

Name (First-Name, Mid-Initial, Last-Name)Current-Residence (Street, City, State, ZipCode)Education (Degree-Obtained, Year-Obtained, GPA) MVNext-of-Kin (Relationship, Phone, Name-Of-Kin (First-Name, Mid_Initial, Last-Name))Marital-Status US-Citizen Soc-Sec-NoBirth-Date Gender Age

Page 25: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

SIM Example: Comparison Queries

Simple QuerySimple Query

Print the names of all non-managers and the title of the department in which they work.

Complex QueryComplex Query

Print the names of employees and the titles of all their projects if they work on any project assigned to the Accounting Department.

Hard QueryHard Query

For the Annual Report Preparation project, print the titles of its subprojects and the names of employees currently assigned.

Page 26: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

SIM Example: Simple Query

DMS IIDMS IIRELATE Person TO Department BY MATCHING Dept-No WITH Dept-No AS Person-Dept;

TAB First-Name, Mid-Initial, Last-Name, Dept-TitleWHERE Employed NEQ “Manager”FROM Person TO Department;

DB2DB2SELECT First-Name, Mid-Initial, Last-Name, TitleFROM Person, DepartmentWHERE Person.Dept-No = Department.Dept-NoAND Person.Employed NEQ “Manager”;

SIMSIMRETRIEVE Name of Project-Employee, Dept-Title of Dept-In

Print the names of all non-managers and the title of the department in which they work.

Page 27: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

SIM Example: Complex Query

DMS IIDMS IIRELATE Department TO Project BY MATCHING Dept-No

WITH Dept-No AS Dept-Proj;

RELATE Project TO Project-Person BY MATCHING Project-No WITH Project-No AS Proj-Person;

RELATE Project-Person TO Person BY MATCHING Soc-Sec-No WITH Soc-Sec-No AS Proj-Emp;

DB2DB2SELECT FIrst-Name, MId-Initial, Last-Name, Project-TitleFROM Person, Project-Person, ProjectWHERE Person.Soc-Sec-No = Project-Person.Soc-Sec-NoAND Project.Project-No = Project-Person.Project-NoAND EXISTS (SELECT *

FROM Project-Person, Project, Department WHERE Project-Person.Soc-Sec-No = Person.Soc-Sec-No AND Project-Person.Project-No = Project.Project-No AND Department.Dept-No = Project.Dept-No AND Department.Dept-Title = “Accounting”)

SIMSIMRETRIEVE Name of Project-Employee, Project-TItle of Current-ProjectWHERE Dept-TItle of SOME(Dept-Assigned of Current-Project) = “Accounting”

Print the names of employees and the titles of all their projects if they work on any project assigned to the Accounting Department.

EXTRACT Soc-Sec-No, COUNT AS SSN-Cnt WHERE Dept-TItle “Accounting” FROM Person TO Project-Person TO Project TO Department :

EXTRACTFILE = ExtFile;OPEN FILE ExtFile;RELATE ExtFile TO Project-Person BY MATCHING

Soc-Sec-No WITH Soc-Sec-No AS Extrel;

TAB First-Name, Mid-Initial, Last-Name, Project-TitleFROM ExtFile TO Project-Person TO ProjectWHERE SSN-Cnt > 0;

Page 28: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

SIM Example: Hard Query

DMS IIDMS IIOPEN DMSII Oranization;OPEN DMSII OrgCopy (DMI =DMINTERPRETER/ORGANIZATION);

RELATE Project of Organization TO Project of OrgCopy BYMATCHING Project-No WITH SuperProject-No ASSubProj;

RELATE Project of Organization TO Person of OrgCopy BY MATCHING Project-No WITH Project-No AS Project-Emp;

DB2DB2SELECT Project-Title, First-Name, Mid-Initial, Last-NameFROM Project, Project, SubProj, Person, Project-PersonWHERE Project.Project-No = SubProj.SuperProject-NoAND SubProj.Project-No = Project-Person.Project-NoAND Project-Person.Soc-Sec-No = Person.Soc-Sec-NoAND Project.Project-Title = “Annual Report Preparation”

SIMSIMRETRIEVE Project-Title of Sub-Projects of Project, Name of Project-Team of Sub-ProjectsWHERE Project-Title of Project = “Annual Report Preparation”

For the Annual Report Preparation project, print the titles of its subprojects and the names of employees currently assigned.

RELATE Project-Person of OrgCopy TO Person of OrgCopy BY MATCHING Employee-ID WITH Employee-ID AS Proj-Person;

TAB Project-Title of Project of OrgCopy, First-Name of Person of OrgCopy, Mid-Initial of Person of OrgCopy, Last-Name of Person of OrgCopy

FROM Project of Organization TO Project of OrgCopy TO Project-Person of OrgCopy TO Person of OrgCopy

WHERE Project-Title of Project of Organization = “Annual Report Preparation”

Page 29: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

Unisys is a registered trademark of Unisys Corporation.

All other brand or product names are trademarks or registered trademarks of their respective companies.

Page 30: Unisys SIM Example:Organization Schema Person Project-Employee Manager Department Assignment Employee Previous-Employee Spouse Child Parent Employee-Manager

Unisys ServerEnterprise

Division

Unisys