13.1.3 Defining the Graph Configuration via Java

You can load a graph from Oracle Database by first defining the graph configuration object using the GraphConfigBuilder class and then reading the graph into the graph server (PGX).

Example 13-1 Reading a graph into the graph server (PGX) using GraphConfigBuilder

GraphConfig cfg = GraphConfigBuilder.forPropertyGraphRdbms()
    .setJdbcUrl("jdbc:oracle:thin:@<host>:<port>/<sid>")
    .setUsername("<username>")
    .setPassword("<password>")
    .setName("bank_graph_analytics")
    .addVertexProperty("id",PropertyType.INTEGER)
    .addEdgeProperty("amount",PropertyType.INTEGER)
    .setPartitionWhileLoading(PartitionWhileLoading.BY_LABEL)
    .setLoadVertexLabels(true)
    .setLoadEdgeLabel(true)
    .build();

PgxGraph "bank_graph_analytics" = session.readGraphWithProperties(cfg);

See Property Graph Schema Objects for Oracle Database for more information.