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

调用VertexApi.update()接口报错:Automatic Id strategy is not supported now #145

Open
1 task done
kouhangting opened this issue Aug 22, 2022 · 2 comments
Open
1 task done

Comments

@kouhangting
Copy link

Problem Type (问题类型)

other exception / error (其他异常报错)

Before submit

Environment (环境信息)

  • Server Version: v0.11.2
  • Client Version: hugegraph-client-2.0.1.yunpi
  • Data Size: xx vertices, xx edges

Your Question (问题描述)

顶点类型使用主键策略为 “自动生成” 策略,调用接口入参

{
"updateStrategies": {
"override": "OVERRIDE"
},
"vertices": [{
"id": 626367419253784576,
"label": "人",
"properties": {
"名称": "朱棣",
"年龄": 65,
"地址": "北京市xxx"
}
}
]
}

调用VertexApi.update()接口报错
com.baidu.hugegraph.exception.ServerException: Automatic Id strategy is not supported now
at com.baidu.hugegraph.exception.ServerException.fromResponse(ServerException.java:47)
at com.baidu.hugegraph.client.RestClient.checkStatus(RestClient.java:93)
at com.baidu.hugegraph.rest.AbstractRestClient.put(AbstractRestClient.java:264)
at com.baidu.hugegraph.rest.AbstractRestClient.put(AbstractRestClient.java:244)
at com.baidu.hugegraph.api.graph.VertexAPI.update(VertexAPI.java:74)

但是如果主键策略为自定义数字等策略就可以正常调用。这个如何解决

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

// 查询顶点数据
g.V(626367419253784576)

// 返回json
[
  {
    "id": "626367419253784576",
    "label": "人",
    "properties": {
      "名称": "朱棣",
      "地址": "北京市",
      "年龄": 60
    }
  }
]

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

graph.schema()

