Download Practical RDF Ch.10

Document related concepts

IMDb wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

SQL wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Concurrency control wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Functional Database Model wikipedia , lookup

Ingres (database) wikipedia , lookup

Database wikipedia , lookup

Clusterpoint wikipedia , lookup

Relational model wikipedia , lookup

PL/SQL wikipedia , lookup

Database model wikipedia , lookup

Oracle Database wikipedia , lookup

Transcript
Object Orientation in Oracle
April 23rd, 2007
Kangpyo Lee
Jaeseok Myung
Contents
 Part 1: OO in Oracle Database 10g
 About Oracle
 Object-Relational Databases
 OO in Oracle Database 10g
 Part 2: OO in Oracle E-Business Suite 11i
 Background
 Oracle’s Solution
 Oracle E-Business Suite 11i
 References & Appendix
2
About Oracle (1/4)
 Oracle Corporation
 One of the world’s greatest IT company, offering database
and middleware S/W, and applications S/W
 Has been an unchallenged leader in database market
 Headquartered in Redwood Shores, California
 Web Site: http://www.oracle.com
3
About Oracle (2/4)
 History
 Oracle was founded by Lawrence
J. Ellison in 1977
 He realized there was tremendous
business potential in RDB model
 The timeline highlights 30 years of
Oracle innovation
 Oracle has refined its technology by
early adopting pervasive ideas of
those days
4
About Oracle (3/4)
 Market Share
5
About Oracle (4/4)
 Oracle Products
Oracle
Database
Oracle
Fusion
Middleware
Oracle
Applications
Oracle
Enterprise
Manager
6
Contents
 Part 1: OO in Oracle Database 10g
 About Oracle
 Object-Relational Databases
 OO in Oracle Database 10g
 Part 2: OO in Oracle E-Business Suite 11i
 Background
 Oracle’s Solution
 Oracle E-Business Suite 11i
 References & Appendix
7
Object-Relational Database (1/4)
 Object-Relational Data Model
 Extends the relational data model to support
 Complex data types
 Type inheritance
 Object identity
Relational
Database
ObjectOriented
Concepts
Object-Relational
Database
8
Object-Relational Database (2/4)
 Pure Object-Oriented Databases
 Around 1985
 Information is represented in the form of objects
 ODBMS
 Object DataBase Management System
 Database capabilities are combined with OO programming capabilities
OOPL
DB
DB
OOPL
Extending an existing DB language
with OO capabilities
Extending an existing OOPL
with DB capabilities
9
Object-Relational Database (3/4)
 RDB vs. OODB !!!
Data Model
Killer
Domain
Query
Language
Access to
Data
RDB
OODB
Entity-relationship model
Object-Oriented Model
Business areas
Application areas (engineering &
(commercial databases)
spatial databases, telecommunications)
& scientific areas (high energy physics
& molecular biology)
SQL
OQL
(Structured Query Language)
(Object Query Language)
Slower
Faster
(Joins among tables are often
needed)
(An object can be retrieved by following
pointers)
10
Object-Relational Database (4/4)
 Why Did OODB Lose the Game?
 Benchmarks have shown that ODBMS can be clearly superior for
certain kinds of tasks, but…
1
2
3
4
Failure to make
great impact
on mainstream
commercial
data
processing
For generalpurpose queries,
pointer-based
techniques will
tend to be slower
and more difficult
to formulate
Lack of
interoperability
with a great # of
tools/features
Intentional
resistance from
major RDB
vendors
 Eventually absorbed into RDB ⇒ ORDB
11
Contents
 Part 1: OO in Oracle Database 10g
 About Oracle
 Object-Relational Databases
 OO in Oracle Database 10g
 Part 2: OO in Oracle E-Business Suite 11i
 Background
 Oracle’s Solution
 Oracle E-Business Suite 11i
 References & Appendix
12
OO in Oracle Database 10g
Oracle Objects (1/3)
 Oracle Object Types
 User-defined types
 Make it possible to model the real-world entities as objects in the
database
 Attributes + methods
13
OO in Oracle Database 10g
Oracle Objects (2/3)
 Example for Creating an Object
