9.1 Loading a PG View Using the readGraphByName API
You can load a graph into the graph server (PGX) from a property graph view (PG View) by name.
You can use the PgxSession#readGraphByName API to load a graph from
a PG View:
readGraphByName(String schemaName, String graphName,
GraphSource source, ReadGraphOption options)
The arguments used in the method are described in the following table:
Table 9-1 Parameters for
the readGraphByName method
| Parameter | Description | Optional |
|---|---|---|
schemaName |
Schema owner | Yes |
graphName |
Name of the PG View | No |
source |
Source format for the
graph:
|
No |
options |
Represents the graph optimization options | Yes |
The readGraphByName() method reads the PG View
metadata tables and internally generates the graph configuration to load the
graph. You must have PGX_SESSION_NEW_GRAPH permission to
use this API.
For example you can load the graph from a property graph view as shown:
opg4j> var graph = session.readGraphByName("BANKDATAVIEW", GraphSource.PG_VIEW)
$12 ==> PgxGraph[name=bankdataview,N=1000,E=5001,created=1625730942294]PgxGraph graph = session.readGraphByName("BANKDATAVIEW", GraphSource.PG_VIEW);
Graph: PgxGraph[name=bankdataview,N=1000,E=5001,created=1625732149262]>>> graph = session.read_graph_by_name('BANKDATAVIEW', 'pg_view')
>>> graph
PgxGraph(name: bankdataview, v: 1000, e: 5001, directed: True, memory(Mb): 0)
- Specifying Options for the readGraphByName API
You can specify graph optimization options,OnMissingVertexOptionor both when using thereadGraphByNameAPI for loading a property graph view (PG View). - Specifying the Schema Name for the readGraphByName API
You can specify the schema name when using thereadGraphByNameAPI for loading a property graph view (PG View).
See Also:
Mapping Oracle Database Types to PGX Types for more information on the supported types in the graph server (PGX)Parent topic: Loading a PG View into the Graph Server (PGX)