Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] When vertex strategy is CUSTOMIZE_UUID, is there need to pass the id value in json? #2535

Open
1 task done
BreakMeEveryday opened this issue Apr 29, 2024 · 6 comments
Labels
inactive question Further information is requested

Comments

@BreakMeEveryday
Copy link

Problem Type (问题类型)

None

Before submit

  • 我已经确认现有的 IssuesFAQ 中没有相同 / 重复问题 (I have confirmed and searched that there are no similar problems in the historical issue and documents)

Environment (环境信息)

  • Server Version: 1.0.0 (Apache Release Version)
  • Backend: RocksDB x nodes, HDD or SSD
  • OS: xx CPUs, xx G RAM, Ubuntu 2x.x / CentOS 7.x
  • Data Size: xx vertices, xx edges

Your Question (问题描述)

image
当一个vertex的id策略为uuid时,即id可以自定义时,增加结点数据需要传入id值吗?我在官方的例子中没有看到相关示例

Vertex/Edge example (问题点 / 边数据举例)

No response

Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)

No response

Copy link

dosubot bot commented Apr 29, 2024

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.

Details

Sources


About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

@dosubot dosubot bot added the question Further information is requested label Apr 29, 2024
@BreakMeEveryday
Copy link
Author

@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": ""
}

Copy link

dosubot bot commented Apr 30, 2024

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.

Details

Sources


About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

@BreakMeEveryday
Copy link
Author

@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": ""
}

Copy link

dosubot bot commented May 5, 2024

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:

  1. 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.

  2. 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.

  3. 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.

Details

Sources


About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inactive question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant