我一直在试验 Neo4J,文本查询工作得很好。然后我切换到 .Net 中的 Neo4JClient,现在我想使用 CypherFluentQuery,但由于某些非常奇怪的原因,生成的查询不包括节点 ID,而只包括像 {p0}、p{1} 这样的占位符...... ) 我错过了什么?
下面是我的简单查询示例:
文本查询(工作正常):
string textQuery = "START user=node(9,7,8,10,11) " +
"MATCH user-[:is_friend_of]->isfriendof " +
"RETURN user.name as user,isfriendof.name as IsFriendOf";
CypherQuery query = new CypherQuery(textQuery,
new Dictionary<string, object>(),
CypherResultMode.Projection);
var nodes = client.ExecuteGetCypherResults<MyNode>(query).ToList();
现在是 CypherFluentQuery(抛出异常):
NodeReference<TestNode> node1 = new NodeReference<TestNode>(9);
NodeReference<TestNode> node2 =new NodeReference<TestNode>(7);
NodeReference<TestNode> node3 = new NodeReference<TestNode>(8);
NodeReference<TestNode> node4 = new NodeReference<TestNode>(10);
NodeReference<TestNode> node5 = new NodeReference<TestNode>(11);
NodeReference [] nodes = { node1, node2, node3, node4, node5 };
var results = new CypherFluentQuery(client)
.Start("user", nodes)
.Match("user-[:is_friend_of]->isfriendof")
.Return<MyNode>("user.name as user,isfriendof.name as IsFriendOf", CypherResultMode.Projection)
.Results.ToList();
引用的节点类如下:
public class MyNode
{
public string user { get; set; }
public string IsFriendOf { get; set; }
}
public class TestNode
{
public string name { get; set; }
}
抛出异常:
Received an unexpected HTTP status when executing the request.
The query was: START user=node({p0}, {p1}, {p2}, {p3}, {p4})
MATCH user-[:is_friend_of]->isfriendof
RETURN user.name as user,isfriendof.name as IsFriendOf
The response status was: 400 Bad Request
更新 我用 nugget 更新了 Neo4JClient,现在显然我不能使用 ExecuteGetCypherResults,所以我想我现在的问题比以往任何时候都更有效:-/