From 239b392e512c17750928292a35d855ca4fa9f4e9 Mon Sep 17 00:00:00 2001 From: Zhang Lei Date: Wed, 11 Sep 2024 10:59:07 +0800 Subject: [PATCH] docs(interactive): Refine the documentation of Interactive (#4209) - Add the documentation of CRU of Vertex/Edge. - Update cpp_procedure.md - Fix the documentation of python sdk. --- .../interactive/development/java/EdgeApi.md | 230 ++++++++++++++++++ .../java/ProcedureManagementApi.md | 2 +- .../development/java/QueryServiceApi.md | 2 +- .../interactive/development/java/VertexApi.md | 222 +++++++++++++++++ .../interactive/development/java/java_sdk.md | 32 ++- .../interactive/development/python/EdgeApi.md | 222 +++++++++++++++++ .../development/python/GraphManagementApi.md | 14 +- .../development/python/JobManagementApi.md | 6 +- .../python/ProcedureManagementApi.md | 10 +- .../development/python/QueryServiceApi.md | 6 +- .../python/ServiceManagementApi.md | 8 +- .../development/python/VertexApi.md | 218 +++++++++++++++++ .../development/python/python_sdk.md | 29 ++- .../stored_procedure/cpp_procedure.md | 5 +- .../stored_procedure/cypher_procedure.md | 51 ---- docs/flex/interactive/getting_started.md | 97 +------- docs/flex/interactive/stored_procedures.md | 9 +- flex/interactive/sdk/generate_sdk_doc.sh | 24 +- 18 files changed, 990 insertions(+), 197 deletions(-) create mode 100644 docs/flex/interactive/development/java/EdgeApi.md create mode 100644 docs/flex/interactive/development/java/VertexApi.md create mode 100644 docs/flex/interactive/development/python/EdgeApi.md create mode 100644 docs/flex/interactive/development/python/VertexApi.md delete mode 100644 docs/flex/interactive/development/stored_procedure/cypher_procedure.md diff --git a/docs/flex/interactive/development/java/EdgeApi.md b/docs/flex/interactive/development/java/EdgeApi.md new file mode 100644 index 000000000000..2119374bf99d --- /dev/null +++ b/docs/flex/interactive/development/java/EdgeApi.md @@ -0,0 +1,230 @@ +# EdgeAPi + +All URIs are relative to *{INTERACTIVE_ADMIN_ENDPOINT}* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**addEdge**](EdgeApi.md#addEdge) | **POST** /v1/graph/{graph_id}/edge | Add edge to the graph | +| [**deleteEdge**](EdgeApi.md#deleteEdge) | **DELETE** /v1/graph/{graph_id}/edge | Remove edge from the graph | +| [**getEdge**](EdgeApi.md#getEdge) | **GET** /v1/graph/{graph_id}/edge | Get the edge's properties with src and dst vertex primary keys. | +| [**updateEdge**](EdgeApi.md#updateEdge) | **PUT** /v1/graph/{graph_id}/edge | Update edge's property | + + + +# **addEdge** +> Result<String> addEdge(graphId, edgeRequest) + +Add edge to the graph. + +See [Creating-Graph](GraphManagementApi.md#creategraph) about how to create a graph. Here we use the default graph(with id 1) for example. + +### Example +```java +// Import classes: +import com.alibaba.graphscope.interactive.models.*; +import com.alibaba.graphscope.interactive.client.Driver; +import com.alibaba.graphscope.interactive.client.Session; +import com.alibaba.graphscope.interactive.client.common.Result; + +public class Example { + public static void main(String[] args) { + Driver driver = Driver.connect(); + Session session = driver.session(); + + String graphId = "1"; + EdgeRequest edgeRequest3 = + new EdgeRequest() + .srcLabel("person") + .dstLabel("person") + .edgeLabel("knows") + .srcPrimaryKeyValue(2) + .dstPrimaryKeyValue(4) + .addPropertiesItem(new Property().name("weight").value(9.123)); + EdgeRequest edgeRequest4 = + new EdgeRequest() + .srcLabel("person") + .dstLabel("person") + .edgeLabel("knows") + .srcPrimaryKeyValue(2) + .dstPrimaryKeyValue(6) + .addPropertiesItem(new Property().name("weight").value(3.233)); + List edgeRequests = new ArrayList<>(); + edgeRequests.add(edgeRequest3); + edgeRequests.add(edgeRequest4); + Result addEdgeResponse = session.addEdge(graphId, edgeRequests); + if (!addEdgeResponse.isOk()) { + System.out.println("Failed to create edge: " + addEdgeResponse.getStatusMessage()); + } + else { + System.out.println("Create edge response: " + addEdgeResponse.getValue()); + } + return; + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **graphId** | **String**| | | +| **edgeRequest** | [**List<EdgeRequest>**](EdgeRequest.md)| | | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successfully insert the edge | - | +| **400** | Invalid input edge | - | +| **409** | edge already exists | - | +| **500** | Server internal error | - | + + +# **getEdge** +> Result<EdgeData> getEdge(graphId, edgeLabel, srcLabel, srcPrimaryKeyValue, dstLabel, dstPrimaryKeyValue) + +Get the edge's properties with src and dst vertex primary keys. + +### Example +```java +// Import classes: +import com.alibaba.graphscope.interactive.models.*; +import com.alibaba.graphscope.interactive.client.Driver; +import com.alibaba.graphscope.interactive.client.Session; +import com.alibaba.graphscope.interactive.client.common.Result; + +public class Example { + public static void main(String[] args) { + Driver driver = Driver.connect(); + Session session = driver.session(); + + String graphId = "1"; + Result getEdgeResponse = + session.getEdge(graphId, "knows", "person", 2, "person", 4); + if (getEdgeResponse.isOk()){ + for (Property property : getEdgeResponse.getValue().getProperties()) { + if (property.getName().equals("weight")) { + Double weight = Double.parseDouble(property.getValue().toString()); + assert weight.equals(9.123); + } + } + } else { + System.out.println("Get edge failed: " + getEdgeResponse.getValue()); + } + return; + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **graphId** | **String**| | | +| **edgeLabel** | **String**| The label name of querying edge. | | +| **srcLabel** | **String**| The label name of src vertex. | | +| **srcPrimaryKeyValue** | [**Object**](.md)| The primary key value of src vertex. | | +| **dstLabel** | **String**| The label name of dst vertex. | | +| **dstPrimaryKeyValue** | [**Object**](.md)| The value of dst vertex's primary key | | + +### Return type + +[**EdgeData**](EdgeData.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Found Edge | - | +| **400** | Bad input parameter | - | +| **404** | Edge not found or Graph not found | - | +| **500** | Server internal error | - | + + +# **updateEdge** +> Result<String> updateEdge(graphId, edgeRequest) + +Update edge's property + + +### Example +```java +// Import classes: +import com.alibaba.graphscope.interactive.models.*; +import com.alibaba.graphscope.interactive.client.Driver; +import com.alibaba.graphscope.interactive.client.Session; +import com.alibaba.graphscope.interactive.client.common.Result; + +public class Example { + public static void main(String[] args) { + Driver driver = Driver.connect(); + Session session = driver.session(); + + String graphId = "1"; + EdgeRequest updateEdgeRequest = + new EdgeRequest() + .srcLabel("person") + .dstLabel("person") + .edgeLabel("knows") + .srcPrimaryKeyValue(2) + .dstPrimaryKeyValue(4) + .addPropertiesItem(new Property().name("weight").value(3.0)); + Result updateEdgeResponse = session.updateEdge(graphId, updateEdgeRequest); + if (!updateEdgeResponse.isOk()) { + System.out.println("Failed to update edge: " + updateEdgeResponse.getStatusMessage()); + } + else { + System.out.println("Update edge response: " + updateEdgeResponse.getValue()); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **graphId** | **String**| | | +| **edgeRequest** | [**EdgeRequest**](EdgeRequest.md)| | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successfully update edge | - | +| **400** | Invalid input parameters | - | +| **404** | Edge not exists | - | +| **500** | Server internal error | - | + diff --git a/docs/flex/interactive/development/java/ProcedureManagementApi.md b/docs/flex/interactive/development/java/ProcedureManagementApi.md index 8a1262f85533..751e222d8a2f 100644 --- a/docs/flex/interactive/development/java/ProcedureManagementApi.md +++ b/docs/flex/interactive/development/java/ProcedureManagementApi.md @@ -18,7 +18,7 @@ All URIs are relative to *{INTERACTIVE_ADMIN_ENDPOINT}* Create a new procedure on a graph with give id. Both `cypher` and `c++` stored procedures could be registered. -Please refer to [CppStoredProcedure](../stored_procedure/cpp_procedure.md) and [CypherStoredProcedure](../stored_procedure/cypher_procedure.md). +Please refer to [CppStoredProcedure](../stored_procedure/cpp_procedure.md) and [CypherStoredProcedure](../../stored_procedures.md). ### Example ```java diff --git a/docs/flex/interactive/development/java/QueryServiceApi.md b/docs/flex/interactive/development/java/QueryServiceApi.md index f6e84d2c59a5..a1227b43eb5c 100644 --- a/docs/flex/interactive/development/java/QueryServiceApi.md +++ b/docs/flex/interactive/development/java/QueryServiceApi.md @@ -19,7 +19,7 @@ If you attempt to submit a query to a graph that is not currently running, we wi Submit procedure call queries to the specified graph. The output format for the query is define by the [results.proto](https://github.com/alibaba/GraphScope/blob/main/interactive_engine/executor/ir/proto/results.proto). -For the creation of stored procedure please refer to [CypherStoredProcedure](../stored_procedure/cypher_procedure.md) and [CppStoredProcedure](../stored_procedure/cpp_procedure.md). +For the creation of stored procedure please refer to [CypherStoredProcedure](../../stored_procedures.md) and [CppStoredProcedure](../stored_procedure/cpp_procedure.md). ### Example ```java diff --git a/docs/flex/interactive/development/java/VertexApi.md b/docs/flex/interactive/development/java/VertexApi.md new file mode 100644 index 000000000000..f4e7d7402e69 --- /dev/null +++ b/docs/flex/interactive/development/java/VertexApi.md @@ -0,0 +1,222 @@ +# VertexApi + +All URIs are relative to *{INTERACTIVE_ADMIN_ENDPOINT}* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**addVertex**](VertexApi.md#addVertex) | **POST** /v1/graph/{graph_id}/vertex | Add vertex to the graph | +| [**deleteVertex**](VertexApi.md#deleteVertex) | **DELETE** /v1/graph/{graph_id}/vertex | Remove vertex from the graph | +| [**getVertex**](VertexApi.md#getVertex) | **GET** /v1/graph/{graph_id}/vertex | Get the vertex's properties with vertex primary key. | +| [**updateVertex**](VertexApi.md#updateVertex) | **PUT** /v1/graph/{graph_id}/vertex | Update vertex's property | + + + +# **addVertex** +> Result<String> addVertex(graphId, vertexEdgeRequest) + +Add vertex to the graph. + +See [Creating-Graph](GraphManagementApi.md#creategraph) about how to create a graph. Here we use the default graph(with id 1) for example. + +### Example +```java +// Import classes: +import com.alibaba.graphscope.interactive.models.*; +import com.alibaba.graphscope.interactive.client.Driver; +import com.alibaba.graphscope.interactive.client.Session; +import com.alibaba.graphscope.interactive.client.common.Result; + +public class Example { + public static void main(String[] args) { + Driver driver = Driver.connect(); + Session session = driver.session(); + + String graphId = "1"; + VertexRequest vertexRequest = + new VertexRequest() + .label("person") + .primaryKeyValue(8) + .addPropertiesItem(new Property().name("name").value("mike")) + .addPropertiesItem(new Property().name("age").value(12)); + VertexEdgeRequest vertexEdgeRequest = + new VertexEdgeRequest() + .addVertexRequestItem(vertexRequest); + Result addVertexResponse = session.addVertex(graphId, vertexEdgeRequest); + if (!addVertexResponse.isOk()) { + System.out.println("Failed to create vertex: " + addVertexResponse.getStatusMessage()); + } + else { + System.out.println("Create vertex response: " + addVertexResponse.getValue()); + } + return; + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **graphId** | **String**| | | +| **vertexEdgeRequest** | [**VertexEdgeRequest**](VertexEdgeRequest.md)| | | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successfully created vertex | - | +| **400** | Invalid input vertex | - | +| **404** | Graph not found | - | +| **409** | Vertex already exists | - | +| **500** | Server internal error | - | + + + +# **getVertex** +> Result<VertexData> getVertex(graphId, label, primaryKeyValue) + +Get the vertex's properties with vertex primary key. + +Get the properties for the specified vertex. example: ```http GET /endpoint?param1=value1&param2=value2 HTTP/1.1 Host: example.com ``` + +### Example +```java +// Import classes: +import com.alibaba.graphscope.interactive.models.*; +import com.alibaba.graphscope.interactive.client.Driver; +import com.alibaba.graphscope.interactive.client.Session; +import com.alibaba.graphscope.interactive.client.common.Result; + +public class Example { + public static void main(String[] args) { + Driver driver = Driver.connect(); + Session session = driver.session(); + + String graphId = "1"; + Result getVertexResponse = session.getVertex(graphId, "person", 8); + if (getVertexResponse.isOk()){ + for (Property property : getVertexResponse.getValue().getValues()) { + if (property.getName().equals("name")) { + assert property.getValue().equals("mike"); + } + if (property.getName().equals("age")) { + // object is Integer + assert property.getValue().equals("12"); + } + } + } + else { + System.out.println("Failed to create vertex: " + getVertexResponse.getStatusMessage()); + } + return ; + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **graphId** | **String**| The id of the graph | | +| **label** | **String**| The label name of querying vertex. | | +| **primaryKeyValue** | [**Object**] | The primary key value of querying vertex. | | + +### Return type + +[**VertexData**](VertexData.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Found vertex | - | +| **400** | Bad input parameter | - | +| **404** | Vertex not found or graph not found | - | +| **500** | Server internal error | - | + + +# **updateVertex** +> Result<String> updateVertex(graphId, vertexRequest) + +Update the vertex's properties. + +### Example +```java +// Import classes: +import com.alibaba.graphscope.interactive.models.*; +import com.alibaba.graphscope.interactive.client.Driver; +import com.alibaba.graphscope.interactive.client.Session; +import com.alibaba.graphscope.interactive.client.common.Result; + +public class Example { + public static void main(String[] args) { + Driver driver = Driver.connect(); + Session session = driver.session(); + + String graphId = "1"; + VertexRequest updateVertexRequest = + new VertexRequest() + .label("person") + .primaryKeyValue(8) + .addPropertiesItem(new Property().name("name").value("Cindy")) + .addPropertiesItem(new Property().name("age").value(24)); + Result updateVertexResponse = session.updateVertex(graphId, updateVertexRequest); + if (updateVertexResponse.isOk()){ + System.out.println("Successfully updated vertex's property"); + } + else { + System.out.println("Fail to update vertex's property" + updateVertexResponse.getStatusMessage()); + } + return ; + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **graphId** | **String**| | | +| **vertexRequest** | [**VertexRequest**](VertexRequest.md)| | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successfully update vertex | - | +| **400** | Invalid input parameters | - | +| **404** | Vertex not exists | - | +| **500** | Server internal error | - | + diff --git a/docs/flex/interactive/development/java/java_sdk.md b/docs/flex/interactive/development/java/java_sdk.md index e423e3cf2da9..050ceb19ee5c 100644 --- a/docs/flex/interactive/development/java/java_sdk.md +++ b/docs/flex/interactive/development/java/java_sdk.md @@ -420,6 +420,8 @@ The APIs in interactive SDK are divided into five categories. - JobManagementApi - ServiceManagementApi - QueryServiceApi +- VertexApi +- EdgeApi @@ -447,20 +449,28 @@ Class | Method | HTTP request | Description *ServiceManagementApi* | [**StopService**](./ServiceManagementApi.md#StopService) | **POST** /v1/service/stop | *QueryServiceApi* | [**CallProcedure**](./QueryServiceApi.md#CallProcedure) | **POST** /v1/graph/{graph_id}/query | *QueryServiceApi* | [**CallProcedureOnCurrentGraph**](./QueryServiceApi.md#CallProcedureOnCurrentGraph) | **POST** /v1/graph/current/query | - +*VertexApi* | [**addVertex**](./VertexApi.md#addVertex) | **POST** /v1/graph/{graph_id}/vertex | Add vertex to the graph +*VertexApi* | [**getVertex**](./VertexApi.md#getVertex) | **GET** /v1/graph/{graph_id}/vertex | Get the vertex's properties with vertex primary key. +*VertexApi* | [**updateVertex**](./VertexApi.md#updateVertex) | **PUT** /v1/graph/{graph_id}/vertex | Update vertex's property +*EdgeApi* | [**addEdge**](./EdgeApi.md#addEdge) | **POST** /v1/graph/{graph_id}/edge | Add edge to the graph +*EdgeApi* | [**getEdge**](./EdgeApi.md#getEdge) | **GET** /v1/graph/{graph_id}/edge | Get the edge's properties with src and dst vertex primary keys. +*EdgeApi* | [**updateEdge**](./EdgeApi.md#updateEdge) | **PUT** /v1/graph/{graph_id}/edge | Update edge's property + + +```{note} +Delete Vertex/Edge is currently not supported by Interactive. +``` ## Documentation for Data Structures + - [APIResponseWithCode](./APIResponseWithCode.md) - [BaseEdgeType](./BaseEdgeType.md) - [BaseEdgeTypeVertexTypePairRelationsInner](./BaseEdgeTypeVertexTypePairRelationsInner.md) - [BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams](./BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams.md) - [BasePropertyMeta](./BasePropertyMeta.md) - [BaseVertexType](./BaseVertexType.md) - [BaseVertexTypeXCsrParams](./BaseVertexTypeXCsrParams.md) - - [Collection](./Collection.md) - - [CollectiveResults](./CollectiveResults.md) - - [Column](./Column.md) - [ColumnMapping](./ColumnMapping.md) - [CreateEdgeType](./CreateEdgeType.md) - [CreateGraphRequest](./CreateGraphRequest.md) @@ -470,6 +480,7 @@ Class | Method | HTTP request | Description - [CreateProcedureResponse](./CreateProcedureResponse.md) - [CreatePropertyMeta](./CreatePropertyMeta.md) - [CreateVertexType](./CreateVertexType.md) + - [DateType](./DateType.md) - [EdgeData](./EdgeData.md) - [EdgeMapping](./EdgeMapping.md) - [EdgeMappingDestinationVertexMappingsInner](./EdgeMappingDestinationVertexMappingsInner.md) @@ -477,43 +488,48 @@ Class | Method | HTTP request | Description - [EdgeMappingSourceVertexMappingsInnerColumn](./EdgeMappingSourceVertexMappingsInnerColumn.md) - [EdgeMappingTypeTriplet](./EdgeMappingTypeTriplet.md) - [EdgeRequest](./EdgeRequest.md) - - [Element](./Element.md) + - [EdgeStatistics](./EdgeStatistics.md) - [FixedChar](./FixedChar.md) - [FixedCharChar](./FixedCharChar.md) - [GSDataType](./GSDataType.md) - [GetEdgeType](./GetEdgeType.md) - [GetGraphResponse](./GetGraphResponse.md) - [GetGraphSchemaResponse](./GetGraphSchemaResponse.md) + - [GetGraphStatisticsResponse](./GetGraphStatisticsResponse.md) - [GetProcedureResponse](./GetProcedureResponse.md) - [GetPropertyMeta](./GetPropertyMeta.md) - [GetVertexType](./GetVertexType.md) - [JobResponse](./JobResponse.md) - [JobStatus](./JobStatus.md) - - [KeyValue](./KeyValue.md) - [LongText](./LongText.md) - [Parameter](./Parameter.md) - [PrimitiveType](./PrimitiveType.md) - [Property](./Property.md) - - [PropertyArray](./PropertyArray.md) - [QueryRequest](./QueryRequest.md) - - [Record](./Record.md) - [SchemaMapping](./SchemaMapping.md) - [SchemaMappingLoadingConfig](./SchemaMappingLoadingConfig.md) + - [SchemaMappingLoadingConfigDataSource](./SchemaMappingLoadingConfigDataSource.md) - [SchemaMappingLoadingConfigFormat](./SchemaMappingLoadingConfigFormat.md) + - [SchemaMappingLoadingConfigXCsrParams](./SchemaMappingLoadingConfigXCsrParams.md) - [ServiceStatus](./ServiceStatus.md) - [StartServiceRequest](./StartServiceRequest.md) - [StoredProcedureMeta](./StoredProcedureMeta.md) - [StringType](./StringType.md) - [StringTypeString](./StringTypeString.md) - [TemporalType](./TemporalType.md) + - [TemporalTypeTemporal](./TemporalTypeTemporal.md) - [TimeStampType](./TimeStampType.md) - [TypedValue](./TypedValue.md) - [UpdateProcedureRequest](./UpdateProcedureRequest.md) + - [UploadFileResponse](./UploadFileResponse.md) - [VarChar](./VarChar.md) - [VarCharVarChar](./VarCharVarChar.md) - [VertexData](./VertexData.md) + - [VertexEdgeRequest](./VertexEdgeRequest.md) - [VertexMapping](./VertexMapping.md) - [VertexRequest](./VertexRequest.md) + - [VertexStatistics](./VertexStatistics.md) + - [VertexTypePairStatistics](./VertexTypePairStatistics.md) diff --git a/docs/flex/interactive/development/python/EdgeApi.md b/docs/flex/interactive/development/python/EdgeApi.md new file mode 100644 index 000000000000..442127dc6a29 --- /dev/null +++ b/docs/flex/interactive/development/python/EdgeApi.md @@ -0,0 +1,222 @@ +# EdgeApi + +All URIs are relative to *{INTERACTIVE_ADMIN_ENDPOINT}* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_edge**](EdgeApi.md#add_edge) | **POST** /v1/graph/{graph_id}/edge | Add edge to the graph +[**get_edge**](EdgeApi.md#get_edge) | **GET** /v1/graph/{graph_id}/edge | Get the edge's properties with src and dst vertex primary keys. +[**update_edge**](EdgeApi.md#update_edge) | **PUT** /v1/graph/{graph_id}/edge | Update edge's property + + +# **add_edge** +> Result[str] add_edge(graph_id, edge_request) + +Add a edge to the graph. + +### Example + + +```python +from gs_interactive.client.driver import Driver +from gs_interactive.client.session import Session +from gs_interactive.models import * + +driver = Driver() +sess = driver.session() + +graph_id = "1" + +edge_request = [ + EdgeRequest( + src_label="person", + dst_label="person", + edge_label="knows", + src_primary_key_value=2, + dst_primary_key_value=4, + properties=[ModelProperty(name="weight", value=9.123)], + ), + EdgeRequest( + src_label="person", + dst_label="person", + edge_label="knows", + src_primary_key_value=2, + dst_primary_key_value=6, + properties=[ModelProperty(name="weight", value=3.233)], + ), +] +resp = sess.add_edge(graph_id, edge_request) +print(resp) +assert resp.is_ok() +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **graph_id** | **str**| | + **edge_request** | [**List[EdgeRequest]**](EdgeRequest.md)| | + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successfully insert the edge | - | +**400** | Invalid input edge | - | +**409** | edge already exists | - | +**500** | Server internal error | - | + +[[Back to top]](#) [[Back to API list]](python_sdk.md#documentation-for-service-apis) [[Back to Model list]](python_sdk.md#documentation-for-data-structures) [[Back to python_sdk]](python_sdk.md) + + +# **get_edge** +> Result[EdgeData] get_edge(graph_id, edge_label, src_label, src_primary_key_value, dst_label, dst_primary_key_value) + +Get the edge's properties with src and dst vertex primary keys. + +Get the properties for the specified vertex. + +### Example + + +```python +from gs_interactive.client.driver import Driver +from gs_interactive.client.session import Session +from gs_interactive.models import * + +driver = Driver() +sess = driver.session() + +graph_id = "1" + +resp = sess.get_edge(graph_id, "knows", "person", 2, "person", 4) +assert resp.is_ok() +for k, v in resp.get_value().properties: + if k == "weight": + assert v == 9.123 +print(resp) +assert resp.is_ok() +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **graph_id** | **str**| | + **edge_label** | **str**| The label name of querying edge. | + **src_label** | **str**| The label name of src vertex. | + **src_primary_key_value** | [**object**](.md)| The primary key value of src vertex. | + **dst_label** | **str**| The label name of dst vertex. | + **dst_primary_key_value** | [**object**](.md)| The value of dst vertex's primary key | + +### Return type + +[**EdgeData**](EdgeData.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Found Edge | - | +**400** | Bad input parameter | - | +**404** | Edge not found or Graph not found | - | +**500** | Server internal error | - | + +[[Back to top]](#) [[Back to API list]](python_sdk.md#documentation-for-service-apis) [[Back to Model list]](python_sdk.md#documentation-for-data-structures) [[Back to python_sdk]](python_sdk.md) + +# **update_edge** +> Result[str] update_edge(graph_id, edge_request=edge_request) + +Update edge's property + +Update the edge on the running graph. + +### Example + + +```python +from gs_interactive.client.driver import Driver +from gs_interactive.client.session import Session +from gs_interactive.models import * + +driver = Driver() +sess = driver.session() + +graph_id = "1" + +resp = sess.update_edge( + graph_id, + EdgeRequest( + src_label="person", + dst_label="person", + edge_label="knows", + src_primary_key_value=2, + dst_primary_key_value=4, + properties=[ModelProperty(name="weight", value=3)], + ), +) +print(resp) +assert resp.is_ok() +``` + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **graph_id** | **str**| | + **edge_request** | [**EdgeRequest**](EdgeRequest.md)| | [optional] + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successfully update edge | - | +**400** | Invalid input parameters | - | +**404** | Edge not exists | - | +**500** | Server internal error | - | + +[[Back to top]](#) [[Back to API list]](python_sdk.md#documentation-for-service-apis) [[Back to Model list]](python_sdk.md#documentation-for-data-structures) [[Back to python_sdk]](python_sdk.md) + diff --git a/docs/flex/interactive/development/python/GraphManagementApi.md b/docs/flex/interactive/development/python/GraphManagementApi.md index caae6afb2167..e9507008fd69 100644 --- a/docs/flex/interactive/development/python/GraphManagementApi.md +++ b/docs/flex/interactive/development/python/GraphManagementApi.md @@ -113,7 +113,7 @@ No authorization required **400** | BadRequest | - | **500** | Internal error | - | -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](python_sdk.md#documentation-for-service-apis) [[Back to Model list]](python_sdk.md#documentation-for-data-structures) [[Back to python_sdk]](python_sdk.md) @@ -163,7 +163,7 @@ No authorization required **404** | Not Found | - | **500** | Internal Error | - | -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](python_sdk.md#documentation-for-service-apis) [[Back to Model list]](python_sdk.md#documentation-for-data-structures) [[Back to python_sdk]](python_sdk.md) # **GetGraphMeta** > GetGraphResponse get_graph(graph_id) @@ -210,7 +210,7 @@ No authorization required **200** | Successful operation | - | **404** | Not found | - | -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](python_sdk.md#documentation-for-service-apis) [[Back to Model list]](python_sdk.md#documentation-for-data-structures) [[Back to python_sdk]](python_sdk.md) # **GetGraphStatistics** > GetGraphStatisticsResponse get_graph_statistic(graph_id) @@ -259,7 +259,7 @@ No authorization required **404** | Not Found | - | **503** | Service Unavailable | - | -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](python_sdk.md#documentation-for-service-apis) [[Back to Model list]](python_sdk.md#documentation-for-data-structures) [[Back to python_sdk]](python_sdk.md) # **GetGraphSchema** > Result[GetGraphSchemaResponse] get_graph_schema(graph_id) @@ -305,7 +305,7 @@ No authorization required |-------------|-------------|------------------| **200** | successful operation | - | -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](python_sdk.md#documentation-for-service-apis) [[Back to Model list]](python_sdk.md#documentation-for-data-structures) [[Back to python_sdk]](python_sdk.md) # **ListGraphs** > Result[List[GetGraphResponse]] list_graphs() @@ -348,7 +348,7 @@ No authorization required |-------------|-------------|------------------| **200** | Successful operation | - | -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](python_sdk.md#documentation-for-service-apis) [[Back to Model list]](python_sdk.md#documentation-for-data-structures) [[Back to python_sdk]](python_sdk.md) # **BulkLoading** @@ -432,4 +432,4 @@ No authorization required |-------------|-------------|------------------| **200** | successful operation | - | -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) \ No newline at end of file +[[Back to top]](#) [[Back to API list]](python_sdk.md#documentation-for-service-apis) [[Back to Model list]](python_sdk.md#documentation-for-data-structures) [[Back to python_sdk]](python_sdk.md) \ No newline at end of file diff --git a/docs/flex/interactive/development/python/JobManagementApi.md b/docs/flex/interactive/development/python/JobManagementApi.md index 9cc8acf8bbb9..07c2992732aa 100644 --- a/docs/flex/interactive/development/python/JobManagementApi.md +++ b/docs/flex/interactive/development/python/JobManagementApi.md @@ -59,7 +59,7 @@ No authorization required |-------------|-------------|------------------| **200** | Successful operation | - | -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](python_sdk.md#documentation-for-service-apis) [[Back to Model list]](python_sdk.md#documentation-for-data-structures) [[Back to python_sdk]](python_sdk.md) # **GetJobById** > Result[JobStatus] get_job(job_id) @@ -104,7 +104,7 @@ No authorization required |-------------|-------------|------------------| **200** | successful operation | - | -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](python_sdk.md#documentation-for-service-apis) [[Back to Model list]](python_sdk.md#documentation-for-data-structures) [[Back to python_sdk]](python_sdk.md) # **ListJobs** > Result[List[JobStatus]] list_jobs() @@ -145,5 +145,5 @@ No authorization required |-------------|-------------|------------------| **200** | successful operation | - | -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](python_sdk.md#documentation-for-service-apis) [[Back to Model list]](python_sdk.md#documentation-for-data-structures) [[Back to python_sdk]](python_sdk.md) diff --git a/docs/flex/interactive/development/python/ProcedureManagementApi.md b/docs/flex/interactive/development/python/ProcedureManagementApi.md index 020188cfe74b..e6538b0c8d00 100644 --- a/docs/flex/interactive/development/python/ProcedureManagementApi.md +++ b/docs/flex/interactive/development/python/ProcedureManagementApi.md @@ -125,7 +125,7 @@ No authorization required **404** | not found | - | **500** | Internal Error | - | -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](python_sdk.md#documentation-for-service-apis) [[Back to Model list]](python_sdk.md#documentation-for-data-structures) [[Back to python_sdk]](python_sdk.md) # **DeleteProcedure** > Result[str] delete_procedure(graph_id, procedure_id) @@ -173,7 +173,7 @@ No authorization required **200** | Successful operation | - | **404** | Not Found | - | -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](python_sdk.md#documentation-for-service-apis) [[Back to Model list]](python_sdk.md#documentation-for-data-structures) [[Back to python_sdk]](python_sdk.md) # **GetProcedure** > Result[GetProcedureResponse] get_procedure(graph_id, procedure_id) @@ -221,7 +221,7 @@ No authorization required **200** | successful operation | - | **404** | Not found | - | -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](python_sdk.md#documentation-for-service-apis) [[Back to Model list]](python_sdk.md#documentation-for-data-structures) [[Back to python_sdk]](python_sdk.md) # **ListProcedures** > Result[List[GetProcedureResponse]] list_procedures(graph_id) @@ -268,7 +268,7 @@ No authorization required **200** | Successful operation | - | **404** | Not found | - | -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](python_sdk.md#documentation-for-service-apis) [[Back to Model list]](python_sdk.md#documentation-for-data-structures) [[Back to python_sdk]](python_sdk.md) # **UpdateProcedure** > Result[str] update_procedure(graph_id, procedure_id, update_procedure_request=update_procedure_request) @@ -320,5 +320,5 @@ No authorization required **404** | Not Found | - | **500** | Internal error | - | -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](python_sdk.md#documentation-for-service-apis) [[Back to Model list]](python_sdk.md#documentation-for-data-structures) [[Back to python_sdk]](python_sdk.md) diff --git a/docs/flex/interactive/development/python/QueryServiceApi.md b/docs/flex/interactive/development/python/QueryServiceApi.md index 554a405e760b..807067b84ac3 100644 --- a/docs/flex/interactive/development/python/QueryServiceApi.md +++ b/docs/flex/interactive/development/python/QueryServiceApi.md @@ -18,7 +18,7 @@ If you attempt to submit a query to a graph that is not currently running, we wi Submit procedure call queries to the specified graph. The output format for the query is define by the [results.proto](https://github.com/alibaba/GraphScope/blob/main/interactive_engine/executor/ir/proto/results.proto). -For the creation of stored procedure please refer to [CypherStoredProcedure](../stored_procedure/cypher_procedure.md) and [CppStoredProcedure](../stored_procedure/cpp_procedure.md). +For the creation of stored procedure please refer to [CypherStoredProcedure](../../stored_procedures.md) and [CppStoredProcedure](../stored_procedure/cpp_procedure.md). ### Example @@ -73,7 +73,7 @@ No authorization required **200** | Successfully runned. Empty if failed? | - | **500** | Server internal error | - | -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](python_sdk.md#documentation-for-service-apis) [[Back to Model list]](python_sdk.md#documentation-for-data-structures) [[Back to python_sdk]](python_sdk.md) # **CallProcedureOnCurrentGraph** > Result[CollectiveResults] call_procedure_current(params) @@ -134,5 +134,5 @@ No authorization required **200** | Successfully runned. Empty if failed? | - | **500** | Server internal error | - | -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](python_sdk.md#documentation-for-service-apis) [[Back to Model list]](python_sdk.md#documentation-for-data-structures) [[Back to python_sdk]](python_sdk.md) diff --git a/docs/flex/interactive/development/python/ServiceManagementApi.md b/docs/flex/interactive/development/python/ServiceManagementApi.md index 54ab6dcb0617..40ceb1d9048f 100644 --- a/docs/flex/interactive/development/python/ServiceManagementApi.md +++ b/docs/flex/interactive/development/python/ServiceManagementApi.md @@ -51,7 +51,7 @@ No authorization required |-------------|-------------|------------------| **200** | successful operation | - | -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](python_sdk.md#documentation-for-service-apis) [[Back to Model list]](python_sdk.md#documentation-for-data-structures) [[Back to python_sdk]](python_sdk.md) # **RestartService** > Result[str] restart_service() @@ -94,7 +94,7 @@ No authorization required |-------------|-------------|------------------| **200** | successful operation | - | -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](python_sdk.md#documentation-for-service-apis) [[Back to Model list]](python_sdk.md#documentation-for-data-structures) [[Back to python_sdk]](python_sdk.md) # **StartService** > Result[str] start_service(start_service_request=start_service_request) @@ -143,7 +143,7 @@ No authorization required **200** | successful operation | - | **500** | Internal Error | - | -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](python_sdk.md#documentation-for-service-apis) [[Back to Model list]](python_sdk.md#documentation-for-data-structures) [[Back to python_sdk]](python_sdk.md) # **StopService** > Result[str] stop_service() @@ -186,5 +186,5 @@ No authorization required |-------------|-------------|------------------| **200** | successful operation | - | -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](python_sdk.md#documentation-for-service-apis) [[Back to Model list]](python_sdk.md#documentation-for-data-structures) [[Back to python_sdk]](python_sdk.md) diff --git a/docs/flex/interactive/development/python/VertexApi.md b/docs/flex/interactive/development/python/VertexApi.md new file mode 100644 index 000000000000..7248068454f0 --- /dev/null +++ b/docs/flex/interactive/development/python/VertexApi.md @@ -0,0 +1,218 @@ +# VertexApi + +All URIs are relative to *{INTERACTIVE_ADMIN_ENDPOINT}* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_vertex**](VertexApi.md#add_vertex) | **POST** /v1/graph/{graph_id}/vertex | Add vertex to the graph +[**get_vertex**](VertexApi.md#get_vertex) | **GET** /v1/graph/{graph_id}/vertex | Get the vertex's properties with vertex primary key. +[**update_vertex**](VertexApi.md#update_vertex) | **PUT** /v1/graph/{graph_id}/vertex | Update vertex's property + + +# **add_vertex** +> Result[str] add_vertex(graph_id, vertex_edge_request) + +Add the provided vertex to the specified graph. + +### Example + + +```python +from gs_interactive.client.driver import Driver +from gs_interactive.client.session import Session +from gs_interactive.models import * + +driver = Driver() +sess = driver.session() + +graph_id = "1" + +vertex_request = [ + VertexRequest( + label="person", + primary_key_value=8, + properties=[ + ModelProperty(name="name", type="string", value="mike"), + ModelProperty(name="age", type="integer", value=12), + ], + ), +] +resp = sess.add_vertex( + graph_id, + VertexEdgeRequest(vertex_request=vertex_request), +) +print(resp) +assert resp.is_ok() +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **graph_id** | **str**| | + **vertex_edge_request** | [**VertexEdgeRequest**](VertexEdgeRequest.md)| | + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successfully created vertex | - | +**400** | Invalid input vertex | - | +**404** | Graph not found | - | +**409** | Vertex already exists | - | +**500** | Server internal error | - | + +[[Back to top]](#) [[Back to API list]](python_sdk.md#documentation-for-service-apis) [[Back to Model list]](python_sdk.md#documentation-for-data-structures) [[Back to python_sdk]](python_sdk.md) + + +# **get_vertex** +> Result[VertexData] get_vertex(graph_id, label, primary_key_value) + +Get the vertex's properties with vertex primary key. + +Get the properties for the specified vertex. example: ```http GET /endpoint?param1=value1¶m2=value2 HTTP/1.1 Host: example.com ``` + +### Example + + +```python +from gs_interactive.client.driver import Driver +from gs_interactive.client.session import Session +from gs_interactive.models import * + +driver = Driver() +sess = driver.session() + +graph_id = "1" + +# get vertex +resp = sess.get_vertex(graph_id, "person", 8) +assert resp.is_ok() +for k, v in resp.get_value().values: + if k == "name": + assert v == "mike" + if k == "age": + assert v == 12 +print(resp) +assert resp.is_ok() +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **graph_id** | **str**| The id of the graph | + **label** | **str**| The label name of querying vertex. | + **primary_key_value** | [**object**](.md)| The primary key value of querying vertex. | + +### Return type + +[**VertexData**](VertexData.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Found vertex | - | +**400** | Bad input parameter | - | +**404** | Vertex not found or graph not found | - | +**500** | Server internal error | - | + +[[Back to top]](#) [[Back to API list]](python_sdk.md#documentation-for-service-apis) [[Back to Model list]](python_sdk.md#documentation-for-data-structures) [[Back to python_sdk]](python_sdk.md) + +# **update_vertex** +> Result[str] update_vertex(graph_id, vertex_request=vertex_request) + +Update vertex's property + +Remove the vertex from the specified graph. + +### Example + + +```python +from gs_interactive.client.driver import Driver +from gs_interactive.client.session import Session +from gs_interactive.models import * + +driver = Driver() +sess = driver.session() + +graph_id = "1" + +vertex_request = VertexRequest( + label="person", + primary_key_value=1, + properties=[ + ModelProperty(name="name", type="string", value="Cindy"), + ModelProperty(name="age", type="integer", value=24), + ], +) +# update vertex +resp = sess.update_vertex(graph_id, vertex_request) +print(resp) +assert resp.is_ok() +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **graph_id** | **str**| | + **vertex_request** | [**VertexRequest**](VertexRequest.md)| | [optional] + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successfully update vertex | - | +**400** | Invalid input parameters | - | +**404** | Vertex not exists | - | +**500** | Server internal error | - | + +[[Back to top]](#) [[Back to API list]](python_sdk.md#documentation-for-service-apis) [[Back to Model list]](python_sdk.md#documentation-for-data-structures) [[Back to python_sdk]](python_sdk.md) + diff --git a/docs/flex/interactive/development/python/python_sdk.md b/docs/flex/interactive/development/python/python_sdk.md index 1850dbe429ab..77d5a7a84321 100644 --- a/docs/flex/interactive/development/python/python_sdk.md +++ b/docs/flex/interactive/development/python/python_sdk.md @@ -380,6 +380,8 @@ The APIs in interactive SDK are divided into five categories. - JobManagementApi - ServiceManagementApi - QueryServiceApi +- VertexApi +- EdgeApi All URIs are relative to `${INTERACTIVE_ADMIN_ENDPOINT}` @@ -406,20 +408,23 @@ Class | Method | HTTP request | Description *ServiceManagementApi* | [**StopService**](./ServiceManagementApi.md#StopService) | **POST** /v1/service/stop | *QueryServiceApi* | [**CallProcedure**](./QueryServiceApi.md#CallProcedure) | **POST** /v1/graph/{graph_id}/query | *QueryServiceApi* | [**CallProcedureOnCurrentGraph**](./QueryServiceApi.md#CallProcedureOnCurrentGraph) | **POST** /v1/graph/current/query | - +*VertexApi* | [**addVertex**](./VertexApi.md#addVertex) | **POST** /v1/graph/{graph_id}/vertex | Add vertex to the graph +*VertexApi* | [**getVertex**](./VertexApi.md#getVertex) | **GET** /v1/graph/{graph_id}/vertex | Get the vertex's properties with vertex primary key. +*VertexApi* | [**updateVertex**](./VertexApi.md#updateVertex) | **PUT** /v1/graph/{graph_id}/vertex | Update vertex's property +*EdgeApi* | [**addEdge**](./EdgeApi.md#addEdge) | **POST** /v1/graph/{graph_id}/edge | Add edge to the graph +*EdgeApi* | [**getEdge**](./EdgeApi.md#getEdge) | **GET** /v1/graph/{graph_id}/edge | Get the edge's properties with src and dst vertex primary keys. +*EdgeApi* | [**updateEdge**](./EdgeApi.md#updateEdge) | **PUT** /v1/graph/{graph_id}/edge | Update edge's property ## Documentation for Data Structures + - [APIResponseWithCode](./APIResponseWithCode.md) - [BaseEdgeType](./BaseEdgeType.md) - [BaseEdgeTypeVertexTypePairRelationsInner](./BaseEdgeTypeVertexTypePairRelationsInner.md) - [BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams](./BaseEdgeTypeVertexTypePairRelationsInnerXCsrParams.md) - [BasePropertyMeta](./BasePropertyMeta.md) - [BaseVertexType](./BaseVertexType.md) - [BaseVertexTypeXCsrParams](./BaseVertexTypeXCsrParams.md) - - [Collection](./Collection.md) - - [CollectiveResults](./CollectiveResults.md) - - [Column](./Column.md) - [ColumnMapping](./ColumnMapping.md) - [CreateEdgeType](./CreateEdgeType.md) - [CreateGraphRequest](./CreateGraphRequest.md) @@ -429,6 +434,7 @@ Class | Method | HTTP request | Description - [CreateProcedureResponse](./CreateProcedureResponse.md) - [CreatePropertyMeta](./CreatePropertyMeta.md) - [CreateVertexType](./CreateVertexType.md) + - [DateType](./DateType.md) - [EdgeData](./EdgeData.md) - [EdgeMapping](./EdgeMapping.md) - [EdgeMappingDestinationVertexMappingsInner](./EdgeMappingDestinationVertexMappingsInner.md) @@ -436,43 +442,48 @@ Class | Method | HTTP request | Description - [EdgeMappingSourceVertexMappingsInnerColumn](./EdgeMappingSourceVertexMappingsInnerColumn.md) - [EdgeMappingTypeTriplet](./EdgeMappingTypeTriplet.md) - [EdgeRequest](./EdgeRequest.md) - - [Element](./Element.md) + - [EdgeStatistics](./EdgeStatistics.md) - [FixedChar](./FixedChar.md) - [FixedCharChar](./FixedCharChar.md) - [GSDataType](./GSDataType.md) - [GetEdgeType](./GetEdgeType.md) - [GetGraphResponse](./GetGraphResponse.md) - [GetGraphSchemaResponse](./GetGraphSchemaResponse.md) + - [GetGraphStatisticsResponse](./GetGraphStatisticsResponse.md) - [GetProcedureResponse](./GetProcedureResponse.md) - [GetPropertyMeta](./GetPropertyMeta.md) - [GetVertexType](./GetVertexType.md) - [JobResponse](./JobResponse.md) - [JobStatus](./JobStatus.md) - - [KeyValue](./KeyValue.md) - [LongText](./LongText.md) - - [ModelProperty](./ModelProperty.md) - [Parameter](./Parameter.md) - [PrimitiveType](./PrimitiveType.md) - - [PropertyArray](./PropertyArray.md) + - [Property](./Property.md) - [QueryRequest](./QueryRequest.md) - - [Record](./Record.md) - [SchemaMapping](./SchemaMapping.md) - [SchemaMappingLoadingConfig](./SchemaMappingLoadingConfig.md) + - [SchemaMappingLoadingConfigDataSource](./SchemaMappingLoadingConfigDataSource.md) - [SchemaMappingLoadingConfigFormat](./SchemaMappingLoadingConfigFormat.md) + - [SchemaMappingLoadingConfigXCsrParams](./SchemaMappingLoadingConfigXCsrParams.md) - [ServiceStatus](./ServiceStatus.md) - [StartServiceRequest](./StartServiceRequest.md) - [StoredProcedureMeta](./StoredProcedureMeta.md) - [StringType](./StringType.md) - [StringTypeString](./StringTypeString.md) - [TemporalType](./TemporalType.md) + - [TemporalTypeTemporal](./TemporalTypeTemporal.md) - [TimeStampType](./TimeStampType.md) - [TypedValue](./TypedValue.md) - [UpdateProcedureRequest](./UpdateProcedureRequest.md) + - [UploadFileResponse](./UploadFileResponse.md) - [VarChar](./VarChar.md) - [VarCharVarChar](./VarCharVarChar.md) - [VertexData](./VertexData.md) + - [VertexEdgeRequest](./VertexEdgeRequest.md) - [VertexMapping](./VertexMapping.md) - [VertexRequest](./VertexRequest.md) + - [VertexStatistics](./VertexStatistics.md) + - [VertexTypePairStatistics](./VertexTypePairStatistics.md) diff --git a/docs/flex/interactive/development/stored_procedure/cpp_procedure.md b/docs/flex/interactive/development/stored_procedure/cpp_procedure.md index 45a021c2b10a..fed500df0740 100644 --- a/docs/flex/interactive/development/stored_procedure/cpp_procedure.md +++ b/docs/flex/interactive/development/stored_procedure/cpp_procedure.md @@ -1,6 +1,6 @@ # Create c++ Stored Procedures on GraphScope Interactive -Apart from adapting Cypher query as stored procedure, Interactive supports implementing stored procedure via c++ code, by calling the interfaces provided by Graph Database Engine. +Apart from adapting [Cypher query as stored procedure](../../stored_procedures.md), Interactive supports implementing stored procedure via c++ code, by calling the interfaces provided by Graph Database Engine. ## Getting Started. @@ -262,6 +262,9 @@ resp = sess.call_procedure_raw(graph_id="1", params=encoder.get_bytes()) assert resp.is_ok() ``` +## Programming Interface + +To create an efficient procedure that meets your needs, it's essential to understand the programming interface and the Interactive storage interface. We recommend reading the [source code](https://github.com/alibaba/GraphScope/tree/main/flex) of Interactive, and you can also access the generated API documentation [here](https://graphscope.io/docs/reference/flex/). diff --git a/docs/flex/interactive/development/stored_procedure/cypher_procedure.md b/docs/flex/interactive/development/stored_procedure/cypher_procedure.md deleted file mode 100644 index d21974de92b3..000000000000 --- a/docs/flex/interactive/development/stored_procedure/cypher_procedure.md +++ /dev/null @@ -1,51 +0,0 @@ -# Turning Cypher Queries into Stored Procedures with GraphScope Interactive - -GraphScope Interactive offers a seamless way for users to transform Cypher queries into stored procedures, eliminating the need for intricate C++ programming. Drawing inspiration from Neo4j, we empower users to craft a query skeleton, incorporating runtime parameters denoted by `$param_name`. - - -## Define a Cypher Stored Procedure - -In GraphScope Interactive, a Cypher Stored Procedure is defined via a `yaml` file. - -```yaml -name: -description: -query: -type: cypher -``` - -Here comes the detail explanation for each field. - -- name(required): A unique identifier for a stored procedure, which you will need when calling the stored procedure from either the Interactive SDK or neo4j-native tools. The uniqueness is within the context of a graph, which means you can define two stored procedure with the same name in two different graph. But when calling procedure from client, make sure the Interactive instance is running on the graph you desired. -- description(optional): A string which help you remember and illustrate the use of this procedure. If not given, a default description will be assigned. -- query(required): The cypher query string which defines the logic of this procedure. Template cypher query is supported, use can denote the runtime parameters as `$param_name`, and assign the param with actual values till calling the stored procedure. -- type(required): Make sure is set to `cypher`. - - -## Template the Stored Procedure - -With params introduced in cypher query, a template stored procedure could be crafted, and used flexibly. For example, for a simple cypher query - -```cypher -MATCH(n: person) WHERE n.id == 123 RETURN n.name; -``` - -we can parameterized the input id as a parameter -```cypher -MATCH(n: person) WHERE n.id == $personId RETURN n.name; -``` - -And define it as a stored procedure. - -```yaml -name: get_person_name -description: A template stored procedure to get person's name from id. -query: "MATCH(n: person) WHERE n.id == $personId RETURN n.name;" -type: cypher -``` - -## Creating Stored Procedure and Calling - -Please refer to the [StoredProcedure Documentation](../../stored_procedures.md) for creating stored procedures with `gsctl` and calling stored procedures. - -Refer to [Java SDK Documentation](../java/java_sdk.md#create-a-stored-procedure) and [Python SDK Documentation](../python/python_sdk.md#create-a-stored-procedure) for creating stored procedures with SDKs. \ No newline at end of file diff --git a/docs/flex/interactive/getting_started.md b/docs/flex/interactive/getting_started.md index f4ca3acbffb3..2038bc513761 100644 --- a/docs/flex/interactive/getting_started.md +++ b/docs/flex/interactive/getting_started.md @@ -47,108 +47,35 @@ gsctl service status # show current service status As seen from the output, the Interactive service is already running on the built-in graph. -## Create a Stored Procedure -We proceed to create a stored procedure by defining a procedure with a YAML configuration: `procedure.yaml`. - -```yaml -name: test_procedure -description: "Ths is a test procedure" -query: "MATCH (n) RETURN COUNT(n);" -type: cypher -``` - -and create it via - -```bash -gsctl create storedproc -f ./procedure.yaml -``` - -This step may take a while, since code generation and compilation is invoked. -Finally, the id of the stored procedure(currently the name of the procedure) is returned, -you can display the detail of the stored procedure with the following command. - -```bash -gsctl desc storedproc test_procedure -``` - -You may notice that the value of`runnable` field is `false`, we need to restart service to enable it. - -### Restart the service - -The stored procedure will not be able to serve requests until we restart the service. - -```bash -gsctl service restart -``` - -After the service is restarted, check the runnable field; it should be set to true. - -```bash -gsctl desc storedproc test_procedure -``` +## Submit Cypher Queries -## Call the Stored Procedure +GraphScope Interactive seamlessly integrates with the Neo4j ecosystem. You can establish a connection to the Interactive service using Neo4j's Bolt connector and execute Cypher queries. Our implementation of Cypher queries aligns with the standards set by the [openCypher](http://www.opencypher.org/) project. For a detailed overview of the supported Cypher queries, please visit [supported_cypher](https://graphscope.io/docs/latest/interactive_engine/neo4j/supported_cypher). -You have two options to call the stored procedure, one is through Interactive SDK, and the other is through the native tools of Cypher. +Follow the instructions in [Connect-to-cypher-service](../../interactive_engine/neo4j/cypher_sdk) to connect to the Cypher service using either the Python client or cypher-shell. -### Call the Stored Procedure via Interactive SDK +To submit a simple query using `cypher-shell`: -You can call the stored procedure via Interactive Python SDK. (Make sure environment variables are set correctly, see [above session](#deploy-in-local-mode)). +#### Download `cypher-shell` ```bash -export INTERACTIVE_ADMIN_ENDPOINT=http://127.0.0.1:7777 -export INTERACTIVE_STORED_PROC_ENDPOINT=http://127.0.0.1:10000 -export INTERACTIVE_CYPHER_ENDPOINT=neo4j://127.0.0.1:7687 +wget https://dist.neo4j.org/cypher-shell/cypher-shell-4.4.19.zip +unzip cypher-shell-4.4.19.zip && cd cypher-shell ``` -```{note} -If you have customized the ports when deploying Interactive, remember to replace the default ports with your customized ports. -``` - -Install Interactive python SDK +#### Connect to the Service ```bash -pip3 install gs_interactive -``` - -and try to call the stored procedure. - -```python -from gs_interactive.client.driver import Driver -from gs_interactive.client.session import Session -from gs_interactive.models import * - -driver = Driver() -with driver.getNeo4jSession() as session: - result = session.run("CALL test_procedure() YIELD *;") - for record in result: - print(record) +./cypher-shell +# or -a neo4j://localhost: to connect to the customized port ``` -### Call the Stored Procedure via Neo4j-native Tools - -You can also call the stored procedure via neo4j-native tools, like `cypher-shell`, `neo4j-driver`. Please refer to [this document](../../interactive_engine/neo4j/cypher_sdk) for connecting to cypher service. - +#### Run a Simple Query ```bash -./cypher-shell -a ${INTERACTIVE_CYPHER_ENDPOINT} +@neo4j> MATCH (n) RETURN n LIMIT 10; ``` -```cypher -CALL test_procedure() YIELD *; -``` - - -## Submit Cypher Queries - -GraphScope Interactive seamlessly integrates with the Neo4j ecosystem. You can establish a connection to the Interactive service using Neo4j's Bolt connector and execute Cypher queries. Our implementation of Cypher queries aligns with the standards set by the [openCypher](http://www.opencypher.org/) project. For a detailed overview of the supported Cypher queries, please visit [supported_cypher](https://graphscope.io/docs/latest/interactive_engine/neo4j/supported_cypher). - -Follow the instructions in [Connect-to-cypher-service](../../interactive_engine/neo4j/cypher_sdk) to connect to the Cypher service using either the Python client or cypher-shell. - - -Note: Cypher queries submitted to GraphScope Interactive are compiled into a dynamic library for execution. While the initial compilation might take some time, the execution for subsequent uses (of the **same** query) will be much faster since it is cached by Interactive. - ## Close the connection If you want to disconnect to coordinator, just type diff --git a/docs/flex/interactive/stored_procedures.md b/docs/flex/interactive/stored_procedures.md index a747a6829702..df32c3af051f 100644 --- a/docs/flex/interactive/stored_procedures.md +++ b/docs/flex/interactive/stored_procedures.md @@ -19,12 +19,11 @@ type: cypher ``` Note: -- `name` is required. -- `description` is optional. -- The string in `query` field could be either `cypher` query or `c++` code. For comprehensive guidelines on crafting stored procedures in GraphScope Interactive using both Cypher and C++, refer to the [Cypher procedure](./development/stored_procedure/cypher_procedure.md) and [C++ procedure](./development/stored_procedure/cpp_procedure.md) documentation. -- When compiling from Cypher code, the optimization rules defined under [`compiler.planner`](./configuration) will be taken into account to generate a more efficient program. +- `name` is required. It serves as a unique identifier for a stored procedure, necessary for calling it from the Interactive SDK or Neo4j-native tools. Uniqueness is maintained within the context of a graph, allowing the same name for procedures in different graphs. Ensure the Interactive instance is running on the desired graph when calling the procedure. +- `description` is optional. It is a string that helps you remember and illustrate the procedure's use. If omitted, a default description will be assigned. +- The `query` field can contain either a Cypher query or C++ code. Cypher queries support templates where runtime parameters can be denoted as `$param_name`, which can be assigned values when calling the procedure. For defining a stored procedure in C++, see [C++ procedure](./development/stored_procedure/cpp_procedure.md). +- When compiling Cypher code, the optimization rules specified in [`compiler.planner`](./configuration) will be applied to generate a more efficient program. -For more information on defining a Cypher stored procedure, please refer to [Cypher Stored Procedure](./development/stored_procedure/cypher_procedure.md). ## Create a Stored Procedure diff --git a/flex/interactive/sdk/generate_sdk_doc.sh b/flex/interactive/sdk/generate_sdk_doc.sh index d21f503d9dd4..0059d734e52d 100644 --- a/flex/interactive/sdk/generate_sdk_doc.sh +++ b/flex/interactive/sdk/generate_sdk_doc.sh @@ -43,22 +43,18 @@ function do_gen() { # post process the generated docs inplace. # replace all occurrence of $GENERATED_ENDPOINT with $ENDPOINT_PLACE_HOLDER # in the generated docs, for all files under ./java/docs and ./python/docs - cmd="sed -i 's|${GENERATED_ENDPOINT}|${ENDPOINT_PLACE_HOLDER}|g' ./java/docs/*" - echo "Running command: ${cmd}" - eval $cmd - cmd="sed -i 's|${GENERATED_ENDPOINT}|${ENDPOINT_PLACE_HOLDER}|g' ./python/docs/*" - echo "Running command: ${cmd}" - eval $cmd + sed -i 's|${GENERATED_ENDPOINT}|${ENDPOINT_PLACE_HOLDER}|g' ./java/docs/* || (echo "Failed to replace endpoint in java docs" && exit 1) + sed -i 's|${GENERATED_ENDPOINT}|${ENDPOINT_PLACE_HOLDER}|g' ./python/docs/* || (echo "Failed to replace endpoint in python docs" && exit 1) + sed -i 's|\.\.\/README|python_sdk|g' ./python/docs/* || (echo "Failed to replace README in python docs" && exit 1) + sed -i 's|README|python_sdk|g' ./python/docs/* || (echo "Failed to replace README in python docs" && exit 1) + sed -i 's|documentation-for-models|documentation-for-data-structures|g' ./python/docs/* || (echo "Failed to replace documentation-for-models in python docs" && exit 1) + sed -i 's|documentation-for-api-endpoints|documentation-for-service-apis|g' ./python/docs/* || (echo "Failed to replace documentation-for-api-endpoints in python docs" && exit 1) # # Copy the generated docs to the output path - cmd="find ./java/docs/* -type f ! -name "*Api*" -exec cp {} ${OUTPUT_PATH}/java/ \;" - echo "Running command: ${cmd}" - eval $cmd - echo "Running command: ${cmd}" - eval $cmd - cmd="find ./python/docs/* -type f ! -name "*Api*" -exec cp {} ${OUTPUT_PATH}/python/ \;" - echo "Running command: ${cmd}" - eval $cmd + # echo_and_run "find ./java/docs/* -type f ! -name "*Api*" -exec cp {} ${OUTPUT_PATH}/java/ \;" + find ./java/docs/* -type f ! -name "*Api*" -exec cp {} ${OUTPUT_PATH}/java/ \; + # echo_and_run "find ./python/docs/* -type f ! -name "*Api*" -exec cp {} ${OUTPUT_PATH}/python/ \;" + find ./python/docs/* -type f ! -name "*Api*" -exec cp {} ${OUTPUT_PATH}/python/ \; echo "SDK documentation generated successfully." }