Get Started with the APEX Graph Visualization Plug-in

Get started with the APEX Graph Visualization plug-in in your APEX application on your Autonomous Database instance.

Before you begin, ensure that you meet the prerequisites described in Prerequisites for Using the APEX Graph Visualization Plug-in.
  1. Download the Graph Visualization (Preview) plug-in from Oracle APEX GitHub repository.
  2. Sign in to your APEX workspace in your Autonomous Database instance.
  3. Import the downloaded plug-in script (region_type_plugin_graphviz.sql) file into your target APEX application by following the steps in Importing Plug-ins in the Oracle Application Express App Builder User’s Guide.
  4. Implement the plug-in in an application page to perform graph visualization.
    The following basic example describes the steps to visualize a graph existing in your Autonomous Database instance using the Graph Visualization plug-in.
    1. Open the application page in Page Designer.
    2. Select the Rendering tab on the left pane of the Page Designer.
    3. Right-click an existing component and add a new region component.
    4. 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:
      1. Enter the Identification Title.
      2. Select Graph Visualization (Preview) as Identification Type.
      3. Select the source Location as Local Database.
      4. Select Type as SQL Query.
      5. Run a SQL query, which wraps a PGQL query in the ORA_PGQL_TO_JSON PL/SQL function, to retrieve the graph data.

        For example:

        SELECT 
          ORA_PGQL_TO_JSON(query => 'SELECT e FROM MATCH
            (e:employees) ON OEHR_EMPLOYESS LIMIT 20') 
          FROM DUAL;

        It is important to note the following:

        • The plugin accepts the input graph data containing the vertex and edge information in JSON format only. This is supported by the ORA_PGQL_TO_JSON PL/SQL function which takes a PGQL query as input and returns the graph output in JSON structure.
        • The graph referenced in the PGQL query must exist in your Autonomous Database instance.
    5. Run the application page to visualize the graph rendered by the plug-in.Description of apex_basic_graph.png follows
      Description of the illustration apex_basic_graph.png
  5. Optionally, if you wish to implement pagination in the preceding graph visualization, then perform the following steps:
    1. 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.
    2. Bind the page_start and page_size parameters when calling the ORA_PGQL_TO_JSON function in the SQL query as shown in the following example code:
      SELECT 
        ORA_PGQL_TO_JSON(query => 'SELECT e FROM MATCH
          (e:employees) ON OEHR_EMPLOYESS LIMIT 20',:page_start,:page_size) 
        AS result FROM DUAL;
    3. Set the Page Size value in the Attributes tab of the Property Editor.
      Note that the page_start value is automatcially set.
    4. Save and rerun the application page.
      The graph gets rendered with pagination.
  6. Optionally, download the Sample Graph Visualizations application from Oracle APEX GitHub repository.
    This application demonstrates the use of the Graph Visualization plug-in.
    1. Import the downloaded sample-apps/sample-graph-visualizations/sample-graph-visualizations_19adb.sql into your APEX instance by following the steps in Importing an Application.
    2. Run the sample application from the application home page in App Builder.