如何在.net core 中编写neo4j 密码的用户定义函数和存储过程查询?
How to write user defined functions and stored procedure query of cipher of neo4j in .net core?
我有这样的查询
call apoc.load.json("url") yield value
unwind value.learningPaths as val
merge (n:learningPaths {id:val.uid}) Set n.modified = val.last_modofied,
n.type = val.type,
n.locale = val.locale,
n.childrens= val.number_of_children,
n.summary = val.summary,
n.minutes = val.duration_in_minutes,
n.title = val.title,
n.levels = val.levels,
n.roles = val.roles,
n.modules = val.modules,
n.products = val.products
我如何在 .net core API 中编写该查询以在 neo4j 数据库中添加数据?
流利的api这里应有尽有,所以:
await client.Cypher.Call("apoc.load.json('url')").Yield("value")
.Unwind("value.learningPaths", "val")
.Merge("(n:learningPaths {id:val.uid})")
.Set(@"n.modified = val.last_modofied,
n.type = val.type,
n.locale = val.locale,
n.childrens= val.number_of_children,
n.summary = val.summary,
n.minutes = val.duration_in_minutes,
n.title = val.title,
n.levels = val.levels,
n.roles = val.roles,
n.modules = val.modules,
n.products = val.products")
.ExecuteWithoutResultsAsync();
如果我是你,我可能会考虑是否可以缩短 SET
以仅使用 =
来设置所有属性:
await client.Cypher.Call("apoc.load.json('url')").Yield("value")
.Merge("(n:learningPaths {id:val.uid})")
.Set(@"n = val")
.ExecuteWithoutResultsAsync();
或者 +=
如果你需要它是加法的:
await client.Cypher.Call("apoc.load.json('url')").Yield("value")
.Merge("(n:learningPaths {id:val.uid})")
.Set(@"n += val")
.ExecuteWithoutResultsAsync();
这将取决于 val
到底有什么,请通读 SET documentation (maybe Replacing Properties or Mutating properties)。
我有这样的查询
call apoc.load.json("url") yield value
unwind value.learningPaths as val
merge (n:learningPaths {id:val.uid}) Set n.modified = val.last_modofied,
n.type = val.type,
n.locale = val.locale,
n.childrens= val.number_of_children,
n.summary = val.summary,
n.minutes = val.duration_in_minutes,
n.title = val.title,
n.levels = val.levels,
n.roles = val.roles,
n.modules = val.modules,
n.products = val.products
我如何在 .net core API 中编写该查询以在 neo4j 数据库中添加数据?
流利的api这里应有尽有,所以:
await client.Cypher.Call("apoc.load.json('url')").Yield("value")
.Unwind("value.learningPaths", "val")
.Merge("(n:learningPaths {id:val.uid})")
.Set(@"n.modified = val.last_modofied,
n.type = val.type,
n.locale = val.locale,
n.childrens= val.number_of_children,
n.summary = val.summary,
n.minutes = val.duration_in_minutes,
n.title = val.title,
n.levels = val.levels,
n.roles = val.roles,
n.modules = val.modules,
n.products = val.products")
.ExecuteWithoutResultsAsync();
如果我是你,我可能会考虑是否可以缩短 SET
以仅使用 =
来设置所有属性:
await client.Cypher.Call("apoc.load.json('url')").Yield("value")
.Merge("(n:learningPaths {id:val.uid})")
.Set(@"n = val")
.ExecuteWithoutResultsAsync();
或者 +=
如果你需要它是加法的:
await client.Cypher.Call("apoc.load.json('url')").Yield("value")
.Merge("(n:learningPaths {id:val.uid})")
.Set(@"n += val")
.ExecuteWithoutResultsAsync();
这将取决于 val
到底有什么,请通读 SET documentation (maybe Replacing Properties or Mutating properties)。