-
Notifications
You must be signed in to change notification settings - Fork 442
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
feat(interactive): Add Create/Update/Get APIs for vertex/edge in Interactive #4025
Conversation
Nice work! Could you please add an end-to-end test case covering the creation, updating, and retrieval of vertices and edges? Perhaps including a test scenario within You may use the ldbc sf0.1 as the dataset. |
435308e
to
6bcafb1
Compare
@@ -168,6 +169,84 @@ seastar::future<std::unique_ptr<seastar::httpd::reply>> hqps_ic_handler::handle( | |||
auto dst_executor = executor_idx_; | |||
executor_idx_ = (executor_idx_ + 1) % shard_concurrency_; | |||
// TODO(zhanglei): choose read or write based on the request, after the | |||
auto& method = req->_method; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we need a new handler to handle vertex/edge CRUD request? @luoxiaojian
@@ -59,6 +59,8 @@ using admin_query_result = payload<gs::Result<seastar::sstring>>; | |||
// url_path, query_param | |||
using graph_management_param = | |||
payload<std::pair<seastar::sstring, seastar::sstring>>; | |||
using graph_management_query_param = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need a map?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the get request is for a map, not a json.
15728c8
to
f057101
Compare
…and retrieving vertices and edges. The Delete operation is not included as the underlying Graph DB does not yet support it.
7d23cd6
to
853a136
Compare
…ers into scope cancel/recreation Committed-by: xiaolei.zl from Dev container
Committed-by: xiaolei.zl from Dev container
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What do these changes do?
This PR primarily support six interfaces for creating, updating, and retrieving vertices and edges. The Delete operation is not included as the underlying Graph DB does not yet support it.
The interfaces for vertices are as follows:
GET (retrieve) / POST (create) / PUT (update)
/v1/graph/{graph_id}/vertex
The interfaces for edges are as follows:
GET (retrieve) / POST (create) / PUT (update)
/v1/graph/{graph_id}/edge
CreateVertex
This API interface enables the creation of any number of vertices within an existing graph, along with the addition of any number of edges. The two vertices connected by these edges must either already exist within the graph or be newly created vertices.
single_vertex_insert_transaction
is triggered, which supports inserting a single vertex and multiple edges.insert_transaction
is triggered, which allows for unrestricted insertion of vertices and edges.Http Request
/v1/graph/{graph_id}/vertex
application/json
CreateEdge
This API interface allows the creation of any number of edges within an existing graph. The two vertices connected by these edges must already exist within the graph.
single_edge_insert_transaction
is triggered, which supports the insertion of a single edge.insert_transaction
is triggered, which supports the insertion of an unlimited number of edges.Http Request
/v1/graph/{graph_id}/edge
application/json
GetVertex(GraphManagement Category)
The function of this API interface is to get the properties of a Vertex in an existing graph.
Http Request
/v1/graph/{graph_id}/vertex
Expected Response
application/json
Successfully found vertex
GetEdge(GraphManagement Category)
The function of this API interface is to get information about the properties of an Edge in an existing graph.
Http Request
/v1/graph/{graph_id}/edge
Expected Response
application/json
UpdateVertex(GraphManagement Category)
The function of this API interface is to modify the properties of a Vertex in an existing graph.
Http Request
/v1/graph/{graph_id}/vertex
application/json
UpdateEdge(GraphManagement Category)
The function of this API interface is to modify the properties of the Edge in an existing graph.
Http Request
/v1/graph/{graph_id}/edge
application/json
Limitations:
Due to the significant cost of partitioning, queries on
graph_id
can only be performed on the currently running graph.Although the system now supports edges with multiple attributes, the related transactions only support the creation, update, and retrieval of edges with a single attribute. Therefore, operations on multi-attribute edges are not supported at this time.
For edges/vertices of the same type, only 20% of the size N allocated at import time is reserved. If the initial graph is very small, only one or two edges/vertices can be inserted. This aspect will need to be adjusted in the future.
These interfaces have been designed to closely align with the SDK requirements. However, adjustments are needed within the SDK to support batch insertion of multiple vertices and edges.