Closed Github-Polaris closed 3 weeks ago
Yes, when using the CUSTOMIZE_UUID
strategy for vertex IDs in Apache HugeGraph, you must include the id
value in the JSON body when adding a vertex. This requirement is due to the way the HugeGraph server processes vertex IDs based on the specified ID strategy. Specifically, for CUSTOMIZE_UUID
, the system expects an id
value to be provided, which it then uses to generate a UUID. If the id
value is not provided, the operation will fail because the system attempts to convert a null
value into a UUID, leading to errors. This behavior is outlined in the VertexAPI
class of the HugeGraph server codebase, indicating the necessity of supplying an id
value in your request.
To continue the conversation, mention @dosu.
@dosu Hi, please see the code section below, what's wrong with this?
{
"label": "person",
"properties": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "marko",
"age": 29
}
}
{
"exception": "class java.lang.IllegalArgumentException",
"message": "Must customize vertex string id when id strategy is 'CUSTOMIZE_UUID' for vertex label 'person'",
"cause": ""
}
The error you're encountering, "Must customize vertex string id when id strategy is 'CUSTOMIZE_UUID' for vertex label 'person'"
, indicates that the format or placement of the id
in your JSON request does not meet the expectations for a CUSTOMIZE_UUID
ID strategy in Apache HugeGraph. When using CUSTOMIZE_UUID
, the id
must be provided at the top level of your JSON structure, not nested within the properties
object. Your JSON should look like this:
{
"label": "person",
"id": "123e4567-e89b-12d3-a456-426614174000",
"properties": {
"name": "marko",
"age": 29
}
}
In this corrected format, the id
is directly under the top level of the JSON object, alongside label
and properties
. This placement ensures that the id
is recognized by HugeGraph as the vertex ID, conforming to the CUSTOMIZE_UUID
strategy's requirement for a custom, user-provided UUID string.
To continue the conversation, mention @dosu.
@dosu
Hi, when the vertex id strategy is UUID, how to construct an edge relation between two vertex? Here is my operation that using EdgeAPI /graphs/hugegraph/graph/edges
but has an exception throwed. why there is "Invalid vertex id '123e4567-e89b-12d3-a456-426614174000'"?
{
"label": "friend",
"outV": "123e4567-e89b-12d3-a456-426614174000",
"inV": "123e4567-e89b-12d3-a456-426614174001",
"outVLabel": "person_id",
"inVLabel": "person_id",
"properties": {}
}
{
"exception": "class java.lang.IllegalArgumentException",
"message": "Invalid vertex id '123e4567-e89b-12d3-a456-426614174000'",
"cause": ""
}
The error "Invalid vertex id '123e4567-e89b-12d3-a456-426614174000'" you're encountering when trying to construct an edge suggests a couple of potential issues to check:
Vertex Existence: Ensure that the vertices with IDs 123e4567-e89b-12d3-a456-426614174000
and 123e4567-e89b-12d3-a456-426614174001
actually exist in your graph. The error can occur if the vertex ID provided does not exist.
Label Match: If you're specifying vertex labels (outVLabel
and inVLabel
) when creating the edge, verify that these labels accurately match the labels of the existing vertices. A mismatch in labels can lead to this error.
ID Strategy Consistency: Confirm that your use of UUIDs as vertex IDs is consistent across your graph data. Inconsistencies in ID strategy application can cause confusion and errors.
To troubleshoot, you might start by querying the vertices separately to confirm their existence and labels in the graph. This step can help pinpoint whether the issue lies with the vertex ID, label mismatch, or another aspect of your graph setup.
To continue the conversation, mention @dosu.
Due to the lack of activity, the current issue is marked as stale and will be closed after 20 days, any update will remove the stale label
Problem Type (问题类型)
None
Before submit
Environment (环境信息)
Your Question (问题描述)
Vertex/Edge example (问题点 / 边数据举例)
No response
Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
No response