Apache-AGE 中是否可能让一个节点拥有多个标签?

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

Is it possible for a node to have multiple labels in Apache-AGE

问题

可以一个节点有多个标签吗?
是否可以像这样使用...

CREATE (n:label1:label2)
英文:

Is it possible for a node to have more than one label attached to it?
Is there a way to have something like this…

CREATE (n:label1:label2)

答案1

得分: 2

是的,这是在Cypher语言中创建具有多个标签的节点的示例:

CREATE (n:Label1:Label2)
RETURN n
英文:

Yes and this is an example on creating a node with many labels in cypher language:

CREATE (n:Label1:Label2)
RETURN n

答案2

得分: 1

cypherQuery标准支持多个标签,但AGE的开发人员选择省略此功能,并实施了每个节点一个标签的限制。然而,他们目前正在修改设计,以实现多个标签的功能。这项任务存在一些挑战,因为节点ID和标签是相互关联的。当创建带有标签的节点时,会专门为该标签生成一个新表,所有带有该标签的节点都直接存储在该表中。

如果您对如何在AGE中实现多个标签有一些想法,请在GitHub上分享。

英文:

The cypherQuery standard includes support for multiple labels, but the developers at AGE chose to omit this feature and implemented a restriction of one label per node. However, they are currently working on modifying the design to enable multiple labels. This task presents some challenges because the node IDs and labels are interconnected. When a node is created with a label, a new table is generated specifically for that label , and all nodes with that label are stored directly in that table.

If you have some ideas on how multiple labels can be implemented in AGE, share on Github

答案3

得分: 1

目前无法为顶点/边添加多个标签,或在创建后修改标签,或在创建后删除标签。

该问题目前正在开发中。

一个解决方法是将标签添加为属性,或属性列表(截止目前)。

这可能会影响您的查询获取/删除/更新时间,但它仍然可以正常工作。

目前,我们正在研究各种方法来实现这一点。
https://github.com/apache/age/issues/772

英文:

It is not possible presently to have multiple labels for a vertex/edge, or to modify the labels after creation, or to remove the labels after creation.

The issue is currently under development.

A workaround is adding labels as properties, or a list of properties (as of right now).

This may impact your query fetching/deleting/updating time, however, it works just fine.

As of now, we are currently researching various methods to implement this
https://github.com/apache/age/issues/772

答案4

得分: 0

目前,顶点和边不能具有多个标签。原因是顶点和边的唯一 16 位 ID 与标签 ID 强烈关联(此标签是您为图实体提供的第一个标签,因此无法更改此标签或添加另一个标签)。以这种方式生成实体的 ID 不允许我们向顶点、边添加多个标签,也不能删除/更改标签。

但是,正在进行重新设计图实体的研究,以使其可以具有多个标签。

此外,您可以关注与此相关的 GitHub 问题

英文:

At present, the vertices and edges can not have multiple labels. The reason being that the unique 16-bit id of the vertices and edges is strongly tied to the label id (this label is the very first label that you give to the graph entity and thus you cannot change this label or add another one) . This way of generating ids for entities does not allow us to add multiple labels to vertices, edges or remove/change a label

However, there is ongoing research on redesigning graph entities in a way that these can be given multiple entities.

Moreover, you can keep an eye on the GitHub issue regarding this.

答案5

得分: 0

在Apache AGE中,您不能创建具有多个标签的节点。

如果您尝试运行您提到的查询,您将收到语法错误。

英文:

No in Apache AGE you can't create a node with multiple labels.

If you try to run the query you mentioned you will get a syntax error.

Apache-AGE 中是否可能让一个节点拥有多个标签?

答案6

得分: 0

你可以通过创建逗号分隔的标签列表为单个节点创建多个标签,例如:

CREATE (:label1:label2:label3 {name: '节点的名称'})

英文:

You can create multiple labels for a single node by creating a comma separated list of labels like

CREATE (:label1:label2:label3 {name: 'nameOfTheNode'})

答案7

得分: 0

如果你在提到apacheAGE扩展,那么答案是否定的,但目前正在进行相关工作。如果你在谈论neo4j的Cypher查询语言,那么是的,你可以像你提供的查询一样使用多个标签。

英文:

If you are referring to the apacheAGE extension, then the answer is no but it is being currently worked on. If you are talking about the cypher of neoj4 then yes you can have multiple labels like they query you presented.

答案8

得分: 0

是的,在CypherQuery中,一个节点可以附加多个标签。可以分别用冒号分隔来指定多个标签。

CREATE (n:label1:label2)
RETURN n

这可以用来创建一个具有多个标签的节点。

英文:

Yes, in CypherQuery a node can have multiple labels attached to it. Multiple labels can be assigned which should be separated by colon.

CREATE (n:label1:label2)
RETURN n

This can be used to create a node with multiple labels.

答案9

得分: 0

不,目前还不可能,但正在开发中。您可以通过将标签添加为属性并将其设置为数组来解决这个问题。

英文:

No, It is not possible for now, but it's under development. you can work around that by adding labels as a property and make it as an array

答案10

得分: 0

创建具有多个标签的节点时,您可以按照以下语法:

CREATE (n:Person:Swedish)
// 以上查询的结果如下:
Rows: 0
Nodes created: 1
Labels added: 2

您可以看到,使用此语法,我们可以将两个标签添加到单个节点上。目前,这个语法只在 Neo4j 中支持,但在不久的将来,它将被实现在 Apache Age 中,您可以使用上述查询来使用此功能。

另一个创建一个节点的多个标签的语法示例如下:

CREATE (n:Person {name: 'Andy', title: 'Developer'}:Swedish)

您可以看到,我们已经添加了两个标签并添加了这些标签的属性。

英文:

For creating a node with multiple labels you follow this syntax:

CREATE (n:Person:Swedish)
// The results for the above query is this:
Rows: 0
Nodes created: 1
Labels added: 2

You can see that with this syntax we can add two labels to a single node. For now, this syntax is followed in neo4j only but its currently unavailable in Apache Age but in the near future it will be implemented in the Apache Age and you can use this feature using the above query.

One more example of syntax for making multiple labels of one node is as follows:

CREATE (n:Person {name: 'Andy', title: 'Developer'}:Swedish)

You can see that we have added two labels and added properties to those labels.

答案11

得分: -1

不,使用Apache AGE时,一个节点不能有多个标签。

英文:

No, a node cannot have more than one label when using Apache AGE.

huangapple
  • 本文由 发表于 2023年5月28日 15:46:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/76350458.html
匿名

发表评论

匿名网友

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

确定