在Apache agedb中删除标签名称会产生错误。

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

Removing the label name in Apache agedb produces error

问题

以下是翻译好的内容:

我正在使用以下示例查询来创建一个带有标签的节点。

SELECT *
FROM cypher('vg-graph', $$
	CREATE (m:Movie {name: "电影名称", uid: "12345678", body: "描述"})
	$$) as (n agtype);

以下查询应该从节点中移除标签 'Movie'。

SET search_path TO ag_catalog;
SELECT *
FROM cypher('vg-graph', $$
	MATCH (n {uid:"12345678"})
	REMOVE n:Movie
	RETURN n
    $$) as (n agtype);

但是会产生 ERROR: 语法错误,附近有“:”。您可以以其他方式完成相同的任务吗?

英文:

I am using the following sample query to create a node with a label.

SELECT *
FROM cypher('vg-graph', $$
	CREATE (m:Movie {name: "Movie Name", uid: "12345678", body: "Description"})
	$$) as (n agtype);

Following query should remove label 'Movie' from the node.

SET search_path TO ag_catalog;
SELECT *
FROM cypher('vg-graph', $$
	MATCH (n {uid:"12345678"})
	REMOVE n:Movie
	RETURN n
    $$) as (n agtype);

but produces ERROR: syntax error at or near ":"

How can I achieve the same task in other ways?

答案1

得分: 1

目前,您无法从节点或边上移除标签名称,因为节点/边的ID最初是根据标签分配的序列ID给定的,因此将实体的存在与其标签耦合在一起。

因此,这样的无效操作会导致错误。

然而,将实体ID与标签ID分离的工作正在进行中。这将允许更新/删除现有的标签,并向实体添加多个标签。

英文:

At present, you can not remove the label name from a node or edge because the ID of node/edge is given from sequence id initially assigned to the label hence coupling the entity existence to its label.

Thus, such an invalid operation would result in an error.

However, separating entity ID from label ID is in progress. This would allow updating/deleting existing labels and adding multiple labels to entities.

答案2

得分: 1

Cypher查询没有内置的用于移除标签名称的子句,而是可以使用以下查询将其重命名。

MATCH (a:Label1)
SET a:Label2
REMOVE a:Label1

你可以从这个Github问题链接中获取更多信息,因为已经在那里提出了这个问题。

英文:

Cypher query doesn'have a built in clause for removing the label name, instead you can rename it using the following query.

MATCH (a:Label1)
SET a:Label2
REMOVE a:Label1

You can get more information from this Github issue link as its already raised there.

答案3

得分: 1

错误发生是因为您无法从节点中删除标签。这个功能尚未实现。

但您可以使用一些替代方法,比如

  • 您可以创建一个带有新标签的新节点,然后删除旧节点。
  • 您可以使用MATCHSET命令来重命名节点的标签。
英文:

The error is occurring because you cannot remove the label from the node. This functionality is not implemented yet.

But you can use some alternative ways like

  • You can make a new node with a new label and delete the old one.
  • You can rename the label of node using MATCH and SET commands.

答案4

得分: 1

从节点中移除标签目前不受 Apache AGE 支持。

您可以选择重命名该标签,或者根据您的需求创建一个新的节点。

英文:

Removal of a label from a node is not currently supported in Apache AGE.

Instead you can rename the label or create a new node tailored according to your needs.

答案5

得分: 1

自定义的Cypher扩展似乎不属于常规的Neo4j语言。您在您的"REMOVE"子句中使用的语法未被识别。以下是使用Neo4j标准Cypher执行此操作的方法:

MATCH (n:Movie {uid: "12345678"})
REMOVE n:Movie
SET n:NewLabel
RETURN n
英文:

The custom Cypher extension you're using doesn't seem like it's part of the regular Neo4j language. The syntax that you have used in your "REMOVE" clause is not being recognised. Here's a way to do this using standard Cypher in Neo4j.

MATCH (n:Movie {uid: "12345678"})
REMOVE n:Movie
SET n:NewLabel
RETURN n

答案6

得分: 0

目前,不可能从节点或边缘中删除标签名称,因为实体的ID与标签关联在一起。移除标签会使实体无效,导致错误。

英文:

Currently, it is not possible to remove the label name from a node or edge because the entity's ID is associated with the label. Removing the label would invalidate the entity's existence, resulting in an error.

答案7

得分: 0

从节点或边上移除标签在Apache AGE中会返回错误,因为每个节点或边都与创建时传递的标签关联。

英文:

Removing a label from a node or an edge will return an error in Apache AGE because each node or edge is linked with the label passed upon creation.

答案8

得分: 0

Apache AGE尚未添加标签修改和多标签功能。
目前,AGE根据创建时指定的标签为顶点分配其ID。由于ID是不可变的且与标签名称紧密关联,因此删除标签、修改标签或使用多个标签都不受支持。

但是,目前有一些项目正在进行中以实现这些功能。您可以在此处关注它们:
https://github.com/apache/age/issues/772

英文:

Label modifications and ability to have multiple labels has not yet been added to Apache AGE.
At present AGE assigns vertices their ids based on the labels they're given at the time of creation. And because ids are immutable and are fundamentally tied to the label name, it makes removing the label, or modifying the label, or having multiple labels an unsupported task.

However, there are projects going on to implement the same. You can follow them here
https://github.com/apache/age/issues/772

答案9

得分: 0

