Comments (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:
-
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.
-
Check UUID Handling in VertexAPI: The
checkAndParseVertexId
method in theVertexAPI
class has a bug that incorrectly handles UUIDs. This method checks if theidValue
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. -
Test Case for UUIDs: The
VertexApiTest
class includes a test casetestGetWithCustomizeUuidId
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. -
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
- hugegraph-client/src/test/java/org/apache/hugegraph/api/EdgeApiTest.java
- hugegraph-hubble/hubble-be/src/main/java/org/apache/hugegraph/service/graph/GraphService.java
- hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/EdgeAPI.java
- hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/graph/VertexAPI.java
- hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/id/IdGenerator.java
- hugegraph-client/src/test/java/org/apache/hugegraph/api/VertexApiTest.java
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.
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)
- 增加版本信息支持外部索引 HOT 3
- [Question] 配置的是pgsql,为什么连接用mysql,连接失败 HOT 3
- [Question] 创建顶点的时候,使用.ifNotExist()判断,但是还是出现下面错误 HOT 1
- [Bug] connect graph error in the hubble HOT 1
- 创建一个新的图,可以和原来的图共同存储在同一个mysql后端中吗? HOT 3
- [Question] Vulnerability found in dependency: CVE-2022-42889 9.8 Transitive Improper Control of Generation of Code ("Code Injection") vulnerability with High severity found HOT 2
- [Summary] update licenses/notice for 1.5 HOT 1
- [Question] gremlin-groovy is not an available GremlinScriptEngine HOT 1
- [Question] gremlin-groovy is not an available GremlinScriptEngine HOT 3
- hugegraph最大内存配置 HOT 3
- [Bug] AccessLogFilter for path matrics make Server OOM HOT 7
- 往hugegraph集群添加新机器一直不成功 HOT 3
- [Bug] 使用cypher api查询,提示Unsupported predicate: 'containing(XXXX)' HOT 5
- [Summary] Preparations for Releasing HugeGraph Distributed (pd-store, 1.5) Version
- [Bug] Resolved the cache invalidation of the partition->leader shard in ClientCache HOT 1
- [Bug] Memory leaks occur in HugeGraph Server during data writing. HOT 2
- Add comments to the initial-store-count attribute in pd application.yml
- [Bug] PD, Store process log files do not scroll HOT 1
- [Feature] support disable rocksdb auto compaction through configuration
- [Feature] add MiniCluster as integration test environment
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from incubator-hugegraph.