skip to Main Content

I am trying to create a graph using Apache AGE Viewer, but when I enter a name for the graph and click "Done", I receive the following error message:

subunit

An error occurred
Error Code: undefined
Error Details: TypeError: Cannot read properties of undefined (reading 'map')

I am running the latest version of Apache AGE Viewer on WSL2 with MacO I am logged in as the Superuser and am able to create graph databases by writing queries manually.

2

Answers


  1. This could be because of the reason that you are trying to access a graph or database that has not been created or initialized yet.

    You can solve this error by creating a new graph using the command.

    Run the server.

    npm run start
    

    Create a database using the commands.

    bin/pg_ctl -D example -l logfile start 
    
    bin/createdb exampledb
    

    Load AGE in your database

    CREATE extension age; 
    
    Load 'age';  
    
    SET search_path = ag_catalog, "$user", public;
    

    Create any graph using the commands.

    SELECT create_graph('example_graph'); 
    
    SELECT * FROM cypher('example_graph', $$ MATCH (v) RETURN v $$) as (v agtype);
    

    In the code above, example_graph is the name of our graph. You can use whatever you want.

    This should solve your problem. Now you can use age-viewer to visualize your graph.

    If you are still facing issue. you can follow this guide installing and running age-viewer on linux.

    Login or Signup to reply.
  2. Try creating a new db cluster also check if you have node js 14.16.0 as it is prefered as this looks like a problem of a missing graph or an absent databse

    bin/initdb demo
    

    then start the server and create a database

    bin/pg_ctl -D demo -l logfile start
    bin/createdb demodb
    

    just in case if you want to chnage the port number

    bin/createdb --port=5430 demodb
    

    load AGE

    CREATE EXTENSION age;
    LOAD 'age';
    SET search_path = ag_catalog, "$user", public;
    

    in another terminal start your age viewer

    cd age-viewer
    
    npm run setup
    npm run start
    

    another problem may be that you have not created the relation between the nodes
    try this then

        SELECT * FROM cypher('demo_graph', $$ CREATE (n:Person {name : "imran", bornIn : "Pakistan"}) $$) AS (a agtype);
    SELECT * FROM cypher('demo_graph', $$ CREATE (n:Person {name : "ali", bornIn : "Pakistan"}) $$) AS (a agtype);
    SELECT * FROM cypher('demo_graph', $$ CREATE (n:Person {name : "usama", bornIn : "Pakistan"}) $$) AS (a agtype);
    SELECT * FROM cypher('demo_graph', $$ CREATE (n:Person {name : "akabr", bornIn : "Pakistan"}) $$) AS (a agtype);
    SELECT * FROM cypher('demo_graph', $$ CREATE (n:Person {name : "james", bornIn : "US"}) $$) AS (a agtype);
    SELECT * FROM cypher('demo_graph', $$ CREATE (n:Person {name : "david", bornIn : "US"}) $$) AS (a agtype);
    

    Create nodes for country

        SELECT * FROM cypher('demo_graph', $$ CREATE (n:Country{name : "Pakistan"}) $$) AS (a agtype);
    SELECT * FROM cypher('demo_graph', $$ CREATE (n:Country{name : "US"}) $$) AS (a agtype);
    

    Create the relation using

    SELECT * FROM cypher('demo_graph', $$ MATCH (a:Person), (b:Country) WHERE a.bornIn = b.name CREATE (a)-[r:BORNIN]->(b) RETURN r $$) as (r agtype);
    

    now visualize the graph

    SELECT * from cypher('demo_graph', $$ MATCH (a:Person)-[r]-(b:Country) WHERE a.bornIn = b.name RETURN a, r, b $$) as (a agtype, r agtype, b agtype);
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search