cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Not show the graph node using json

rosdiana
Node Clone

Hi

I have a problem with the graph node. currently i am using eisman project to show the graph, https://github.com/eisman/neo4jd3. But the graph doesn't appear in web browser. Below is my JSON and i already follow the format according to eisman project. But i still didn't get what is wrong with my code.

{
    "errors": [],
    "results": [
        {
            "columns": [
                "user",
                "entity"
            ],
            "data": [
                {
                    "graph": {
                        "relationship": [
                            {
                                "startNode": 1,
                                "id": 221,
                                "endNode": 154,
                                "properties":{
                            
                                },
                                "type": "ACTED_IN"
                            },
                            {
                                "startNode": 1,
                                "id": 114,
                                "endNode": 87,
                                "properties":{
                            
                                },
                                "type": "ACTED_IN"
                            },
                            {
                                "startNode": 1,
                                "id": 132,
                                "endNode": 100,
                                "properties":{
                            
                                },
                                "type": "ACTED_IN"
                            },
                            {
                                "startNode": 1,
                                "id": 22,
                                "endNode": 11,
                                "properties":{
                            
                                },
                                "type": "ACTED_IN"
                            },
                            {
                                "startNode": 1,
                                "id": 15,
                                "endNode": 10,
                                "properties":{
                            
                                },
                                "type": "ACTED_IN"
                            },
                            {
                                "startNode": 1,
                                "id": 8,
                                "endNode": 9,
                                "properties":{
                            
                                },
                                "type": "ACTED_IN"
                            },
                            {
                                "startNode": 1,
                                "id": 0,
                                "endNode": 0,
                                "properties":{
                            
                                },
                                "type": "ACTED_IN"
                            },
                            {
                                "startNode": 188,
                                "id": 478,
                                "endNode": 341,
                                "properties":{
                            
                                },
                                "type": "ACTED_IN"
                            },
                            {
                                "startNode": 188,
                                "id": 272,
                                "endNode": 197,
                                "properties":{
                            
                                },
                                "type": "ACTED_IN"
                            },
                            {
                                "startNode": 188,
                                "id": 265,
                                "endNode": 196,
                                "properties":{
                            
                                },
                                "type": "ACTED_IN"
                            },
                            {
                                "startNode": 188,
                                "id": 257,
                                "endNode": 187,
                                "properties":{
                            
                                },
                                "type": "ACTED_IN"
                            },
                            {
                                "startNode": 188,
                                "id": 371,
                                "endNode": 274,
                                "properties":{
                            
                                },
                                "type": "ACTED_IN"
                            },
                            {
                                "startNode": 188,
                                "id": 279,
                                "endNode": 198,
                                "properties":{
                            
                                },
                                "type": "ACTED_IN"
                            },
                            {
                                "startNode": 188,
                                "id": 389,
                                "endNode": 287,
                                "properties":{
                            
                                },
                                "type": "ACTED_IN"
                            }
                        ],
                        "nodes": [
                            {
                                "id": 1,
                                "labels": [
                                  "Person"
                                ],
                                "properties": {
                              "name": "Keanu Reeves",
                              "born": 1964
                                }
                              },
                              {
                                "id": 188,
                                "labels": [
                                  "Person"
                                ],
                                "properties": {
                              "name": "Keanu Reeves",
                              "born": 1964
                                }
                              },
                            {
                                "properties": {
                                    "title": "Something's Gotta Give",
                                    "released": 2003
                                },
                                "id": 154,
                                "labels": [
                                    "Movie"
                                ]
                            },
                            {
                                "properties": {
                                    "released": 2000,
                                    "title": "The Replacements",
                                    "tagline": "Pain heals, Chicks dig scars... Glory lasts forever"
                                },
                                "id": 87,
                                "labels": [
                                    "Movie"
                                ]
                            },
                            {
                                "properties": {
                                    "released": 1995,
                                    "title": "Johnny Mnemonic",
                                    "tagline": "The hottest data on earth. In the coolest head in town"
                                },
                                "id": 100,
                                "labels": [
                                    "Movie"
                                ]
                            },
                            {
                                "properties": {
                                    "released": 1997,
                                    "title": "The Devil's Advocate",
                                    "tagline": "Evil has its winning ways"
                                },
                                "id": 11,
                                "labels": [
                                    "Movie"
                                ]
                            },
                            {
                                "properties": {
                                    "released": 2003,
                                    "title": "The Matrix Revolutions",
                                    "tagline": "Everything that has a beginning has an end"
                                },
                                "id": 10,
                                "labels": [
                                    "Movie"
                                ]
                            },
                            {
                                "properties": {
                                    "released": 2003,
                                    "title": "The Matrix Reloaded",
                                    "tagline": "Free your mind"
                                },
                                "id": 9,
                                "labels": [
                                    "Movie"
                                ]
                            },
                            {
                                "properties": {
                                    "released": 1999,
                                    "title": "The Matrix",
                                    "tagline": "Welcome to the Real World"
                                },
                                "id": 0,
                                "labels": [
                                    "Movie"
                                ]
                            },
                            {
                                "properties": {
                                    "title": "Something's Gotta Give",
                                    "released": 2003
                                },
                                "id": 341,
                                "labels": [
                                    "Movie"
                                ]
                            },
                            {
                                "properties": {
                                    "released": 2003,
                                    "title": "The Matrix Revolutions",
                                    "tagline": "Everything that has a beginning has an end"
                                },
                                "id": 197,
                                "labels": [
                                    "Movie"
                                ]
                            },
                            {
                                "properties": {
                                    "released": 2003,
                                    "title": "The Matrix Reloaded",
                                    "tagline": "Free your mind"
                                },
                                "id": 196,
                                "labels": [
                                    "Movie"
                                ]
                            },
                            {
                                "properties": {
                                    "released": 1999,
                                    "title": "The Matrix",
                                    "tagline": "Welcome to the Real World"
                                },
                                "id": 187,
                                "labels": [
                                    "Movie"
                                ]
                            },
                            {
                                "properties": {
                                    "released": 2000,
                                    "title": "The Replacements",
                                    "tagline": "Pain heals, Chicks dig scars... Glory lasts forever"
                                },
                                "id": 274,
                                "labels": [
                                    "Movie"
                                ]
                            },
                            {
                                "properties": {
                                    "released": 1997,
                                    "title": "The Devil's Advocate",
                                    "tagline": "Evil has its winning ways"
                                },
                                "id": 198,
                                "labels": [
                                    "Movie"
                                ]
                            },
                            {
                                "properties": {
                                    "released": 1995,
                                    "title": "Johnny Mnemonic",
                                    "tagline": "The hottest data on earth. In the coolest head in town"
                                },
                                "id": 287,
                                "labels": [
                                    "Movie"
                                ]
                            }
                        ]
                    }
                }
            ]
        }
    ]
}

And below some code from eisman project from here to show the graph.

},
                    minCollision: 60,
                    neo4jDataUrl: 'json/data-movie.json',
                    
                    //neo4jData: datagraph,
                                    
                    nodeRadius: 25,
                    onNodeDoubleClick: function(node) {
                        switch(node.id) {
                            case '25':
                                // Google
                                window.open(node.properties.url, '_blank');
                                break;
                            default:
                                var maxNodes = 5,
                                    data = neo4jd3.randomD3Data(node, maxNodes);
                                neo4jd3.updateWithD3Data(data);
                                break;
                        }
                    },
                    onRelationshipDoubleClick: function(relationship) {
                        console.log('double click on relationship: ' + JSON.stringify(relationship));
                    },
                    zoomFit: true
                });

Please help me. Thank you.

1 ACCEPTED SOLUTION

rosdiana
Node Clone

solve it. Type error , not "relationship" but "relationships". missing s

View solution in original post

1 REPLY 1

rosdiana
Node Clone

solve it. Type error , not "relationship" but "relationships". missing s