从AGE中删除节点的标签目前不受支持。然而,正在进行努力以启用此功能。与此同时,您可以通过创建具有相同属性但不同标签的新节点来完成您的任务。

CREATE (a :Label {val: 13})

CREATE (b)
SET b = properties(a)
DELETE a
RETURN b

结果:

{"id": 281474976710663, "label": "", "properties": {"val": 13}}::vertex
(1 row)
英文:

Removing a label from a node in AGE is currently not supported. However, efforts are underway to enable this functionality. In the meantime, you can accomplish your task by creating a new node with identical properties but different label.

CREATE (a :Label {val: 13})

CREATE (b)
SET b = properties(a)
DELETE a
RETURN b
                                 res                                  
----------------------------------------------------------------------
 {"id": 281474976710663, "label": "", "properties": {"v": 13}}::vertex
(1 row)

答案10

得分: 0

目前,直接使用 REMOVE 子句删除节点正在开发中。目前,您可以使用类似上面回答中的 SET 子句的替代解决方案。

英文:

at present, deleting a node directly using REMOVE clause is under development. Currently you can use alternative solution using SET clause like in the answers above

答案11

得分: 0

你看到的错误是“在或接近“:”附近的语法错误”,是因为目前不允许从节点中移除标签名称,因为该节点与该标签关联。

英文:

The error that you see "syntax error at or near ":" ", is because as of now, removing label name from a node is not allowed as the node is linked with the label.

答案12

得分: 0

GitHub上有一个问题说明为什么无法从节点中删除标签。它尚未添加到APACHE AGE中。

问题

英文:

Theres a issue on github explaining why you can't remove the label from a node. It isn't added in APACHE AGE yet.

Issue

答案13

得分: 0

你目前无法从图中删除标签名称,因为Apache AGE尚不支持此功能,但您可以将节点迁移到新标签并删除旧标签。

要获取更多信息,您可以访问以下 GitHub 问题链接:
问题链接 1
问题链接 2

英文:

You currently cannot remove a label name from a graph as it is not yet supported by Apache AGE, but you can migrate your nodes to a new label and remove the old one.

To gain more insight you can visit these github issues:
Link to issue 1
Link to issue 2

答案14

得分: 0

目前,在Apache AGE中不支持从节点中删除标签名称。但是,有其他方法可以实现类似的结果。其中一种选择是将节点迁移到一个新的标签,然后删除旧标签。

以下是如何完成这个操作的示例:

SELECT * 
FROM cypher('graphName', $$
    CREATE (newNode:NewLabel)
    SET newNode = properties(oldNode)
    DELETE oldNode
    RETURN newNode
$$) AS (newNode agtype);
英文:

Currently, removing a label name from a node in Apache AGE is not supported. However, there are alternative ways to achieve a similar outcome. One option is to migrate the nodes to a new label and then remove the old one.

Here's an example of how you can accomplish this:

SELECT * 
FROM cypher('graphName', $$
    CREATE (newNode:NewLabel)
    SET newNode = properties(oldNode)
    DELETE oldNode
    RETURN newNode
$$) AS (newNode agtype);

答案15

得分: 0

你不能从节点中删除标签名称,因为该节点与标签相关联。

例如:0 -> 1

"->" 定义节点之间的关系并关联标签。

英文:

You cannot delete/remove the label name from a node because the node is linked/connected with the label.

for example: 0 -> 1

"->" defines relationship between nodes and associate labels.

答案16

得分: 0

其他人已经提到,目前不可能实现,因为节点在创建时与标签关联,并且存在与此相关的问题。您可以尝试将新节点迁移到另一个标签,然后删除旧节点。

英文:

As other have mentioned it is not possible currently since the node is linked to the label upon creation and there is an issue related to it. You can possibly migrate the new nodes to another label and then delete the old nodes.

答案17

得分: 0

由于节点或边的标识或ID与与匹配标签相关联的序列ID生成的初始分配密切相关,目前不可能将标签名称与节点或边分开。这种连接有效地将实体的存在与其分配的标签相联系。任何试图执行此类活动的努力,实际上涉及分离标签,都将不可避免地导致错误的发生,因为这与系统已建立的结构和引用完整性相冲突。

正在进行努力,以将实体ID与标签ID分离。这一前瞻性的更新旨在使其更容易为个体实体添加多个标签的能力,以及更改或删除现有标签。这一努力的目标是提高系统在处理标签及其与实体的关联关系方面的适应性和灵活性。目前它处于积极的实施和改进状态。

英文:

Since a node's or edge's identification or ID is closely linked to the initial assignment generated from a sequence ID that is associated with the matching label, it is currently not possible to separate the label name from a node or edge. This connection effectively connects an entity's very existence to its assigned label. Any effort to execute such an activity, which would effectively involve detaching the label, would therefore inherently result in the issuance of an error because it conflicts with the system's established structural and referential integrity.

Ongoing efforts are being made to separate the entity ID from the label ID. This forward-thinking update seeks to make it easier to add the ability to label individual entities with numerous labels, as well as to alter or delete existing labels. The goal of this effort is to increase the system's adaptability and flexibility in handling labels and the links they have with entities. It is now in an active state of implementation and improvement.

huangapple
  • 本文由 发表于 2023年6月13日 17:19:32
  • 转载请务必保留本文链接:https://go.coder-hub.com/76463410.html
匿名

发表评论

匿名网友

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

确定