Create a Property Graph from Existing Relational Tables
You can create a property graph from existing relational tables.
Note:
-
The PG Objects graph type is desupported. It is recommended that you create a PGQL Property Graph or SQL Property Graph.
-
SQL property graphs are supported only in Oracle Database 23ai. Therefore, if you are using an Autonomous Database instance with Oracle Database 23ai, then you have the option to create SQL property graphs.
It is also important to note that if the source tables for creating a property graph fulfills any one of the following conditions:
- Contains composite vertex keys
- Contains any one of the Datetime data types in the primary key
Then the property graph wizard will throw a warning when creating the graph. However, you can still create a property graph by ignoring the warning. But you cannot load the property graph into memory.
- Navigate to the Graphs page.
- Select the Property Graph tab and click
Create Graph.The property graph wizard opens displaying the Overview page.
- Enter the Graph Name
- Optionally enter the graph Description and click Next.
- Select the required Graph Type.
Graph Studio supports the creation of two types of property graphs:
- SQL Property Graph: The option to create a SQL property graph is available only if you are using an Autonomous Database instance with Oracle Database 23ai.
- PGQL Property Graph: The option to create a PGQL property graph is available on all types of tenancies and supported on all database versions.
- Select the data tables that are required as input for the graph and move them
to the Selections section on the right.
Description of the illustration pg_workflow_select_tables.pngThe following table shows a few supported input types and the corresponding default mapping when transformed into graph properties:
Oracle Database TypeFoot 1 Oracle PGX Type NUMBER
The following implicit type conversion rules apply: NUMBER
=>LONG
(for key columns)NUMBER
=>DOUBLE
(for non-key columns)NUMBER(m)
(number having precisionm
) withm <= 9
=>INTEGER
NUMBER(m)
(number having precisionm
) with9 < m <= 18
=>LONG
NUMBER(m,n)
(number having precisionm
and scalen
) =>DOUBLE
Note that this applies if
n > 0
. Otherwise, it follows the same mapping asNUMBER(x)
, wherex = m-n
(that is, subtracting the scale from the precision). The PGX type can then vary, depending on thex
value as shown:x <= 9
=>INTEGER
9 < x <= 18
=>LONG
x > 18
=>DOUBLE
For instance, consider a scenario where
n = -100
andm = 1
. In this case,x = 101
(m-n
), which is greater than 18. Extremely large numbers cannot be encoded to fit inINTEGER
orLONG
and therefore require theDOUBLE
data type.
CHAR
orNCHAR
STRING
VARCHAR
,VARCHAR2
, orNVARCHAR2
STRING
BINARY_FLOAT
FLOAT
BINARY_DOUBLE
DOUBLE
FLOAT
The following implicit type conversion rules apply: FLOAT(m)
withm <= 23
=>FLOAT
FLOAT(m)
with23 < m
=>DOUBLE
In the preceding entries,
m
is the variable for precision.CLOB
STRING
DATE
orTIMESTAMP
TIMESTAMP
TIMESTAMP WITH LOCAL TIME ZONE
TIMESTAMP
TIMESTAMP WITH TIME ZONE
TIMESTAMP WITH TIME ZONE
Footnote 1 Data types for PGQL property graphs and SQL property graphs share a one-to-one mapping with Oracle Database data types.
- Click Next to view the suggested graph definition.
You can modify the graph definition if required.
Note:
Verify if the vertex and edge table keys are defined for the graph. These keys are generated automatically by the property graph wizard. In case the wizard is unable to generate the vertex and edge table keys, then you must manually specify these keys. Otherwise, the wizard will not proceed to the next step of graph creation. See Specify Vertex and Edge Table Keys for more information on how to add or edit the vertex and edge table keys.See Add New Edges During Graph Creation for visually adding new edges between two vertices inside the Designer tab at this step.
- Click Next to view the graph summary.
Graph Studio evaluates the graph definition and displays a summary of the graph if the validation is successful.
Otherwise it may report errors, warnings, or both:
Description of the illustration errors_warnings.pngThe errors and warnings may vary depending on the graph type. Also, note the following:- Errors: Errors appear at the beginning in the Errors and Warnings slider. You need to resolve the errors in order to create a graph.
- Warnings: Warnings are reported following the errors. Graph Studio allows you to create a graph despite the warnings, but the graph cannot be loaded into memory. See Warnings During Property Graph Creation for more information on the warnings details when creating a property graph.
You can choose one of the following actions provided on the error or warning message:
- Remove Column: Removes the column from the vertex or edge table and the graph definition is updated and re-validated.
- Remove Table: Removes the vertex or edge table and the graph definition is updated and re-validated.
- Ignore: Dismisses the error or warning message. Ignoring a warning allows you to continue to the next step of creating a graph. However, ignoring an error does not allow you to proceed with the graph creation. If all the reported errors and warnings are ignored, the Errors and Warnings slider is automatically closed.
- Remove All: Removes all the tables and columns that cause errors or warnings and the graph definition is updated and re-validated.
- Ignore All: Closes the Errors and Warnings slider.
- Click Create Graph.
- Optionally, switch on or off the Load Into Memory toggle.By default, the Load Into Memory toggle is disabled. If you had ignored any warnings reported on the graph definition, then the toggle remains disabled as the graph cannot be loaded into memory.
The Estimated in memory graph size is also computed and displayed in the slider. Also, note the following with respect to the status of the compute environment:
- Detached:
- If the estimated graph size is less than the graph
server (PGX) memory that is configured in the compute
environment settings, then this new estimated value will be
automatically saved as the default memory preference for the
graph server (PGX). In this case, the slider will additionally
display the following message:
This value will be saved as memory preference when compute environment is started.
- If the estimated graph size is greater than the
maximum memory allowed to be allocated to the graph server (PGX)
in the compute environment settings, then the following warning
will be displayed in the slider:
A graph of this size will likely result in OutOfMemory errors during loading or analysis. Consider loading a subgraph instead.
- If the estimated graph size is less than the graph
server (PGX) memory that is configured in the compute
environment settings, then this new estimated value will be
automatically saved as the default memory preference for the
graph server (PGX). In this case, the slider will additionally
display the following message:
- Attached: If the estimated graph size is greater than
the graph server (PGX) memory available for allocation in the compute
environment settings, then the following warning will be displayed in
the slider:
A graph of this size will likely result in OutOfMemory errors during loading or analysis. Consider loading a subgraph instead.
- Detached:
- Optionally, switch on or off the Preserve Case toggle.By default, the Preserve Case toggle is switched off.
- Optionally, switch on or off the Ignore Invalid Edges
Errors toggle.The Ignore Invalid Edges Errors toggle determines the behavior for handling edges with missing source or destination vertices when the graph is loaded into memory. When set:
- ON: It specifies that Graph Studio will ignore those edges with missing source or destination vertices.
- OFF: This is the default option. It allows you to create the graph when there are edges with missing source or destination vertices. But Graph Studio throws an error when you attempt to load the graph into memory. However, you can reload the graph into memory from the Graphs page by switching on the Ignore Invalid Edges Error toggle. See Load Graph Into Memory for more information.
- Click Create Graph to create the property graph.