[Neo4j] Loading MySQL dump
Peter Neubauer
peter.neubauer at neotechnology.com
Sat Dec 18 13:37:40 CET 2010
Btw,
On the SQL importer, feedback would be great so it can be made even more useful!
/peter
On Saturday, December 18, 2010, Axel Morgner <axel at morgner.de> wrote:
> Hello Abhi,
>
> you may have a look at the SQL Importer [1].
>
> If you need more control over the import mechanism, and you have MySQL
> tables as XML (f.e. using mysqladmin export), you may use dom4j, Commons
> StringUtils and Java to parse it.
>
> Within a Neo4j transaction, read the XML document, e.g. like this:
>
> SAXReader xmlReader = new SAXReader();
> try {
>
> Document xmlDoc = xmlReader.read(filename);
>
> Element root = xmlDoc.getRootElement();
> List<Element> rootChildren = root.elements();
>
> // Then iterate through child nodes
> for (Element e : rootChildren) {
>
> // Create a node
> Node node = graphDb.createNode();
> String p = e.elementTextTrim(tagName);
> if (StringUtils.isNotBlank(p)) { // optional
> node.setProperty(propertyKey, p);
> }
>
> [...]
>
> } catch (DocumentException ex) {
> [...]
> }
>
> Depending of your data model (start here: [2], you may create a node
> structure with some major nodes (= tables) before adding sub nodes (= rows).
>
> If you got large dumps to import, you may use the Neo4j BatchInserter [3].
>
>
> Greetings
>
> Axel
>
> [1] http://wiki.neo4j.org/content/SQL_Importer
> [2] http://wiki.neo4j.org/content/Domain_Modeling_Gallery
> [3] http://wiki.neo4j.org/content/Batch_Insert
>
> On 18.12.2010 05:22, Abhi wrote:
>> Hello,
>>
>> I have a huge corpus of MySQL dump files of life sciences data which I would
>> like to load into Neo4j. Is there an importer available for this? If not,
>> what is the standard way to go about this problem? Is there any wiki or
>> links for guidance?
>>
>
> _______________________________________________
> Neo4j mailing list
> User at lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>
More information about the User
mailing list