Re: [Neo4j] NoSuchElementException
2011/7/18 sulabh choudhury > Though when I think about it, I guess I would still have the issue of > getting duplicate nodes. > > Say I have 1 million node1, node2, rel entries to put in Neo, > What you are suggesting is that I do a Batch of all sets of node1,node2 > first and then flush and go about inserting all rels in the next batch > insert > Since I can have duplicate nodes in the 1million entries, how do I make > sure that all the nodes within a Batch insert are unique? > > Do I maintain another index within a batch insert (say a > hahmap) which would have entries of node and its indices, or is there a > better way ? > > If the dataset is small enough you could have it in a HashMap, but otherwise you could run that set through some pre-processing before inserting which removes duplicates... I think that would be the best alternative. > > On Mon, Jul 18, 2011 at 11:39 AM, sulabh choudhury wrote: > >> Makes sense. Will try that. >> Thanks. >> >> >> On Fri, Jul 15, 2011 at 2:59 PM, sulabh choudhury wrote: >> >>> Well while inserting the nodes I keep a >>> check batchInserter.nodeExists(node1) so I would guess a node would not be >>> duplicated. >>> Otherwise during a traversal I guess duplicate nodes. IIs there a way I >>> can look into the BtachInsert data before I flush so that I can make sure no >>> duplicate data has been inserted ? >>> >>> On Sat, Jun 25, 2011 at 10:49 AM, sulabh choudhury wrote: >>> Thank you Jim. I will wait for 1.5 and hope it resolves the issue :) On Fri, Jun 24, 2011 at 7:11 PM, sulabh choudhury wrote: > Hi, > > I just downloaded the neo4j-community-1.4.M04. I stumbled into the > java.util.NoSuchElementException: More than one element in > org.neo4j.index.impl.lucene.LuceneIndex$1@396cbd97. First element is > 'Node[3]' and the second element is 'Node[2]' > at > org.neo4j.helpers.collection.IteratorUtil.singleOrNull(IteratorUtil.java:114) > ~[working_graphGen.jar:na] > at > org.neo4j.index.impl.lucene.IdToEntityIterator.getSingle(IdToEntityIterator.java:88) > ~[working_graphGen.jar:na] > at > org.neo4j.index.impl.lucene.IdToEntityIterator.getSingle(IdToEntityIterator.java:32) > ~[working_graphGen.jar:na] > > I looked up and found that this is a bug and has been fixed. I was > wondering if the fix has been incorporated in the latest Milestone or not? > -- -- Thanks and Regards, Sulabh Choudhury >>> >>> >>> -- >>> >>> -- >>> Thanks and Regards, >>> Sulabh Choudhury >>> >>> >> >> >> > > > -- Mattias Persson, [matt...@neotechnology.com] Hacker, Neo Technology www.neotechnology.com ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] NoSuchElementException
Though when I think about it, I guess I would still have the issue of getting duplicate nodes. Say I have 1 million node1, node2, rel entries to put in Neo, What you are suggesting is that I do a Batch of all sets of node1,node2 first and then flush and go about inserting all rels in the next batch insert Since I can have duplicate nodes in the 1million entries, how do I make sure that all the nodes within a Batch insert are unique? Do I maintain another index within a batch insert (say a hahmap) which would have entries of node and its indices, or is there a better way ? On Mon, Jul 18, 2011 at 11:39 AM, sulabh choudhury wrote: > Makes sense. Will try that. > Thanks. > > > On Fri, Jul 15, 2011 at 2:59 PM, sulabh choudhury wrote: > >> Well while inserting the nodes I keep a >> check batchInserter.nodeExists(node1) so I would guess a node would not be >> duplicated. >> Otherwise during a traversal I guess duplicate nodes. IIs there a way I >> can look into the BtachInsert data before I flush so that I can make sure no >> duplicate data has been inserted ? >> >> On Sat, Jun 25, 2011 at 10:49 AM, sulabh choudhury wrote: >> >>> Thank you Jim. >>> I will wait for 1.5 and hope it resolves the issue :) >>> >>> >>> On Fri, Jun 24, 2011 at 7:11 PM, sulabh choudhury wrote: >>> Hi, I just downloaded the neo4j-community-1.4.M04. I stumbled into the java.util.NoSuchElementException: More than one element in org.neo4j.index.impl.lucene.LuceneIndex$1@396cbd97. First element is 'Node[3]' and the second element is 'Node[2]' at org.neo4j.helpers.collection.IteratorUtil.singleOrNull(IteratorUtil.java:114) ~[working_graphGen.jar:na] at org.neo4j.index.impl.lucene.IdToEntityIterator.getSingle(IdToEntityIterator.java:88) ~[working_graphGen.jar:na] at org.neo4j.index.impl.lucene.IdToEntityIterator.getSingle(IdToEntityIterator.java:32) ~[working_graphGen.jar:na] I looked up and found that this is a bug and has been fixed. I was wondering if the fix has been incorporated in the latest Milestone or not? >>> >>> >>> >>> -- >>> >>> -- >>> Thanks and Regards, >>> Sulabh Choudhury >>> >>> >> >> >> -- >> >> -- >> Thanks and Regards, >> Sulabh Choudhury >> >> > > > ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] NoSuchElementException
Makes sense. Will try that. Thanks. On Fri, Jul 15, 2011 at 2:59 PM, sulabh choudhury wrote: > Well while inserting the nodes I keep a > check batchInserter.nodeExists(node1) so I would guess a node would not be > duplicated. > Otherwise during a traversal I guess duplicate nodes. IIs there a way I can > look into the BtachInsert data before I flush so that I can make sure no > duplicate data has been inserted ? > > On Sat, Jun 25, 2011 at 10:49 AM, sulabh choudhury wrote: > >> Thank you Jim. >> I will wait for 1.5 and hope it resolves the issue :) >> >> >> On Fri, Jun 24, 2011 at 7:11 PM, sulabh choudhury wrote: >> >>> Hi, >>> >>> I just downloaded the neo4j-community-1.4.M04. I stumbled into the >>> java.util.NoSuchElementException: More than one element in >>> org.neo4j.index.impl.lucene.LuceneIndex$1@396cbd97. First element is >>> 'Node[3]' and the second element is 'Node[2]' >>> at >>> org.neo4j.helpers.collection.IteratorUtil.singleOrNull(IteratorUtil.java:114) >>> ~[working_graphGen.jar:na] >>> at >>> org.neo4j.index.impl.lucene.IdToEntityIterator.getSingle(IdToEntityIterator.java:88) >>> ~[working_graphGen.jar:na] >>> at >>> org.neo4j.index.impl.lucene.IdToEntityIterator.getSingle(IdToEntityIterator.java:32) >>> ~[working_graphGen.jar:na] >>> >>> I looked up and found that this is a bug and has been fixed. I was >>> wondering if the fix has been incorporated in the latest Milestone or not? >>> >> >> >> >> -- >> >> -- >> Thanks and Regards, >> Sulabh Choudhury >> >> > > > -- > > -- > Thanks and Regards, > Sulabh Choudhury > > ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] NoSuchElementException
get/query methods are only guaranteed to return stuff added before the latest call to flush() (it's all there in the javadocs). I think that's why you probably get stale results from get/query. flush(), or at least the first get/query after a flush() is expensive so try to minimize the number of calls to flush(). Do this by having different steps in your batch insertion, f.ex. one where you insert all nodes and index them... call flush() and then insert relationships. 2011/7/15 sulabh choudhury > Well while inserting the nodes I keep a > check batchInserter.nodeExists(node1) so I would guess a node would not be > duplicated. > Otherwise during a traversal I guess duplicate nodes. IIs there a way I can > look into the BtachInsert data before I flush so that I can make sure no > duplicate data has been inserted ? > > On Sat, Jun 25, 2011 at 10:49 AM, sulabh choudhury wrote: > >> Thank you Jim. >> I will wait for 1.5 and hope it resolves the issue :) >> >> >> On Fri, Jun 24, 2011 at 7:11 PM, sulabh choudhury wrote: >> >>> Hi, >>> >>> I just downloaded the neo4j-community-1.4.M04. I stumbled into the >>> java.util.NoSuchElementException: More than one element in >>> org.neo4j.index.impl.lucene.LuceneIndex$1@396cbd97. First element is >>> 'Node[3]' and the second element is 'Node[2]' >>> at >>> org.neo4j.helpers.collection.IteratorUtil.singleOrNull(IteratorUtil.java:114) >>> ~[working_graphGen.jar:na] >>> at >>> org.neo4j.index.impl.lucene.IdToEntityIterator.getSingle(IdToEntityIterator.java:88) >>> ~[working_graphGen.jar:na] >>> at >>> org.neo4j.index.impl.lucene.IdToEntityIterator.getSingle(IdToEntityIterator.java:32) >>> ~[working_graphGen.jar:na] >>> >>> I looked up and found that this is a bug and has been fixed. I was >>> wondering if the fix has been incorporated in the latest Milestone or not? >>> >> >> >> >> -- >> >> -- >> Thanks and Regards, >> Sulabh Choudhury >> >> > > > -- > > -- > > Thanks and Regards, > Sulabh Choudhury > > > -- Mattias Persson, [matt...@neotechnology.com] Hacker, Neo Technology www.neotechnology.com ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] NoSuchElementException
Well while inserting the nodes I keep a check batchInserter.nodeExists(node1) so I would guess a node would not be duplicated. Otherwise during a traversal I guess duplicate nodes. IIs there a way I can look into the BtachInsert data before I flush so that I can make sure no duplicate data has been inserted ? On Sat, Jun 25, 2011 at 10:49 AM, sulabh choudhury wrote: > Thank you Jim. > I will wait for 1.5 and hope it resolves the issue :) > > > On Fri, Jun 24, 2011 at 7:11 PM, sulabh choudhury wrote: > >> Hi, >> >> I just downloaded the neo4j-community-1.4.M04. I stumbled into the >> java.util.NoSuchElementException: More than one element in >> org.neo4j.index.impl.lucene.LuceneIndex$1@396cbd97. First element is >> 'Node[3]' and the second element is 'Node[2]' >> at >> org.neo4j.helpers.collection.IteratorUtil.singleOrNull(IteratorUtil.java:114) >> ~[working_graphGen.jar:na] >> at >> org.neo4j.index.impl.lucene.IdToEntityIterator.getSingle(IdToEntityIterator.java:88) >> ~[working_graphGen.jar:na] >> at >> org.neo4j.index.impl.lucene.IdToEntityIterator.getSingle(IdToEntityIterator.java:32) >> ~[working_graphGen.jar:na] >> >> I looked up and found that this is a bug and has been fixed. I was >> wondering if the fix has been incorporated in the latest Milestone or not? >> > > > > -- > > -- > Thanks and Regards, > Sulabh Choudhury > > -- -- Thanks and Regards, Sulabh Choudhury ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] NoSuchElementException
Hi sulabh, this is expected behaviour and not a bug... at least I think it is. That exception is thrown when IndexHits#getSingle() is called, but there were more than one item in the result. So it's probably due to that. Could you verify that you really only have one value in there? Also are you in a transaction where you've modified state here? It would be very helpful with a simple piece of code to reproduce it. If it indeed is a bug then it could be circumvented by doing. // org.neo4j.helpers.collection.IteratorUtil Node myNode = IteratorUtil.firstOrNull( myIndex.get( myKey, myValue ) ); Best, Mattias 2011/6/25 sulabh choudhury > Hi, > > I just downloaded the neo4j-community-1.4.M04. I stumbled into the > java.util.NoSuchElementException: More than one element in > org.neo4j.index.impl.lucene.LuceneIndex$1@396cbd97. First element is > 'Node[3]' and the second element is 'Node[2]' > at > > org.neo4j.helpers.collection.IteratorUtil.singleOrNull(IteratorUtil.java:114) > ~[working_graphGen.jar:na] > at > > org.neo4j.index.impl.lucene.IdToEntityIterator.getSingle(IdToEntityIterator.java:88) > ~[working_graphGen.jar:na] > at > > org.neo4j.index.impl.lucene.IdToEntityIterator.getSingle(IdToEntityIterator.java:32) > ~[working_graphGen.jar:na] > > I looked up and found that this is a bug and has been fixed. I was > wondering > if the fix has been incorporated in the latest Milestone or not? > ___ > Neo4j mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user > -- Mattias Persson, [matt...@neotechnology.com] Hacker, Neo Technology www.neotechnology.com ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] NoSuchElementException
Thank you Jim. I will wait for 1.5 and hope it resolves the issue :) On Fri, Jun 24, 2011 at 7:11 PM, sulabh choudhury wrote: > Hi, > > I just downloaded the neo4j-community-1.4.M04. I stumbled into the > java.util.NoSuchElementException: More than one element in > org.neo4j.index.impl.lucene.LuceneIndex$1@396cbd97. First element is > 'Node[3]' and the second element is 'Node[2]' > at > org.neo4j.helpers.collection.IteratorUtil.singleOrNull(IteratorUtil.java:114) > ~[working_graphGen.jar:na] > at > org.neo4j.index.impl.lucene.IdToEntityIterator.getSingle(IdToEntityIterator.java:88) > ~[working_graphGen.jar:na] > at > org.neo4j.index.impl.lucene.IdToEntityIterator.getSingle(IdToEntityIterator.java:32) > ~[working_graphGen.jar:na] > > I looked up and found that this is a bug and has been fixed. I was > wondering if the fix has been incorporated in the latest Milestone or not? > -- -- Thanks and Regards, Sulabh Choudhury ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] NoSuchElementException
Hi Sulabh, An empiricist would say: run your test against the snapshot/latest source or against M05 (out next week) and see :-) Jim On 25 Jun 2011, at 03:11, sulabh choudhury wrote: > Hi, > > I just downloaded the neo4j-community-1.4.M04. I stumbled into the > java.util.NoSuchElementException: More than one element in > org.neo4j.index.impl.lucene.LuceneIndex$1@396cbd97. First element is > 'Node[3]' and the second element is 'Node[2]' > at > org.neo4j.helpers.collection.IteratorUtil.singleOrNull(IteratorUtil.java:114) > ~[working_graphGen.jar:na] > at > org.neo4j.index.impl.lucene.IdToEntityIterator.getSingle(IdToEntityIterator.java:88) > ~[working_graphGen.jar:na] > at > org.neo4j.index.impl.lucene.IdToEntityIterator.getSingle(IdToEntityIterator.java:32) > ~[working_graphGen.jar:na] > > I looked up and found that this is a bug and has been fixed. I was wondering > if the fix has been incorporated in the latest Milestone or not? > ___ > Neo4j mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
[Neo4j] NoSuchElementException
Hi, I just downloaded the neo4j-community-1.4.M04. I stumbled into the java.util.NoSuchElementException: More than one element in org.neo4j.index.impl.lucene.LuceneIndex$1@396cbd97. First element is 'Node[3]' and the second element is 'Node[2]' at org.neo4j.helpers.collection.IteratorUtil.singleOrNull(IteratorUtil.java:114) ~[working_graphGen.jar:na] at org.neo4j.index.impl.lucene.IdToEntityIterator.getSingle(IdToEntityIterator.java:88) ~[working_graphGen.jar:na] at org.neo4j.index.impl.lucene.IdToEntityIterator.getSingle(IdToEntityIterator.java:32) ~[working_graphGen.jar:na] I looked up and found that this is a bug and has been fixed. I was wondering if the fix has been incorporated in the latest Milestone or not? ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user