If the number of options is limited, you can do:
MATCH (user:User)-[:Chose]->(option1:Option), (user)-[:Chose]->(option2:Option), (user)-[:Chose]->(option3:Option) WHERE option1.Key = '1' AND option2.Key = '2' AND option3.Key = '3' RETURN user.Id
This will only return the user with all three parameters.
This is a bit muddy, since obviously you have 3 lines, where you have 1, but I don't know how to do what you want using the IN keyword.
If you code it, it's pretty simple to create a WHERE and MATCH WHERE , but still not perfect .:(
EDIT - Example
Turns out there are some string manipulations (!) Here, but you can always cache bits. Important is the use of Params , which would allow neo4j to cache requests and provide faster responses on every call.
public static IEnumerable<User> GetUser(IGraphClient gc) { var query = GenerateCypher(gc, new[] {"1", "2", "3"}); return query.Return(user => user.As<User>()).Results; } public static ICypherFluentQuery GenerateCypher(IGraphClient gc, string[] options) { ICypherFluentQuery query = new CypherFluentQuery(gc); for(int i = 0; i < options.Length; i++) query = query.Match(string.Format("(user:User)-[:CHOSE]->(option{0}:Option)", i)); for (int i = 0; i < options.Length; i++) { string paramName = string.Format("option{0}param", i); string whereString = string.Format("option{0}.Key = {{{1}}}", i, paramName); query = i == 0 ? query.Where(whereString) : query.AndWhere(whereString); query = query.WithParam(paramName, options[i]); } return query; }
source share