I am trying to query whole graph db using Ajax in Neo4j. Below is my ajax code.
$.ajax({
type: "POST",
url: "http://localhost:7474/db/data/transaction/commit ",
dataType: "json",
contentType: "application/json;charset=UTF-8",
data: JSON.stringify({"statements": [{"statement": "MATCH (n) OPTIONAL MATCH (n)-[r]-() RETURN n,r"}]}),
success: function (data, textStatus, jqXHR) {
$(".neo4jResponse").html(JSON.stringify(data));
},
error: function (jqXHR, textStatus, errorThrown) {
alert("Error");
}
});`
It's returning the response as:
{
"results":
[
{
"columns":["n","r"],
"data":
[
{"row":[{"title":"Tourism","name":"Tourism"},{}]},
{"row":[{"title":"Tourism","name":"Tourism"},{}]},
{"row":[{"title":"Coastal Debris","name":"Coastal Debris"},{}]},
{"row":[{"title":"Coastal Debris","name":"Coastal Debris"},{}]},
{"row":[{"title":"Quality","name":"Quality"},{}]},
{"row":[{"title":"Quality","name":"Quality"},{}]},
{"row":[{"title":"Recreational Value","name":"Recreational Value"},{}]},
{"row":[{"title":"Recreational Value","name":"Recreational Value"},{}]},
{"row":[{"title":"Eco-Tourism Incentives","name":"Eco-Tourism Incentives"},{}]},
{"row":[{"title":"Eco-Tourism Incentives","name":"Eco-Tourism Incentives"},{}]},
{"row":[{"title":"Eco-Tourism","name":"Eco-Tourism"},{}]},
{"row":[{"title":"Eco-Tourism","name":"Eco-Tourism"},{}]}
]
}
],
"errors":[]
}
Why I am not able to get the relationship? Any suggestions would help.
Note - All the nodes are connected in Neo4j through relationship.