skip to Main Content

I have created two vertices, one with label "Book" and another with label "User". The "Book" vertex has a property called "title" and the "User" vertex has the properties "first_name" and "last_name".

SELECT * FROM cypher ('goodreads_db', $$
MATCH (v)
RETURN v
$$) as (v agtype);
        v                                                                                                            
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 {"id": 844424930131969, "label": "User", "properties": {"read": 9, "country": "Brazil", "reading": 2, "last_name": "Matsumoto", "first_name": "Matheus"}}::vertex
 {"id": 1125899906842625, "label": "Book", "properties": {"pages": 336, "title": "To Kill a Mockingbird", "author": "Harper Lee", "rating": 4.27, "ratings": 5574002, "reviews": 107847, "language": "English"}}::vertex
(2 rows)

When I try to visualize these nodes on AGE Viewer, it does not show the book title nor the user’s first name on top of their vertices. Instead, it shows the book’s id and nothing on the user’s vertex (image below). Is there any way that I can output the book’s title and the user’s first name instead of what is currently displaying? If so, how?

enter image description here

3

Answers


  1. I don’t think you can change what shows on the top as of now in Age Viewer. But you can do that on the console:

    enter image description here

    You can find a way to change the id value to an alias, but as of now we cannot change what’s on top.

    Login or Signup to reply.
  2. Yes! Apache-age provides you the facility to visualize the properties on the top of their vertices.

    First properties inserted in the node while creating it will be shown on the top of the node.
    So in your case you should keep the book title and user’s first name as the first property while creating the node.

    Since it depends on the creation of nodes, if you had provided the query for creating nodes then I would be more clear to work on problem.
    But I have took example to show the working.
    Let’s walk through the example to clearly understand it.

    First let’s create PERSON nodes

    SELECT * FROM cypher('graph_one', $$ CREATE (n:Person {name : "Kamlesh", bornIn : "Pakistan"}) $$) AS (a agtype);
    SELECT * FROM cypher('graph_one', $$ CREATE (n:Person {name : "John", bornIn : "US"}) $$) AS (a agtype);
    SELECT * FROM cypher('graph_one', $$ CREATE (n:Person {name : "Matheus", bornIn : "US"}) $$) AS (a agtype);
    SELECT * FROM cypher('graph_one', $$ CREATE (n:Person {name : "akabr", bornIn : "Pakistan"}) $$) AS (a agtype); 
    

    Now creates some nodes for COUNTRY.

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

    Create the relationship between nodes

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

    Visualizeing the graph created.

    SELECT * from cypher('graph_one', $$ MATCH (a:Person)-[r]-(b:Country) WHERE a.bornIn = b.name RETURN a, r, b $$) as (a agtype, r agtype, b agtype);
    

    Here is the result:

    Result

    Login or Signup to reply.
  3. There is a field above the graph with a list of the nodes and edges’ labels, click on the label you want to change and a menu will appear below the graph, then choose the "caption" you want to display, that’s what will show on top of the vertex.

    Changing caption

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