[
  {
    "propertyKeys": [
      {
        "id": 7,
        "name": "地理_经度",
        "data_type": "DOUBLE",
        "cardinality": "SINGLE",
        "aggregate_type": "NONE",
        "properties": [],
        "status": "CREATED",
        "user_data": {
          "~create_time": 1657604950089
        }
      },
      {
        "id": 6,
        "name": "简介",
        "data_type": "TEXT",
        "cardinality": "SINGLE",
        "aggregate_type": "NONE",
        "properties": [],
        "status": "CREATED",
        "user_data": {
          "~create_time": 1657604803060
        }
      },
      {
        "id": 9,
        "name": "出生日期",
        "data_type": "DATE",
        "cardinality": "SINGLE",
        "aggregate_type": "NONE",
        "properties": [],
        "status": "CREATED",
        "user_data": {
          "~create_time": 1657605043247
        }
      },
      {
        "id": 8,
        "name": "地理_纬度",
        "data_type": "DOUBLE",
        "cardinality": "SINGLE",
        "aggregate_type": "NONE",
        "properties": [],
        "status": "CREATED",
        "user_data": {
          "~create_time": 1657604968127
        }
      },
      {
        "id": 3,
        "name": "经度",
        "data_type": "DOUBLE",
        "cardinality": "SINGLE",
        "aggregate_type": "NONE",
        "properties": [],
        "status": "CREATED",
        "user_data": {
          "~create_time": 1657604758104
        }
      },
      {
        "id": 2,
        "name": "地址",
        "data_type": "TEXT",
        "cardinality": "SINGLE",
        "aggregate_type": "NONE",
        "properties": [],
        "status": "CREATED",
        "user_data": {
          "~create_time": 1657604743501
        }
      },
      {
        "id": 5,
        "name": "创建时间",
        "data_type": "DATE",
        "cardinality": "SINGLE",
        "aggregate_type": "NONE",
        "properties": [],
        "status": "CREATED",
        "user_data": {
          "~create_time": 1657604782324
        }
      },
      {
        "id": 4,
        "name": "纬度",
        "data_type": "DOUBLE",
        "cardinality": "SINGLE",
        "aggregate_type": "NONE",
        "properties": [],
        "status": "CREATED",
        "user_data": {
          "~create_time": 1657604767341
        }
      },
      {
        "id": 1,
        "name": "名称",
        "data_type": "TEXT",
        "cardinality": "SINGLE",
        "aggregate_type": "NONE",
        "properties": [],
        "status": "CREATED",
        "user_data": {
          "~create_time": 1657604735292
        }
      },
      {
        "id": 11,
        "name": "年龄",
        "data_type": "INT",
        "cardinality": "SINGLE",
        "aggregate_type": "NONE",
        "properties": [],
        "status": "CREATED",
        "user_data": {
          "~create_time": 1657786872204
        }
      },
      {
        "id": 12,
        "name": "头像",
        "data_type": "TEXT",
        "cardinality": "SINGLE",
        "aggregate_type": "NONE",
        "properties": [],
        "status": "CREATED",
        "user_data": {
          "~create_time": 1658311968927
        }
      },
      {
        "id": 10,
        "name": "员工人数",
        "data_type": "INT",
        "cardinality": "SINGLE",
        "aggregate_type": "NONE",
        "properties": [],
        "status": "CREATED",
        "user_data": {
          "~create_time": 1657605057534
        }
      },
      {
        "id": 13,
        "name": "图片列表",
        "data_type": "TEXT",
        "cardinality": "LIST",
        "aggregate_type": "NONE",
        "properties": [],
        "status": "CREATED",
        "user_data": {
          "~create_time": 1658312738487
        }
      }
    ],
    "vertexLabels": [
      {
        "id": 1,
        "name": "古建筑",
        "id_strategy": "AUTOMATIC",
        "primary_keys": [],
        "nullable_keys": [
          "地址",
          "经度",
          "纬度",
          "创建时间",
          "简介"
        ],
        "index_labels": [],
        "properties": [
          "名称",
          "地址",
          "经度",
          "纬度",
          "创建时间",
          "简介"
        ],
        "status": "CREATED",
        "ttl": 0,
        "enable_label_index": false,
        "user_data": {
          "~create_time": 1657604998427,
          "~style": "{\"icon\":\"\",\"color\":\"#5c73e6\",\"size\":\"NORMAL\",\"display_fields\":[\"名称\"],\"join_symbols\":[\"-\"]}"
        }
      },
      {
        "id": 2,
        "name": "企业",
        "id_strategy": "AUTOMATIC",
        "primary_keys": [],
        "nullable_keys": [
          "地址",
          "创建时间",
          "简介",
          "地理_经度",
          "地理_纬度"
        ],
        "index_labels": [],
        "properties": [
          "名称",
          "地址",
          "创建时间",
          "简介",
          "地理_经度",
          "地理_纬度"
        ],
        "status": "CREATED",
        "ttl": 0,
        "enable_label_index": false,
        "user_data": {
          "~create_time": 1657605028652,
          "~style": "{\"icon\":\"\",\"color\":\"#5c73e6\",\"size\":\"NORMAL\",\"display_fields\":[\"名称\"],\"join_symbols\":[\"-\"]}"
        }
      },
      {
        "id": 3,
        "name": "人",
        "id_strategy": "AUTOMATIC",
        "primary_keys": [],
        "nullable_keys": [
          "地址",
          "地理_经度",
          "地理_纬度",
          "出生日期",
          "年龄",
          "头像",
          "图片列表"
        ],
        "index_labels": [
          "名称检索"
        ],
        "properties": [
          "名称",
          "地址",
          "地理_经度",
          "地理_纬度",
          "出生日期",
          "年龄",
          "头像",
          "图片列表"
        ],
        "status": "CREATED",
        "ttl": 0,
        "enable_label_index": false,
        "user_data": {
          "~create_time": 1657605149220,
          "~style": "{\"icon\":\"\",\"color\":\"#5c73e6\",\"size\":\"NORMAL\",\"display_fields\":[\"名称\"],\"join_symbols\":[\"-\"]}"
        }
      },
      {
        "id": 4,
        "name": "事件",
        "id_strategy": "AUTOMATIC",
        "primary_keys": [],
        "nullable_keys": [
          "经度",
          "纬度",
          "创建时间"
        ],
        "index_labels": [],
        "properties": [
          "名称",
          "经度",
          "纬度",
          "创建时间"
        ],
        "status": "CREATED",
        "ttl": 0,
        "enable_label_index": false,
        "user_data": {
          "~create_time": 1658124686874,
          "~style": "{\"icon\":\"\",\"color\":\"#5c73e6\",\"size\":\"NORMAL\",\"display_fields\":[\"名称\"],\"join_symbols\":[\"-\"]}"
        }
      },
      {
        "id": 5,
        "name": "地点",
        "id_strategy": "AUTOMATIC",
        "primary_keys": [],
        "nullable_keys": [
          "地址",
          "创建时间",
          "简介",
          "地理_经度",
          "地理_纬度"
        ],
        "index_labels": [],
        "properties": [
          "名称",
          "地址",
          "创建时间",
          "简介",
          "地理_经度",
          "地理_纬度"
        ],
        "status": "CREATED",
        "ttl": 0,
        "enable_label_index": false,
        "user_data": {
          "~create_time": 1658138631791,
          "~style": "{\"icon\":\"\",\"color\":\"#5c73e6\",\"size\":\"NORMAL\",\"display_fields\":[\"名称\"],\"join_symbols\":[\"-\"]}"
        }
      }
    ],
    "edgeLabels": [
      {
        "id": 1,
        "name": "办公住址",
        "source_label": "人",
        "target_label": "企业",
        "frequency": "SINGLE",
        "sort_keys": [],
        "nullable_keys": [
          "名称"
        ],
        "index_labels": [],
        "properties": [
          "名称"
        ],
        "status": "CREATED",
        "ttl": 0,
        "enable_label_index": false,
        "user_data": {
          "~create_time": 1658124621457,
          "~style": "{\"color\":\"#5c73e6\",\"with_arrow\":true,\"line_type\":\"SOLID\",\"thickness\":\"NORMAL\",\"display_fields\":[\"~id\"],\"join_symbols\":[\"-\"]}"
        }
      },
      {
        "id": 2,
        "name": "变更",
        "source_label": "人",
        "target_label": "事件",
        "frequency": "SINGLE",
        "sort_keys": [],
        "nullable_keys": [],
        "index_labels": [],
        "properties": [
          "名称"
        ],
        "status": "CREATED",
        "ttl": 0,
        "enable_label_index": false,
        "user_data": {
          "~create_time": 1658124736095,
          "~style": "{\"color\":\"#5c73e6\",\"with_arrow\":true,\"line_type\":\"SOLID\",\"thickness\":\"NORMAL\",\"display_fields\":[\"名称\"],\"join_symbols\":[\"-\"]}"
        }
      },
      {
        "id": 3,
        "name": "历史",
        "source_label": "企业",
        "target_label": "地点",
        "frequency": "SINGLE",
        "sort_keys": [],
        "nullable_keys": [
          "名称"
        ],
        "index_labels": [],
        "properties": [
          "名称"
        ],
        "status": "CREATED",
        "ttl": 0,
        "enable_label_index": false,
        "user_data": {
          "~create_time": 1658138717237,
          "~style": "{\"color\":\"#5c73e6\",\"with_arrow\":true,\"line_type\":\"SOLID\",\"thickness\":\"NORMAL\",\"display_fields\":[\"~id\"],\"join_symbols\":[\"-\"]}"
        }
      }
    ],
    "indexLabels": [
      {
        "id": 1,
        "name": "名称检索",
        "base_type": "VERTEX_LABEL",
        "base_value": "人",
        "index_type": "SECONDARY",
        "fields": [
          "名称"
        ],
        "status": "CREATED",
        "user_data": {
          "~create_time": "2022-08-09 17:39:27.135"
        }
      }
    ]
  }
]
@imbajin
Copy link
Contributor

imbajin commented Aug 22, 2022

current repository is archived soon, please move to apache-hugegraph-toolchain

image

@kouhangting
Copy link
Author

这个里面也是引用的 hugegraph-client 这个jar,最终还是调用的这个,但是我看数据库界面编辑调用的接口 /api/v1.2/graph-connections/226/graph/vertex/626367419253784576
参数:{"id":"626367419253784576","label":"人","properties":{"名称":"朱棣","地址":"北京市","年龄":"60"}}
底层也是调用的 api接口,这个问题最终如何解决

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants