-
Notifications
You must be signed in to change notification settings - Fork 41
JSON structures stored in GraphSpace databases
We would like to split our json structures into three types of json structure:
- Graph Structure
- Style
- Node positions
This information will be stored in two tables
-
graph table a. graph_json - structure of the graph and their annotations b. style_json - base styling of the graph.
-
layout table - layout consists of both location and style information. a. positions_json - map of node locations b. style_json - styling for the layout
Here is the format of all the three JSON structures:
elements: nodes: data: position: edges: data: position: data:
{
'<node_id>': {
'x': 27.22,
'y': 11.98
},
....
}
[
{
selector: 'node',
style: {
'background-color': 'red'
}
},
...
]
The format accepted by GraphSpace will look like this:
elements: nodes: data: positions: edges: data: data: tags: description: name:
aand stored in graph JSON on upload:
elements: nodes: data: positions: edges: data: data: tags: description: name:
The aim of the migration is to change the following convert from old graph JSON format to new graph JSON format.
OLD graph JSON format looks like this:
graph: nodes: data: id: content: background_color: shape: ... position: x: y: edges: data: source: target: background_color: shape: ... position: x: y: metadata: tags: description: name:
NEW graph JSON format looks like this:
elements: nodes: data: id: content: position: x: y: edges: data: source: target: position: x: y: data: tags: description: name:
[ { selector: 'node', style: { 'background-color': 'red' } }, ... ]
OLD layout JSON format looks like two different format:
{
'<node_id>': {
'x': 27.22,
'y': 11.98
},
....
}
[
{
'x': 27.22,
'y': 11.98,
'id': '<node_id>'
},
....
]
NEW layout JSON format looks like this:
{ '<node_id>': { 'x': 27.22, 'y': 11.98 }, .... },
[ { selector: 'node', style: { 'background-color': 'red' } }, ... ]