Hi,

What is the total number of edges in the graph? Also how much RAM does
the computer have you are running this on?

The batch inserter needs to be configured properly as described in the
last section on the wiki page
[http://wiki.neo4j.org/content/Batch_Insert] to achieve best
performance.

Another thing is the getNodeProperties is very slow so if you could remove:


while(!neo.getNodeProperties(tale).get("TYPE").equals("title")) {
                    tale = it.next();
                }

it should speed things up. Also I see that you add 3 properties (or
more since properties map is never cleared or instantiated in that
method) to each relationship created:

                properties.put("NLC", tokens[2]);
                properties.put("TYPE", tokens[3]);
                properties.put("RelationshipType", "REF_TITLE");

this will also slow down relationship creates. The last property could
be removed since it will be identical on all relationships. "TYPE"
property should be encoded in the relationship type (such as
MyRelationshipTypes.REF_TITLE). "NLC" could maybe also be removed if
it is the same as the "NLC" property on either of the relationship's
nodes.

Regards,
-Johan

On Tue, Aug 25, 2009 at 11:02 AM, Vanessa Junquero
Trabado<vanessitajunqu...@hotmail.com> wrote:
>
> Hi,
>
> I have followed the steps in the wiki but I still have the
> same problem. I have no problems when I load the nodes of the graph but
> when I try to load the edges the program becomes very very slow. I have
> calculated that the program lasts 5 days more or less to load the all
> graph.
>
>
> The load of the nodes is as follows:
>
>    public static void createImageNodes(BatchInserter neo, 
> LuceneIndexBatchInserter indexService) throws IOException {
>
>               BufferedReader bfEntry = null;
>
>            try {
>                bfEntry = new BufferedReader(new 
> FileReader("rdbms_images.csv"));
>            } catch(FileNotFoundException e) {
>                System.out.print("Error: Fitxer no trobat");
>
>            }
>
>            long node;
>            String linea = bfEntry.readLine();
>            String attrID, attrNLC, attrFILENAME;
>            StringTokenizer tokens;
>            while((linea = bfEntry.readLine())!=null) {
>
>
>                tokens = new StringTokenizer(linea,";");
>                attrID = tokens.nextToken();
>                properties.put("ID", attrID);
>                attrNLC = tokens.nextToken();
>
>                properties.put("NLC", attrNLC);
>                attrFILENAME = tokens.nextToken();
>                properties.put("FILENAME", attrFILENAME);
>                properties.put("TYPE", "image");
>
>                node = neo.createNode(properties);
>                indexService.index(node, "ID", attrID);
>                indexService.index(node, "NLC", attrNLC);
>                indexService.index(node, "FILENAME", attrFILENAME);
>
>                indexService.index(node, "TYPE", "image");
>                nNodes++;
>            }
>            indexService.optimize();
>    }
>
> And the load of the edges is as follows:
>
>
> public static void createRelationsBetweenTitles(BatchInserter neo, 
> LuceneIndexBatchInserter indexService) throws IOException {
>
>               BufferedReader bfEntry = null;
>            try {
>                bfEntry = new BufferedReader(new 
> FileReader("rdbms_refs_title.csv"));
>
>            } catch(FileNotFoundException e) {
>                System.out.print("Error: Fitxer no trobat");
>            }
>
>            Iterator<Long> it;
>            String linea = bfEntry.readLine();
>
>            long head, tale;
>            while((linea = bfEntry.readLine()) != null) {
>
>                String tokens[] = new String[4];
>                tokens = linea.split(";");
>                it = indexService.getNodes("ID", tokens[0]).iterator();
>
>                tale = it.next();
>                
> while(!neo.getNodeProperties(tale).get("TYPE").equals("title")) {
>                    tale = it.next();
>                }
>                it = indexService.getNodes("ID", tokens[1]).iterator();
>
>                head = it.next();
>                
> while(!neo.getNodeProperties(head).get("TYPE").equals("title")) {
>                    head = it.next();
>                }
>                properties.put("NLC", tokens[2]);
>
>                properties.put("TYPE", tokens[3]);
>                properties.put("RelationshipType", "REF_TITLE");
>                neo.createRelationship( tale, head, 
> MyRelationshipTypes.REF_TITLE, properties );
>
>            }
>    }
>
> Any idea?
>
> Thank you for your help.
>
> Vanesa.
_______________________________________________
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to