10.1 Loading a PGQL Property Graph Using the readGraphByName API
You can load a PGQL property graph by name into the graph server (PGX).
You can use the PgxSession#readGraphByName API to load a PGQL property graph:
readGraphByName(String schemaName, String graphName,
GraphSource source, ReadGraphOption options)
The arguments used in the method are described in the following table:
Table 10-1 Parameters for
the readGraphByName method
| Parameter | Description | Optional |
|---|---|---|
schemaName |
Schema owner | Yes |
graphName |
Name of the PGQL property graph | No |
source |
Source format for the
graph:
|
No |
options |
Represents the graph optimization options | Yes |
The readGraphByName() method reads the PGQL property graph 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 PGQL property graph as shown:
opg4j> var graph = session.readGraphByName("BANKDATA", GraphSource.PG_VIEW)
$12 ==> PgxGraph[name=bankdata,N=1000,E=5001,created=1625730942294]PgxGraph graph = session.readGraphByName("BANKDATA", GraphSource.PG_VIEW);
Graph: PgxGraph[name=bankdata,N=1000,E=5001,created=1625732149262]>>> graph = session.read_graph_by_name('BANKDATA', 'pg_view')
>>> graph
PgxGraph(name: bankdata, 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 PGQL property graph. - Specifying the Schema Name for the readGraphByName API
You can specify the schema name when using thereadGraphByNameAPI for loading a PGQL property graph.
See Also:
Mapping Oracle Database Types to PGX Types for more information on the supported types in the graph server (PGX)