SlideShare a Scribd company logo
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Oracle Ask TOM Office Hours:
How To Model and Construct
Graphs with Oracle Database
Learn the first steps to use property graphs in the database – modeling and
constructing a graph. 2018.04.24
Albert Godfrind, Solutions Architect
Zhe Wu, Architect
Jean Ihm, Product Manager
Confidential – Oracle Internal/Restricted/Highly Restricted
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
AskTOM sessions on property graphs
• Today’s is the second session on property graphs
• February’s session covered “Introduction to Property Graphs”
– In case you missed it, recording is available at URL above
• Today’s topic: How To Model and Construct Graphs with Oracle Database
• Visit the Spatial and Graph landing page to view recordings; submit
feedback, questions, topic requests; view upcoming session dates and
topics; sign up
4
https://devgym.oracle.com/pls/apex/dg/office_hours/3084
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Oracle Big Data Spatial and Graph
• Available for Big Data platform/BDCS
– Hadoop, HBase, Oracle NoSQL
• Supported both on BDA and commodity
hardware
– CDH and Hortonworks
• Database connectivity through Big Data
Connectors or Big Data SQL
• Included in Big Data Cloud Service
Oracle Spatial and Graph
• Available with Oracle 18c/12.2/DBCS
• Using tables for graph persistence
• Graph views on relational data
• In-database graph analytics
– Sparsification, shortest path, page rank, triangle
counting, WCC, sub graphs
• SQL queries possible
• Included in Database Cloud Service
5
Graph Product Options
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Property Graph Database Features:
• Scalability and Performance
• Graph analytics
• Graph Visualization
• Graph Query Language (PGQL)
• Standard interfaces
• Graph views on relational and RDF data
• Integration with Machine Learning tools
6
Courtesy Tom Sawyer Perspectives
Courtesy Linkurious
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Graph Data Access Layer (DAL)
Architecture Property Graph Support
Graph Analytics
Blueprints & Lucene/SolrCloud RDF (RDF/XML, N-
Triples, N-Quads,
TriG,N3,JSON)
REST/WebService/Notebooks
Java,Groovy,Python,…
Java APIs
Java APIs/JDBC/SQL/PLSQL
Property Graph
formats
GraphML
GML
Graph-SON
Flat Files
7
Scalable and Persistent Storage Management
Parallel In-Memory Graph
Analytics/Graph Query (PGX)
Oracle NoSQL DatabaseOracle RDBMS Apache HBase
Apache
Spark
Apache
Spark
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
8
Designing Graphs
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
• What is a graph?
– Data model representing entities as
vertices and relationships as edges
– Optionally including attributes
• What are typical graphs?
– Social Networks
• LinkedIn, Facebook, Google+, Twitter, ...
– Financial networks
• Fund transfers, ownerships, …
– Dependencies
• Complex system interactions
9
Graph Data Model
E
A D
C B
F
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
• Why are graphs popular?
– Easy data modeling
• „whiteboard friendly“
– Flexible data model
• No predefined schema, easily extensible
• Particularly useful for sparse data
– Insight from graphical representation
• Intuitive visualization
– Enabling new kinds of analytics
• Overcoming limitations in relational
technology
10
Graph Data Model
E
A D
C B
F
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
• A set of vertices (or nodes)
– each vertex has a unique identifier.
– each vertex has a set of in/out edges.
– each vertex has a collection of properties.
– vertices are of different kinds
• A set of edges (or links)
– each edge has a unique identifier.
– each edge has a head/tail vertex.
– each edge has a label denoting type of
relationship between two vertices.
– each edge has a collection of properties.
11
A More Detailed Look at the Graph Model
https://github.com/tinkerpop/blueprints/wiki/Property-Graph-Model
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 12
Designing a Relational vs a Graph Model
Relational Graph
Relationships are implicit (primary / foreign keys) Relationships are explicit (edges)
Need technical expertise (normal form, …) Little or no technical expertise needed
Tools available (SQL Developer Data Modeler) No tools – just use a whiteboard !
Schema kept in dictionary No schema: add properties, vertex types, edge types at
will
Strong dependency between data model and
applications: changing the model impacts many
applications
Weak dependency: changing schema only impacts
applications that use the new properties, vertices or
edges
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
• Given a source Data Model
(Relational) ...
From Relational to Graph ...
• Obtain a graph …
Courtesy: Tom Sawyer 2017 13
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Step 1: Understand the Source Data Models
• What are the entities?
– People, Departments
– Attributes of entities (name, ID, …)
• What are the relationships/links?
– Membership
– People-people relationship
– Department hierarchy
– Attributes of links(strength, startDate, location, …)
14Courtesy: Tom Sawyer 2017
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Step 2: Think About What You Want To Achieve
• Navigation?
• Pattern matching?
• Analytics?
• Integration?
• Visualization?
• or something else?
15
Choice of edges and attributes e.g.
Tom  memberOf  Sales
Tom (memberOf:‘Sales,Marketing‘ )
Courtesy: Tom Sawyer 2017
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Step 3: Construct the Graph Model
16
• Rows in tables usually
become vertices
• Columns become
properties on vertices
• Relationships become
edges
• Join tables in n:m relations
become relationships,
Courtesy: Tom Sawyer 2017
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Step 4: Try Your Work Load and Repeat 1,2,3 if Necessary
It is OK and quite typical to do trial-and-error
17Courtesy: Tom Sawyer 2017
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 18
Example 1:
Human
Resources
JOBS
COUNTRIES
REGIONS
LOCATIONS
JOB_HISTORY
DEPARTMENTS EMPLOYEES
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
JOBS
COUNTRIES
REGIONS
LOCATIONS
EMPLOYEESDEPARTMENTS
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Depart
ment
Employee
Job
Location
Works In
Located At
Occupation
Manages
Heads
Human
Resources
Graph
Model
Country and
region as
properties
History
integrated as
start/end dates
on edges
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Depart
ment
Employee
Job
Location
Works In
Located At
Occupation
Manager
ManagesHeads
Manages
Human
Resources
Graph
Model
Manager as a
separate vertex
type
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
JOBS
LOCATIONS
EMPLOYEESDEPARTMENTS
PROJECTS
EMP_PROJ
COUNTRIES
REGIONS
Include
projects
Human
Resources
Schema
Extended
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Depart
ment
Employee
Job
Location
Works In
Located At
Occupation
Manager
ManagesHeads
Manages
Human
Resources
Graph
Model
Project
Works
on
Include
projects
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 24
Manager
Employee
Job
Depart
ment Location
Occupation
Located
At
Manages
Works In
Heads
Manages
Project Works
on
Another
Graphic
Representation
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
PRODUCTS
ORDERS
CUSTOMERS
ORDER_LINES
Customer ProductPurchased
Example 2: Order Entry
Order
properties:
quantity, date
purchased ..
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Example 3: Dependencies • Dependencies between
schema objects in a database
• Very useful for impact
analysis
• Map dependencies as a graph
desc dba_dependencies
Name Null? Type
----------------------- -------- --------------
OWNER NOT NULL VARCHAR2(128)
NAME NOT NULL VARCHAR2(128)
TYPE VARCHAR2(19)
REFERENCED_OWNER VARCHAR2(128)
REFERENCED_NAME VARCHAR2(128)
REFERENCED_TYPE VARCHAR2(19)
REFERENCED_LINK_NAME VARCHAR2(128)
DEPENDENCY_TYPE VARCHAR2(4)
Object
Depends
On
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Type
View
Index Table
Column
Indexes
View On
Has Column
Uses
View On • More detailed graph model
• Can also include stored
functions, packages, triggers
• Extend with programs
References
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
28
Constructing Graphs
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
• Oracle Data Integrator (ODI)
• Data Access Layer (DAL) Java Programming APIs
• DAL Utility
– RDBMS Data Source to Graph
– CSV to Graph
• SQL
29
Several Simple Ways to Construct a Property Graph
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Use Oracle Data Integrator (ODI) to Generate Graph
30
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Oracle Data Integrator
Bulk Data Performance
Non Invasive Footprint
Future Proof IT Skills
Oracle Data Integrator provides high performance bulk
data movement, massively parallel data transformation
using database or big data technologies, and block-level
data loading that leverages native data utilities
Bulk Data
Transformation
Most Apps,
Databases
& Cloud Bulk Data Movement
Cloud
DBs
Big
Data
1000’s of
customers –
more than other
ETL tools
1000’s of
customers –
more than other
ETL tools
Flexible ELT
workloads run
anywhere: DBs,
Big Data, Cloud
Flexible ELT
workloads run
anywhere: DBs,
Big Data, Cloud
Up to 2x faster
batch processes
and 3x more
efficient tooling
Up to 2x faster
batch processes
and 3x more
efficient tooling
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Key Architecture Benefits
Reverse Engineer
Metadata
Journalize
(CDC)
Load from
Source to
Staging
Check
Constraints
Integrate,
Transform
Data Service
32
Simpler Physical Design and Shorter Implementation Time
Knowledge Modules
Oracle Spark Hive HBase Pig Sqoop
BICS
Oracle
Datapump
Oracle
DBLink
JMS
External
Tables
Teradata
SAP Siebel
eBusiness
Suite
IBM DB2 Netezza SCD
Pluggable Knowledge Modules Architecture
Sample out-of-the-box Knowledge Modules
• Faster development and simpler
maintenance using templates
• Easy to extend and add new best practices
• Enforces predictability and reduces cost of
ownership
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 33
Property Graph Construction Work Flow with ODI
Define Source
Model
(payment data in CSV)
Define Target
Model
(data shape required
by Graph)
Generate Mapping Execute Conversion
Graph Model
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 34
Property Graph Construction Work Flow with ODI
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Demo
35
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Use DAL APIs to programmatically create a graph
36
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
opgtest = OraclePropertyGraph.getInstance(cfg);
v=opgtest.addVertex(100l);
v.setProperty("name", name);
v.setProperty("hiredate", d);
v2=opgtest.addVertex(102l);
e1 = opgtest.addEdge(1l, v1, v2, "likes");
e1.setProperty("strength", 0.8d);
…
OraclePropertyGraphUtils.exportFlatFiles(opgtest,
"/tmp/graph.opv",
"/tmp/graph.ope",
2,
false);
37
Using Data Access Layer (DAL) Java APIs
Building a Property Graph From Scratch
Incremental vertices update & set of properties
Incremental edges update & set of properties
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Read from a data source &
Use DAL APIs to programmatically create a graph
38
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Building a Property Graph from a Data Source
oracle=new Oracle("jdbc:oracle:thin:@(…)", "scott", "password");
cfg =…;
opgtest = OraclePropertyGraph.getInstance(cfg);
rs = oracle.executeQuery("select empno, ename, mgr, hiredate
from scott.emp");
while(rs.next()) {
eid=rs.getLong(1); name=rs.getString(2);
mgr=rs.getLong(3); d=rs.getDate(4);
v=opgtest.addVertex((Long)eid);
v.setProperty("name", name);
v.setProperty("hiredate", d); …
}
39
Querying a Relational Data Source to produce a Property Graph Data Model
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Building a Property Graph from a Data Source
opg-hbase> opgtest.getVertices();
==>Vertex ID 7902 {name:str:FORD, hiredate:dat:1981-12-03}
==>Vertex ID 7654 {name:str:MARTIN, hiredate:dat:1981-09-28}
==>Vertex ID 7499 {name:str:ALLEN, hiredate:dat:1981-02-20}
==>Vertex ID 7369 {name:str:SMITH, hiredate:dat:1980-12-17}
==>Vertex ID 7844 {name:str:TURNER, hiredate:dat:1981-09-08}
==>Vertex ID 7521 {name:str:WARD, hiredate:dat:1981-02-22}
==>Vertex ID 7698 {name:str:BLAKE, hiredate:dat:1981-05-01}
==>Vertex ID 7782 {name:str:CLARK, hiredate:dat:1981-06-09}
==>Vertex ID 7788 {name:str:SCOTT, hiredate:dat:1987-04-19}
==>Vertex ID 7566 {name:str:JONES, hiredate:dat:1981-04-02}
==>Vertex ID 7900 {name:str:JAMES, hiredate:dat:1981-12-03}
==>Vertex ID 7839 {name:str:KING, hiredate:dat:1981-11-17}
==>Vertex ID 7934 {name:str:MILLER, hiredate:dat:1982-01-23}
==>Vertex ID 7876 {name:str:ADAMS, hiredate:dat:1987-05-23}
7521,hiredate,5,,,1981-02-22T00:00:00.000-05:00
7521,name,1,WARD,,
7788,hiredate,5,,,1987-04-19T00:00:00.000-04:00
7788,name,1,SCOTT,,
40
Generated output
Vertices converted from
Scott.EMP
Serialized Vertices in Flat File format
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Generate a Property Graph (.opv/.ope) directly from
relational tables (views)
41
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 42
Graph Construction Work Flow From Relational Tables
Select Tables Define Mappings
(ColumnToAttrMappings)
Execute Conversion Load Graph
1101,name,1,Jean,,
1101,age,2,,20,
1101,salary,4,,120.0,
1102,name,1,Mary,,
…
100,1101,1002,works,weight,3,,1.0,
101,1110,1015,works,weight,3,,1.0,
102,1110,1102,works,weight,3,,1.0,
…
Vertex Flat-file
Edge Flat-file
name String
join_date Date
salary Double
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Convert Relational Tables/Views to Flat Files: Vertices
43
1
1101,name,1,Mara%20Kessler,,
1101,join_date,5,,,2016-11-21T00:00:00.000-00:00
1101,location,1,East%20Pinkchester,,
1102,name,1,Brad%20Eichmann,,
1102,join_date,5,,,2018-05-02T00:00:00.000-00:00
1102,location,1,Kiannaside,,
…
name String
join_date Date
location String
employees Table
EMP_ID name join_date location …
1 Mara Kessler 2016-11-21
East
Pinkchester
…
2 Brad Eichmann 2018-05-02 Kiannaside …
… … … … …
8 Clotilde Romaguera 2018-06-16 Rodgerborough …
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Convert from Relational to Flat Files: Vertices
String opv = "./employees-graph.opv";
OutputStream opvOS = new FileOutputStream(opv);
ColumnToAttrMapping[] ctams = new ColumnToAttrMapping[3];
ctams[0] = ColumnToAttrMapping.getInstance("name", "name", String.class);
ctams[1] = ColumnToAttrMapping.getInstance("join_date", "join date", Date.class);
ctams[2] = ColumnToAttrMapping.getInstance("loc", "location", String.class);
OraclePropertyGraphUtils.convertRDBMSTable2OPV(conn,
"employees",
"emp_id",
1100,
ctams,
8,
opvOS,
(DataConverterListener) null);
44
Specify the table to convert data from and the column
used to identify the vertices ID
Mappings between table columns &
vertex properties (including data types)
Specify the offset for vertex ID
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Generate a Property Graph (.opv/.ope) directly from CSV
Files
45
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 46
Graph Construction Work Flow From CSV Files
Select CSV Files Define Mappings
(ColumnToAttrMappings)
Execute Conversion Load Graph
1101,name,1,Jean,,
1101,age,2,,20,
1101,salary,4,,120.0,
1102,name,1,Mary,,
…
100,1101,1002,works,weight,3,,1.0,
101,1110,1015,works,weight,3,,1.0,
102,1110,1102,works,weight,3,,1.0,
…
Vertex Flat-file
Edge Flat-file
name String
join_date Date
salary Double
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Convert From CSV File to Flat File: Vertices
47
1
1101,name,1,John,,
1101,score,4,,4.2,
1101,age,2,,30,
1102,name,1,Mary,,
1102,score,4,,4.3,
1102,age,2,,32,
…
name String
score Float
age Integer
1,John,4.2,30
2,Mary,4.3,32
3,"Skywalker, Anakin",5.0,46
4,"Darth Vader",5.0,46
5,"Skywalker, Luke",5.0,53
…
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Convert From CSV File to Flat File: Vertices
String inputCSV = "/path/mygraph-vertices.csv";
String outputOPV = "/path/mygraph.opv";
ColumnToAttrMapping[] ctams = new ColumnToAttrMapping[4];
ctams[0] = ColumnToAttrMapping.getInstance("VID", Long.class);
ctams[1] = ColumnToAttrMapping.getInstance("name", String.class);
ctams[2] = ColumnToAttrMapping.getInstance("score", Double.class);
ctams[3] = ColumnToAttrMapping.getInstance("age", Integer.class);
InputStream isCSV = new FileInputStream(inputCSV);
OutputStream osOPV = new FileOutputStream(new File(outputOPV));
OraclePropertyGraphUtilsBase.convertCSV2OPV(isCSV,
"VID",
0,
ctams,
1,
0, osOPV, null);
48
Specify the CSV File to convert data from and the
column used to identify the vertices ID
Mappings between table columns &
vertex properties (including data types)
Specify the offset for vertex ID
Specify the offset of lines to skip from file
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
VID:int,name,score:float,age:integer
1,John,4.2,30
2,Mary,4.3,32
3,"Skywalker, Anakin",5.0,46
4,"Darth Vader",5.0,46
5,"Skywalker, Luke",5.0,53
Convert From CSV File with Headers to Flat File: Vertices
49
1
name String
score Float
age Integer
1101,name,1,John,,
1101,score,4,,4.2,
1101,age,2,,30,
1102,name,1,Mary,,
1102,score,4,,4.3,
1102,age,2,,32,
…
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Convert From CSV File with Headers to Flat File: Vertices
String inputCSV = "/path/mygraph-vertices.csv";
String outputOPV = "/path/mygraph.opv";
InputStream isCSV = new FileInputStream(inputCSV);
OutputStream osOPV = new FileOutputStream(new File(outputOPV));
OraclePropertyGraphUtilsBase.convertCSV2OPV(isCSV,
"VID",
0 /* Vertex ID offset */,
null,
1 /* Degree of Parallelism */,
0 /* Lines to skip from file */,
osOPV, (DataConverterListener)null);
5050
Mappings between CSV columns & vertex properties will
be read from the header of the CSV file
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Convert CSV Files with Headers to Flat Files: Edges
51
1,30,0,friends,since,5,,,2010-04-14T00:00:00.000-00:00
1,30,0,friends,weight,3,,1.0,
3,48,36,colleagues,since,5,,,2013-11-07T00:00:00.000-00:00
3,48,36,colleagues,weight,3,,1.0,
…
10,21,16,manager,since,5,,,2014-03-05T00:00:00.000-00:00
10,21,16,manager,weight,3,,1.0,
0
30
‘friends’since Date
weight Float
EID,SINCE,SRC,STRENGTH,DEST,RELATION
1,14-04-2010,1,30,0,friends
3,07-11,2013,1,48,36,friends
...
10,05-03-2014,0,21,16,manager
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Convert From CSV File with Headers to Flat File: Edges
String inputCSE = "/path/mygraph-edges.csv";
String outputOPE = "/path/mygraph.ope";
InputStream isCSE = new FileInputStream(inputCSE);
OutputStream osOPE = new FileOutputStream(new File(outputOPE));
OraclePropertyGraphUtilsBase.convertCSV2OPE(isCSE,
"EID",
0 /* Edge ID offset */,
"SRC",
"DEST",
true, "RELATION",
null,
1 /* Degree of Parallelism */,
0 /* Lines to skip from file */,
osOPE,
(DataConverterListener)null);
5252
Mappings between CSV columns & vertex
properties will be read from the header of the CSV
file
Specify the columns where source and
destination vertex IDs will be taken from
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Customization of CSV Conversion to Flat Files
53
OraclePropertyGraphUtilsBase.convertCSV2OPE(isCSV,
"eid",
100 /* edge ID offset */,
"person" /* source vertex column */,
"product" /* destination vertex column */,
10 /* offset source vertex IDs */,
50 /* offset destination vertex IDs */,
false /* has edge column? */,
"bought",
null /* ctams mappings */,
1 /* degree of parallelism */,
‘|’,
‘"’,
1,
new SimpleDateFormat("dd/MM/yyyy"),
true,
osOPE,
null) ;
Specify default edge label
Delimiter character
Quotation character
Date format
Skip CSV records
Allow support for multiline in CSV records
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Construct a property graph with SQL
54
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Graph Construction with SQL
Confidential – Oracle Internal/Restricted/Highly Restricted 55
--
-- A Helper SQL View to simplify comparison of multiple vertex properties
--
CREATE VIEW BankXpivot AS
SELECT * FROM ( SELECT vid, k, v FROM BankXVT$)
PIVOT (MIN(v) FOR k IN ('Address' AS Address,
'Address1' AS Address1,
'Address2' AS Address2,
'AppId' AS AppId,
'CIO' AS CIO , 'In-Address' AS In_Address,
'In-Port' AS In_Port, 'LOB' AS LOB,
'Label' AS Label, 'Name' AS Name,
'Out-Address' AS Out_Address,
'Out-Port' AS Out_Port,
'Type' AS Type, 'VertexType' AS VertexType,
'Web' AS Web )
)
• Use native SQL to construct edges (modeling complex business relationships) on the fly
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Graph Construction with SQL
Confidential – Oracle Internal/Restricted/Highly Restricted 56
--
-- App to LOB where Appname.LOB = LOB.LOB
-- Edge keys: LOB
--
INSERT INTO BankX_pivotGE$ (eid, svid, dvid, el, k, t, v)
SELECT ROWNUM+100000 AS eid,
apps.vid AS svid,
lobs.vid AS dvid,
'Owner' AS el,
'LOB' AS k,
1 AS t,
apps.lob AS v
FROM ( SELECT * FROM BankXpivot WHERE VertexType = 'App') apps
JOIN ( SELECT * FROM BankXpivot WHERE VertexType = 'LOB') lobs
ON apps.lob = lobs.label
ORDER BY svid, dvid
• Use native SQL
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | .
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
58
Resources
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Resources
• Oracle Spatial and Graph & Big Data Spatial and Graph on OTN
oracle.com/technetwork/database/options/spatialandgraph
oracle.com/technetwork/database/database-technologies/bigdata-spatialandgraph
– White papers, software downloads, documentation and videos
• Blogs – examples, tips & tricks
blogs.oracle.com/oraclespatial | blogs.oracle.com/bigdataspatialgraph
• Property Graphs 101: How to Get Started with Property Graphs on the Oracle Database –
Arthur Dayton, Vlamis Software video https://youtu.be/QSj0zOjOAWI |
blog post http://www.vlamis.com/blog/2018/2/5/creating-a-property-graph-on-oracle-database
• YouTube channel https://www.youtube.com/channel/UCZqBavfLlCuS0il6zNY696w
• Oracle Big Data Lite Virtual Machine - a free sandbox to get started
www.oracle.com/technetwork/database/bigdata-appliance/oracle-bigdatalite-2104726.html
– Hands On Lab included in /opt/oracle/oracle-spatial-graph/ or http://github.com/oracle/BigDataLite/
59
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Resources – social media and online communities
• Follow the product team: @JeanIhm, @agodfrin, @alanzwu, @SpatialHannes
• Oracle Spatial and Graph SIG user groups (search “Oracle Spatial and
Graph Community”)
60
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
AskTOM sessions on property graphs
• Next Spatial and Graph session in late May
– Topic: Performing Graph Analytics
• View recordings, submit feedback, questions,
topic requests, view upcoming session dates
and topics, sign up to get regular updates
61
https://devgym.oracle.com/pls/apex/dg/office_hours/3084
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
62
Thanks for attending! See you next month.
https://devgym.oracle.com/pls/apex/dg/office_hours/3084
How To Model and Construct Graphs with Oracle Database (AskTOM Office Hours part 2)

More Related Content

What's hot

20181123 dn2018 graph_analytics_k_patenge
20181123 dn2018 graph_analytics_k_patenge20181123 dn2018 graph_analytics_k_patenge
20181123 dn2018 graph_analytics_k_patenge
Karin Patenge
 
Large Scale Graph Analytics with RDF and LPG Parallel Processing
Large Scale Graph Analytics with RDF and LPG Parallel ProcessingLarge Scale Graph Analytics with RDF and LPG Parallel Processing
Large Scale Graph Analytics with RDF and LPG Parallel Processing
Cambridge Semantics
 
A gentle introduction to Oracle R Enterprise
A gentle introduction to Oracle R EnterpriseA gentle introduction to Oracle R Enterprise
A gentle introduction to Oracle R Enterprise
Swiss Data Forum Swiss Data Forum
 
Machine learning with Spark
Machine learning with SparkMachine learning with Spark
Machine learning with Spark
Khalid Salama
 
8th TUC Meeting - Zhe Wu (Oracle USA). Bridging RDF Graph and Property Graph...
8th TUC Meeting -  Zhe Wu (Oracle USA). Bridging RDF Graph and Property Graph...8th TUC Meeting -  Zhe Wu (Oracle USA). Bridging RDF Graph and Property Graph...
8th TUC Meeting - Zhe Wu (Oracle USA). Bridging RDF Graph and Property Graph...
LDBC council
 
8th TUC Meeting – Yinglong Xia (Huawei), Big Graph Analytics Engine
8th TUC Meeting – Yinglong Xia (Huawei), Big Graph Analytics Engine8th TUC Meeting – Yinglong Xia (Huawei), Big Graph Analytics Engine
8th TUC Meeting – Yinglong Xia (Huawei), Big Graph Analytics Engine
LDBC council
 
AnzoGraph DB - SPARQL 101
AnzoGraph DB - SPARQL 101AnzoGraph DB - SPARQL 101
AnzoGraph DB - SPARQL 101
Cambridge Semantics
 
Oracle Advanced Analytics
Oracle Advanced AnalyticsOracle Advanced Analytics
Oracle Advanced Analyticsaghosh_us
 
Hybrid Enterprise Knowledge Graphs
Hybrid Enterprise Knowledge GraphsHybrid Enterprise Knowledge Graphs
Hybrid Enterprise Knowledge Graphs
Peter Haase
 
Knowledge Graph for Machine Learning and Data Science
Knowledge Graph for Machine Learning and Data ScienceKnowledge Graph for Machine Learning and Data Science
Knowledge Graph for Machine Learning and Data Science
Cambridge Semantics
 
Graph database & neo4j
Graph database & neo4jGraph database & neo4j
Graph database & neo4j
Sandip Jadhav
 
Nodes2020 | Graph of enterprise_metadata | NEO4J Conference
Nodes2020 | Graph of enterprise_metadata | NEO4J ConferenceNodes2020 | Graph of enterprise_metadata | NEO4J Conference
Nodes2020 | Graph of enterprise_metadata | NEO4J Conference
Deepak Chandramouli
 
What you need to know to start an AI company?
What you need to know to start an AI company?What you need to know to start an AI company?
What you need to know to start an AI company?
Mo Patel
 
Joseph Bradley, Software Engineer, Databricks Inc. at MLconf SEA - 5/01/15
Joseph Bradley, Software Engineer, Databricks Inc. at MLconf SEA - 5/01/15Joseph Bradley, Software Engineer, Databricks Inc. at MLconf SEA - 5/01/15
Joseph Bradley, Software Engineer, Databricks Inc. at MLconf SEA - 5/01/15
MLconf
 
Atlas ApacheCon 2017
Atlas ApacheCon 2017Atlas ApacheCon 2017
Atlas ApacheCon 2017
Vimal Sharma
 
Data Science for Dummies - Data Engineering with Titanic dataset + Databricks...
Data Science for Dummies - Data Engineering with Titanic dataset + Databricks...Data Science for Dummies - Data Engineering with Titanic dataset + Databricks...
Data Science for Dummies - Data Engineering with Titanic dataset + Databricks...
Rodney Joyce
 
Graph Gurus Episode 1: Enterprise Graph
Graph Gurus Episode 1: Enterprise GraphGraph Gurus Episode 1: Enterprise Graph
Graph Gurus Episode 1: Enterprise Graph
TigerGraph
 
Big Analytics Without Big Hassles
Big Analytics Without Big HasslesBig Analytics Without Big Hassles
Big Analytics Without Big Hassles
Paradigm4
 
2020 | Metadata Day | LinkedIn
2020 | Metadata Day | LinkedIn2020 | Metadata Day | LinkedIn
2020 | Metadata Day | LinkedIn
Deepak Chandramouli
 
Predicting Influence and Communities Using Graph Algorithms
Predicting Influence and Communities Using Graph AlgorithmsPredicting Influence and Communities Using Graph Algorithms
Predicting Influence and Communities Using Graph Algorithms
Databricks
 

What's hot (20)

20181123 dn2018 graph_analytics_k_patenge
20181123 dn2018 graph_analytics_k_patenge20181123 dn2018 graph_analytics_k_patenge
20181123 dn2018 graph_analytics_k_patenge
 
Large Scale Graph Analytics with RDF and LPG Parallel Processing
Large Scale Graph Analytics with RDF and LPG Parallel ProcessingLarge Scale Graph Analytics with RDF and LPG Parallel Processing
Large Scale Graph Analytics with RDF and LPG Parallel Processing
 
A gentle introduction to Oracle R Enterprise
A gentle introduction to Oracle R EnterpriseA gentle introduction to Oracle R Enterprise
A gentle introduction to Oracle R Enterprise
 
Machine learning with Spark
Machine learning with SparkMachine learning with Spark
Machine learning with Spark
 
8th TUC Meeting - Zhe Wu (Oracle USA). Bridging RDF Graph and Property Graph...
8th TUC Meeting -  Zhe Wu (Oracle USA). Bridging RDF Graph and Property Graph...8th TUC Meeting -  Zhe Wu (Oracle USA). Bridging RDF Graph and Property Graph...
8th TUC Meeting - Zhe Wu (Oracle USA). Bridging RDF Graph and Property Graph...
 
8th TUC Meeting – Yinglong Xia (Huawei), Big Graph Analytics Engine
8th TUC Meeting – Yinglong Xia (Huawei), Big Graph Analytics Engine8th TUC Meeting – Yinglong Xia (Huawei), Big Graph Analytics Engine
8th TUC Meeting – Yinglong Xia (Huawei), Big Graph Analytics Engine
 
AnzoGraph DB - SPARQL 101
AnzoGraph DB - SPARQL 101AnzoGraph DB - SPARQL 101
AnzoGraph DB - SPARQL 101
 
Oracle Advanced Analytics
Oracle Advanced AnalyticsOracle Advanced Analytics
Oracle Advanced Analytics
 
Hybrid Enterprise Knowledge Graphs
Hybrid Enterprise Knowledge GraphsHybrid Enterprise Knowledge Graphs
Hybrid Enterprise Knowledge Graphs
 
Knowledge Graph for Machine Learning and Data Science
Knowledge Graph for Machine Learning and Data ScienceKnowledge Graph for Machine Learning and Data Science
Knowledge Graph for Machine Learning and Data Science
 
Graph database & neo4j
Graph database & neo4jGraph database & neo4j
Graph database & neo4j
 
Nodes2020 | Graph of enterprise_metadata | NEO4J Conference
Nodes2020 | Graph of enterprise_metadata | NEO4J ConferenceNodes2020 | Graph of enterprise_metadata | NEO4J Conference
Nodes2020 | Graph of enterprise_metadata | NEO4J Conference
 
What you need to know to start an AI company?
What you need to know to start an AI company?What you need to know to start an AI company?
What you need to know to start an AI company?
 
Joseph Bradley, Software Engineer, Databricks Inc. at MLconf SEA - 5/01/15
Joseph Bradley, Software Engineer, Databricks Inc. at MLconf SEA - 5/01/15Joseph Bradley, Software Engineer, Databricks Inc. at MLconf SEA - 5/01/15
Joseph Bradley, Software Engineer, Databricks Inc. at MLconf SEA - 5/01/15
 
Atlas ApacheCon 2017
Atlas ApacheCon 2017Atlas ApacheCon 2017
Atlas ApacheCon 2017
 
Data Science for Dummies - Data Engineering with Titanic dataset + Databricks...
Data Science for Dummies - Data Engineering with Titanic dataset + Databricks...Data Science for Dummies - Data Engineering with Titanic dataset + Databricks...
Data Science for Dummies - Data Engineering with Titanic dataset + Databricks...
 
Graph Gurus Episode 1: Enterprise Graph
Graph Gurus Episode 1: Enterprise GraphGraph Gurus Episode 1: Enterprise Graph
Graph Gurus Episode 1: Enterprise Graph
 
Big Analytics Without Big Hassles
Big Analytics Without Big HasslesBig Analytics Without Big Hassles
Big Analytics Without Big Hassles
 
2020 | Metadata Day | LinkedIn
2020 | Metadata Day | LinkedIn2020 | Metadata Day | LinkedIn
2020 | Metadata Day | LinkedIn
 
Predicting Influence and Communities Using Graph Algorithms
Predicting Influence and Communities Using Graph AlgorithmsPredicting Influence and Communities Using Graph Algorithms
Predicting Influence and Communities Using Graph Algorithms
 

Similar to How To Model and Construct Graphs with Oracle Database (AskTOM Office Hours part 2)

AnzoGraph DB: Driving AI and Machine Insights with Knowledge Graphs in a Conn...
AnzoGraph DB: Driving AI and Machine Insights with Knowledge Graphs in a Conn...AnzoGraph DB: Driving AI and Machine Insights with Knowledge Graphs in a Conn...
AnzoGraph DB: Driving AI and Machine Insights with Knowledge Graphs in a Conn...
Cambridge Semantics
 
20181019 code.talks graph_analytics_k_patenge
20181019 code.talks graph_analytics_k_patenge20181019 code.talks graph_analytics_k_patenge
20181019 code.talks graph_analytics_k_patenge
Karin Patenge
 
Graph Analytics on Data from Meetup.com
Graph Analytics on Data from Meetup.comGraph Analytics on Data from Meetup.com
Graph Analytics on Data from Meetup.com
Karin Patenge
 
Applying large scale text analytics with graph databases
Applying large scale text analytics with graph databasesApplying large scale text analytics with graph databases
Applying large scale text analytics with graph databases
Data Ninja API
 
Separation of Concerns through APIs: the Essence of #SmartDB
Separation of Concerns through APIs: the Essence of #SmartDBSeparation of Concerns through APIs: the Essence of #SmartDB
Separation of Concerns through APIs: the Essence of #SmartDB
Toon Koppelaars
 
MySQL JSON Document Store - A Document Store with all the benefits of a Trans...
MySQL JSON Document Store - A Document Store with all the benefits of a Trans...MySQL JSON Document Store - A Document Store with all the benefits of a Trans...
MySQL JSON Document Store - A Document Store with all the benefits of a Trans...
Olivier DASINI
 
Domain Specific Languages for Parallel Graph AnalytiX (PGX)
Domain Specific Languages for Parallel Graph AnalytiX (PGX)Domain Specific Languages for Parallel Graph AnalytiX (PGX)
Domain Specific Languages for Parallel Graph AnalytiX (PGX)
Eelco Visser
 
Arches Getty Brownbag Talk
Arches Getty Brownbag TalkArches Getty Brownbag Talk
Arches Getty Brownbag Talk
benosteen
 
Meetup Oracle Database MAD: 2.1 Data Management Trends: SQL, NoSQL y Big Data
Meetup Oracle Database MAD: 2.1 Data Management Trends: SQL, NoSQL y Big Data Meetup Oracle Database MAD: 2.1 Data Management Trends: SQL, NoSQL y Big Data
Meetup Oracle Database MAD: 2.1 Data Management Trends: SQL, NoSQL y Big Data
avanttic Consultoría Tecnológica
 
Novinky v Oracle Database 18c
Novinky v Oracle Database 18cNovinky v Oracle Database 18c
Novinky v Oracle Database 18c
MarketingArrowECS_CZ
 
Oracle Code Online: Building a Serverless State Service for the Cloud
Oracle Code Online: Building a Serverless State Service for the CloudOracle Code Online: Building a Serverless State Service for the Cloud
Oracle Code Online: Building a Serverless State Service for the Cloud
Ed Burns
 
SRV307 Applying AWS Purpose-Built Database Strategy: Match Your Workload to ...
 SRV307 Applying AWS Purpose-Built Database Strategy: Match Your Workload to ... SRV307 Applying AWS Purpose-Built Database Strategy: Match Your Workload to ...
SRV307 Applying AWS Purpose-Built Database Strategy: Match Your Workload to ...
Amazon Web Services
 
Graph database in sv meetup
Graph database in sv meetupGraph database in sv meetup
Graph database in sv meetup
Joshua Bae
 
Meetup Oracle Database BCN: 2.1 Data Management Trends
Meetup Oracle Database BCN: 2.1 Data Management TrendsMeetup Oracle Database BCN: 2.1 Data Management Trends
Meetup Oracle Database BCN: 2.1 Data Management Trends
avanttic Consultoría Tecnológica
 
Business Analytics with R
Business Analytics with RBusiness Analytics with R
Business Analytics with REdureka!
 
aRangodb, un package per l'utilizzo di ArangoDB con R
aRangodb, un package per l'utilizzo di ArangoDB con RaRangodb, un package per l'utilizzo di ArangoDB con R
aRangodb, un package per l'utilizzo di ArangoDB con R
GraphRM
 
Oracle ADF Architecture TV - Development - Naming Conventions & Project Layouts
Oracle ADF Architecture TV - Development - Naming Conventions & Project LayoutsOracle ADF Architecture TV - Development - Naming Conventions & Project Layouts
Oracle ADF Architecture TV - Development - Naming Conventions & Project Layouts
Chris Muir
 
How to Survive as a Data Architect in a Polyglot Database World
How to Survive as a Data Architect in a Polyglot Database WorldHow to Survive as a Data Architect in a Polyglot Database World
How to Survive as a Data Architect in a Polyglot Database World
Karen Lopez
 
AnDSummit2020 Session Pattern Analysis Data Model
AnDSummit2020 Session Pattern Analysis Data ModelAnDSummit2020 Session Pattern Analysis Data Model
AnDSummit2020 Session Pattern Analysis Data Model
Shankar Somayajula
 
Business Analytics with R
Business Analytics with RBusiness Analytics with R
Business Analytics with REdureka!
 

Similar to How To Model and Construct Graphs with Oracle Database (AskTOM Office Hours part 2) (20)

AnzoGraph DB: Driving AI and Machine Insights with Knowledge Graphs in a Conn...
AnzoGraph DB: Driving AI and Machine Insights with Knowledge Graphs in a Conn...AnzoGraph DB: Driving AI and Machine Insights with Knowledge Graphs in a Conn...
AnzoGraph DB: Driving AI and Machine Insights with Knowledge Graphs in a Conn...
 
20181019 code.talks graph_analytics_k_patenge
20181019 code.talks graph_analytics_k_patenge20181019 code.talks graph_analytics_k_patenge
20181019 code.talks graph_analytics_k_patenge
 
Graph Analytics on Data from Meetup.com
Graph Analytics on Data from Meetup.comGraph Analytics on Data from Meetup.com
Graph Analytics on Data from Meetup.com
 
Applying large scale text analytics with graph databases
Applying large scale text analytics with graph databasesApplying large scale text analytics with graph databases
Applying large scale text analytics with graph databases
 
Separation of Concerns through APIs: the Essence of #SmartDB
Separation of Concerns through APIs: the Essence of #SmartDBSeparation of Concerns through APIs: the Essence of #SmartDB
Separation of Concerns through APIs: the Essence of #SmartDB
 
MySQL JSON Document Store - A Document Store with all the benefits of a Trans...
MySQL JSON Document Store - A Document Store with all the benefits of a Trans...MySQL JSON Document Store - A Document Store with all the benefits of a Trans...
MySQL JSON Document Store - A Document Store with all the benefits of a Trans...
 
Domain Specific Languages for Parallel Graph AnalytiX (PGX)
Domain Specific Languages for Parallel Graph AnalytiX (PGX)Domain Specific Languages for Parallel Graph AnalytiX (PGX)
Domain Specific Languages for Parallel Graph AnalytiX (PGX)
 
Arches Getty Brownbag Talk
Arches Getty Brownbag TalkArches Getty Brownbag Talk
Arches Getty Brownbag Talk
 
Meetup Oracle Database MAD: 2.1 Data Management Trends: SQL, NoSQL y Big Data
Meetup Oracle Database MAD: 2.1 Data Management Trends: SQL, NoSQL y Big Data Meetup Oracle Database MAD: 2.1 Data Management Trends: SQL, NoSQL y Big Data
Meetup Oracle Database MAD: 2.1 Data Management Trends: SQL, NoSQL y Big Data
 
Novinky v Oracle Database 18c
Novinky v Oracle Database 18cNovinky v Oracle Database 18c
Novinky v Oracle Database 18c
 
Oracle Code Online: Building a Serverless State Service for the Cloud
Oracle Code Online: Building a Serverless State Service for the CloudOracle Code Online: Building a Serverless State Service for the Cloud
Oracle Code Online: Building a Serverless State Service for the Cloud
 
SRV307 Applying AWS Purpose-Built Database Strategy: Match Your Workload to ...
 SRV307 Applying AWS Purpose-Built Database Strategy: Match Your Workload to ... SRV307 Applying AWS Purpose-Built Database Strategy: Match Your Workload to ...
SRV307 Applying AWS Purpose-Built Database Strategy: Match Your Workload to ...
 
Graph database in sv meetup
Graph database in sv meetupGraph database in sv meetup
Graph database in sv meetup
 
Meetup Oracle Database BCN: 2.1 Data Management Trends
Meetup Oracle Database BCN: 2.1 Data Management TrendsMeetup Oracle Database BCN: 2.1 Data Management Trends
Meetup Oracle Database BCN: 2.1 Data Management Trends
 
Business Analytics with R
Business Analytics with RBusiness Analytics with R
Business Analytics with R
 
aRangodb, un package per l'utilizzo di ArangoDB con R
aRangodb, un package per l'utilizzo di ArangoDB con RaRangodb, un package per l'utilizzo di ArangoDB con R
aRangodb, un package per l'utilizzo di ArangoDB con R
 
Oracle ADF Architecture TV - Development - Naming Conventions & Project Layouts
Oracle ADF Architecture TV - Development - Naming Conventions & Project LayoutsOracle ADF Architecture TV - Development - Naming Conventions & Project Layouts
Oracle ADF Architecture TV - Development - Naming Conventions & Project Layouts
 
How to Survive as a Data Architect in a Polyglot Database World
How to Survive as a Data Architect in a Polyglot Database WorldHow to Survive as a Data Architect in a Polyglot Database World
How to Survive as a Data Architect in a Polyglot Database World
 
AnDSummit2020 Session Pattern Analysis Data Model
AnDSummit2020 Session Pattern Analysis Data ModelAnDSummit2020 Session Pattern Analysis Data Model
AnDSummit2020 Session Pattern Analysis Data Model
 
Business Analytics with R
Business Analytics with RBusiness Analytics with R
Business Analytics with R
 

Recently uploaded

Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP
 
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Subhajit Sahu
 
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
slg6lamcq
 
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
slg6lamcq
 
Machine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptxMachine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptx
balafet
 
My burning issue is homelessness K.C.M.O.
My burning issue is homelessness K.C.M.O.My burning issue is homelessness K.C.M.O.
My burning issue is homelessness K.C.M.O.
rwarrenll
 
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
NABLAS株式会社
 
The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...
jerlynmaetalle
 
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
Timothy Spann
 
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
AbhimanyuSinha9
 
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdfCh03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
haila53
 
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
mbawufebxi
 
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
axoqas
 
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
ahzuo
 
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
pchutichetpong
 
原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样
原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样
原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样
u86oixdj
 
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
g4dpvqap0
 
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
Timothy Spann
 
Influence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business PlanInfluence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business Plan
jerlynmaetalle
 
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
oz8q3jxlp
 

Recently uploaded (20)

Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
 
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
 
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
 
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
 
Machine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptxMachine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptx
 
My burning issue is homelessness K.C.M.O.
My burning issue is homelessness K.C.M.O.My burning issue is homelessness K.C.M.O.
My burning issue is homelessness K.C.M.O.
 
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
 
The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...
 
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
 
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
 
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdfCh03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
 
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
 
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
 
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
 
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
 
原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样
原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样
原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样
 
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
 
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
 
Influence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business PlanInfluence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business Plan
 
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
 

How To Model and Construct Graphs with Oracle Database (AskTOM Office Hours part 2)

  • 1. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Ask TOM Office Hours: How To Model and Construct Graphs with Oracle Database Learn the first steps to use property graphs in the database – modeling and constructing a graph. 2018.04.24 Albert Godfrind, Solutions Architect Zhe Wu, Architect Jean Ihm, Product Manager Confidential – Oracle Internal/Restricted/Highly Restricted
  • 2. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | AskTOM sessions on property graphs • Today’s is the second session on property graphs • February’s session covered “Introduction to Property Graphs” – In case you missed it, recording is available at URL above • Today’s topic: How To Model and Construct Graphs with Oracle Database • Visit the Spatial and Graph landing page to view recordings; submit feedback, questions, topic requests; view upcoming session dates and topics; sign up 4 https://devgym.oracle.com/pls/apex/dg/office_hours/3084
  • 3. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Big Data Spatial and Graph • Available for Big Data platform/BDCS – Hadoop, HBase, Oracle NoSQL • Supported both on BDA and commodity hardware – CDH and Hortonworks • Database connectivity through Big Data Connectors or Big Data SQL • Included in Big Data Cloud Service Oracle Spatial and Graph • Available with Oracle 18c/12.2/DBCS • Using tables for graph persistence • Graph views on relational data • In-database graph analytics – Sparsification, shortest path, page rank, triangle counting, WCC, sub graphs • SQL queries possible • Included in Database Cloud Service 5 Graph Product Options
  • 4. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Property Graph Database Features: • Scalability and Performance • Graph analytics • Graph Visualization • Graph Query Language (PGQL) • Standard interfaces • Graph views on relational and RDF data • Integration with Machine Learning tools 6 Courtesy Tom Sawyer Perspectives Courtesy Linkurious
  • 5. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Graph Data Access Layer (DAL) Architecture Property Graph Support Graph Analytics Blueprints & Lucene/SolrCloud RDF (RDF/XML, N- Triples, N-Quads, TriG,N3,JSON) REST/WebService/Notebooks Java,Groovy,Python,… Java APIs Java APIs/JDBC/SQL/PLSQL Property Graph formats GraphML GML Graph-SON Flat Files 7 Scalable and Persistent Storage Management Parallel In-Memory Graph Analytics/Graph Query (PGX) Oracle NoSQL DatabaseOracle RDBMS Apache HBase Apache Spark Apache Spark
  • 6. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 8 Designing Graphs
  • 7. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | • What is a graph? – Data model representing entities as vertices and relationships as edges – Optionally including attributes • What are typical graphs? – Social Networks • LinkedIn, Facebook, Google+, Twitter, ... – Financial networks • Fund transfers, ownerships, … – Dependencies • Complex system interactions 9 Graph Data Model E A D C B F
  • 8. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | • Why are graphs popular? – Easy data modeling • „whiteboard friendly“ – Flexible data model • No predefined schema, easily extensible • Particularly useful for sparse data – Insight from graphical representation • Intuitive visualization – Enabling new kinds of analytics • Overcoming limitations in relational technology 10 Graph Data Model E A D C B F
  • 9. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | • A set of vertices (or nodes) – each vertex has a unique identifier. – each vertex has a set of in/out edges. – each vertex has a collection of properties. – vertices are of different kinds • A set of edges (or links) – each edge has a unique identifier. – each edge has a head/tail vertex. – each edge has a label denoting type of relationship between two vertices. – each edge has a collection of properties. 11 A More Detailed Look at the Graph Model https://github.com/tinkerpop/blueprints/wiki/Property-Graph-Model
  • 10. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 12 Designing a Relational vs a Graph Model Relational Graph Relationships are implicit (primary / foreign keys) Relationships are explicit (edges) Need technical expertise (normal form, …) Little or no technical expertise needed Tools available (SQL Developer Data Modeler) No tools – just use a whiteboard ! Schema kept in dictionary No schema: add properties, vertex types, edge types at will Strong dependency between data model and applications: changing the model impacts many applications Weak dependency: changing schema only impacts applications that use the new properties, vertices or edges
  • 11. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | • Given a source Data Model (Relational) ... From Relational to Graph ... • Obtain a graph … Courtesy: Tom Sawyer 2017 13
  • 12. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Step 1: Understand the Source Data Models • What are the entities? – People, Departments – Attributes of entities (name, ID, …) • What are the relationships/links? – Membership – People-people relationship – Department hierarchy – Attributes of links(strength, startDate, location, …) 14Courtesy: Tom Sawyer 2017
  • 13. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Step 2: Think About What You Want To Achieve • Navigation? • Pattern matching? • Analytics? • Integration? • Visualization? • or something else? 15 Choice of edges and attributes e.g. Tom  memberOf  Sales Tom (memberOf:‘Sales,Marketing‘ ) Courtesy: Tom Sawyer 2017
  • 14. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Step 3: Construct the Graph Model 16 • Rows in tables usually become vertices • Columns become properties on vertices • Relationships become edges • Join tables in n:m relations become relationships, Courtesy: Tom Sawyer 2017
  • 15. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Step 4: Try Your Work Load and Repeat 1,2,3 if Necessary It is OK and quite typical to do trial-and-error 17Courtesy: Tom Sawyer 2017
  • 16. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 18 Example 1: Human Resources JOBS COUNTRIES REGIONS LOCATIONS JOB_HISTORY DEPARTMENTS EMPLOYEES
  • 17. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | JOBS COUNTRIES REGIONS LOCATIONS EMPLOYEESDEPARTMENTS
  • 18. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Depart ment Employee Job Location Works In Located At Occupation Manages Heads Human Resources Graph Model Country and region as properties History integrated as start/end dates on edges
  • 19. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Depart ment Employee Job Location Works In Located At Occupation Manager ManagesHeads Manages Human Resources Graph Model Manager as a separate vertex type
  • 20. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | JOBS LOCATIONS EMPLOYEESDEPARTMENTS PROJECTS EMP_PROJ COUNTRIES REGIONS Include projects Human Resources Schema Extended
  • 21. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Depart ment Employee Job Location Works In Located At Occupation Manager ManagesHeads Manages Human Resources Graph Model Project Works on Include projects
  • 22. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 24 Manager Employee Job Depart ment Location Occupation Located At Manages Works In Heads Manages Project Works on Another Graphic Representation
  • 23. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | PRODUCTS ORDERS CUSTOMERS ORDER_LINES Customer ProductPurchased Example 2: Order Entry Order properties: quantity, date purchased ..
  • 24. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Example 3: Dependencies • Dependencies between schema objects in a database • Very useful for impact analysis • Map dependencies as a graph desc dba_dependencies Name Null? Type ----------------------- -------- -------------- OWNER NOT NULL VARCHAR2(128) NAME NOT NULL VARCHAR2(128) TYPE VARCHAR2(19) REFERENCED_OWNER VARCHAR2(128) REFERENCED_NAME VARCHAR2(128) REFERENCED_TYPE VARCHAR2(19) REFERENCED_LINK_NAME VARCHAR2(128) DEPENDENCY_TYPE VARCHAR2(4) Object Depends On
  • 25. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Type View Index Table Column Indexes View On Has Column Uses View On • More detailed graph model • Can also include stored functions, packages, triggers • Extend with programs References
  • 26. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 28 Constructing Graphs
  • 27. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | • Oracle Data Integrator (ODI) • Data Access Layer (DAL) Java Programming APIs • DAL Utility – RDBMS Data Source to Graph – CSV to Graph • SQL 29 Several Simple Ways to Construct a Property Graph
  • 28. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Use Oracle Data Integrator (ODI) to Generate Graph 30
  • 29. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Oracle Data Integrator Bulk Data Performance Non Invasive Footprint Future Proof IT Skills Oracle Data Integrator provides high performance bulk data movement, massively parallel data transformation using database or big data technologies, and block-level data loading that leverages native data utilities Bulk Data Transformation Most Apps, Databases & Cloud Bulk Data Movement Cloud DBs Big Data 1000’s of customers – more than other ETL tools 1000’s of customers – more than other ETL tools Flexible ELT workloads run anywhere: DBs, Big Data, Cloud Flexible ELT workloads run anywhere: DBs, Big Data, Cloud Up to 2x faster batch processes and 3x more efficient tooling Up to 2x faster batch processes and 3x more efficient tooling
  • 30. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Key Architecture Benefits Reverse Engineer Metadata Journalize (CDC) Load from Source to Staging Check Constraints Integrate, Transform Data Service 32 Simpler Physical Design and Shorter Implementation Time Knowledge Modules Oracle Spark Hive HBase Pig Sqoop BICS Oracle Datapump Oracle DBLink JMS External Tables Teradata SAP Siebel eBusiness Suite IBM DB2 Netezza SCD Pluggable Knowledge Modules Architecture Sample out-of-the-box Knowledge Modules • Faster development and simpler maintenance using templates • Easy to extend and add new best practices • Enforces predictability and reduces cost of ownership
  • 31. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 33 Property Graph Construction Work Flow with ODI Define Source Model (payment data in CSV) Define Target Model (data shape required by Graph) Generate Mapping Execute Conversion Graph Model
  • 32. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 34 Property Graph Construction Work Flow with ODI
  • 33. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Demo 35
  • 34. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Use DAL APIs to programmatically create a graph 36
  • 35. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | opgtest = OraclePropertyGraph.getInstance(cfg); v=opgtest.addVertex(100l); v.setProperty("name", name); v.setProperty("hiredate", d); v2=opgtest.addVertex(102l); e1 = opgtest.addEdge(1l, v1, v2, "likes"); e1.setProperty("strength", 0.8d); … OraclePropertyGraphUtils.exportFlatFiles(opgtest, "/tmp/graph.opv", "/tmp/graph.ope", 2, false); 37 Using Data Access Layer (DAL) Java APIs Building a Property Graph From Scratch Incremental vertices update & set of properties Incremental edges update & set of properties
  • 36. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Read from a data source & Use DAL APIs to programmatically create a graph 38
  • 37. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Building a Property Graph from a Data Source oracle=new Oracle("jdbc:oracle:thin:@(…)", "scott", "password"); cfg =…; opgtest = OraclePropertyGraph.getInstance(cfg); rs = oracle.executeQuery("select empno, ename, mgr, hiredate from scott.emp"); while(rs.next()) { eid=rs.getLong(1); name=rs.getString(2); mgr=rs.getLong(3); d=rs.getDate(4); v=opgtest.addVertex((Long)eid); v.setProperty("name", name); v.setProperty("hiredate", d); … } 39 Querying a Relational Data Source to produce a Property Graph Data Model
  • 38. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Building a Property Graph from a Data Source opg-hbase> opgtest.getVertices(); ==>Vertex ID 7902 {name:str:FORD, hiredate:dat:1981-12-03} ==>Vertex ID 7654 {name:str:MARTIN, hiredate:dat:1981-09-28} ==>Vertex ID 7499 {name:str:ALLEN, hiredate:dat:1981-02-20} ==>Vertex ID 7369 {name:str:SMITH, hiredate:dat:1980-12-17} ==>Vertex ID 7844 {name:str:TURNER, hiredate:dat:1981-09-08} ==>Vertex ID 7521 {name:str:WARD, hiredate:dat:1981-02-22} ==>Vertex ID 7698 {name:str:BLAKE, hiredate:dat:1981-05-01} ==>Vertex ID 7782 {name:str:CLARK, hiredate:dat:1981-06-09} ==>Vertex ID 7788 {name:str:SCOTT, hiredate:dat:1987-04-19} ==>Vertex ID 7566 {name:str:JONES, hiredate:dat:1981-04-02} ==>Vertex ID 7900 {name:str:JAMES, hiredate:dat:1981-12-03} ==>Vertex ID 7839 {name:str:KING, hiredate:dat:1981-11-17} ==>Vertex ID 7934 {name:str:MILLER, hiredate:dat:1982-01-23} ==>Vertex ID 7876 {name:str:ADAMS, hiredate:dat:1987-05-23} 7521,hiredate,5,,,1981-02-22T00:00:00.000-05:00 7521,name,1,WARD,, 7788,hiredate,5,,,1987-04-19T00:00:00.000-04:00 7788,name,1,SCOTT,, 40 Generated output Vertices converted from Scott.EMP Serialized Vertices in Flat File format
  • 39. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Generate a Property Graph (.opv/.ope) directly from relational tables (views) 41
  • 40. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 42 Graph Construction Work Flow From Relational Tables Select Tables Define Mappings (ColumnToAttrMappings) Execute Conversion Load Graph 1101,name,1,Jean,, 1101,age,2,,20, 1101,salary,4,,120.0, 1102,name,1,Mary,, … 100,1101,1002,works,weight,3,,1.0, 101,1110,1015,works,weight,3,,1.0, 102,1110,1102,works,weight,3,,1.0, … Vertex Flat-file Edge Flat-file name String join_date Date salary Double
  • 41. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Convert Relational Tables/Views to Flat Files: Vertices 43 1 1101,name,1,Mara%20Kessler,, 1101,join_date,5,,,2016-11-21T00:00:00.000-00:00 1101,location,1,East%20Pinkchester,, 1102,name,1,Brad%20Eichmann,, 1102,join_date,5,,,2018-05-02T00:00:00.000-00:00 1102,location,1,Kiannaside,, … name String join_date Date location String employees Table EMP_ID name join_date location … 1 Mara Kessler 2016-11-21 East Pinkchester … 2 Brad Eichmann 2018-05-02 Kiannaside … … … … … … 8 Clotilde Romaguera 2018-06-16 Rodgerborough …
  • 42. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Convert from Relational to Flat Files: Vertices String opv = "./employees-graph.opv"; OutputStream opvOS = new FileOutputStream(opv); ColumnToAttrMapping[] ctams = new ColumnToAttrMapping[3]; ctams[0] = ColumnToAttrMapping.getInstance("name", "name", String.class); ctams[1] = ColumnToAttrMapping.getInstance("join_date", "join date", Date.class); ctams[2] = ColumnToAttrMapping.getInstance("loc", "location", String.class); OraclePropertyGraphUtils.convertRDBMSTable2OPV(conn, "employees", "emp_id", 1100, ctams, 8, opvOS, (DataConverterListener) null); 44 Specify the table to convert data from and the column used to identify the vertices ID Mappings between table columns & vertex properties (including data types) Specify the offset for vertex ID
  • 43. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Generate a Property Graph (.opv/.ope) directly from CSV Files 45
  • 44. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 46 Graph Construction Work Flow From CSV Files Select CSV Files Define Mappings (ColumnToAttrMappings) Execute Conversion Load Graph 1101,name,1,Jean,, 1101,age,2,,20, 1101,salary,4,,120.0, 1102,name,1,Mary,, … 100,1101,1002,works,weight,3,,1.0, 101,1110,1015,works,weight,3,,1.0, 102,1110,1102,works,weight,3,,1.0, … Vertex Flat-file Edge Flat-file name String join_date Date salary Double
  • 45. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Convert From CSV File to Flat File: Vertices 47 1 1101,name,1,John,, 1101,score,4,,4.2, 1101,age,2,,30, 1102,name,1,Mary,, 1102,score,4,,4.3, 1102,age,2,,32, … name String score Float age Integer 1,John,4.2,30 2,Mary,4.3,32 3,"Skywalker, Anakin",5.0,46 4,"Darth Vader",5.0,46 5,"Skywalker, Luke",5.0,53 …
  • 46. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Convert From CSV File to Flat File: Vertices String inputCSV = "/path/mygraph-vertices.csv"; String outputOPV = "/path/mygraph.opv"; ColumnToAttrMapping[] ctams = new ColumnToAttrMapping[4]; ctams[0] = ColumnToAttrMapping.getInstance("VID", Long.class); ctams[1] = ColumnToAttrMapping.getInstance("name", String.class); ctams[2] = ColumnToAttrMapping.getInstance("score", Double.class); ctams[3] = ColumnToAttrMapping.getInstance("age", Integer.class); InputStream isCSV = new FileInputStream(inputCSV); OutputStream osOPV = new FileOutputStream(new File(outputOPV)); OraclePropertyGraphUtilsBase.convertCSV2OPV(isCSV, "VID", 0, ctams, 1, 0, osOPV, null); 48 Specify the CSV File to convert data from and the column used to identify the vertices ID Mappings between table columns & vertex properties (including data types) Specify the offset for vertex ID Specify the offset of lines to skip from file
  • 47. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | VID:int,name,score:float,age:integer 1,John,4.2,30 2,Mary,4.3,32 3,"Skywalker, Anakin",5.0,46 4,"Darth Vader",5.0,46 5,"Skywalker, Luke",5.0,53 Convert From CSV File with Headers to Flat File: Vertices 49 1 name String score Float age Integer 1101,name,1,John,, 1101,score,4,,4.2, 1101,age,2,,30, 1102,name,1,Mary,, 1102,score,4,,4.3, 1102,age,2,,32, …
  • 48. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Convert From CSV File with Headers to Flat File: Vertices String inputCSV = "/path/mygraph-vertices.csv"; String outputOPV = "/path/mygraph.opv"; InputStream isCSV = new FileInputStream(inputCSV); OutputStream osOPV = new FileOutputStream(new File(outputOPV)); OraclePropertyGraphUtilsBase.convertCSV2OPV(isCSV, "VID", 0 /* Vertex ID offset */, null, 1 /* Degree of Parallelism */, 0 /* Lines to skip from file */, osOPV, (DataConverterListener)null); 5050 Mappings between CSV columns & vertex properties will be read from the header of the CSV file
  • 49. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Convert CSV Files with Headers to Flat Files: Edges 51 1,30,0,friends,since,5,,,2010-04-14T00:00:00.000-00:00 1,30,0,friends,weight,3,,1.0, 3,48,36,colleagues,since,5,,,2013-11-07T00:00:00.000-00:00 3,48,36,colleagues,weight,3,,1.0, … 10,21,16,manager,since,5,,,2014-03-05T00:00:00.000-00:00 10,21,16,manager,weight,3,,1.0, 0 30 ‘friends’since Date weight Float EID,SINCE,SRC,STRENGTH,DEST,RELATION 1,14-04-2010,1,30,0,friends 3,07-11,2013,1,48,36,friends ... 10,05-03-2014,0,21,16,manager
  • 50. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Convert From CSV File with Headers to Flat File: Edges String inputCSE = "/path/mygraph-edges.csv"; String outputOPE = "/path/mygraph.ope"; InputStream isCSE = new FileInputStream(inputCSE); OutputStream osOPE = new FileOutputStream(new File(outputOPE)); OraclePropertyGraphUtilsBase.convertCSV2OPE(isCSE, "EID", 0 /* Edge ID offset */, "SRC", "DEST", true, "RELATION", null, 1 /* Degree of Parallelism */, 0 /* Lines to skip from file */, osOPE, (DataConverterListener)null); 5252 Mappings between CSV columns & vertex properties will be read from the header of the CSV file Specify the columns where source and destination vertex IDs will be taken from
  • 51. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Customization of CSV Conversion to Flat Files 53 OraclePropertyGraphUtilsBase.convertCSV2OPE(isCSV, "eid", 100 /* edge ID offset */, "person" /* source vertex column */, "product" /* destination vertex column */, 10 /* offset source vertex IDs */, 50 /* offset destination vertex IDs */, false /* has edge column? */, "bought", null /* ctams mappings */, 1 /* degree of parallelism */, ‘|’, ‘"’, 1, new SimpleDateFormat("dd/MM/yyyy"), true, osOPE, null) ; Specify default edge label Delimiter character Quotation character Date format Skip CSV records Allow support for multiline in CSV records
  • 52. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Construct a property graph with SQL 54
  • 53. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Graph Construction with SQL Confidential – Oracle Internal/Restricted/Highly Restricted 55 -- -- A Helper SQL View to simplify comparison of multiple vertex properties -- CREATE VIEW BankXpivot AS SELECT * FROM ( SELECT vid, k, v FROM BankXVT$) PIVOT (MIN(v) FOR k IN ('Address' AS Address, 'Address1' AS Address1, 'Address2' AS Address2, 'AppId' AS AppId, 'CIO' AS CIO , 'In-Address' AS In_Address, 'In-Port' AS In_Port, 'LOB' AS LOB, 'Label' AS Label, 'Name' AS Name, 'Out-Address' AS Out_Address, 'Out-Port' AS Out_Port, 'Type' AS Type, 'VertexType' AS VertexType, 'Web' AS Web ) ) • Use native SQL to construct edges (modeling complex business relationships) on the fly
  • 54. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Graph Construction with SQL Confidential – Oracle Internal/Restricted/Highly Restricted 56 -- -- App to LOB where Appname.LOB = LOB.LOB -- Edge keys: LOB -- INSERT INTO BankX_pivotGE$ (eid, svid, dvid, el, k, t, v) SELECT ROWNUM+100000 AS eid, apps.vid AS svid, lobs.vid AS dvid, 'Owner' AS el, 'LOB' AS k, 1 AS t, apps.lob AS v FROM ( SELECT * FROM BankXpivot WHERE VertexType = 'App') apps JOIN ( SELECT * FROM BankXpivot WHERE VertexType = 'LOB') lobs ON apps.lob = lobs.label ORDER BY svid, dvid • Use native SQL
  • 55. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | .
  • 56. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 58 Resources
  • 57. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Resources • Oracle Spatial and Graph & Big Data Spatial and Graph on OTN oracle.com/technetwork/database/options/spatialandgraph oracle.com/technetwork/database/database-technologies/bigdata-spatialandgraph – White papers, software downloads, documentation and videos • Blogs – examples, tips & tricks blogs.oracle.com/oraclespatial | blogs.oracle.com/bigdataspatialgraph • Property Graphs 101: How to Get Started with Property Graphs on the Oracle Database – Arthur Dayton, Vlamis Software video https://youtu.be/QSj0zOjOAWI | blog post http://www.vlamis.com/blog/2018/2/5/creating-a-property-graph-on-oracle-database • YouTube channel https://www.youtube.com/channel/UCZqBavfLlCuS0il6zNY696w • Oracle Big Data Lite Virtual Machine - a free sandbox to get started www.oracle.com/technetwork/database/bigdata-appliance/oracle-bigdatalite-2104726.html – Hands On Lab included in /opt/oracle/oracle-spatial-graph/ or http://github.com/oracle/BigDataLite/ 59
  • 58. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Resources – social media and online communities • Follow the product team: @JeanIhm, @agodfrin, @alanzwu, @SpatialHannes • Oracle Spatial and Graph SIG user groups (search “Oracle Spatial and Graph Community”) 60
  • 59. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | AskTOM sessions on property graphs • Next Spatial and Graph session in late May – Topic: Performing Graph Analytics • View recordings, submit feedback, questions, topic requests, view upcoming session dates and topics, sign up to get regular updates 61 https://devgym.oracle.com/pls/apex/dg/office_hours/3084
  • 60. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 62 Thanks for attending! See you next month. https://devgym.oracle.com/pls/apex/dg/office_hours/3084