Cannot create node with label `User` in AGCloud

112 views Asked by At

I'm using AGViewer on cloud with AGCloud, and I can not create a Node with Label User.

I tried to create a Node with label User using the following query

Create(u:User {name: 'user1', email: '[email protected]', phone: '1234-5678'}) RETURN u

but I got the error: Syntax error at or near "User"

I tried to run the same query for different label it is working fine.

Create(u:Person {name: 'user1', email: '[email protected]', phone: '1234-5678'}) RETURN u

Output

Image showing output of Person Node

tell me what is the issue.

8

There are 8 answers

0
Nnaemeka Daniel John On BEST ANSWER

This Query works as expected on Apache AGE viewer, perhaps User is a reserved keyword in AGCloud. You could try to find your way around it or simply use another Label name.

Query on AGE Viewer

0
Huzaifa On

I do think its because "User" is a keyword in AGE. Try enclosing it in backticks.

CREATE (u:`User` {name: 'user1', email: '[email protected]', phone: '1234-5678'}) RETURN u

Also, its better to have meaningful name, so change of name is recommended.

2
Wendel On

Try it out this query:

SELECT * FROM cypher('graph_name', $$ 
    CREATE (u:User {name: 'user1', email: '[email protected]', phone: '1234-5678'}) 
    RETURN u
$$) AS (node agtype);
0
Waleed Ahmed Shahid On

Its permissible in Apache Age. I guess that you have dependency error based on your entered data or you are getting a syntax error.

For creating a single vertex:

SELECT * 
FROM cypher('graph_name', $$
    CREATE (n)
$$) as (v agtype);

For creating a vertex with a label:

SELECT * 
FROM cypher('graph_name', $$
    CREATE (:Person)
$$) as (v agtype);

For creating a vertex and add labels and properties:

SELECT * 
FROM cypher('graph_name', $$
    CREATE (:Person {name: 'Andres', title: 'Developer')
$$) as (n agtype);

You can check this documentation for more information.

0
Zeeshan On

To create a single vertex, you can use the following query:

SELECT *
FROM cypher('graph_name', $$
    CREATE (n)
$$) AS (v agtype);

In this case, the vertex will be labeled as "Person".

To create a vertex and add labels and properties, you can use the following query as an example:

SELECT *
FROM cypher('graph_name', $$
    CREATE (:Person {name: 'Andres', title: 'Developer'})
$$) AS (n agtype);

This query creates a vertex labeled as "Person" and assigns it properties such as "name" and "title" with corresponding values.

Remember to replace "graph_name" with the actual name of your graph.

If you need more detailed information, you can refer to the documentation for Apache Age.

0
Prachi On

As answered by some folks, it is quite possible that User is some reserved keyword or there is an already existing relation. You are getting this error probably because when you are trying to use the word User, it is referring to the already existing keyword.

0
Abdul Manan On

I executed the query successfully using the label name "User" on AGE. It appears that the word "User" is not a reserved word in AGE. If you encountered an error, it might be due to another relation having the same name or it could be because "User" is a reserved word in AGCloud.

 SELECT * FROM cypher('usergraph', $$CREATE(u:User {name: 'user1', email: '[email protected]', phone:
'1234-5678'}) RETURN u$$) as (u agtype);

enter image description here

0
Haseeb Ashraf On

In AGViewer with AGCloud, there are some specific restrictions that will prevent you from using reserved words like 'USER' as a label. You can consider using a different label name such as ''people'. Meanwhile, if using the label 'User' is necessary for your specific use case, you can check the official documentation to see if there are any possible workarounds around this specific label.