SlidePub
Home
Categories
Login
Register
Home
General
54147 Session PPT - ComplexRelationshipsMadeSimple.pdf
54147 Session PPT - ComplexRelationshipsMadeSimple.pdf
dumian
91 views
44 slides
Oct 08, 2024
Slide
1
of 44
Previous
Next
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
About This Presentation
graph technology
Size:
2.16 MB
Language:
en
Added:
Oct 08, 2024
Slides:
44 pages
Slide Content
Slide 1
MelliAnnamalai and Denise Myrick
Graph Product Management
Oracle Database
July 25, 2024
Complex Relationships Made
Simple with Graphs
In Oracle Database 23ai
Slide 2
Are you connected to someone you meet here?
Copyright © 2024, Oracle and/or its affiliates2
Olivia
Emily
Harper
Ethan
Liam
Ava
Lucas
Amelia
Alex Henry
Mia
Slide 3
Are you connected to someone you meet here?
Copyright © 2024, Oracle and/or its affiliates3
Olivia
Emily
Harper
Ethan
Liam
Ava
Lucas
Amelia
Alex Henry
Mia
Slide 4
Is Bank Account 1Connected to Bank Account 833?
ACCT:
484
ACCT:
730
ACCT:
1
ACCT:
609
ACCT:
484
ACCT:
703
ACCT:
457
ACCT:
333
ACCT:
673
ACCT:
964
ACCT:
833
Copyright © 2024, Oracle and/or its affiliates4
Slide 5
Is Bank Account 1Connected to Bank Account 833?
ACCT:
484
ACCT:
730
ACCT:
1
ACCT:
609
ACCT:
484
ACCT:
703
ACCT:
457
ACCT:
333
ACCT:
673
ACCT:
964
ACCT:
833
Copyright © 2024, Oracle and/or its affiliates5
Slide 6
Is ID 1 Connected to ID 833?
Copyright © 2024, Oracle and/or its affiliates6
BANK_ACCOUNTS BANK_TRANSFERS
Is ID 1connected to ID 833,when using
information in these tables?
?
ID NAME
1
2
3
…
672
673
674
…
831
832
833
…
SRC_ACCT_IDDST_ACCT_IDAMOUNT
1 672 1000
1 584 1000
1 259 100000
2 833 5001
2 840 7050
2 493 4363
… … …
672 831 5425
… … …
831 833 256
… … …
Slide 7
Is ID 1 Connected to ID 833?
Copyright © 2024, Oracle and/or its affiliates7
BANK_ACCOUNTS BANK_TRANSFERS
Is ID1connected to ID833,when using
information in these tables?
?
ID NAME
1
2
3
…
672
673
674
…
831
832
833
…
SRC_ACCT_IDDST_ACCT_IDAMOUNT
1 672 1000
1 584 1000
1 259 100000
2 833 5001
2 840 7050
2 493 4363
… … …
672 831 5425
… … …
831 833 256
… … …
Slide 8
Is ID 1Connected to ID 833?
Copyright © 2024, Oracle and/or its affiliates8
BANK_ACCOUNTS BANK_TRANSFERS
?
ID NAME
1
2
3
…
672
673
674
…
831
832
833
…
SRC_ACCT_IDDST_ACCT_IDAMOUNT
1 672 1000
1 584 1000
1 259 100000
2 833 5001
2 840 7050
2 493 4363
… … …
672 831 5425
… … …
831 833 256
… … …
831
1
672
601
584
833
493960
840
2
Graph view of data
Edges
Nodes
Slide 9
Is ID <src> connected to ID <dst> in 1 to 3 hops?
Copyright © 2024, Oracle and/or its affiliates9
--With new GRAPH_TABLE and MATCH syntax
SELECTaccount_id
FROMGRAPH_TABLE(bank_graph
MATCH (src)-[is bank_transfers]->{1,3}(dst)
COLUMNS(src.id as account_id) );
--SQL without new syntax (12 joins and 3 UNION ALLs)
SELECTv1.id as account_id1 , v2.id as account_id2
FROM bank_accountsv1 ,
bank_transfersbtx,
bank_accountsv2
WHERE(v1.id = btx.src_acct_id ANDv2.id = btx.dst_acct_id)
AND v1.id=<src> ANDv2.id=<dst>
UNION ALL
SELECTv1.id as account_id1 , v2.id as account_id2
FROM bank_accountsv1 ,
bank_transfersbtx,
bank_accountsbc2,
bank_transfersbtx2 ,
bank_accountsv2
WHERE(v1.id = btx.src_acct_id ANDbc2.id = btx.dst_acct_id AND
bc2.id = btx2.src_acct_id AND v2.id = btx2.dst_acct_id )
AND v1.id=<src> AND v2.id= <dst>
UNION ALL
SELECTv1.id as account_id1 ,v2.id as account_id2
FROM bank_accountsv1 ,
bank_transfersbtx,
bank_accountsbc2,
bank_transfersbtx2 ,
bank_accountsbac4,
bank_transfersbtx5 ,
bank_accountsv2
WHERE(v1.id = btx.src_acct_id ANDbc2.id = btx.dst_acct_id AND
bc2.id = btx2.src_acct_id ANDbac4.id = btx2.dst_acct_id AND
bac4.id = btx5.src_acct_id ANDv2.id = btx5.dst_acct_id )
AND v1.id=<src> ANDv2.id= <dst>
;
831
1
672
601
584
833
493960
840
2
Slide 10
More Graph Queries
Copyright © 2024, Oracle and/or its affiliates10
960
Which nodes are directly
connected to node
Which nodes are indirectly
connected to node with
1 or 2 hops
960
831
1
672
601
584
833
493960
840
2
831
1
672
601
584
833
493960
840
2
831
1
672
601
584
833
493960
840
2
What are all the paths from
node to
960
1
Slide 11
11 Copyright © 2024, Oracle and/or its affiliates
A Language for Property Graphs
Adding syntax to SQL
Slide 12
SQL/PGQ in SQL:2023
Copyright © 2024, Oracle and/or its affiliates12
SQL syntax for DDL
operations
•
Create property graph
•
Drop property graph
SQL syntax for DML
operations
•
Queries
Slide 13
Graph is like a Viewon Relational Tables
•
No data copy –graph is a view on relational tables
•
Insert/update/delete in underlying tables instantly available in a graph
•
Fast, concurrent updates
•
Well suited for operational workloads
13 Copyright © 2024, Oracle and/or its affiliates
Slide 14
Operational Workflowswith Property Graphs
Copyright © 2024, Oracle and/or its affiliates14
High degree of concurrency Transactional consistency High availability
Maintain same TPC-C
throughput with graphs
Integrate with JSON and
other types in the database
Flashback for historical
view of graphs
Slide 15
FastExecution
•
Extreme scalability of SQL engine for graph queries
•
Sub-millisecond response times for billions of nodes and edges
•
Concurrency
•
Millions of users can concurrently run graph queries and update graph data
15 Copyright © 2024, Oracle and/or its affiliates
Slide 16
Oracle Database 23ai
16 Copyright © 2024, Oracle and/or its affiliates
Unification of
JSON and Relational
Unification of
Graph and Relational
Unification of
AI and Databases
AI
One part of an app can treat data as relational, while other parts treat the samedata as a
document, and others treat it as a graph, and unify with AI
Slide 17
17 Copyright © 2024, Oracle and/or its affiliates
Demo
Slide 18
Creating the GraphView
Copyright © 2024, Oracle and/or its affiliates18
ID NAME
1
2
3
…
672
673
674
…
831
832
833
…
SRC_ACCT_IDDST_ACCT_IDAMOUNT
1 672 1000
1 584 1000
1 259 100000
2 833 5001
2 840 7050
2 493 4363
… … …
672 831 5425
… … …
831 833 256
… … …
1000
5001
CREATE PROPERTY GRAPH BANK_GRAPH
VERTEX TABLES (
BANK_ACCOUNTS
KEY (ID)
PROPERTIES (ID, Name, Balance)
)
EDGE TABLES (
BANK_TRANSFERS
KEY (TXN_ID)
SOURCE KEY (src_acct_id) REFERENCES BANK_ACCOUNTS(ID)
DESTINATION KEY (dst_acct_id) REFERENCES BANK_ACCOUNTS(ID)
PROPERTIES (src_acct_id, dst_acct_id, amount)
);
Graph name
Table holding vertex
data
Column values
become properties
Table holding edge
data (connections
you want to traverse)
Column values
become properties
SOURCE and
DESTINATION KEYS link
vertices with the edge
Slide 19
Query a Graph
Copyright © 2024, Oracle and/or its affiliates19
select account_idfrom GRAPH_TABLE(bank_graph
MATCH(src)-[is bank_transfers]->(dst)
COLUMNS(src.id as account_id) );
Vertices are in (), edges are in []
Columns to return
bank_transfers
src dst
List all accounts that have transferred money to another account
Slide 20
Query a Graph
Copyright © 2024, Oracle and/or its affiliates20
select account_idfrom GRAPH_TABLE(bank_graph
MATCH(src)-[is bank_transfers]->(dst)
COLUMNS(src.id as account_id) );
Vertices are in (), edges are in []
Columns to return
select account_idfrom GRAPH_TABLE(bank_graph
MATCH(src)-[is bank_transfers]->{1,3}(dst)
COLUMNS(src.id as account_id) );
bank_transfers
src dst
bank_transfers bank_transfers
List all accounts that have transferred money to another account
List all accounts that have transferred money through intermediate accounts
Slide 21
Query a Graph
Copyright © 2024, Oracle and/or its affiliates21
SELECT acct_id, COUNT(1) AS Num_5hop_Chains
FROM GRAPH_TABLE(BANK_GRAPH
MATCH(src) -[]->{5} (src)
COLUMNS(src.id AS acct_id)
) GROUP BY acct_idORDER BY Num_5hop_Chains DESC;
Starting vertex and ending vertex are
the same
bank_transfers
src
bank_transfers
bank_transfers
bank_transfers
List all accounts that have 5 hop transfers that start and end with
the same account, and order by number of such cycles
Slide 22
22 Copyright © 2024, Oracle and/or its affiliates
RAG and LLMs
Slide 23
Large Language Models
•
Powerful AI models that can
process and generate human
language text
•
Model created by training
on massive volumes of data
•
Researchers and practitioners
are racing to learn how LLMs
can help their products and
their business
23 Copyright © 2024, Oracle and/or its affiliates
Slide 24
Some Challenges Faced by LLMs
•
LLMs only as good
as the data they are
trained on
•
They can get out-of-date
•
They can have bias
•
They are expensive to re-train
•
Sometimes answers are misleading
and incorrect –“hallucination”
•
Because they generate output
based on patterns in data
they have been trained on
rather than from a deep
understanding of facts
24 Copyright © 2024, Oracle and/or its affiliates
Not True
Slide 25
Improved Responses by Adding Context in the Prompt
25 Copyright © 2024, Oracle and/or its affiliates
query
context
This is correct
Slide 26
RAG: Retrieval Augmented Generation
26 Copyright © 2024, Oracle and/or its affiliates
User query
(prompt)
Encode and use
to retrieve
context
from vector
database
Retrieve
context
Context-
enhanced
prompt
LLMs
Vector database
optimized for
fast search
Regular
updates
•
Use latest data to provide
context to LLM
•
Create encodings (referred to
as embeddings) that are stored
as vectors in a vector database
•
User query is encoded and
matched with stored vectors
•
Top matches are retrieved and
provided as context with the
prompt
Slide 27
Vector Search in SQL for a RAG Pipeline
27 Copyright © 2024, Oracle and/or its affiliates
•
Get context from latest data,
using vector search in SQL
Slide 28
28 Copyright © 2024, Oracle and/or its affiliates
Graph-RAG and LLMs
Slide 29
Knowledge Graphs
Copyright © 2024, Oracle and/or its affiliates29
•
Knowledge graphs
capture facts about a
domain and relationships
between them
Melli
Redwood Shores
CA
Roadshow
Slide 30
Knowledge Graphs
Copyright © 2024, Oracle and/or its affiliates30
•
Knowledge graphs
capture facts about a
domain and relationships
between them
Melli
Redwood Shores
CA
Roadshow
New York City
Slide 31
Knowledge Graphs
Copyright © 2024, Oracle and/or its affiliates31
•
Knowledge graphs
capture facts about a
domain and relationships
between them
New York City
Melli
Redwood Shores
CA
Marouane
Jayant
Nashua
NH
Casablanca
Morocco
Slide 32
Knowledge Graphs
Copyright © 2024, Oracle and/or its affiliates32
•
Knowledge graphs
capture facts about a
domain and relationships
between them
Melli
Redwood Shores
CA
Marouane
Jayant
Nashua
NH
Casablanca
Morocco
New York City
OCI GenAIService
Slide 33
Is Mellilikely to use the GenAIservice?
Copyright © 2024, Oracle and/or its affiliates33
•
Knowledge graphs
capture facts about a
domain and relationships
between them
Melli
Redwood Shores
CA
Marouane
Jayant
Nashua
NH
Casablanca
Morocco
New York City
AI/ML
?
OCI GenAIService
Slide 34
Enhance Retrieval Augmented Generation with Knowledge Graphs
Copyright © 2024, Oracle and/or its affiliates34
User query
(prompt)
Encode and use
to retrieve
context
from vector
database
Retrieve
context
Context-
enhanced
prompt
LLMs
Vector database with vectors created
from node and edge embeddings
from knowledge graphs
•
Create encodings from
the knowledge graph
and use for semantic
search to enhance
prompts
Slide 35
Using Graph RAG to Enhance the Prompt with New Information
35 Copyright © 2024, Oracle and/or its affiliates
Query
Context
(as a graph)
The art of the possible
Output
Slide 36
Graph and Vector Search in SQL for a RAG Pipeline
36 Copyright © 2024, Oracle and/or its affiliates
•
Get context from latest data,
using graph and vector
search in SQL
Slide 37
37 Copyright © 2024, Oracle and/or its affiliates
Creating Encodings Using
Graph Machine Learning Algorithms
Capture the structure of data in the encoding
Slide 38
What are Graph Machine Learning Algorithms?
Copyright © 2024, Oracle and/or its affiliates38
DeepWalk: Follow all paths from each node and
create a vector of ids
Use case: Find patterns similar to the pattern
around a known fraudulent account (nature of
pattern is not known)
Slide 39
Graphs and Machine Learning
Copyright © 2024, Oracle and/or its affiliates39
Hop 1
Hop 2
DeepWalk: Follow all paths from each node and
create a vector of ids
Use case: Find patterns similar to the pattern
around a known fraudulent account (nature of
pattern is not known)
GraphWise: Sample neighbors recursively
to learn a function (a graph convolutional
network)
Use case: Recommender systems
Slide 40
Graph-RAG and LLMs
Copyright © 2024, Oracle and/or its affiliates40
User query
(prompt)
Encode and use
to retrieve
context
from vector
database
Retrieve
context
Context-
enhanced
prompt
LLMs
Vector database with vectors created
by running graph ML algorithms on
knowledge graphs
•
Use encodings from
executing graph machine
learning algorithms on
knowledge graphs
Slide 41
Key Takeaways
New SQL syntax in Oracle Database 23ai makes it easy to write queries that traverse connections in data
Graphs provide new insights by analyzing the structure of data connections
Graph feature of Oracle Database has comprehensive support to create, query, and analyze data as a
graph
Graphs add value to machine learning algorithms and retrieval-augmented generation for gen AI
41 Copyright © 2024, Oracle and/or its affiliates
Slide 42
Resources
42 Copyright © 2024, Oracle and/or its affiliates
oracle.com/database/graph/
oracle.com/livelabssearch for ‘graph’
YouTube search for ‘oracle spatial and graph’
blogs.oracle.com/database/category/db-graph
medium.com/tag/oracle-graph/latest
Slide 43
Thank you
@AnnamalaiMelli
[email protected]
43 Copyright © 2024, Oracle and/or its affiliates
Tags
Categories
General
Download
Download Slideshow
Get the original presentation file
Quick Actions
Embed
Share
Save
Print
Full
Report
Statistics
Views
91
Slides
44
Age
423 days
Related Slideshows
22
Pray For The Peace Of Jerusalem and You Will Prosper
RodolfoMoralesMarcuc
33 views
26
Don_t_Waste_Your_Life_God.....powerpoint
chalobrido8
36 views
31
VILLASUR_FACTORS_TO_CONSIDER_IN_PLATING_SALAD_10-13.pdf
JaiJai148317
33 views
14
Fertility awareness methods for women in the society
Isaiah47
30 views
35
Chapter 5 Arithmetic Functions Computer Organisation and Architecture
RitikSharma297999
29 views
5
syakira bhasa inggris (1) (1).pptx.......
ourcommunity56
30 views
View More in This Category
Embed Slideshow
Dimensions
Width (px)
Height (px)
Start Page
Which slide to start from (1-44)
Options
Auto-play slides
Show controls
Embed Code
Copy Code
Share Slideshow
Share on Social Media
Share on Facebook
Share on Twitter
Share on LinkedIn
Share via Email
Or copy link
Copy
Report Content
Reason for reporting
*
Select a reason...
Inappropriate content
Copyright violation
Spam or misleading
Offensive or hateful
Privacy violation
Other
Slide number
Leave blank if it applies to the entire slideshow
Additional details
*
Help us understand the problem better