8.1.1 向HugeGraphServer发送gremlin语句(GET),同步执行

    Params
    • gremlin: 要发送给执行的gremlin语句
    • bindings: 用来绑定参数,key是字符串,value是绑定的值(只能是字符串或者数字),功能类似于MySQL的 Prepared Statement,用于加速语句执行
    • language: 发送语句的语言类型,默认为gremlin-groovy
    • aliases: 为存在于图空间的已有变量添加别名
    Method & Url
    Response Status
    1. 200
    Response Body
    1. {
    2. "requestId": "c6ef47a8-b634-4b07-9d38-6b3b69a3a556",
    3. "status": {
    4. "message": "",
    5. "code": 200,
    6. "attributes": {}
    7. },
    8. "result": {
    9. "data": [{
    10. "id": "1:marko",
    11. "label": "person",
    12. "type": "vertex",
    13. "properties": {
    14. "city": [{
    15. "id": "1:marko>city",
    16. "value": "Beijing"
    17. }],
    18. "name": [{
    19. "id": "1:marko>name",
    20. "value": "marko"
    21. }],
    22. "age": [{
    23. "value": 29
    24. }]
    25. }
    26. }],
    27. "meta": {}
    28. }
    29. }

    8.1.2 向HugeGraphServer发送gremlin语句(POST),同步执行

    Method & Url
    1. POST http://localhost:8080/gremlin

    查询顶点

    Request Body
    1. {
    2. "gremlin": "hugegraph.traversal().V('1:marko')",
    3. "bindings": {},
    4. "language": "gremlin-groovy",
    5. "aliases": {}
    6. }
    Response Status
    Response Body
    1. {
    2. "requestId": "c6ef47a8-b634-4b07-9d38-6b3b69a3a556",
    3. "status": {
    4. "message": "",
    5. "attributes": {}
    6. },
    7. "result": {
    8. "data": [{
    9. "id": "1:marko",
    10. "label": "person",
    11. "type": "vertex",
    12. "properties": {
    13. "city": [{
    14. "id": "1:marko>city",
    15. "value": "Beijing"
    16. }],
    17. "name": [{
    18. "id": "1:marko>name",
    19. "value": "marko"
    20. }],
    21. "age": [{
    22. "id": "1:marko>age",
    23. "value": 29
    24. }]
    25. }
    26. }],
    27. "meta": {}
    28. }
    29. }

    注意:

    查询边

    Request Body
    1. {
    2. "gremlin": "g.E('S1:marko>2>>S2:lop')",
    3. "bindings": {},
    4. "language": "gremlin-groovy",
    5. "graph": "hugegraph",
    6. "g": "__g_hugegraph"
    7. }
    8. }
    Response Status
    1. 200
    Response Body
    1. {
    2. "requestId": "3f117cd4-eedc-4e08-a106-ee01d7bb8249",
    3. "status": {
    4. "code": 200,
    5. "attributes": {}
    6. },
    7. "result": {
    8. "data": [{
    9. "id": "S1:marko>2>>S2:lop",
    10. "label": "created",
    11. "type": "edge",
    12. "inVLabel": "software",
    13. "outVLabel": "person",
    14. "inV": "2:lop",
    15. "outV": "1:marko",
    16. "properties": {
    17. "weight": 0.4,
    18. "date": "20171210"
    19. }
    20. }],
    21. "meta": {}
    22. }
    23. }

    8.1.3 向HugeGraphServer发送gremlin语句(POST),异步执行

    Method & Url

    查询顶点

    Request Body
    1. {
    2. "gremlin": "g.V('1:marko')",
    3. "bindings": {},
    4. "language": "gremlin-groovy",
    5. "aliases": {}
    6. }

    注意:

    Response Status
    1. 201
    Response Body
    1. {
    2. "task_id": 1
    3. }

    注:

    查询边

    Request Body
    1. {
    2. "gremlin": "g.E('S1:marko>2>>S2:lop')",
    3. "bindings": {},
    4. "language": "gremlin-groovy",
    5. "aliases": {}
    6. }
    Response Status
    Response Body
    1. {
    2. "task_id": 2