neo4j-contrib / neo4j-apoc-procedures

Awesome Procedures On Cypher for Neo4j - codenamed "apoc"                     If you like it, please ★ above ⇧            

Home Page:https://neo4j.com/labs/apoc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

apoc.convert.totree not returning some inner relationships

atish-19 opened this issue · comments

below query (query:1)not returning Follows and belongs to relationship for id_str = '2eabebe734977c29165b9bd62f296e39' of post
however when I run the query (query:2) with this id_str in match then it is returning the complete tree.

MATCH (b:Post{isdeleted:false})
WHERE (b.posttype = 'Post' OR b.posttype = 'Poll')
with b
order by b.createdate desc
skip 0
limit 10
MATCH x = (b)
MATCH u1 = (b)<-[:CREATEDPOST]-(us1:User)
Optional Match img = (b)<-[:CREATEDPOST]-(us2:User)-[:HASURL]->(url2:URL)
Optional Match cty= (b)<-[:CREATEDPOST]-(us4:User)-[:BELONGSTO]->(ctt:City)
Optional Match usr11 = (b)<-[:CREATEDPOST]-(us3:User)<-[:FOLLOWS]-(flr:User{customerid:'64373'})
Optional Match p=(b) -[COMMENT*..2]->(c:Post)
Optional Match h = (b) - [:HASURL]->(u:URL)
Optional Match l=(b)<- [:LIKE] - (a:User{customerid:'64373'})
Optional Match o= (b)- [:POLLOPTION] -> (po:PollOption)
Optional Match ans= (b)- [:POLLOPTION] -> (pp:PollOption)- [:ANSWERBY] -> (usr:User)
With (collect (x) + COALESCE(COLLECT(u1),[]) + COALESCE(COLLECT(img),[]) + COALESCE(COLLECT(cty),[]) + COALESCE(COLLECT(usr11),[]) + COALESCE(collect(p),[]) + COALESCE(COLLECT(h),[]) + COALESCE(COLLECT(l),[]) + COALESCE(COLLECT(o),[]) + COALESCE(COLLECT(ans),[])) as path
Call apoc.convert.toTree(path)
Yield value
Return value

Match post with id_str

MATCH (b:Post{id_str:'2eabebe734977c29165b9bd62f296e39'})
WHERE (b.posttype = 'Post' OR b.posttype = 'Poll')
with b
order by b.createdate desc
skip 0
limit 10
MATCH x = (b)
MATCH u1 = (b)<-[:CREATEDPOST]-(us1:User)
Optional Match img = (b)<-[:CREATEDPOST]-(us2:User)-[:HASURL]->(url2:URL)
Optional Match cty= (b)<-[:CREATEDPOST]-(us4:User)-[:BELONGSTO]->(ctt:City)
Optional Match usr11 = (b)<-[:CREATEDPOST]-(us3:User)<-[:FOLLOWS]-(flr:User{customerid:'64373'})
Optional Match p=(b) -[COMMENT*..2]->(c:Post)
Optional Match h = (b) - [:HASURL]->(u:URL)
Optional Match l=(b)<- [:LIKE] - (a:User{customerid:'64373'})
Optional Match o= (b)- [:POLLOPTION] -> (po:PollOption)
Optional Match ans= (b)- [:POLLOPTION] -> (pp:PollOption)- [:ANSWERBY] -> (usr:User)
With (collect (x) + COALESCE(COLLECT(u1),[]) + COALESCE(COLLECT(img),[]) + COALESCE(COLLECT(cty),[]) + COALESCE(COLLECT(usr11),[]) + COALESCE(collect(p),[]) + COALESCE(COLLECT(h),[]) + COALESCE(COLLECT(l),[]) + COALESCE(COLLECT(o),[]) + COALESCE(COLLECT(ans),[])) as path
Call apoc.convert.toTree(path)
Yield value
Return value

Attaching the Graph screenshot here.
graph

Please help me

@atish-19 Do you have the possibility to send us your data set, alternative a smaller CREATE query in order to reproduce the issue?

Best regards Louise, Neo4j