MATCH (p:Project{id:"p1test"})<-[r1:TICKET]-(:Ticket)
MATCH (u:User{id:"user1test"})
WITH u, COUNT(r1) + 1 AS issNo, p
CREATE (p)<-[rel:TICKET]-(t: Ticket {id:apoc.create.uuid(), title:"T1", hourEstimate:9, desc:"hELLO", done:false, issueNumber: issNo })<-[:CREATED {timestamp: apoc.date.currentTimestamp()}]-(u)
RETURN t
This statement returns no mathcing record, and none of the nodes or relationships get created..
I'm trying to create a ticket node, with an issue number property that matches the number of tickets already related to project node + 1.
First 2 line of your code is trying to join two datasets coming from match. As there is no relationship visible between it will not return any row.
MATCH (p:Project{id:"p1test"})<-[r1:TICKET]-(:Ticket)
MATCH (u:User{id:"user1test"})
In fact if you try below it will not give you any result.
MATCH (p:Project{id:"p1test"})<-[r1:TICKET]-(:Ticket)
MATCH (u:User{id:"user1test"})
Return p, u,r1
If nothing's getting created, then one of your two MATCH patterns aren't finding any matching paths.
Try running each MATCH separately, returning the node (or nodes) in its own query. That should show you which one is finding no matches in the graph.
Then it's up to you to figure out why it's not finding any nodes. Typos in the query? Typos in your graph data? Does the project not have any tickets? Something is off there. Once you fix whatever needs fixing such that both MATCHes can find results in the graph, then your query should work.
MATCH (p:Project),(u:User)
WHERE p.id = 'p1test' AND u.id = 'user1test'
CREATE (p)<-[:TICKET]-(t: Ticket {id:apoc.create.uuid(), title:"t1", hourEstimate:9, desc:"hello", done:false})<-[:CREATED {timestamp: apoc.date.currentTimestamp()}]-(u)
WITH p, t
MATCH (p)<-[r1:TICKET]-(:Ticket)
WITH COUNT(r1) AS issNo,t
SET t.issueNumber = issNo
RETURN t
Would be nice to condense it down.. does anyone have any thoughts?
hey @q6qgs, if you are trying to create a new ticket for the project having no tickets, this match query gives you null. That's why this statement does not create any node and relationship.
on the other hand, here you first create a ticket for a particular project and then you try to find pattern with match clause, that's why you always get the result