[Neo] Node not found using BatchInserter

Amir Hossein Jadidinejad amir.jadidi at yahoo.com
Thu Apr 1 09:57:37 CEST 2010


Ok. Thank you very much.
I just want to load a huge graph but during insertion I have to lookup for previous relations (In order to prevent of duplicate relations). Using BatchInserter isn't applicable?, Better idea?

--- On Thu, 4/1/10, Mattias Persson <mattias at neotechnology.com> wrote:

From: Mattias Persson <mattias at neotechnology.com>
Subject: Re: [Neo] Node not found using BatchInserter
To: "Neo user discussions" <user at lists.neo4j.org>
Date: Thursday, April 1, 2010, 2:32 AM

rel_itr.next() returns relationship ids, not node ids... that's why you get
those NotFoundExceptions. What you'd need to do is to
inserter.getRelationshipById( <rel-id> ) on those ids and get either start
or end node from it.

But, is it really right to use the batch inserter in your case?
BatchInserter is only meant to be used if you're doing a one-time initial
loading of a big dataset, but never in production or when you have a
database containing data. Use the EmbeddedGraphDatabase for normal use.

2010/3/31 Amir Hossein Jadidinejad <amir.jadidi at yahoo.com>

> Hi,
> Check the following code:
>             for (Iterator<Long> rel_itr =
> inserter.getRelationshipIds(current_node).iterator(); rel_itr.hasNext();) {
>                 long neighbor = rel_itr.next();
>                 if (neighbor != current_node && neighbor != -1) {
>                     try {
>
> exist_neighbors.add(inserter.getNodeProperties(neighbor).get("cui").toString());
>                     } catch (Exception e) {
>                         e.printStackTrace();
>                     }
>                 }
>             }
>
> After running, I have a lot of this error:
> org.neo4j.graphdb.NotFoundException: id=3225225
>     at
> org.neo4j.kernel.impl.batchinsert.BatchInserterImpl.getNodeRecord(BatchInserterImpl.java:517)
>     at
> org.neo4j.kernel.impl.batchinsert.BatchInserterImpl.getNodeProperties(BatchInserterImpl.java:238)
>     at org.qiau.wnng.build.BuildGraph.addAllNodes(BuildGraph.java:220)
>     at org.qiau.wnng.build.BuildGraph.main(BuildGraph.java:288)
>
> Is it possible that a neighbor node not found while "getRelationshipIds"
> method return it?!
>
>
>
>
> _______________________________________________
> Neo mailing list
> User at lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>



-- 
Mattias Persson, [mattias at neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com
_______________________________________________
Neo mailing list
User at lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user



      


More information about the User mailing list