Professional Documents
Culture Documents
2/88
Dr. Philip Cannata 2
Doug Tolbert Unisys doug_tolbert@omg.org Doug Tolbert has been involved with OMG since the early 1990s. He is a member of the Board of Directors and currently holds a Platform seat on the Architecture Board. Doug was a principal member of the team that developed CWM, and he has made contributions to many OMG platform (UML, MOF, XMI, IMM, SOA, Alf, and ADTF) and domain (Finance, Life Science, Insurance) over the years. He is currently active on the UML Simplification and IMM submission teams. On the AB, Doug works to ensure that OMG specifications are clear and understandable in both their human- and machine-readable forms.
Previous-Employee
Termination-Reason Leave-Status Last-Work-Date Hire-Date
Employee
Employee-ID Employee-Hire-Date Employee-Salary Employee-Status
Employee-Manager Employees-Managed
Project-Employee
Title Overall-Rating Dept-In Dept-Staff
Interim-Manager
Interim-History (Start-Date, End-Date) MV
Manager
Manager-Title Bonus Project-Manager Projects-Managing
Department
Dept-No Dept-Title Dept-Location Dept-Assigned
Project
(Next-Project-No) Project-No Project-Title Sub-Project-Of
Sub-Projects
Assignment-Record
Assignment
Start-Date AssignmentNo End-Date Rating Est-Person-Hours
Project-Of Assignment-History
Staff-Assigned
Unisys
SIM
Origins and Evolution
Doug Tolbert Unisys Corporation Mission Viejo, CA
Dr. Philip Cannata 6
Ease of Use
Integrated, high level interface Query & schema flexibility Data Independence Set-oriented, non-procedural interface Naturally handle complexity 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 Easy to learn Minimal programming effort Retrieval without programming
Productivity
Data Integrity
Coexistence
Performance
Relational System
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
Something New
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
Artificial Intelligence
Semantic Models
Semantic Networks
Quillian, Brachman
SDM
Hammer & McLeod
Entity Relationship
Chen
SIM
Programmatic Model
DAPLEX
Shipman
RM/T
Codd
Query Languages
GORDAS
El-Masri
SDMs capture the meaning of data, not just its physical representation So, the more meaning a data model captures, the more semantic it is
Schema objects should look like corresponding real world objects Meaning captured by object types, relationships, attribute types, cardinality constraints, active rules
10
SIM Concepts:
Entity An object or idea of interest in the application environment Does not imply a particular physical implementation But 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, ...
Dr. Philip Cannata 11
SIM Concepts:
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
IS A
Project-Employee
12
SIM Concepts:
Attributes
Employee
Name EmployeeID
Attribute Inheritance Subclasses inherit attributes from all their superclasses Subclasses may declare additional attributes Attribute Types Data-Valued Attributes (DVA)
Project-Employee
Title DeptI n
Department
13
SIM Concepts:
Extended Attributes
Employee
Name EmployeeID
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
Project-Employee
Title DeptI n
Department
Dept-No
14
SIM Concepts:
Attribute Constraints Isomorphic for EVA/DVA Single-Valued Multi-Valued Required Unique Relationships (EVAs) Always bi-directional Automatic referential integrity Transitive closure function
Employee
Name EmployeeID
Project-Employee
Title
DeptI n Dept-Staff
Department
Dept-No
15
SIM Concepts:
Class Attributes
Data Types
One value per class, not associated with any entity, DVA only Data Types Similar to Pascal, with relaxed string type checking
System Defined
Integer Real Boolean Date Time Character Number String (fixed) String (variable) Kanji Symbolic Ordered Symbolic
User Defined
Based on system defined types Set membership for strings WeekDay : String(Mon, ..., Fri) Enforced subrange Employee-Age : Integer(18..70)
16
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
WHERE Employee-Hire-Date > 12/31/95 ELSE Spouse may not work for company
17
SIM Concepts:
Security
Security
ACCESS RETRIEVE
18
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
19
SIM Concepts:
Expressions
Operators
Arithmetic Boolean Relational String Existence +, -, *, /, DIV, MOD, ** NOT, AND, OR <, >, =, <=, >=, <> &, pattern matching EXISTS
Functions
Arithmetic String Symbolic Date Time Relationships ABS, ROUND, TRUNC, SQRT LENGTH, EXT, POS, RPT PRED, SUCC YEAR, MONTH, DAY, ELAPSED_DAYS, ADD_DAYS, DAY_OF_WEEK, MONTH_NAME, CURRENT_DATE HOUR, MINUTE, SECOND, ELAPSED_TIME, ADD_TIME, CURRENT_TIME INVERSE, TRANSITIVE
Multi-Valued
Operators Aggregates Quantifiers INCLUDE, EXCLUDE AVG, SUM, COUNT, MIN, MAX SOME, ALL, NO
20
SIM Concepts:
Role Testing
Retrieve the names of employees whose spouses are managers. RETRIEVE Name of Employee WHERE Spouse ISA Manager
Role Qualification
Retrieve the names of US citizens and the employee IDs of their spouses. RETRIEVE Name of Person, Employee-ID of Spouse AS Employee WHERE US-Citizen
21
SIM Concepts:
Reference Variables
Retrieve the names of all managers who manage employees making more than $40,000 and employees making less than $20,000. RETRIEVE Name of Manager WHERE Employee-Salary of Employees-Managing > 40000 AND Employee-Salary of Employees-Managing CALLED Underpaid < 20000
Local Selection
Retrieve the names of managers of all departments and the salaries of only the division managers. RETRIEVE Name of Dept-Managers of Department, Employee-Salary of Dept-Managers WITH (Manager-Title of Dept-Managers = Division-Manager)
22
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 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 Delete: Remove all projects assigned to managers that manage departments located in Los Angeles. DELETE Project WHERE Dept-Location of Managers-Department of Project-Manager = Los Angeles
23
SIM Example
SIM
A semantic DBMS
24
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
Dr. Philip Cannata 25
Family
Parent-SSN Child-SSN Family-Set
Person
Soc-Sec-No Spouse-SSN Managers-SSN Assignment-No Dept-No Employed Employee-ID Person-Set
Assignment
Assignment-No Project-No Assignment-Set
Education
Soc-Sec-No Education-Set
Project-Person
Employee-ID Project-No ProjPerson-Set
Project
Project-No Dept-No SuperProject-No Project-Set
Interim-Manager
Employee-ID
Duration
StartDate EndDate InterimHist-Set Interim-Set
Department
Dept-No Department-Set
Primary Index
26
Family
Parent-SSN Child-SSN
Person
Soc-Sec-No Spouse-No Managers-SSN Assignment-No Dept-No Employed Employee-ID
Assignment
Assignment-No Project-No
Education
Soc-Sec-No
Project-Person
Employee-ID Project-No
Project
Project-No Dept-No SuperProject-No
Interim-History
Employee-ID StartDate EndDate
Department
Dept-No
27
Previous-Employee
Termination-Reason Leave-Status Last-Work-Date Hire-Date
Employee
Employee-ID Employee-Hire-Date Employee-Salary Employee-Status
Employee-Manager Employees-Managed
Project-Employee
Title Overall-Rating Dept-In Dept-Staff
Interim-Manager
Interim-History (Start-Date, End-Date) MV
Manager
Manager-Title Bonus Project-Manager Projects-Managing
Department
Dept-No Dept-Title Dept-Location Dept-Assigned
Project
(Next-Project-No) Project-No Project-Title
Sub-Projects
Sub-Project-Of
Assignment-Record
Assignment
Start-Date AssignmentNo
End-Date Rating Est-Person-Hours
Project-Of Assignment-History
Staff-Assigned
28
Simple Query
Print the names of all non-managers and the title of the department in which they work.
Complex 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 Query
For the Annual Report Preparation project, print the titles of its subprojects and the names of employees currently assigned.
29
DMS II
RELATE TAB WHERE FROM Person TO Department BY MATCHING Dept-No WITH Dept-No AS Person-Dept; First-Name, Mid-Initial, Last-Name, Dept-Title Employed NEQ Manager Person TO Department;
DB2
SELECT FROM WHERE AND First-Name, Mid-Initial, Last-Name, Title Person, Department Person.Dept-No = Department.Dept-No Person.Employed NEQ Manager;
SIM
RETRIEVE Name of Project-Employee, Dept-Title of Dept-In
30
FROM ExtFile TO Project-Person TO Project RELATE Project TO Project-Person BY WHERE SSN-Cnt > 0; MATCHING Project-No WITH Project-No AS ProjPerson; DB2 RELATE TO Person BY SELECT Project-Person FIrst-Name, MId-Initial, Last-Name, Project-Title MATCHING FROM Person, Project-Person, Project Soc-Sec-No WITH Soc-Sec-No AS ProjWHERE Person.Soc-Sec-No = Project-Person.Soc-Sec-No Emp; AND Project.Project-No = Project-Person.Project-No AND 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)
SIM RETRIEVE Name of Project-Employee, Project-TItle of Current-Project WHERE Dept-TItle of SOME(Dept-Assigned of Current-Project) = Accounting
31
RELATE Project of Organization TO Project of OrgCopy BY MATCHING Project-No WITH SuperProject-No AS SubProj;
DB2 RELATE Project of Organization TO Person of OrgCopy BY SELECT Project-Title, First-Name, Mid-Initial, MATCHING Project-No WITH Project-No ASLast-Name FROM Project, Project, SubProj, Person, Project-Person Project-Emp; WHERE Project.Project-No = SubProj.SuperProject-No AND SubProj.Project-No = Project-Person.Project-No AND Project-Person.Soc-Sec-No = Person.Soc-Sec-No AND Project.Project-Title = Annual Report Preparation SIM RETRIEVE Project-Title of Sub-Projects of Project, Name of Project-Team of Sub-Projects WHERE Project-Title of Project = Annual Report Preparation
32
mgr
33
mgr
34
CLASS person ( ss_num: INTEGER, REQUIRED; name: STRING; ); SUBCLASS emp "Employees of a company" OF person ( job : STRING; mgr : emp, SV, INVERSE IS employees; employees : emp, MV, INVERSE IS mgr; sal : INTEGER; comm : INTEGER; dept : department, SV, INVERSE IS employees; ); INSERT emp ( ss_num:= 7369 , name := "SMITH" , job := "CLERK" , sal := 800 ); INSERT emp ( ss_num:= 7499 , name := "ALLEN" , job := "SALESMAN" , sal := 1600 , comm := 300 ); INSERT emp ( ss_num:= 7521 , name := "WARD" , job := "SALESMAN" , sal := 1250 , comm := 500 ); INSERT emp ( ss_num:= 7566 , name := "JONES" , job := "MANAGER" , sal := 2975 ); INSERT emp ( ss_num:= 7654 , name := "MARTIN" , job := "SALESMAN" , sal := 1250 , comm := 1400 ); INSERT emp ( ss_num:= 7698 , name := "BLAKE" , job := "MANAGER" , sal := 2850 ); INSERT emp ( ss_num:= 7782 , name := "CLARK" , job := "MANAGER" , sal := 2450 ); INSERT emp ( ss_num:= 7788 , name := "SCOTT" , job := "ANALYST" , sal := 3000 ); INSERT emp ( ss_num:= 7839 , name := "KING" , job := "PRESIDENT" , sal := 5000 ); INSERT emp ( ss_num:= 7844 , name := "TURNER" , job := "SALESMAN" , sal := 1500 ); INSERT emp ( ss_num:= 7876 , name := "ADAMS" , job := "CLERK" , sal := 1100 ); INSERT emp ( ss_num:= 7900 , name := "JAMES" , job := "CLERK" , sal := 950 ); INSERT emp ( ss_num:= 7902 , name := "FORD" , job := "ANALYST" , sal := 3000 ); INSERT emp ( ss_num:= 7934 , name := "MILLER" , job := "CLERK" , sal := 1300 );
Dr. Philip Cannata 35
CLASS department "Departments of a company" ( deptno : INTEGER, REQUIRED; dname : STRING; loc : STRING; employees : emp, MV, INVERSE IS dept; ); INSERT department ( deptno := 10 , dname := "ACCOUNTING" , loc := "NEW YORK" );
INSERT department ( deptno := 20 , dname := "RESEARCH" , loc := "DALLAS" ); INSERT department ( deptno := 30 , dname := "SALES" , loc := "CHICAGO" ); INSERT department ( deptno := 40 , dname := "OPERATIONS" , loc := "BOSTON" );
36
MODIFY emp ( dept := department WITH (deptno = 20) ) WHERE ss_num = 7369 ; MODIFY emp ( dept := department WITH (deptno = 30) ) WHERE ss_num = 7499 ; MODIFY emp ( dept := department WITH (deptno = 30) ) WHERE ss_num = 7521 ;
MODIFY emp ( dept := MODIFY emp ( dept := MODIFY emp ( dept := MODIFY emp ( dept := MODIFY emp ( dept := MODIFY emp ( dept := MODIFY emp ( dept := MODIFY emp ( dept := MODIFY emp ( dept := MODIFY emp ( dept := MODIFY emp ( dept :=
department WITH (deptno = department WITH (deptno = department WITH (deptno = department WITH (deptno = department WITH (deptno = department WITH (deptno = department WITH (deptno = department WITH (deptno = department WITH (deptno = department WITH (deptno = department WITH (deptno =
20) ) WHERE ss_num = 7566 ; 30) ) WHERE ss_num = 7654 ; 30) ) WHERE ss_num = 7698 ; 10) ) WHERE ss_num = 7782 ; 20) ) WHERE ss_num = 7788 ; 10) ) WHERE ss_num = 7839 ; 30) ) WHERE ss_num = 7844 ; 20) ) WHERE ss_num = 7876 ; 30) ) WHERE ss_num = 7900 ; 20) ) WHERE ss_num = 7902 ; 10) ) WHERE ss_num = 7934 ;
MODIFY emp ( mgr := emp WITH (ss_num = 7902) ) WHERE ss_num = 7369 ;
MODIFY emp ( mgr MODIFY emp ( mgr MODIFY emp ( mgr MODIFY emp ( mgr MODIFY emp ( mgr MODIFY emp ( mgr MODIFY emp ( mgr MODIFY emp ( mgr MODIFY emp ( mgr MODIFY emp ( mgr MODIFY emp ( mgr MODIFY emp ( mgr Dr. Philip Cannata
:= := := := := := := := := := := :=
emp emp emp emp emp emp emp emp emp emp emp emp
WITH (ss_num = WITH (ss_num = WITH (ss_num = WITH (ss_num = WITH (ss_num = WITH (ss_num = WITH (ss_num = WITH (ss_num = WITH (ss_num = WITH (ss_num = WITH (ss_num = WITH (ss_num =
7698) ) WHERE ss_num = 7499 ; 7698) ) WHERE ss_num = 7521 ; 7839) ) WHERE ss_num = 7566 ; 7698) ) WHERE ss_num = 7654 ; 7839) ) WHERE ss_num = 7698 ; 7839) ) WHERE ss_num = 7782 ; 7566) ) WHERE ss_num = 7788 ; 7698) ) WHERE ss_num = 7844 ; 7788) ) WHERE ss_num = 7876 ; 7698) ) WHERE ss_num = 7900 ; 7566) ) WHERE ss_num = 7902 ; 7782) ) WHERE ss_num = 7934 ;
37
38
39
WDB> from emp retrieve ss_num, name, dname of dept, name of mgr, dname of dept of mgr where true;
40
with
ReL
41
ReL Components
CodeCompiler.java
Python.g
The Python grammar was changed to include SIM, SQL, Prolog, and ASP statements.
AST
The Tuple entry in CodeCompiler was modified to deal with putting SIM, SQL, Prolog, and ASP information and expressions on the runtime stack and to assure that a new instance of PyTuple is created after the expressions are evaluated.
jSIMParser
There is no jSIMParser to parse SIM statements like jSQLParser for SQL but I hope one will be built as a project.
PyTuple.java
-----------parseSIM()
parseSIM parses SIM statements from PyTuple and produces and passes AS information to SIMHelper.
jSQLParser
jSQLParser parses SQL statements from PyTuple and produces an AST that can be visited.
SIMHelper.java
SIMHelper produces appropriate SPARQL statements for the SIM statements which are sent to SPARQLDoer.
Dr. Philip Cannata
SQLVisitor.java
SQLVisitor visits the jSQLParser AST and produces appropriate SPARQL statements for the SQL statements which are sent to SPARQLDoer. 42