简体   繁体   English

C#:执行neo4j Cypher查询,该查询的Where子句中包含路径

[英]C# : Executing neo4j Cypher query that contain path in its Where Clause

I am trying to fetch FOAF nodes for a given node from the c# codeBehind . 我正在尝试从c#codeBehind获取给定节点的FOAF节点。 The cypher is 密码是

MATCH (current { PRSN_F_Name: 'MyName' })-[:KNOWS*1..2]->(fof) 
WHERE NOT (current)- [:KNOWS]->(fof) 
RETURN fof.PRSN_F_Name

How to implement this query using C# ? 如何使用C#实现此查询?

OK

I found the answer myself ... it must be like the following : 我自己找到了答案...它必须像下面这样:

var q = client.Cypher
            .Match("(current { PRSN_F_Name: '" + txtName.Text + "' })-[:KNOWS*1..2]->(fof)")
            .Where("NOT (current)-[:KNOWS]->(fof)")
            .Return((fof) => fof.As<Person>());

        foreach (var result in q.Results)
        {
            ltrFeedback.Text = ltrFeedback.Text + result.PRSN_F_Name + "<br>";
        }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM