Get Started with the APEX Graph Visualization Plug-in (Oracle Database 23ai)
Get started with the APEX Graph Visualization plug-in in your APEX application on your Autonomous Database instance using Oracle Database 23ai.
- Download the Graph Visualization (Preview) plug-in
(
region_type_plugin_graphviz.sql
) from the Oracle APEX GitHub repository. - Sign in to your APEX workspace in your Autonomous Database instance.
- Create the
DBMS_GVT
package in your APEX workspace.- Download the
optional-23ai-only/gvt_sqlgraph_to_json.sql
file from the Oracle APEX GitHub repository. - Upload and run the
gvt_sqlgraph_to_json.sql
script in your APEX workspace (see Uploading a SQL Script).
- Download the
- Import the downloaded plug-in script
(
region_type_plugin_graphviz.sql
) file into your target APEX application (see Importing Plug-ins). - Implement the plug-in in an application page to perform various graph
visualizations.
The following basic example describes the steps to visualize a graph existing in your database using the Graph Visualization plug-in.
- Open the application page in Page Designer.
- Select the Rendering tab on the left pane of the Page Designer.
- Right-click an existing component and add a new region component.
- Select the new region and configure the following attributes
in the Region tab of the Property
Editor on the right pane of the Page Designer:
- Enter the Identification Title.
- Select Graph Visualization (Preview) as Identification Type.
- Select the source Location as Local Database.
- Select the Type value.
You can choose either SQL Query or PropertyGraph as the Type value.
- Embed the SQL graph query to retrieve the graph
data.
Depending on the type selected in the previous step, you can provide the query as shown in the following examples:
- SQL Query: Enter the
SQL graph query input as
shown:
SELECT * FROM GRAPH_TABLE ( BANK_SQL_PG MATCH (a IS accounts) -[e IS transfers]-> (b IS accounts) WHERE a.id = 816 COLUMNS(vertex_id(a) AS id_a, edge_id(e) AS id_e, vertex_id(b) AS id_b) )
- PropertyGraph :
Provide the SQL graph query as shown:
- Graph Name: Select the SQL property graph name.
- Match
Clause: Enter the
MATCH
clause of the graph query. For example:(a IS accounts) -[e IS transfers]-> (b IS accounts)
- Columns
Clause: Enter the
COLUMNS
clause of the graph query. For example:(vertex_id(a) AS id_a, edge_id(e) AS id_e, vertex_id(b) AS id_b)
- Where Clause:
Optionally, enter the
WHERE
clause of the query. For example,a.id = 816
.
- SQL Query: Enter the
SQL graph query input as
shown:
- Run the application page to visualize the graph rendered by
the plugin.
Description of the illustration apex_gviz_basic_graph.pngNote:
The APEX Graph Visualization plug-in on Oracle Database 23ai does not support graphs that use vertex or edge keys withDATE
orTIMESTAMP
data types. Visualizing graph query results on graphs withDATE
orTIMESTAMP
keys may result in only a subset of graph data being shown.
- Optionally, if you wish to implement pagination in the preceding graph
visualization, then perform the following steps:
- Switch ON the SQL Query Supports Pagination setting in the Attributes tab of the Property Editor for the graph visualization component in your APEX application.
- Set the Page Size value in the Attributes tab of the Property Editor.
- Save and rerun the application page.The graph gets rendered with pagination.
- Optionally, you can import and run the Sample Graph Visualizations
application from Oracle APEX GitHub
repository.
- Import the
sample-apps/sample-graph-visualizations/sample-graph-visualizations_23ai.sql
into your APEX instance and install the application by following the steps in Importing an Application.When installing the sample application, ensure that you have theCREATE VIEW
privilege for installing the supporting objects.You can directly run the sample application once it is installed.
Description of the illustration apex_sample_graph_viz.pngAlso, note that the sample application requires a secure
HTTPS
connection. If you want to disable secure connection, then perform the following steps:Caution:
It is not recommended to disable secure connections in production deployment.- Navigate to the sample application home page in App Builder.
- Click Shared Components.
- Click Authentication Schemes under Security.
- Click the Current authentication scheme.
- Click the Session Sharing tab and turn off the Secure switch.
- Click Apply Changes and then run the application.
- Import the