Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Data Loading Neo4j Graphs From SQL Sources

DZone's Guide to

Data Loading Neo4j Graphs From SQL Sources

· Integration Zone ·
Free Resource

SnapLogic is the leading self-service enterprise-grade integration platform. Download the 2018 GartnerMagic Quadrant for Enterprise iPaaS or play around on the platform, risk free, for 30 days.

Neo4j is a powerful graph database that can be used for analytics, recommendation engines, social graphs and many more applications. In the following example we demonstrate in a few steps how you can load Neo4j from your legacy relations SQL source. If you need to get the mule studio: http://www.mulesoft.org/download-mule-esb-community-edition

Create a new mule project, and in the Mule flow:

  1. trigger an event from a web page. The default is http://localhost;8080
  2.  It will do a database query, in my case a simple Select
  3. Inline image 1
    3. Insert the returned map into Neo4j

    Inline image 4

    4.There are 3 lines of script to print the result

    import org.mule.modules.neo4j.model.Node
    Node myNode = payload
    System.err.println “Created node with id: ” + myNode.getId()
    In my console, I see the map of data extracted and then a node with properties created in Neo4j. Inline image 5 Some misc bits ... the choice block is there in the front because a browser will make 2 calls:
    • the first is a real page request
    • the second asks for the page browser icon “/favicon.ico”
    So the choice block filters this out to ensure that there is only 1 call.

    A real world application would probably use a polling even and have and split database records, or use Neo4j's bulk upload. However, I hope this gives you a taste of how easy integration can be. 

With SnapLogic’s integration platform you can save millions of dollars, increase integrator productivity by 5X, and reduce integration time to value by 90%. Sign up for our risk-free 30-day trial!

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}