Reputation: 1792
I use Neo4jClient and I want to get relation attribute MATCH (n:Users {id:1})-[r]-(m:Users) RETURN r
how I can get node with attribute relation , for example :
Node[0]{id:1,name:"Oliver Stone"}
Node[1]{id:2,name:"Charlie Sheen"}
Node[2]{id:3,name:"Martin Sheen"}
Node[3]{id:4,name:"TheAmericanPresident"}
I should know , what is attribute relation between Node[0] and Node[2]? (attribute mean "FOLLOW" or "IGNORE")
Upvotes: 1
Views: 661
Reputation: 6280
You can get the TypeKey
from the r
value you are also retrieving:
var query = Client.Cypher
.Match("(n:User)-[r]-(m:User)")
.Where((UserEntity n) => n.Id == 1)
.Return((n, r, m) => new
{
N = n.As<UserEntity>(),
M = m.As<UserEntity>(),
R = r.As<RelationshipInstance<object>>()
});
var res = query.Results;
foreach (var item in res.ToList())
Console.WriteLine("({0})-[:{1}]-({2})", item.N.Id, item.R.TypeKey, item.M.Id);
You'll obviously need to change UserEntity
for whatever your type actually is.
Upvotes: 1