Interoperability Between Property Graph and Knowledge Graph
SAP HANA Cloud hosts two graph engines within the same database instance.
The Property Graph Engine models data as vertices and edges stored in SQL tables, queried with openCypher through a graph workspace.
The Knowledge Graph Engine models data as RDF triples in a dedicated triple store, queried with SPARQL.
Both engines can interact at two levels: query-time federation and model conversion.
Query-Time Federation
Available since QRC1 2025, two functions enable federated queries across the two engines at runtime, without copying or moving data. SQL acts as the pivot language: results from both engines are ultimately consumed through a standard SQL connection, and SPARQL statements are themselves executed via a SQL stored procedure call.
Query-time federation functions
| Function | Direction | Description |
|---|---|---|
| SPARQL_TABLE() | Knowledge Graph → SQL | Embeds a SPARQL SELECT query inside a SQL statement and returns results as a SQL table |
| SQL_TABLE() | SQL → Knowledge Graph | Embeds a SQL query inside a SPARQL statement and feeds relational rows into a SPARQL graph pattern |
Model Conversion
Introduced in QRC4 2025, two built-in procedures in the SYS schema convert between the two graph models.
Model conversion procedures
| Procedure | Direction |
|---|---|
| SYS.RDF_GRAPH_FROM_GRAPH_WORKSPACE | Property Graph → Knowledge Graph (RDF) |
| SYS.RDF_GRAPH_TO_GRAPH_WORKSPACE | Knowledge Graph (RDF) → Property Graph |
Caution
RDF_GRAPH_FROM_GRAPH_WORKSPACE accepts the following parameters:
Parameters of SYS.RDF_GRAPH_FROM_GRAPH_WORKSPACE
| Parameter | Description |
|---|---|
| GRAPH_WORKSPACE_SCHEMA_NAME | Schema owning the source property graph workspace |
| GRAPH_WORKSPACE_NAME | Name of the source property graph workspace |
| TARGET_GRAPH_URI | IRI of the target RDF named graph (created if it does not exist) |
| MAPPING_MODE | AUTO to generate URIs automatically; alternatively, supply a custom mapping table for full control |
| MAPPING_OUT | Output parameter returning the mapping details applied |
Syntax to Convert Property Graph into Knowledge Graph
1234567CALL SYS.RDF_GRAPH_FROM_GRAPH_WORKSPACE(
GRAPH_WORKSPACE_SCHEMA_NAME => 'MY_SCHEMA',
GRAPH_WORKSPACE_NAME => 'MY_GRAPH_WORKSPACE',
TARGET_GRAPH_URI => '<my_knowledge_graph>',
MAPPING_MODE => 'AUTO',
MAPPING_OUT => ?
);With MAPPING_MODE = 'AUTO', the procedure applies the following automatic mapping rules:
- Each vertex → an RDF resource (URI derived from the key column value)
- Each edge → an RDF triple linking two vertex URIs, with the edge table name as predicate
- Each vertex or edge property → an additional triple with the column name as predicate and the column value as literal
Bulk Import and Export
Introduced in QRC2 2025, two SQL statements enable file-based bulk exchange of Knowledge Graph data with external systems. Both statements require a cloud storage path; Microsoft Azure, Amazon S3, Google Cloud, and SAP HANA Data Lake are supported. A local filesystem path is not accepted.
The file format is Turtle (.ttl), a compact, human-readable W3C standard for serializing RDF data.
Syntax to Import from / Export into an RDF File
1234567IMPORT FROM RDF FILE <storage_path>
INTO SPARQL_GRAPH { DEFAULT | <graph> }
[ WITH <import_options> ];
EXPORT INTO RDF FILE <storage_path>
FROM SPARQL_GRAPH { DEFAULT | <graph> }
[ WITH <export_options> ];The following example exports a named graph to Azure cloud storage:
123EXPORT INTO RDF FILE
'azure://myaccount.blob.core.windows.net/container/kg_logistics.ttl'
FROM SPARQL_GRAPH <kg_logistics>;Release Summary
Graph interoperability features by release
| Release | Capability |
|---|---|
| QRC1 2025 | Query-time federation: SPARQL_TABLE(), SQL_TABLE() |
| QRC2 2025 | Bulk file exchange: IMPORT FROM RDF FILE, EXPORT INTO RDF FILE |
| QRC4 2025 | Model conversion: SYS.RDF_GRAPH_FROM_GRAPH_WORKSPACE, SYS.RDF_GRAPH_TO_GRAPH_WORKSPACE |