简体   繁体   中英

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 . 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# ?

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>";
        }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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