3.1 Loading a Graph into the Graph Server (PGX) from a Property Graph View
You can load a graph into the graph server (PGX) from a property graph view by name.
You can use the following PgxSession
method to load a graph from a
property graph view by name:
readGraphByName(String name, GraphSource source)
The arguments used in the method are as follows:
name
: Name of the property graph view.source
: Source for the graph. In this case,PG_VIEW
.
The readGraphByName(String name, GraphSource source)
method
reads the property graph 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 readGraphByName API
You can specify graph optimization options,OnMissingVertexOption
or both when using thereadGraphByName
API for loading a property graph view.
Parent topic: Property Graph Views on Oracle Database Tables