Params说明

    • id:顶点类型id值
    • name:顶点类型名称,必填
    • id_strategy: 顶点类型的ID策略,主键ID、自动生成、自定义字符串、自定义数字、自定义UUID,默认主键ID
    • properties: 顶点类型关联的属性类型
    • primary_keys: 主键属性,当ID策略为PRIMARY_KEY时必须有值,其他ID策略时必须为空;
    • enable_label_index: 是否开启类型索引,默认关闭
    • index_names:顶点类型创建的索引,详情见3.4
    • nullable_keys:可为空的属性
    • user_data:设置顶点类型的通用信息,作用同属性类型

    1.3.1 创建一个VertexLabel

    Method & Url
    Request Body
    1. "name": "person",
    2. "id_strategy": "DEFAULT",
    3. "properties": [
    4. "name",
    5. "age"
    6. ],
    7. "primary_keys": [
    8. "name"
    9. ],
    10. "nullable_keys": [],
    11. "enable_label_index": true
    12. }
    Response Status
    1. 201
    Response Body
    1. {
    2. "id": 1,
    3. "primary_keys": [
    4. "name"
    5. ],
    6. "name": "person2",
    7. "index_names": [
    8. ],
    9. "properties": [
    10. "name",
    11. "age"
    12. ],
    13. "nullable_keys": [
    14. ],
    15. "enable_label_index": true,
    16. "user_data": {}
    17. }
    1. {
    2. "name": "person",
    3. "id_strategy": "DEFAULT",
    4. "properties": [
    5. "name",
    6. "age"
    7. ],
    8. "primary_keys": [
    9. "name"
    10. ],
    11. "ttl": 86400000,
    12. "enable_label_index": true
    13. }

    另外,当顶点中带有”创建时间”的属性且希望以”创建时间”属性作为计算顶点存活时间的起点时,可以设置 VertexLabel 中的 ttl_start_time 字段。比如 person VertexLabel 有 createdTime 属性,且 createdTime 是 Date 类型的参数,希望 person 类型的顶点从创建开始存活一天的时间,那么创建 person VertexLabel 的 Request Body 如下:

    1. {
    2. "name": "person",
    3. "id_strategy": "DEFAULT",
    4. "properties": [
    5. "name",
    6. "age",
    7. "createdTime"
    8. ],
    9. "primary_keys": [
    10. "name"
    11. ],
    12. "nullable_keys": [],
    13. "ttl": 86400000,
    14. "ttl_start_time": "createdTime",
    15. "enable_label_index": true
    16. }

    1.3.2 为已存在的VertexLabel添加properties或userdata,或者移除userdata(目前不支持移除properties)

    Params
    • action: 表示当前行为是添加还是移除,取值为append(添加)和eliminate(移除)
    Method & Url
    Request Body
    1. {
    2. "name": "person",
    3. "properties": [
    4. "city"
    5. ],
    6. "nullable_keys": ["city"],
    7. "user_data": {
    8. "super": "animal"
    9. }
    Response Status
    1. 200
    Response Body
    1. {
    2. "id": 1,
    3. "primary_keys": [
    4. "name"
    5. ],
    6. "id_strategy": "PRIMARY_KEY",
    7. "name": "person",
    8. "index_names": [
    9. ],
    10. "city",
    11. "name",
    12. "age"
    13. ],
    14. "nullable_keys": [
    15. "city"
    16. ],
    17. "enable_label_index": true,
    18. "user_data": {
    19. "super": "animal"
    20. }
    21. }

    1.3.3 获取所有的VertexLabel

    Method & Url
    1. GET http://localhost:8080/graphs/hugegraph/schema/vertexlabels
    Response Status
    1. 200
    Response Body

    1.3.4 根据name获取VertexLabel

    Method & Url
    1. GET http://localhost:8080/graphs/hugegraph/schema/vertexlabels/person
    Response Status
    1. 200
    Response Body
    1. {
    2. "id": 1,
    3. "primary_keys": [
    4. "name"
    5. ],
    6. "id_strategy": "PRIMARY_KEY",
    7. "name": "person",
    8. "index_names": [
    9. ],
    10. "properties": [
    11. "city",
    12. "name",
    13. "age"
    14. ],
    15. "nullable_keys": [
    16. "city"
    17. ],
    18. "enable_label_index": true,
    19. "user_data": {
    20. "super": "animal"
    21. }
    22. }

    1.3.5 根据name删除VertexLabel

    Method & Url
    1. DELETE http://localhost:8080/graphs/hugegraph/schema/vertexlabels/person
    Response Status
      Response Body

      注: