如何使用 neo4jclient 通过展开来添加边?
How to add edges by unwind using neo4jclient?
节点已经存在。
我尝试通过展开来添加边,但是我的函数 importBuyConnectionIntoNeo4j
没有用,
有没有人可以帮助我?
数据结构:
class Connection
{
private string type;
public string Type
{
get { return type; }
set { type = value; }
}
private string source;
public string Source
{
get { return source; }
set { source = value; }
}
private string target;
public string Target
{
get { return target; }
set { target = value; }
}
}
class BuyConnection:Connection
{
}
我的函数:
public void importBuyConnectionIntoNeo4j(List<BuyConnection> connectionList)
{
GraphClient client = createConnectionToNeo4j();
client.Cypher
.Unwind(connectionList, "connection")
.Match("(source:Person),(target:Vegetable)")
.Where("source.Name=connection.Source AND target.Type=connection.Target")
.Create("(source)-[:Buy]->(target)")
.ExecuteWithoutResults();
}
我认为问题出在您的 .where
文字上:
.Where("source.Name=connection.Source AND target.Type=connection.Target")
Source
和 Target
是正确的方法吗?
节点已经存在。
我尝试通过展开来添加边,但是我的函数 importBuyConnectionIntoNeo4j
没有用,
有没有人可以帮助我?
数据结构:
class Connection
{
private string type;
public string Type
{
get { return type; }
set { type = value; }
}
private string source;
public string Source
{
get { return source; }
set { source = value; }
}
private string target;
public string Target
{
get { return target; }
set { target = value; }
}
}
class BuyConnection:Connection
{
}
我的函数:
public void importBuyConnectionIntoNeo4j(List<BuyConnection> connectionList)
{
GraphClient client = createConnectionToNeo4j();
client.Cypher
.Unwind(connectionList, "connection")
.Match("(source:Person),(target:Vegetable)")
.Where("source.Name=connection.Source AND target.Type=connection.Target")
.Create("(source)-[:Buy]->(target)")
.ExecuteWithoutResults();
}
我认为问题出在您的 .where
文字上:
.Where("source.Name=connection.Source AND target.Type=connection.Target")
Source
和 Target
是正确的方法吗?