Reputation: 574
VB.NET program that loads a few thousand nodes and set up relationships between them. I'm using the Neo4J C# Client (version 1.1.0.8)
One of the commands is
TheConnection.GraphClient.Cypher.Match(
"(user1:StartingPoint)",
"(user2:Committee)"
).Where(
Function(user1 As StartingPoint)
user1.Id = KnowsID
).AndWhere(
Function(user2 As Committee)
user2.Id = KnownID
).Create(
"user1-[r: Knows ]->user2"
).ExecuteWithoutResults()
For various business logic reasons I want to match the nodes by FECIDNumber (it's actually a string, in example 'C00530767') instead of ID. So I changed
This gives me following query
TheConnection.GraphClient.Cypher.Match(
"(user1:StartingPoint)",
"(user2:Committee)"
).Where(
Function(user1 As StartingPoint)
user1.Id = KnowsID
).AndWhere(
Function(user2 As Committee) user2.FECIDNumber = KnownID
).Create(
"user1-[r: Knows ]->user2"
).ExecuteWithoutResults()
When executed it throws
{"SyntaxException: Invalid input '{':expected an identifier character, whitespace, '?', '!', '.', node labels, '[', ""=~"", IN, STARTS, ENDS, CONTAINS, IS, '^', '*', '/', '%', '+', '-', '=', ""<>"", ""!="", '<', '>', ""<="", "">="", AND, XOR, OR or ')' (line 3, column 23 (offset: 95))" & vbLf & """AND (user2.FECIDNumber{p1}{p2} = {p3})" & vbCr & """" & vbLf & " ^"}
When I go into the Neo4J Browser and run
MATCH (user:Committee) WHERE user.FECIDNumber = "C00530766" RETURN user
it returns the node as expected.
I think the important part of the error seems to be
(line 3, column 23 (offset: 95))
" & vbLf & """AND (user2.FECIDNumber{p1}{p2} = {p3})" & vbCr & """" & vbLf & "
It looks like the Neo4J C# Client is tossing in a second parameter {p2}
, but that's just a guess.
Any suggestions?
Edit 1
(I didn't know I could even pull the raw query text)
It's returning
MATCH (user1:StartingPoint), (user2:Committee)
WHERE (user1.Id = 1)
AND (user2.FECIDNumber"C00530766"false = 0)
CREATE user1-[r: Knows ]->user2
Clearly the problem is that
user2.FECIDNumber = KnownID).Create("user1-[r: Knows ]->user2")
is somehow generating
user2.FECIDNumber"C00530766"false = 0
Ideas? Is there a different syntax I should be using? Do I need to convert FECIDNumber to a different type?
Edit 2
The same code now generates
MATCH (user1:StartingPoint), (user2:Committee)
WHERE (user1.Id = 1)
AND (user2.FECIDNumber = "C00530766")
CREATE user1-[r: Knows ]->user2
And it creates the relationship as expected.
Winner.....
Upvotes: 0
Views: 2181
Reputation: 6270
I have published a version (1.1.0.26) which should resolve this for you, it'll take a few mins for Nuget to index it, so give it 1/2 an hour or so from when this is posted...
Let me know!
Upvotes: 1