CREATE TYPE person_typ AS OBJECT (
attributes
idno
NUMBER,
first_name
VARCHAR2(20),
last_name
VARCHAR2(25),
methods
email
VARCHAR2(25),
phone
VARCHAR2(20),
MEMBER FUNCTION get_idno RETURN NUMBER,
MEMBER PROCEDURE display_details ( SELF IN OUT NOCOPY
person_typ ));
14
OO in Oracle Database 10g
Oracle Objects (3/3)
 Oracle Object Methods
 Functions or procedures that you can declare in an object type
definition to implement behavior
 Written in PL/SQL
Member
function
CREATE TYPE BODY person_typ AS
MEMBER FUNCTION get_idno RETURN NUMBER IS
Member
BEGIN
procedure
RETURN idno;
END;
MEMBER PROCEDURE display_details ( SELF IN OUT NOCOPY person_typ ) IS
BEGIN
DBMS_OUTPUT.PUT_LINE(TO_CHAR(idno) || ' ' || first_name || ' ' || last_name);
DBMS_OUTPUT.PUT_LINE(email || ' ' || phone);
END;
END;
15
OO in Oracle Database 10g
Object Tables
 Oracle Object Tables
 A special kind of table where each row represents an object
CREATE TABLE person_obj_table OF person_typ;
INSERT INTO person_obj_table VALUES (
person_typ(101, 'John', 'Smith', '[email protected]', '1-800-555-1212') );
SELECT VALUE(p) FROM person_obj_table p
WHERE p.last_name = 'Smith';
Returns object instances
corresponding to rows of the table
DECLARE
person person_typ;
BEGIN
SELECT VALUE(p) INTO person FROM person_obj_table p WHERE p.idno = 101;
person.display_details();
END;
16
OO in Oracle Database 10g
Inheritance in Object Types (1/3)
 Type Inheritance
 The new subtype inherits all the attributes and methods that its
parent type has
 Supertypes & subtypes
 No multiple inheritance is allowed
 Determines whether subtypes can be derived from that type by
 FINAL
 NOT FINAL
