Closed flieks closed 1 year ago
I don't know what the problem is, the code you've tried generates what you're after.
var q = new CypherFluentQuery(client)
.Match("(artist:Artist)<-[similarRelation:SIMILAR]-(artist2:Artist)<-[:ON]-(music:Music)")
.With("music, similarRelation LIMIT 1")
.With ("music, COUNT(similarRelation) as countRelation ORDER BY countRelation DESC")
.With ("music, countRelation");
q.Query.DebugQueryText.Dump();
Generates:
MATCH (artist:Artist)<-[similarRelation:SIMILAR]-(artist2:Artist)<-[:ON]-(music:Music)
WITH music, similarRelation LIMIT 1
WITH music, COUNT(similarRelation) as countRelation ORDER BY countRelation DESC
WITH music, countRelation
Or to match what the StackOverflow post was talking about, you could do this:
var q = new CypherFluentQuery(client)
.Match("(artist:Artist)<-[similarRelation:SIMILAR]-(artist2:Artist)<-[:ON]-(music:Music)")
.With("music, similarRelation")
.Limit(1)
.With ("music, COUNT(similarRelation) as countRelation ORDER BY countRelation DESC")
.With ("music, countRelation");
q.Query.DebugQueryText.Dump();
and you get:
MATCH (artist:Artist)<-[similarRelation:SIMILAR]-(artist2:Artist)<-[:ON]-(music:Music)
WITH music, similarRelation
LIMIT 1
WITH music, COUNT(similarRelation) as countRelation ORDER BY countRelation DESC
WITH music, countRelation
Which is also what you wanted (albeit with an extra CR/LF there)
What problem are you actually getting?
No response. Closing.
What i want to achieve is this RAW cypher with Neo4jClient:
But adding this in a with does not work
.With("music, similarRelation LIMIT 1")
or.With("music, similarRelation LIMIT 1 as similarRelationWithLimit")
i see someone also posted this on stackoverflow a long time ago.