Chapter 24 · JSON, XML, Spatial, Graph, and Converged Data Capabilities

Graph Modeling/Analytics Concepts and Integrating Graph with Relational Data

Project relational technicians/work orders/assignments as a SQL property graph and query relationships with SQL:2023 GRAPH_TABLE, comparing graph patterns with ordinary relational joins/hierarchical SQL and keeping RDF as a distinct semantic model.

Advanced125–145 minutesSQL Property Graph + GRAPH_TABLE labSQL property graphs are 26ai SQL:2023CREATE PROPERTY GRAPH privilege requiredLast reviewed: August 2026

Learning outcomes

ServiceHub wants to answer relationship-heavy questions: “Which technician is assigned to which open work order?”, later expanding toward referrals, assets, dependencies and multi-hop paths. Repeated self-joins and recursive SQL remain valid relational tools, but a property graph exposes relational rows as vertices (entities), edges (relationships), labels and properties, letting SQL express graph patterns directly. In 26ai, SQL property graphs and GRAPH_TABLE align with SQL:2023 graph syntax.

01

Create a SQL property graph over relational vertex/edge tables without copying the data into another store.

02

Query one-hop relationship patterns with GRAPH_TABLE and join graph results back to ordinary SQL.

03

Inspect USER_PROPERTY_GRAPHS/USER_PG_* metadata and understand ENFORCED/TRUSTED graph integrity concepts.

04

Compare graph patterns with equivalent relational joins/hierarchical traversal and choose from query complexity/workload evidence.

05

Distinguish property graphs from RDF/OWL semantic graphs and label Graph Server/Client analytics as an optional external component.

Generation-time baseline, licensing, compatibility, and topology boundary

Mandatory examples target Oracle AI Database Free 26ai and were reviewed against RU 23.26.3, SQL Developer 26.2, and SQLcl 26.2.1.222.1617. Free is capped at 2 foreground CPU cores, 2 GB database RAM, 12 GB user data, and one installation per logical environment; Oracle Free receives no Release Update patches or Oracle Support SRs. The course CDB/PDB baseline remains FREE/FREEPDB1 and the schema/domain remains SERVICEHUB_OWNER/ServiceHub. Current 26ai licensing lists Oracle Spatial and Graph plus Property Graph and RDF Graph Technologies (RDF/OWL) as available across all listed offerings, including Free; parallel spatial index builds are not available in Free, and partitioned spatial indexes have offering-specific Partitioning requirements. JSON/XML examples require no management pack. Native SQL data type JSON requires COMPATIBLE >= 20. XMLType created in 26ai defaults to Transportable Binary XML when COMPATIBLE >= 23.0. JSON Relational Duality Views and SQL property-graph dictionary views are 26ai capabilities. No mandatory lab changes COMPATIBLE, enables RAC/Data Guard/GoldenGate, or installs external Graph Server/Client.

1. Property graph is a query/model layer over relational objects

A property graph has vertices and directed/undirected edges. Both can carry labels and key/value properties. Oracle SQL property graphs reference tables/views as graph element tables. The relational tables remain the data of record; graph DDL defines keys, labels, exposed properties and source/destination relationships.

2. Privilege boundary

sql · admin grants only the required creation privilege
GRANT CREATE PROPERTY GRAPH TO servicehub_owner;

To create a graph in another schema requires CREATE ANY PROPERTY GRAPH, which is broader and unnecessary for this local lab. Query users can receive READ/SELECT on the graph without automatically receiving direct SELECT on every base table.

3. Build relational vertices and edges

sql · setup
BEGIN EXECUTE IMMEDIATE 'DROP TABLE sh24_assignment PURGE';EXCEPTION WHEN OTHERS THEN IF SQLCODE != -942 THEN RAISE; END IF; END;/BEGIN EXECUTE IMMEDIATE 'DROP TABLE sh24_graph_order PURGE';EXCEPTION WHEN OTHERS THEN IF SQLCODE != -942 THEN RAISE; END IF; END;/BEGIN EXECUTE IMMEDIATE 'DROP TABLE sh24_graph_tech PURGE';EXCEPTION WHEN OTHERS THEN IF SQLCODE != -942 THEN RAISE; END IF; END;/CREATE TABLE sh24_graph_tech (  technician_id NUMBER PRIMARY KEY,  tech_name VARCHAR2(80) NOT NULL,  region_code VARCHAR2(8) NOT NULL);CREATE TABLE sh24_graph_order (  work_order_id NUMBER PRIMARY KEY,  status_code VARCHAR2(12) NOT NULL,  priority_code NUMBER NOT NULL);CREATE TABLE sh24_assignment (  assignment_id NUMBER PRIMARY KEY,  technician_id NUMBER NOT NULL    REFERENCES sh24_graph_tech(technician_id),  work_order_id NUMBER NOT NULL    REFERENCES sh24_graph_order(work_order_id),  assigned_at TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL,  CONSTRAINT sh24_assignment_uq    UNIQUE(technician_id,work_order_id));INSERT INTO sh24_graph_tech VALUES(101,'Nigar Aliyeva','AZ-N');INSERT INTO sh24_graph_tech VALUES(102,'Kamran Hasanov','AZ-N');INSERT INTO sh24_graph_order VALUES(9001,'OPEN',1);INSERT INTO sh24_graph_order VALUES(9002,'CLOSED',3);INSERT INTO sh24_assignment(assignment_id,technician_id,work_order_id)VALUES(1,101,9001);INSERT INTO sh24_assignment(assignment_id,technician_id,work_order_id)VALUES(2,102,9002);COMMIT;

4. Create the SQL property graph

sql · 26ai SQL property graph
CREATE PROPERTY GRAPH sh24_service_graph  VERTEX TABLES (    sh24_graph_tech AS technicians      KEY(technician_id)      LABEL technician      PROPERTIES(technician_id,tech_name,region_code),    sh24_graph_order AS orders      KEY(work_order_id)      LABEL work_order      PROPERTIES(work_order_id,status_code,priority_code)  )  EDGE TABLES (    sh24_assignment AS assigned_to      KEY(assignment_id)      SOURCE KEY(technician_id)        REFERENCES technicians(technician_id)      DESTINATION KEY(work_order_id)        REFERENCES orders(work_order_id)      LABEL assigned_to      PROPERTIES(assignment_id,assigned_at)  );

The graph maps rows to graph elements; it does not copy the rows into a separate graph database.

5. Query a graph pattern with GRAPH_TABLE

sql · open work orders and their technicians
SELECT *FROM GRAPH_TABLE(  sh24_service_graph  MATCH    (t IS technician)    -[a IS assigned_to]->    (w IS work_order)  WHERE w.status_code='OPEN'  COLUMNS(    t.technician_id AS technician_id,    t.tech_name     AS technician_name,    w.work_order_id AS work_order_id,    w.priority_code AS priority_code  ));

MATCH describes graph structure; WHERE filters properties; COLUMNS turns graph solutions back into ordinary SQL rows. That result can be joined to relational, JSON, XML or spatial expressions in the same SQL statement.

6. Compare with ordinary relational SQL

sql · same one-hop business question using joins
SELECT  t.technician_id,  t.tech_name AS technician_name,  w.work_order_id,  w.priority_codeFROM sh24_graph_tech tJOIN sh24_assignment a  ON a.technician_id=t.technician_idJOIN sh24_graph_order w  ON w.work_order_id=a.work_order_idWHERE w.status_code='OPEN';

For one simple relationship, the relational join is arguably clearer. Graph becomes more compelling when the query itself is naturally a path/pattern—variable-length paths, multiple relationship types, graph algorithms or relationship-centric exploration. The right choice is query clarity and measured performance, not data-model branding.

7. Inspect graph metadata

sql · graph dictionary
SELECT  graph_name,  graph_mode,  allows_mixed_types,  inmemoryFROM user_property_graphsWHERE graph_name='SH24_SERVICE_GRAPH';SELECT  graph_name,  element_name,  object_name,  element_kindFROM user_pg_elementsWHERE graph_name='SH24_SERVICE_GRAPH'ORDER BY element_kind,element_name;SELECT  graph_name,  label_nameFROM user_pg_labelsWHERE graph_name='SH24_SERVICE_GRAPH'ORDER BY label_name;

These dictionary views are themselves new 26ai surfaces. They prove graph metadata exists; they do not prove the graph model is appropriate for your workload.

8. Deliberately wrong: create graph edges without relational integrity

If the application maintains a separate copied edge store without foreign-key/business validation, relationships can point to missing technicians or work orders. In this lab the edge table itself prevents that:

sql · invalid edge
INSERT INTO sh24_assignment(  assignment_id,technician_id,work_order_id)VALUES(3,999,9001);-- Expected:-- ORA-02291: integrity constraint ... violated - parent key not found

Graph syntax does not eliminate data-integrity design. The safe architecture keeps identity/referential constraints in the relational source where possible, then projects graph semantics over them.

9. Multi-hop awareness without overcomplicating the first lab

GRAPH_TABLE supports richer path patterns, including variable-length traversal. Before replacing recursive CONNECT BY/recursive subquery factoring, prototype the actual path depth, branching factor, filters, returned properties and concurrency. A graph expression that is clearer can still be slower for a particular physical workload—or vice versa.

10. RDF/OWL is a different graph model

RDF (Resource Description Framework) represents subject-predicate-object statements identified by URIs; OWL and RDFS add semantic vocabularies/inference. Property graphs instead attach properties directly to vertices/edges and are usually simpler for application relationships. Oracle supports both. Current licensing lists Property Graph and RDF Graph Technologies across all listed offerings; RDF support has specific setup/install prerequisites and restricted-use Partitioning rights for the RDF/property-graph schema infrastructure.

11. Graph analytics component boundary

SQL property graph creation/query runs in Oracle AI Database. Advanced graph analytics and Graph Studio can involve Oracle Graph Server and Client/PGX; current release 26.3 is a separately installed component for user-managed deployments, while Autonomous can provide Graph Studio as part of the service environment. This chapter does not require that external topology.

12. Cleanup

sql · cleanup
DROP PROPERTY GRAPH sh24_service_graph;DROP TABLE sh24_assignment PURGE;DROP TABLE sh24_graph_order PURGE;DROP TABLE sh24_graph_tech PURGE;

13. Production judgment

Use a SQL property graph when relationship/path queries are central and projecting existing relational truth avoids duplicate pipelines/security/recovery. Keep simple joins simple. For graph algorithms or very large graph-native workloads, measure SQL graph/Graph Server against specialized platforms using equivalent data, traversal semantics and concurrency.

Current 26ai property graphs are available in Free under the current licensing matrix; CREATE PROPERTY GRAPH privilege is required. No restart, pack or COMPATIBLE change is needed for the lab. RDF is supported but has separate semantic/setup concepts. Lesson 5 now forces the architecture question the chapter has been building toward: when is convergence actually cheaper and when does a specialist system earn its place?

Check your understanding

  1. What does CREATE PROPERTY GRAPH store?
  2. When is a relational join clearer than GRAPH_TABLE?
  3. What privilege creates a property graph in your own schema?
  4. Why does the edge table still need integrity rules?
  5. How does RDF differ conceptually from a property graph?
Review the answers

It stores graph metadata mapping relational tables/views to vertices/edges/labels/properties; the base data remains in those relational objects.

For simple/fixed relationships where normal join SQL expresses the question directly.

CREATE PROPERTY GRAPH.

Graph modeling does not automatically guarantee valid business endpoints; FK/key constraints prevent dangling/invalid relationships.

RDF uses semantic subject-predicate-object statements/URIs and inference vocabularies; property graphs model labeled vertices/edges with direct properties.

Authoritative references

Keep knowledge open

Help the academy stay free and grow.

If these tutorials save you time, a small donation supports new lessons, technical review, diagrams, examples, and long-term maintenance.

ETHEthereum / ERC-20 only
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0

Send only Ethereum or ERC-20 compatible assets to this address.