CREATE TYPE student_typ UNDER person_typ (
dept_id NUMBER,
major VARCHAR2(30),
NOT FINAL;
17
OO in Oracle Database 10g
Inheritance in Object Types (2/3)
 Method Overloading & Overriding
 Adding new methods
 Adding new methods that have the same names as methods it inherits
(overloading)
 Redefining methods it inherits (overriding)
 Example for Creating a Subtype with an Overloading Method
CREATE TYPE MyType_typ AS OBJECT (...,
MEMBER PROCEDURE draw(x NUMBER), ...) NOT FINAL;
CREATE TYPE MySubType_typ UNDER MyType_typ (...,
MEMBER PROCEDURE draw(x VARCHAR2(20)),
...);
18
OO in Oracle Database 10g
Inheritance in Object Types (3/3)
 Example for Creating a Subtype with an Overriding Method
CREATE TYPE student_typ UNDER person_typ (
dept_id NUMBER,
major VARCHAR2(30),
OVERRIDING MEMBER FUNCTION show RETURN VARCHAR2)
NOT FINAL;
CREATE TYPE BODY student_typ AS
OVERRIDING MEMBER FUNCTION show RETURN VARCHAR2 IS
BEGIN
RETURN person_typ.show_super ( SELF ) || ' -- Major: ' || major ;
END;
END;
Displays the newly added
attribute major
19
OO in Oracle Database 10g
Object Identity (1/2)
 Oracle REF




Oracle built-in datatype
A logical pointer to a row object constructed from the OID
Provides an easy mechanism for navigating between objects
Uses the dot (.) notation to follow the pointers
 Scoped REF
 Constrains a REF to contain only references to a specified object
table
20
OO in Oracle Database 10g
Object Identity (2/2)
 Example for Using a scoped REF to an Object
contacts_ref
person_obj_table
contact_ref
contact_date
person_obj_1
▪
’26 Jun 2007’
person_obj_2
▪
’23 Feb 2007’
CREATE TABLE contacts_ref (
contact_ref REF person_typ SCOPE IS person_obj_table,
contact_date DATE );
INSERT INTO contacts_ref
SELECT REF(p), '26 Jun 2007'
FROM person_obj_table p
WHERE p.idno = 101;
21
OO in Oracle Database 10g
Support for Collection Datatypes (1/3)
 Oracle Collection Datatypes
 Varrays
 Nested tables
 Varrays
phone_list
phone_
object_1
phone_
object_2
…
...
…
 An ordered set of elements, all of the same datatype
 Each element has an index
CREATE TYPE phone_varray_typ AS VARRAY(5) OF phone_typ;
CREATE TABLE dept_phone_list (
dept_no NUMBER(5),
phone_list phone_varray_typ);
INSERT INTO dept_phone_list VALUES (100,
phone_varray_typ( phone_typ ('01', '650', '5061111'),
phone_typ ('01', '650', '5062525')));
22
OO in Oracle Database 10g
Support for Collection Datatypes (2/3)
 Nested Tables
 An unordered set of elements, all of the same datatype
 No maximum & no order
 A nested table has a single column
 Elements of a nested table are actually stored in a separate table
CREATE TYPE people_typ AS TABLE OF person_typ;
CREATE TABLE people_tab (
group_no NUMBER,
people_column people_typ )
NESTED TABLE people_column STORE AS people_column_nt;
INSERT INTO people_tab VALUES ( 100,
people_typ( person_typ(1, 'John Smith', '1-800-555-1212'),
person_typ(2, 'Diane Smith', NULL)));
23
OO in Oracle Database 10g
Support for Collection Datatypes (3/3)
 Multilevel Collection Types





Nested table of nested table type
Nested table of varray type
Varray of nested table type
Varray of varray type
Nested table or varray of a user-defined type that has an
attribute that is a nested table or varray type
24
OO in Oracle Database 10g
Object Functions & Operators
 Functions & Operators Useful with Objects









CAST
CURSOR
DEREF
IS OF type
REF
SYS_TYPEID
TABLE()
TREAT
VALUE
SELECT VALUE(p)
FROM person_obj_table p
WHERE VALUE(p) IS OF (student_typ);
SELECT name, SYS_TYPEID(VALUE(p))
typeid
FROM person_obj_table p;
SELECT TREAT(VALUE(p) AS
student_typ)
FROM person_obj_table p;
25
OO in Oracle Database 10g
Object Views (1/2)
 Oracle Object View
 A virtual object table
 Each row in the view is an object
 Useful in prototyping or transitioning to OO applications
 The data in the view can be taken from relational tables and accessed
 Can be used like table views
 Presents only the data that you want users to see
CREATE TABLE emp_table (
empnum NUMBER (5),
ename
VARCHAR2 (20),
salary
NUMBER (9,2),
job
VARCHAR2 (20));
CREATE TYPE employee_t AS OBJECT (
empno NUMBER (5),
ename VARCHAR2 (20),
salary
NUMBER (9,2),
job
VARCHAR2 (20));
A pointer (REF) to the
objects in the view
CREATE VIEW emp_view OF employee_t
WITH OBJECT IDENTIFIER (empno) AS
SELECT e.empnum, e.ename, e.salary, e.job
FROM emp_table e
WHERE job = 'Developer';
26
OO in Oracle Database 10g
Object Views (2/2)
 Object View Hierarchies
 A set of object views each of which is based on a different type in a type
hierarchy
 Superviews, subviews
CREATE VIEW Person_v OF person_typ
WITH OBJECT OID(ssn) AS
SELECT ssn, name, address
FROM AllPersons WHERE typeid = 1;
CREATE VIEW Student_v OF student_typ UNDER Person_v
AS
SELECT ssn, name, address, deptid, major
FROM AllPersons WHERE typeid = 2;
CREATE VIEW Employee_v OF employee_typ UNDER Person_v
AS
SELECT ssn, name, address, empid, mgr
FROM AllPersons WHERE typeid = 3;
27
OO in Oracle Database 10g
Support for XML (1/3)
 Oracle XML DB
 Treats XML as a native data type in the database
 Applications can use standard SQL and XML operators
 to generate complex XML documents from SQL queries
 to store XML documents
 Benefits
28
OO in Oracle Database 10g
Support for XML (2/3)
29
OO in Oracle Database 10g
Support for XML (3/3)
 Oracle XML Developer’s Kits (XDK)
 Contain the basic building blocks for reading,
manipulating, transforming, & viewing XML documents







XML Parsers
XSLT Processor
XML Schema Processor
XML Class Generator
XML Java Beans
XML SQL Utility
XSQL Servlet
30
Summary of Pt. 1
 Oracle Database 10g
 Fully supports the basic OO concepts such as








Object Types
Object Tables
Inheritance in Object Types
Object Identity
Support for Collection Datatypes
Object Views
Object Functions & Operators
Support for XML
31
Contents
 Part 1: OO in Oracle Database 10g
 About Oracle
 Object-Relational Databases
 OO in Oracle Database 10g
 Part 2: OO in Oracle E-Business Suite 11i
 Background
 Oracle’s Solution
 Oracle E-Business Suite 11i
 References & Appendix
32
Background
What Is the Business on IT’s Viewpoint?
Performance
Extensibility
Availability
Lowers TCO
(Total Cost of Ownership)
Integration
Maintenance
33
Background
Problems over the Business (1/3)
 Fragmented Systems and Data
 Consistency
Finances
CRM
 Each data source value may different
 Accuracy
 Can’t make a good decision
 Performance
Supply Chain
 Need additional transactions
 Integration
 Difficult combine other systems
Warehouse
34
Background
Problems over the Business (2/3)
 Architecture Problems Based on Multiple Vendors
Business Intelligence
Applications Server
Database Server
Portal
Business Intelligence
ETL
35
Background
Problems over the Business (3/3)
 Various Business Solutions
 Separated applications take long time to be an expert
 Separated applications cause many administration costs
Financials
CRM
Human
Resources
SCM
36
Contents
 Part 1: OO in Oracle Database 10g
 About Oracle
 Object-Relational Databases
 OO in Oracle Database 10g
 Part 2: OO in Oracle E-Business Suite 11i
 Background
 Oracle’s Solution
 Oracle E-Business Suite 11i
 References & Appendix
37
Oracle’s Solution
The Power of One (1/3)
 One Family of Applications
Maintain
Develop
Projects
Market
Sell
Finance
Order
HR
Plan
Service
Fulfill
Source
Manufacture
Procure
38
Oracle’s Solution
The Power of One (2/3)
 One Enterprise Data Model
 Global Single Data Model (GSD)
Maintain
Develop
Projects
Market
Sell
Customers,
Products,
& Everything
Else!
Finance
HR
Service
Fulfill
Order
Plan
Source
Manufacture
Procure
39
Oracle’s Solution
The Power of One (3/3)
 One Underlying Technology Platform
Client Tier
User Interface
Application Tier
Database Tier
Application Logic
Database Logic
40
Oracle Fusion
Next-Generation Enterprise Applications
 Oracle procured many application sets by greedy
M&A
 Integrate those applications, is called “Fusion”
41
Contents
 Part 1: OO in Oracle Database 10g
 About Oracle
 Object-Relational Databases
 OO in Oracle Database 10g
 Part 2: OO in Oracle E-Business Suite 11i
 Background
 Oracle’s Solution
 Oracle E-Business Suite 11i
 References & Appendix
42
Oracle E-Business Suite 11i
The True Character of EBS
 The Portal System for Enterprise
 which contains many applications
43
Oracle E-Business Suite 11i
The Technology Stack of EBS
 Oracle AS and Database have technical components
 EBS has a framework to manipulate other layers
 EBS applications are developed by such framework
44
Oracle E-Business Suite 11i
How Can Make a View of EBS App?
 All pages of EBS application consist of components
45
Oracle E-Business Suite 11i
MVC Architecture
 A component-based design with clean interfaces
among model, view, and controller objects
The controller responds to
user actions and directs
Controller
application flow
Model
View
The model encapsulates The view formats and
underlying data and business presents data from a
logic of the application model to the user
46
Oracle E-Business Suite 11i
The View – Using Java Objects
Header Bean
Each UI widget
corresponds to one or
more Java objects
(beans)
Submit button
Bean
Table Bean
The Java objects are
used to create HTML
at runtime.
47
Oracle E-Business Suite 11i
The View – UIX (User Interface XML)
<div xmlns="http://www.w3.org/TR/REC-html40"
xmlns:ui="http://xmlns.oracle.com/uix/ui">
Hello world.
<ul>
<li>First list element</li>
<li>Second list element</li>
</ul>
<ui:button text="Push me" destination="http://www.example.org"/>
</div>
UIX
ButtonBean button = new ButtonBean();
button.setText("Push me");
button.setDestination("http://www.example.org");
div.addIndexedChild(button);
48
Oracle E-Business Suite 11i
The View – How It Works
OA Framework Design time
OA Framework Runtime
Page Hierarchy
UIX
Bean Hierarchy
UIX
Renderers
JSP/HTML
Browser
Cache
Metadata
.XML
49
Oracle E-Business Suite 11i
The Controller – User Interaction
User takes an action Browser
sends
request to
Controller
Apply
1. Controller delegates data
processing to Model
2. Determines next page
3. Invokes View to present the
next page to user
Controller
Metadata
Workflow
Model
View
50
Oracle E-Business Suite 11i
The Model – Data Processing
BC4J OBJECTS
Entity Objects
(Simple DAO)
View Objects
(Using SQL DAO)
UIX
Bean Hierarchy
Application Module
(EJB Session Bean)
.XML
DML
Validations
Defaulting
Application Module
Database
Tables,Views
PL/SQL
51
Oracle E-Business Suite 11i
Applied Case – LG Philips LCD (1/2)
(LCD Market Leader)
CRM
US $25.9
Million
(2000 ~ )
SCM
FCM
HRM











Oracle Financials
Oracle Treasury
Oracle Financial Analyzer
Oracle Purchasing
Oracle Manufacturing
Oracle Order Management
Oracle Self-Service Human Resources
Oracle Training Administration
Oracle Time and Labor
Oracle Payroll
Oracle Advanced Benefits
52
Oracle E-Business Suite 11i
Applied Case – LG Philips LCD (2/2)
 Over a five-year period(2001 ~ 2005), LG Philips
LCD realizes US $104.7 million in gross benefits
from the ERP and HR projects
Inventory Turnover(in days)
Summary of Benefits by Business Area
53
Summary of Pt. 2
 The Oracle E-Business Suite 11i
 Provides many business applications
 Lowers total cost of ownership
 The Oracle solution is the power of one
 One family applications
 One enterprise data model
 One underlying technology platform
54
Contents
 Part 1: OO in Oracle Database 10g
 About Oracle
 Object-Relational Databases
 OO in Oracle Database 10g
 Part 2: OO in Oracle E-Business Suite 11i
 Background
 Oracle’s Solution
 Oracle E-Business Suite 11i
 References & Appendix
55
References
 Oracle® Database Application Developer's Guide - Object-Relational
Features 10g Release 2 (10.2) Part Number B14260-01,
http://downloadeast.oracle.com/docs/cd/B19306_01/appdev.102/b14260/toc.htm
 Silberschatz, Korth, Sudarshan, "Database System Concepts" 5th edition,
McGraw-Hill, 2006, Part 3, Chapter 9, p.361-394
 S. Khoshafian, R. Abnous. "Object Orientation", 2nd edition, John Wiley &
Sons, 1995, Chapter 8, p.320-379
 Oracle Applications Concepts, Oracle E-Business Suite Online
Documentation Library Release 12+, December 2006, Part No. B3145001, http://www.oracle.com/technology/documentation/applications.html
 Nadia Bendjou, Why Architecture Matters, Oracle OpenWorld 2005,
http://www.oracle.com/technology/products/applications/architecture/inde
x.html
 Lisa Parekh, Oracle E-Business Suite Technology Updates, Oracle
OpenWorld 2006,
http://www.oracle.com/technology/products/applications/ebs/index.html
 Wikipedia, http://en.wikipedia.org/
56
Appendix (1/2)
 PL/SQL
 Procedural Language/Structured Query Language
 Oracle’s proprietary server-based procedural extension
to the SQL database language
 Consists of blocks
DECLARE
-- Declaration block (optional)
BEGIN
-- Program proper
EXCEPTION
-- Exception-handling (optional)
END
Back!
57
Appendix (2/2)
 Oracle Applications Framework
 100% Java & XML, middle-tier application framework
 Use XML files to define pages and data
 Use PL/SQL to generate the HTML page
 JDeveloper extension
 Deploying applications to application server
 Demo
 http://www.oracle.com/technology/products/jdev/viewlets/1013/ADF_Overview_Viewl
et_viewlet_swf.html
 Reference
 http://download-west.oracle.com/otn_hosted_doc/jdeveloper/1013/adfdevguide.pdf
58