在neo4j

时间:2017-05-24 05:37:17

标签: json neo4j

这里我试图在neo4j中执行shortestPath算法。

{
    method: 'POST',
    json:true,
    url: 'http://neo4j:admin@localhost:7474/db/data/81/path',
    body:{
        "to" : '/db/data/84',
        "max_depth" : 2,
        "relationships" : {
            "type" : "Meet",
            "direction" : "out"
        },
        "algorithm" : "shortestPath"
    }
},

获得回复:

错误:null 身体:

{
 "statusCode":404,
    "headers":
         {
          "date":"Wed, 24 May 2017 05:10:51 GMT",
          "access-control-allow-origin":"*",
          "connection":"close",
          "server":"Jetty(9.2.9.v20150224)"
        },
    "request":
        {
         "uri":
           {
            "protocol":"http:",
            "slashes":true,
            "auth":"neo4j:admin",
            "host":"localhost:7474",
            "port":"7474",
            "hostname":"localhost",
            "hash":null,
            "search":null,
            "query":null,
            "pathname":"/db/data/81/path",
            "path":"/db/data/81/path",
            "href":"http://neo4j:admin@localhost:7474/db/data/81/path"
           },
         "method":"POST",
         "headers":
           {
            "authorization":"Basic bmVvNGo6YWRtaW4=",
            "accept":"application/json",
            "content-type":"application/json",
            "content-length":144
           }
       }
}

拜托,有人可以帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

您的/nodeurl路径中缺少to

试试这个:

{
    method: 'POST',
    json:true,
    url: 'http://neo4j:admin@localhost:7474/db/data/node/81/path',
    body:{
        "to" : '/node/84',
        "max_depth" : 2,
        "relationships" : {
            "type" : "Meet",
            "direction" : "out"
        },
        "algorithm" : "shortestPath"
    }
}