import data

256 views
Skip to first unread message

sally

unread,
Feb 22, 2012, 12:54:05 PM2/22/12
to ne...@googlegroups.com
Hi All,


I want to import my database into neo4j to do traversal on the graph,
I didn't find anything useful in the documentation but there is a useful post here http://lists.neo4j.org/pipermail/user/2011-June/009080.html to import data and it's java implementation is explicitly wrote here https://gist.github.com/1375679

but I can't run this java file because I can't find and import these 2 :
import org.neo4j.mailvision.load.Config;
import org.neo4j.mailvision.load.Tracing;

by the way if anyone knows about other ways to import data from a text file into neo4j, I would be very thankful.
and my other question is how to find those 2 imports? I mean which package should be downloaded and used in the classpath?

-Thanks in advance .
-Sally.de

Michael Hunger

unread,
Feb 22, 2012, 4:28:02 PM2/22/12
to ne...@googlegroups.com
You can use this as a starting point as well:


Those 2 imports are just convenience, just replace them by Config.MILLION 1000*1000 and

either remove the tracing stuff or use this class:

public class Tracing {
    public static long elapsedSeconds(long time) {
        return (System.currentTimeMillis() - time) / 1000;
    }

    public static long elapsedMillis(long time) {
        return (System.currentTimeMillis() - time);
    }

    public static long traceSeconds(long time, String msg) {
        System.out.println(elapsedSeconds(time) + " s: "+ msg);
        return System.currentTimeMillis();
    }
}

Soheila Dehghanzadeh

unread,
Feb 27, 2012, 4:49:42 PM2/27/12
to ne...@googlegroups.com
Hi Michael,
I used batch import but when it tries to run the program it didn't import the nodes.csv and rels.csv
actually I ran TestDataGenerator.java and place 2 files in a db folder in my target folder but my results is like this :

Physical mem: 16077MB, Heap size: 3640MB
use_memory_mapped_buffers=false
neostore.propertystore.db.index.keys.mapped_memory=5M
neostore.propertystore.db.strings.mapped_memory=100M
neostore.propertystore.db.arrays.mapped_memory=215M
neo_store=/Users/mh/java/neo/batchimport/target/db/neostore
neostore.relationshipstore.db.mapped_memory=1000M
neostore.propertystore.db.index.mapped_memory=5M
neostore.propertystore.db.mapped_memory=1000M
dump_configuration=true
cache_type=none
neostore.nodestore.db.mapped_memory=200M
0 seconds

do you know what can be wrong?
Thanks.
Sallyde

Michael Hunger

unread,
Feb 27, 2012, 4:53:30 PM2/27/12
to ne...@googlegroups.com
Did you see the commandline from the readme?

java -server -Xmx4G -jar target/batch-import-jar-with-dependencies.jar target/db nodes.csv rels.csv

target/db is the directory of the new database
the files are actually in the current directory.

Michael

沈首二

unread,
Feb 28, 2012, 6:35:34 AM2/28/12
to ne...@googlegroups.com
May be The program can not read the files ( the nodes.csv and the rels.csv )
you can debugger it !

2012/2/28 Michael Hunger <michael...@neotechnology.com>

Soheila Dehghanzadeh

unread,
Feb 28, 2012, 2:56:33 PM2/28/12
to ne...@googlegroups.com
Hi Michael,
thank you. It was solved and those file was imported . How we can run
BFS on My imported graph?


On Mon, Feb 27, 2012 at 9:53 PM, Michael Hunger

Michael Hunger

unread,
Feb 28, 2012, 4:07:18 PM2/28/12
to ne...@googlegroups.com
Depends on your use-case.

Can you describe your graph model and also what you want to search for?

Michael

Soheila Dehghanzadeh

unread,
Feb 28, 2012, 4:26:00 PM2/28/12
to ne...@googlegroups.com
for example lets consider the graph model the same as the node.csv and rels.csv in the provided example.
I want to find the size of the Strongly connected component by running a BFS. and extract all the connected components ?

Soheila Dehghanzadeh

unread,
Feb 29, 2012, 2:11:32 PM2/29/12
to ne...@googlegroups.com

Soheila Dehghanzadeh

unread,
Feb 29, 2012, 4:37:08 PM2/29/12
to ne...@googlegroups.com
By the way, i don't know how to import the generated nodes.csv and rels.csv into graphDb, does anyone know?
when I try to set the DBPath to the target/db and get the iterator, it only contains one node but I have lots of node in the nodes.csv file !!!!
Iterable<Node> nodesi = graphDb.getAllNodes();//getNodeById(a);
            Iterator<Node> itern = nodesi.iterator();
            firstNode = itern.next();
            System.out.println(">>>>>>"+firstNode.getId());
            secondNode = itern.next();
            System.out.println(">>>>>>"+secondNode.getId());

Max De Marzi Jr.

unread,
Feb 29, 2012, 4:40:20 PM2/29/12
to ne...@googlegroups.com
Sally,

You can go through these two blog posts to get help with the importer:


Regards,
Max

Soheila Dehghanzadeh

unread,
Mar 1, 2012, 5:17:19 AM3/1/12
to ne...@googlegroups.com
Hi Max,

I just want to retrieve imported nodes to run these functions
private static Traverser getFriends( final Node person )
{
    return person.traverse( Order.BREADTH_FIRST,
            StopEvaluator.END_OF_GRAPH,
            ReturnableEvaluator.ALL_BUT_START_NODE, RelTypes.KNOWS,
            Direction.OUTGOING );
}

Let’s perform the actual traversal and print the results:

String output = neoNode.getProperty( "name" ) + "'s friends:\n";
Traverser friendsTraverser = getFriends( neoNode );
for ( Node friendNode : friendsTraverser )
{
    output += "At depth " +
                friendsTraverser.currentPosition().depth() +
                " => " +
                friendNode.getProperty( "name" ) + "\n";
}


looking for a lost ring in my chain??? how to retrieve my imported node???
Reply all
Reply to author
Forward
0 new messages