The graph features of Oracle Database enables developers to store and navigate relationships between entities. Oracle Graph Server and Client enables developers, analysts, and data scientists to use graphs within Oracle Database, while Graph Studio in Oracle Autonomous Database removes barriers to entry by automating setup and management, automating graph creation, and by providing step-by-step examples for getting started.
The last quarterly update on Oracle Graph, announced the availability of Oracle Graph Server and Client 23.3. That release focused on a new REST API, along with updates to graph visualization, PGQL, and RDF Server.
Oracle Graph Server and Client 23.4 is now available for download for use with databases in the Cloud (OCI Marketplace image is available) and for databases on-premises. In this release we introduce a PGQL function to validate the vertices and edges of a graph when primary and foreign key constraints are not present, and a PGQL function to aggregate values into a JSON array. We also introduce the ability to create a new graph from an existing one, along with some additional notable features listed at the end of this article.
This built-in function checks if vertex/edge keys are unique, and if the source and destination vertices exist for every edge. This is useful when you cannot, or do not want to, create primary and/or foreign key constraints. This function throws a descriptive error message if it detects a problem, such as a ‘dangling’ edge (an edge with a vertex that does not exist in the vertex table). Here is an example of how you can use this function:
JSON_ARRAYAGG is a SQL function added to PGQL when it executes in the database, which aggregates values into a JSON array. This is very useful when you want group results of a pattern matching query in a JSON array. In the following example, we can use the JSON_ARRAYAGG function to group friends of each person in our graph.
You can also use various JSON_ARRAYAGG options, such as using the order by clause and returning clause to specify the order of the resulting array and the datatype returned by the function.
This release includes the ability to create a new graph from existing graphs (referred to as “base graphs” in the CREATE PROPERTY GRAPH syntax). This feature is especially useful to create new graphs that offer a different perspective using multiple base graphs. As with all property graphs the source data is not duplicated, only metadata from the base graphs is copied into the metadata tables for the new graph. Following the syntax from the example below, you can create a new graph based on existing graphs.
CREATE PROPERTY GRAPH financial_transactions
BASE GRAPHS (
bank_transactions,
social_network ALL ELEMENT TABLES EXCEPT ( knows ) )
EDGE TABLES (
Accounts AS PersonOwner
SOURCE KEY( "number" ) REFERENCES Accounts ( "number" )
DESTINATION Persons
LABEL owner NO PROPERTIES,
Accounts AS CompanyOwner
SOURCE KEY( "number" ) REFERENCES Accounts ( "number" )
DESTINATION Companies
LABEL owner NO PROPERTIES )
OPTIONS ( PG_PGQL )
For more information, please visit our Property Graph documentation and RDF Graph documentation.
Product Manager for Oracle Spatial and Graph
Next Post