neo4j - Cypher LinkedList Match by index but "Don't know how to compare that." instead -


i having trouble match index , hoping can help. related discussion can found @ post: cypher linked list: how unshift , replace index

first run following unshift query 3 times in order populate linked list relationships , nodes

match (p {id: '123a'}) optional match (p)-[r:foo]->(c) p, r, collect(c) cs merge (cnew {     id:'456b'    // , '789c' , 'wxyz' }) create (p)-[rnew:foo {     isfavorite:false,     isopen:false,     currenttab:'all',     currentdate:2015-10-30t07:00:00.000z }]->(cnew) foreach (x in cs |      create (cnew)-[:foo {         isfavorite:r.isfavorite,         isopen:r.isopen,         currenttab:r.currenttab,         currentdate:r.currentdate     }]->(x)     delete r) return p, rnew, cnew 

afterwords can fetch output query can see have 3 elements in linkedlist array under relationship label foo

match ()-[r:`language-arts_allresources`]->() return r  isfavorite  false isopen  false currenttab  currentdate 2015-10-30t07:00:00.000z  isfavorite  false isopen  false currenttab  currentdate 2015-10-30t07:00:00.000z  isfavorite  false isopen  false currenttab  currentdate 2015-10-30t07:00:00.000z 

i try query first index cypher query

match (p { id:"123a" }) match (p)-[:foo*1]->()-[r:foo]->(c) return c 

but coming error below:

don't know how compare that. left: [:foo[8258]  {isfavorite:false,isopen:false,currenttab:"all",currentdate:"2015-10-  30t07:00:00.000z"}] ($colon$colon); right: :foo[8260]  {isfavorite:false,isopen:false,currenttab:"all",currentdate:"2015-10-  30t07:00:00.000z"} (relationshipproxy) 

i tried fetching query:

match (p { id:"123a" }) match (p)-[:foo*2]->(c) return c 

and output comes back

id  789c // index 1 

i have slight confusion whether index 1 should fetched integer 0 or 1 or 2 confusion sure can sorted out once passed 'don't know how compare that.' error. please me guidance right way fetch index , avoid error listed above.

i grateful help

** note **

after reading cybersam's answer, have run following tests on linked list structure mentioned above contains 3 elements

this query returns child @ index 0 position:

match (p { id:'123a' }) match (p)-[:foo*0]->()-[r:foo]->(c) return c 

this query returns child @ index 1 position:

match (p { id:'123a' }) match (p)-[:foo]->()-[r:foo]->(c) return c 

this query returns "don't know how compare that." error

match (p { id:'123a' }) match (p)-[:foo*1]->()-[r:foo]->(c) return c 

this query returns child @ index 2 position:

match (p { id:'123a' }) match (p)-[:foo*2]->()-[r:foo]->(c) return c 

i assuming last 1 works >= 2

cypher seems confused (as far can tell) legal [:foo*1] syntax. if used [:foo] instead, logically equivalent, have avoided error.

but, actually, way index 0 child is:

match (p { id:"123a" }) match (p)-[r:foo]->(c) return c; 

or, 0 index child in more generic way, work. generic pattern should always work index (by replacing 0 desired index), there seems bug (as stated above) in cypher when using 1:

match (p { id:"123a" }) match (p)-[:foo*0]->()-[r:foo]->(c) return c 

i have created neo4j issue 5799 this.


Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -