1.2 PropertyKey

Params说明:

  • name:属性类型名称,必填
  • data_type:属性类型数据类型,包括:bool、byte、int、long、float、double、string、date、uuid、blob,默认string类型
  • cardinality:属性类型基数,包括:single、list、set,默认single

请求体字段说明:

  • id:属性类型id值
  • properties:属性的属性,对于属性而言,此项为空
  • user_data:设置属性类型的通用信息,比如可设置age属性的取值范围,最小为0,最大为100;目前此项不做任何校验,只为后期拓展提供预留入口

1.2.1 创建一个 PropertyKey

Method & Url
  1. POST http://localhost:8080/graphs/hugegraph/schema/propertykeys
Request Body
  1. {
  2. "property_key" : {
  3. "name": "age",
  4. "data_type": "INT",
  5. "cardinality": "SINGLE"
  6. },
  7. "task_id": 0
  8. }
Response Status
  1. 202
Response Body
  1. {
  2. "id": 2,
  3. "name": "age",
  4. "data_type": "INT",
  5. "cardinality": "SINGLE",
  6. "properties": [],
  7. "user_data": {}
  8. }

1.2.2 为已存在的 PropertyKey 添加或移除 userdata

Params
  • action: 表示当前行为是添加还是移除,取值为append(添加)和eliminate(移除)
Method & Url
  1. PUT http://localhost:8080/graphs/hugegraph/schema/propertykeys/age?action=append
Request Body
  1. {
  2. "property_key" : {
  3. "name": "age",
  4. "user_data": {
  5. "min": 0,
  6. "max": 100
  7. }
  8. },
  9. "task_id" : 0
  10. }
Response Status
  1. 202
Response Body
  1. {
  2. "id": 2,
  3. "name": "age",
  4. "data_type": "INT",
  5. "cardinality": "SINGLE",
  6. "properties": [],
  7. "user_data": {
  8. "min": 0,
  9. "max": 100
  10. }
  11. }

1.2.3 获取所有的 PropertyKey

Method & Url
  1. GET http://localhost:8080/graphs/hugegraph/schema/propertykeys
Response Status
  1. 200
Response Body
  1. {
  2. "propertykeys": [
  3. {
  4. "id": 3,
  5. "name": "city",
  6. "data_type": "TEXT",
  7. "cardinality": "SINGLE",
  8. "properties": [],
  9. "user_data": {}
  10. },
  11. {
  12. "id": 2,
  13. "name": "age",
  14. "data_type": "INT",
  15. "cardinality": "SINGLE",
  16. "properties": [],
  17. "user_data": {}
  18. },
  19. {
  20. "id": 5,
  21. "name": "lang",
  22. "data_type": "TEXT",
  23. "cardinality": "SINGLE",
  24. "properties": [],
  25. "user_data": {}
  26. },
  27. {
  28. "id": 4,
  29. "name": "weight",
  30. "data_type": "DOUBLE",
  31. "cardinality": "SINGLE",
  32. "properties": [],
  33. "user_data": {}
  34. },
  35. {
  36. "id": 6,
  37. "name": "date",
  38. "data_type": "TEXT",
  39. "cardinality": "SINGLE",
  40. "properties": [],
  41. "user_data": {}
  42. },
  43. {
  44. "id": 1,
  45. "name": "name",
  46. "data_type": "TEXT",
  47. "cardinality": "SINGLE",
  48. "properties": [],
  49. "user_data": {}
  50. },
  51. {
  52. "id": 7,
  53. "name": "price",
  54. "data_type": "INT",
  55. "cardinality": "SINGLE",
  56. "properties": [],
  57. "user_data": {}
  58. }
  59. ]
  60. }

1.2.4 根据name获取PropertyKey

Method & Url
  1. GET http://localhost:8080/graphs/hugegraph/schema/propertykeys/age

其中,age为要获取的PropertyKey的名字

Response Status
  1. 200
Response Body
  1. {
  2. "id": 2,
  3. "name": "age",
  4. "data_type": "INT",
  5. "cardinality": "SINGLE",
  6. "properties": [],
  7. "user_data": {}
  8. }

1.2.5 根据name删除PropertyKey

Method & Url
  1. DELETE http://localhost:8080/graphs/hugegraph/schema/propertykeys/age

其中,age为要获取的PropertyKey的名字

Response Status
  1. 202
Response Body
  1. {
  2. "property_key" : {
  3. "id": 2,
  4. "name": "age",
  5. "data_type": "INT",
  6. "cardinality": "SINGLE",
  7. "properties": [],
  8. "user_data": {}
  9. },
  10. "task_id" : 0
  11. }