无法在AGCloud中创建带有标签`User`的节点。

huangapple go评论51阅读模式
英文:

Cannot create node with label `User` in AGCloud

问题

我在使用AGCloud上的AGViewer,并且无法创建一个带有标签“User”的节点。

我尝试使用以下查询创建一个带有标签“User”的节点:

> Create(u:User {name: 'user1', email: 'user1@email.com', phone: '1234-5678'}) RETURN u

但是我收到了错误消息:“在或附近的语法错误"User"”。

我尝试对不同的标签运行相同的查询,它可以正常工作。

> Create(u:Person {name: 'user1', email: 'user1@email.com', phone: '1234-5678'}) RETURN u

输出

无法在AGCloud中创建带有标签`User`的节点。

告诉我问题出在哪里。

英文:

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: 'user1@email.com', 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: 'user1@email.com', phone: '1234-5678'}) RETURN u

Output

无法在AGCloud中创建带有标签`User`的节点。

tell me what is the issue.

答案1

得分: 1

我认为这是因为 "User" 是 AGE 中的一个关键字。尝试用反引号括起来。

CREATE (u:User {name: 'user1', email: 'user1@email.com', phone: '1234-5678'}) RETURN u

此外,最好使用有意义的名称,因此建议更改名称。

英文:

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

CREATE (u:`User` {name: 'user1', email: 'user1@email.com', phone: '1234-5678'}) RETURN u

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

答案2

得分: 1

这个查询在Apache AGE查看器上按预期工作,也许User是AGCloud中的保留关键字。你可以尝试绕过它,或者简单地使用另一个标签名称。

英文:

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.

无法在AGCloud中创建带有标签`User`的节点。

答案3

得分: 0

尝试运行此查询:

SELECT * FROM cypher('graph_name', $$ 
    CREATE (u:User {name: 'user1', email: 'user1@email.com', phone: '1234-5678'}) 
    RETURN u
$$) AS (node agtype);
英文:

Try it out this query:

SELECT * FROM cypher('graph_name', $$ 
    CREATE (u:User {name: 'user1', email: 'user1@email.com', phone: '1234-5678'}) 
    RETURN u
$$) AS (node agtype);

答案4

得分: 0

在Apache Age中允许这样做。我猜你的问题可能是由于你输入的数据存在依赖错误或语法错误。

要创建单个顶点:

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

要创建带有标签的顶点:

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

要创建带有标签和属性的顶点:

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

你可以查看这个文档获取更多信息。

英文:

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.

答案5

得分: 0

由一些人回答,很可能“User”是一个保留关键字,或者已经存在一个关系。当你尝试使用单词“User”时,可能会出现这个错误,因为它指向已经存在的关键字。

英文:

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.

答案6

得分: 0

我使用标签名称"User"在AGE上成功执行了查询。看起来"User"这个词在AGE中并不是保留字。如果你遇到了错误,可能是因为另一个关系使用了相同的名称,或者可能是因为"User"在AGCloud中是保留字。

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

无法在AGCloud中创建带有标签`User`的节点。

英文:

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: 'user1@email.com', phone:
'1234-5678'}) RETURN u$$) as (u agtype);

无法在AGCloud中创建带有标签`User`的节点。

答案7

得分: -1

要创建一个单一的顶点,您可以使用以下查询:

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

在这种情况下,顶点将被标记为 "Person"。

要创建一个顶点并添加标签和属性,您可以使用以下查询作为示例:

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

这个查询创建了一个标记为 "Person" 的顶点,并分配了属性如 "name" 和 "title" 以及相应的值。

请记得将 "graph_name" 替换为您的图的实际名称。

如果您需要更详细的信息,可以参考 Apache Age 的文档。

英文:

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.

huangapple
  • 本文由 发表于 2023年6月26日 02:49:29
  • 转载请务必保留本文链接:https://go.coder-hub.com/76551957.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定