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 using JShell as shown:
var pgview = session.readGraphByName("bankdataview", GraphSource.PG_VIEW)
$12 ==> PgxGraph[name=bankdataview,N=1000,E=5001,created=1625730942294]
Similarly, you can load the graph from a property graph view using Java as shown:
PgxGraph graph = session.readGraphByName("bankdataview", GraphSource.PG_VIEW);
Graph: PgxGraph[name=bankdataview,N=1000,E=5001,created=1625732149262]
Also, you can load the graph from a property graph view using Python as shown:
>>> graph = session.read_graph_by_name('bankdataview', 'pg_view')
>>> graph
PgxGraph(name: bankdataview, v: 1000, e: 5001, directed: True, memory(Mb): 0)
Parent topic: Property Graph Views on Oracle Database Tables