Skip to content

Find all edges pointing back to a vertex in the current path #1392

Closed Answered by utillity
utillity asked this question in Q&A
Discussion options

You must be logged in to vote

I found the answer:

you use .As("some-step-name") to store the current company and then in the where use the same step name to point back to the company:

var q = graph.V<CompanyDbVertex>().As("Comp").Project(p => p.ToDynamic()
	.By(nameof(BaseCompanyDao.Company), c => c)
	.By(nameof(BaseCompanyDao.Employees), c => c.Out<HasDbEdge>().OfType<EmployeeDbVertex>().FilterDeleted()
		.Where(x => x.Status != EmployeeStatusType.Removed && x.Status != EmployeeStatusType.Declined)
		.Project(p2 => p2.ToDynamic()
			.By(nameof(EmployeeDao.Rights), q => q.Out<HasDbEdge>().OfType<UserDbVertex>().OutE<HasRightDbEdge>()
				.Where(q2 => q2.InV().As("Comp")).Values(e => e.Right)))));
Output.WriteLine(q.De…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by utillity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant