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)
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)
Yes and this is an example on creating a node with many labels in cypher language:
CREATE (n:Label1:Label2)
RETURN n
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
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
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.
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.
You can create multiple labels for a single node by creating a comma separated list of labels like
CREATE (:label1:label2:label3 {name: 'nameOfTheNode'})
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.
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.
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
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.