Giter Club home page Giter Club logo

Comments (2)

dosubot avatar dosubot commented on July 23, 2024 2

The "Invalid vertex id" error you're encountering when creating an edge using UUIDs as vertex IDs in HugeGraph version 1.0.0 is likely due to a known issue in the checkAndParseVertexId method in the VertexAPI class. This method incorrectly handles UUIDs by removing a leading "U" if it exists, which can lead to incorrect parsing and handling of UUIDs.

Here are the steps to resolve this issue:

  1. Ensure Vertex IDs Exist: You've already verified that the vertex IDs exist, which is good. This step ensures that the IDs you are using are valid and present in the database.

  2. Check UUID Handling in VertexAPI: The checkAndParseVertexId method in the VertexAPI class has a bug that incorrectly handles UUIDs. This method checks if the idValue starts with "U"", and if so, it removes the leading "U" before parsing the UUID. This can lead to incorrect parsing and handling of UUIDs.

  3. Test Case for UUIDs: The VertexApiTest class includes a test case testGetWithCustomizeUuidId that demonstrates the correct usage of UUIDs as vertex IDs. This test case creates a vertex with a UUID, retrieves it, and verifies that the ID, label, and properties are correctly handled.

  4. Workaround: As a workaround, you can ensure that the UUIDs are correctly formatted and handled by the API. You might need to modify the request to ensure that the UUIDs are correctly parsed. For example, you can try prefixing the UUIDs with "U" to match the expected format in the checkAndParseVertexId method.

    Modified Request Body:

    {
      "label": "dsToTaskLineageEdgeLabelTTI",
      "inV": "U\"a9a0e424-129b-487d-a089-6372673ebedc\"",
      "inVLabel": "taskLineageVertexLabel",
      "outV": "U\"3b567246-d408-461f-b481-a899d1477e0d\"",
      "outVLabel": "dsLineageVertexLabel",
      "properties": {
          "date": "20171210",
          "weight": 0.4
      }
    }

By ensuring that the UUIDs are correctly formatted and handled, you should be able to resolve the "Invalid vertex id" error when creating an edge using UUIDs as vertex IDs. If the issue persists, you may need to look into updating to a newer version of HugeGraph where this bug might have been fixed.

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.

from incubator-hugegraph.

aaawuanjun avatar aaawuanjun commented on July 23, 2024

it does not work, the code version is 1.3.0

from belows, it produce exception, it does not judge U prefix

    private static Vertex getVertex(HugeGraph graph, Object id, String label) {
        HugeVertex vertex;
        try {
            vertex = (HugeVertex) graph.vertices(id).next();
        } catch (NoSuchElementException e) {
            throw new IllegalArgumentException(String.format("Invalid vertex id '%s'", id));
        }
        if (label != null && !vertex.label().equals(label)) {
            throw new IllegalArgumentException(String.format(
                    "The label of vertex '%s' is unmatched, users expect " +
                    "label '%s', actual label stored is '%s'",
                    id, label, vertex.label()));
        }
        // Clone a new vertex to support multi-thread access
        return vertex.copy();
    }

from incubator-hugegraph.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.