4.9 Graph Schema Visualization

You can visualize the underlying database schema for your property graph using the Graph Visualization library.

The following shows an example JSON configuration for a schema view:

{
    "vertices": [{
        "labelName": "COUNTRIES",
        "properties": [{
            "name": "COUNTRY_ID",
            "dataType": "string",
            "limits": [2],
            "mandatory": true
        }, {
            "name": "COUNTRY_NAME",
            "dataType": "string",
            "limits": [40],
            "mandatory": false
        }, {
            "name": "REGION_ID",
            "dataType": "number",
            "limits": [],
            "mandatory": false
        }]
    }, {
        "labelName": "DEPARTMENTS",
        "properties": [{
            "name": "DEPARTMENT_ID",
            "dataType": "number",
            "limits": [],
            "mandatory": true
        }, {
            "name": "DEPARTMENT_NAME",
            "dataType": "string",
            "limits": [30],
            "mandatory": true
        }, {
            "name": "LOCATION_ID",
            "dataType": "number",
            "limits": [],
            "mandatory": false
        }, {
            "name": "MANAGER_ID",
            "dataType": "number",
            "limits": [],
            "mandatory": false
        }]
    }, {
        "labelName": "LOCATIONS",
        "properties": [{
            "name": "CITY",
            "dataType": "string",
            "limits": [30],
            "mandatory": true
        }, {
            "name": "COUNTRY_ID",
            "dataType": "string",
            "limits": [2],
            "mandatory": false
        }, {
            "name": "LOCATION_ID",
            "dataType": "number",
            "limits": [],
            "mandatory": true
        }, {
            "name": "POSTAL_CODE",
            "dataType": "string",
            "limits": [12],
            "mandatory": false
        }, {
            "name": "STATE_PROVINCE",
            "dataType": "string",
            "limits": [25],
            "mandatory": false
        }, {
            "name": "STREET_ADDRESS",
            "dataType": "string",
            "limits": [40],
            "mandatory": false
        }]
    }, {
        "labelName": "JOBS",
        "properties": [{
            "name": "JOB_ID",
            "dataType": "string",
            "limits": [10],
            "mandatory": true
        }, {
            "name": "JOB_TITLE",
            "dataType": "string",
            "limits": [35],
            "mandatory": true
        }, {
            "name": "MAX_SALARY",
            "dataType": "number",
            "limits": [],
            "mandatory": false
        }, {
            "name": "MIN_SALARY",
            "dataType": "number",
            "limits": [],
            "mandatory": false
        }]
    }, {
        "labelName": "EMPLOYEES",
        "properties": [{
            "name": "COMMISSION_PCT",
            "dataType": "number",
            "limits": [],
            "mandatory": false
        }, {
            "name": "DEPARTMENT_ID",
            "dataType": "number",
            "limits": [],
            "mandatory": false
        }, {
            "name": "EMAIL",
            "dataType": "string",
            "limits": [25],
            "mandatory": true
        }, {
            "name": "EMPLOYEE_ID",
            "dataType": "number",
            "limits": [],
            "mandatory": true
        }, {
            "name": "FIRST_NAME",
            "dataType": "string",
            "limits": [20],
            "mandatory": false
        }, {
            "name": "HIRE_DATE",
            "dataType": "string",
            "limits": [],
            "mandatory": true
        }, {
            "name": "JOB_ID",
            "dataType": "string",
            "limits": [10],
            "mandatory": true
        }, {
            "name": "LAST_NAME",
            "dataType": "string",
            "limits": [25],
            "mandatory": true
        }, {
            "name": "MANAGER_ID",
            "dataType": "number",
            "limits": [],
            "mandatory": false
        }, {
            "name": "PHONE_NUMBER",
            "dataType": "string",
            "limits": [20],
            "mandatory": false
        }, {
            "name": "SALARY",
            "dataType": "number",
            "limits": [],
            "mandatory": false
        }]
    }, {
        "labelName": "REGIONS",
        "properties": [{
            "name": "REGION_ID",
            "dataType": "number",
            "limits": [],
            "mandatory": true
        }, {
            "name": "REGION_NAME",
            "dataType": "string",
            "limits": [25],
            "mandatory": false
        }]
    }],
    "edges": [{
        "labelName": "COUNTRIES_REGIONS",
        "properties": [],
        "sourceVertexLabel": "COUNTRIES",
        "targetVertexLabel": "REGIONS"
    }, {
        "labelName": "DEPARTMENTS_EMPLOYEES",
        "properties": [],
        "sourceVertexLabel": "DEPARTMENTS",
        "targetVertexLabel": "EMPLOYEES"
    }, {
        "labelName": "DEPARTMENTS_LOCATIONS",
        "properties": [],
        "sourceVertexLabel": "DEPARTMENTS",
        "targetVertexLabel": "LOCATIONS"
    }, {
        "labelName": "LOCATIONS_COUNTRIES",
        "properties": [],
        "sourceVertexLabel": "LOCATIONS",
        "targetVertexLabel": "COUNTRIES"
    }, {
        "labelName": "EMPLOYEES_JOBS",
        "properties": [],
        "sourceVertexLabel": "EMPLOYEES",
        "targetVertexLabel": "JOBS"
    }, {
        "labelName": "EMPLOYEES_DEPARTMENTS",
        "properties": [],
        "sourceVertexLabel": "EMPLOYEES",
        "targetVertexLabel": "DEPARTMENTS"
    }, {
        "labelName": "EMPLOYEES_EMPLOYEES",
        "properties": [],
        "sourceVertexLabel": "EMPLOYEES",
        "targetVertexLabel": "EMPLOYEES"
    }]
}

The corresponding schema visualization is as shown:

Figure 4-13 Visualizing Database Schema for the Property Graph