Creating Graphs by using the JSON Configurator

You can write a JSON configuration file based on the PGX JSON fields defined in the PGX graph configuration documentation to confirgure your graph.

To create the Graphs by using the JSON Configurator, follow these steps:

1.      In the Create new Graph Configuration dialog box, click Plain

2.     Specify the name of your graph and the JSON code in the code field.

3.     Click Create. The graph is created. Sample code snippet is as follws:

{

"vertex_labels": false, "edge_label": true, "loading": {

"load_edge_label": true

},

"date_format": "yyyy-MM-dd HH:mm:ss", "vertex_props": [

{

"type": "string",

"name": "type"

},

{

"type": "string", "name": "religion"

},

{

"type": "string",

"name": "company"

},

{

"type": "string", "name": "musicGenre"

},

{

"type": "string",

"name": "show"

},

{

"type": "string",

"name": "name"

},

{

"type": "string",

"name": "country"

},

{

"type": "string",

"name": "team"

},

{

"type": "string",

"name": "genre"

},

{

"type": "string", "name": "occupation"

},

{

"type": "string",

"name": "role"

}

],

"edge_props": [

{

"type": "float",

"name": "weight"

}

],

"format": "edge_list", "vertex_id_type": "integer", "attributes": {},

"header": "",

"uri": "http://pgx.us.oracle.com/graphs/connections.edge_list","separator": "\t "

}

This newly created graph configuration can be used in a notebook for the following:

§       Load a graph using the PGX interpreter.

To load a graph, create a notebook and a paragraph with a PGX interpreter. Enter the code format given in the following example:

graph = session.readGraphWithProperties(dataSourceName, 'graphName')

Here, dataSourceName refers to the graph name that you have created.

§       Query a graph using the PGQL interpreter.

To query a graph, create a notebook and create a paragraph with a PGQL interpreter. Specify the code format given in the following example:

"SELECT n,e,m FROM GRAPH_NAME MATCH (n) -[e]-> (m)"

Here GRAPH_NAME refers to the graph name that you have created.