Wednesday, April 12, 2023

Operational Property Graphs in Oracle Database 23c Free - Developer Release

Oracle Database 23c Free - Developer Release is the first release of the next-generation Oracle Database, allowing developers a head-start on building applications with innovative 23c features that simplify the development of modern data-driven apps. The entire feature set of Oracle Database 23c is planned to be generally available within the next 12 months.
 
Your data is connected. Traversing implicit or explict connections in your data usually requires complex recursive queries or lengthy joins. In Oracle Database 23c Free - Developer Release, the GRAPH_TABLE function and MATCH clause of the new SQL:2023 standard enable you to write simple SQL queries to follow connections in data. You can model your data as a graph and run graph queries in SQL to quickly see relationships in your data that are difficult to identify otherwise. This has a variety of applications, from making product recommendations to detecting financial fraud to identifying dependencies in IT workflows. Graphs are a powerful tool to extract value from your data based on the connections embedded in data.

Graphs created from relational tables are like a ‘view’ on top of these tables. Data will not be moved into a specialized schema or database. Data stays in place in the source database tables, making graphs in Oracle Database particularly well-suited for applications working with operational property graphs. All inserts, updates, and deletes to the source tables are instantly reflected in the graph. 

Oracle Database 23c Free, Oracle Database Career, Oracle Database Prep, Oracle Database Preparation, Oracle Database Skills, Oracle Database Jobs, Oracle Database Tutorial and Materials
Graphs have been supported in Oracle Database since release 12c, with graph queries enabled by the Property Graph Query Language (PGQL). In Oracle Database 23c Free - Developer Release, this functionality is available in SQL. The property graph data model consists of vertices connected to other vertices by edges, each of which can have associated key-value pairs (properties). Typically, vertices represent entities in a dataset (such as a ‘customer,’ ‘product,’ or ‘account_id’), and edges represent the relationships between these entitles. Queries are based on graph pattern matching, which allows you to specify patterns that are matched against vertices and edges in a graph model of data.
 
Oracle Database 23c Free, Oracle Database Career, Oracle Database Prep, Oracle Database Preparation, Oracle Database Skills, Oracle Database Jobs, Oracle Database Tutorial and Materials
PGQL will continue to be supported in 23c, and your PGQL code will continue to work as before. However, if you're new to graphs or developing new functionality, this new SQL support is an exciting opportunity to explore graphs using the language and tools you already know. Building a graph using SQL is a simple process. Let's look at an example:

CREATE PROPERTY GRAPH bank_graph
    VERTEX TABLES (
        bank_accounts as ACCOUNTS
        PROPERTIES(ID, BALANCE)
    )
    EDGE TABLES (
        bank_transfers
        SOURCE KEY      (from_acc) REFERENCES ACCOUNTS(ID)
        DESTINATION KEY (to_acc)   REFERENCES ACCOUNTS(ID)
        PROPERTIES (amount)
    )

Here we create a property graph called bank_graph with a vertex table bank_accounts with two properties, id and balance. Our graph also has an edge table, bank_transfers, with the property amount representing the transfer of money between them.  

If we want to query the property graph that we just created, it's simple. But let's review a few basic syntax specifications we'll need to know first.

Symbol Name  Example 
() Vertex (v1) and (v2) are bank accounts
[] Edge  [e1] represents a cash transfer between them 
{} <Path length  {1,3} 
-> Directed edge   

SELECT distinct(account_id)
FROM GRAPH_TABLE(bank_graph
   MATCH (v1)-[is bank_transfers]->{3,5}(v1)
    COLUMNS (v1.id as account_id)  
);

This query returns all accounts that are cycles (start and stop with the same account) that are 3 to 5 hops long.


Oracle Database is the graph database for the enterprise. It enables high-performance, scalable graph queries with the security, high availability, and simpler manageability required by enterprise applications.

Source: oracle.com

Related Posts

0 comments:

Post a Comment