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

April 4, 2023 | 4 minute read
Denise Myrick
Senior Product Manager
Text Size 100%:

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. 

CREATE PROPERTY GRAPH example

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.
 
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.

For more information on Operational Property Graphs, please visit the Graph Developer's Guide for Property Graph. If you would like a hands on experience exploring Operational Property Graphs in 23c, try our LiveLab. Configure your Oracle Database 23c - Developer Release instance for operational property graphs by following this blog.
Need a graph primer? This video is an excellent overview of graphs. Check out our other videos on this channel for more.     

 

 

Melliyal Annamalai

Melli Annamalai is a distinguished product manager at Oracle.  Starting from her career as a developer, she has extensive experience in working with different types of data in the database, including multimedia data, data in Apache Hadoop platforms, streaming data, property graphs, and RDF knowledge graphs.  Her current focus area is graph database and analytics, in particular on ways to make it easy for developers to use graphs in any application.

Denise Myrick

Senior Product Manager

Denise Myrick is a Senior Product Manager with the Spatial and Graph Product Management team. She is based in Nashua, New Hampshire.


Previous Post

Introducing Oracle Database 23c Free – Developer Release

Gerald Venzl | 4 min read

Next Post


Key benefits of JSON Relational Duality: Experience it today using "Oracle Database 23c Free--Developer Release"

Ranjan Priyadarshi | 5 min read