Tommu10ve commented on issue #2776:
URL:
https://github.com/apache/incubator-hugegraph/issues/2776#issuecomment-2910856874
> > > > > String personLabelId =
graph.schema().getVertexLabel("person").id().asString();
> > > > > 顶点类型id是 7, primaryKeys是4,为什么会拼接处 7:14的值出来
> > > >
> > > >
> > > >

> > >
> > >
> > > 你可以搜一下历史 issue 有解释, doc 里也有说明, 这是因为它是组合 vertexLabelID + pkValue 的方式
> > > 另外和🤖对话可以识别图片, 但尽量手动召唤一下 [@dosu-bot](https://github.com/dosu-bot),
来解答一下这个问题
> >
> >
> > vertexLabelID + pkValue , vertexLabelID 值是 7, pkValue 值是4,最后结果是 7:14
我表示很疑惑的是为什么会多出1
>
> 你查一下 HTTP 看看 VertexLabel 的定义, 贴一下, 以及单独查一下 `7:14` 这个 vid 对应的完整 json 返回
>
> 有完整上下文才好分析, 否则中间容易有 gap
>
> [@dosu-bot](https://github.com/dosu-bot) 怎么偷懒不回复了呢 🕧
http://xxx:8080/graphs/hugegraph/schema/vertexlabels
```
{
"vertexlabels": [
{
"id": 17,
"name": "star",
"id_strategy": "PRIMARY_KEY",
"primary_keys": [
"star_id"
],
"nullable_keys": [],
"index_labels": [
"star_name_idnex"
],
"properties": [
"star_name",
"star_id"
],
"status": "CREATED",
"ttl": 0,
"enable_label_index": true,
"user_data": {
"~create_time": "2025-05-27 01:10:24.309"
}
}
]
}
```
http://xxx:8080/graphs/hugegraph/graph/vertices?page&limit=3

```
@Test
void testSchema() {
SchemaManager schema = hugeClient.schema();
// 创建 属性类型
schema.propertyKey("star_name").asText().valueSingle().ifNotExist().create();
schema.propertyKey("star_relationship").asText().valueSingle().ifNotExist().create();
schema.propertyKey("star_id").asInt().valueSingle().ifNotExist().create();
// 创建顶点类型
schema.vertexLabel("star")
.properties("star_name", "star_id") // 绑定属性
.primaryKeys("star_id")
.ifNotExist().create();
// 创建 EdgeLabel(边类型)
schema.edgeLabel("rjgx")
.sourceLabel("star") // 源顶点类型
.targetLabel("star") // 目标顶点类型
.properties("star_relationship") // 边的属性(如关系强度)
.nullableKeys("star_relationship") // 允许 weight 属性为空
.ifNotExist().create();
// 为顶点属性创建索引
schema.indexLabel("star_name_idnex")
.onV("star")
.by("star_name")
.search() // 查询是基于"是"或者"包含"的查询条件
.ifNotExist().create();
//schema.indexLabel("star_id_idnex")
// .onV("star")
// .by("star_id")
// .secondary() // 二级索引(适用于精确查询)
// .ifNotExist().create();
// 为边属性创建索引
schema.indexLabel("rjgx_by_star_relationship")
.onE("rjgx")
.by("star_relationship")
.search() // 查询是基于"是"或者"包含"的查询条件
.ifNotExist().create();
}
@Test
void testGraphOne2() {
GraphManager graph = hugeClient.graph();
Vertex star_name1 = graph.addVertex(T.LABEL, "star", "star_id", 1,
"star_name", "黄飞鸿-25");
Vertex star_name2 = graph.addVertex(T.LABEL, "star", "star_id", 2,
"star_name", "十三姨");
//star_name1.addEdge("rjgx", star_name2, "star_relationship", "老公");
Edge edge = new Edge("rjgx");
edge.sourceId(1);
edge.targetId(2);
edge.property("star_relationship", "老公");
graph.addEdge(edge);
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]