skip to Main Content

how do I transfer an existing graph database in Neo4j to Apache Age. A step by step guide will be greatly appreciated. I am a beginner.

I couldn’t find the solution online.

3

Answers


  1. You can make use of the APOC with Neo4j to export the graph data into CSV file(s).

    Follow the official Neo4j documentation for that

    Then import the CSV data into Apache AGE.

    Follow the official Apache AGE documentation here.

    Login or Signup to reply.
  2. You have to export the data from the Neo4j in the form of CSV file and after exporting it, you can import that data in the Apache Age.

    Let’s assume we have this movies dataset:

    CREATE (TheMatrix:Movie {title:'The Matrix', released:1999, tagline:'Welcome to the Real World'})
    CREATE (Keanu:Person {name:'Keanu Reeves', born:1964})
    CREATE (Carrie:Person {name:'Carrie-Anne Moss', born:1967})
    CREATE (Laurence:Person {name:'Laurence Fishburne', born:1961})
    CREATE (Hugo:Person {name:'Hugo Weaving', born:1960})
    CREATE (LillyW:Person {name:'Lilly Wachowski', born:1967})
    CREATE (LanaW:Person {name:'Lana Wachowski', born:1965})
    CREATE (JoelS:Person {name:'Joel Silver', born:1952})
    CREATE
    (Keanu)-[:ACTED_IN {roles:['Neo']}]->(TheMatrix),
    (Carrie)-[:ACTED_IN {roles:['Trinity']}]->(TheMatrix),
    (Laurence)-[:ACTED_IN {roles:['Morpheus']}]->(TheMatrix),
    (Hugo)-[:ACTED_IN {roles:['Agent Smith']}]->(TheMatrix),
    (LillyW)-[:DIRECTED]->(TheMatrix),
    (LanaW)-[:DIRECTED]->(TheMatrix),
    (JoelS)-[:PRODUCED]->(TheMatrix);
    

    Now for exporting this data in csv format:

    CALL apoc.export.csv.all("movies.csv", {})
    

    We can use different functions from Neo4j like "apoc.export.csv.data" or "apoc.export.csv.query" to export data in the form of separate labels and edges files. Once we have the data in labels and edges form we can use that to import it in Apache Age.

    Importing data in Apache Age:

    We can load the labels from file using this command:

    load_labels_from_file('<graph name>', 
                      '<label name>',
                      '<file path>', 
                      false)
    #The fourth parameter is optional, use this only when you have no id field in file.
    

    The CSV format for this file is as follows:

    id – properties

    The id column will be exempted if we have given the fourth parameter and it’s false.

    For loading relationships, this function will be used:

    load_edges_from_file('<graph name>',
                    '<label name>',
                    '<file path>');
    

    The CSV format for this file is as follows:

    start_id – start_vertex_type – end_id – end_vertex_type – properties

    Login or Signup to reply.
  3. Here’s a link to a similar question:

    Export Data to CSV files from Neo4j

    And import this file to APACHE AGE, following this tutorial:

    AGE LOAD CSV FILES

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search