Class DefaultSession
- java.lang.Object
-
- com.alibaba.graphscope.interactive.client.impl.DefaultSession
-
- All Implemented Interfaces:
EdgeInterface,GraphInterface,JobInterface,ProcedureInterface,QueryInterface,QueryServiceInterface,Session,UtilsInterface,VertexInterface,AutoCloseable
public class DefaultSession extends Object implements Session
A default implementation of the GraphScope interactive session interface. Based on the code generated by OpenAPI Generator.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Result<String>addEdge(String graphName, List<com.alibaba.graphscope.interactive.models.EdgeRequest> edgeRequest)Result<String>addVertex(String graphId, com.alibaba.graphscope.interactive.models.VertexEdgeRequest request)Result<com.alibaba.graphscope.interactive.models.JobResponse>bulkLoading(String graphId, com.alibaba.graphscope.interactive.models.SchemaMapping mapping)Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults>callProcedure(com.alibaba.graphscope.gaia.proto.StoredProcedure.Query request)Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults>callProcedure(com.alibaba.graphscope.interactive.models.QueryRequest request)Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults>callProcedure(String graphId, com.alibaba.graphscope.gaia.proto.StoredProcedure.Query request)Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults>callProcedure(String graphId, com.alibaba.graphscope.interactive.models.QueryRequest request)CompletableFuture<Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults>>callProcedureAsync(com.alibaba.graphscope.gaia.proto.StoredProcedure.Query request)CompletableFuture<Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults>>callProcedureAsync(com.alibaba.graphscope.interactive.models.QueryRequest queryRequest)CompletableFuture<Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults>>callProcedureAsync(String graphId, com.alibaba.graphscope.gaia.proto.StoredProcedure.Query request)CompletableFuture<Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults>>callProcedureAsync(String graphId, com.alibaba.graphscope.interactive.models.QueryRequest queryRequest)Result<byte[]>callProcedureRaw(byte[] request)Result<byte[]>callProcedureRaw(String graphId, byte[] request)Call procedure with raw bytes.CompletableFuture<Result<byte[]>>callProcedureRawAsync(byte[] request)CompletableFuture<Result<byte[]>>callProcedureRawAsync(String graphId, byte[] request)Result<String>cancelJob(String jobId)voidclose()Closes this resource, relinquishing any underlying resources.Result<com.alibaba.graphscope.interactive.models.CreateGraphResponse>createGraph(com.alibaba.graphscope.interactive.models.CreateGraphRequest graph)Result<com.alibaba.graphscope.interactive.models.CreateProcedureResponse>createProcedure(String graphId, com.alibaba.graphscope.interactive.models.CreateProcedureRequest procedure)Result<String>deleteEdge(String graphName, List<com.alibaba.graphscope.interactive.models.DeleteEdgeRequest> requests)Result<String>deleteGraph(String graphId)Result<String>deleteProcedure(String graphId, String procedureName)Result<String>deleteVertex(String graphId, List<com.alibaba.graphscope.interactive.models.DeleteVertexRequest> requests)Result<List<com.alibaba.graphscope.interactive.models.GetGraphResponse>>getAllGraphs()Result<com.alibaba.graphscope.interactive.models.EdgeData>getEdge(String graphName, String edgeLabel, String srcLabel, Object srcPrimaryKeyValue, String dstLabel, Object dstPrimaryKeyValue)Result<com.alibaba.graphscope.interactive.models.GetGraphResponse>getGraphMeta(String graphId)Result<com.alibaba.graphscope.interactive.models.GetGraphSchemaResponse>getGraphSchema(String graphId)Result<com.alibaba.graphscope.interactive.models.GetGraphStatisticsResponse>getGraphStatistics(String graphId)Result<com.alibaba.graphscope.interactive.models.JobStatus>getJobStatus(String jobId)Result<com.alibaba.graphscope.interactive.models.GetProcedureResponse>getProcedure(String graphId, String procedureId)Result<com.alibaba.graphscope.interactive.models.ServiceStatus>getServiceStatus()Result<com.alibaba.graphscope.interactive.models.VertexData>getVertex(String graphId, String label, Object primaryKey)Result<List<com.alibaba.graphscope.interactive.models.JobStatus>>listJobs()Result<List<com.alibaba.graphscope.interactive.models.GetProcedureResponse>>listProcedures(String graphId)static DefaultSessionnewInstance(String adminUri)static DefaultSessionnewInstance(String adminUri, Config config)static DefaultSessionnewInstance(String adminUri, String storedProcUri)static DefaultSessionnewInstance(String adminUri, String storedProcUri, Config config)static QueryInterfacequeryInterfaceOnly(String storedProcUri, Config config)Create defaultSession in stored procedure only mode, which means the session will only connect to query service, for launching queries.Result<String>restartService()Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults>runAdhocQuery(com.alibaba.graphscope.gaia.proto.GraphAlgebraPhysical.PhysicalPlan physicalPlan)Submit a adhoc query, represented via physical plan.Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults>runAdhocQuery(String graphId, com.alibaba.graphscope.gaia.proto.GraphAlgebraPhysical.PhysicalPlan physicalPlan)Submit a adhoc query, represented via physical plan.CompletableFuture<Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults>>runAdhocQueryAsync(com.alibaba.graphscope.gaia.proto.GraphAlgebraPhysical.PhysicalPlan physicalPlan)CompletableFuture<Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults>>runAdhocQueryAsync(String graphId, com.alibaba.graphscope.gaia.proto.GraphAlgebraPhysical.PhysicalPlan physicalPlan)Result<String>startService(com.alibaba.graphscope.interactive.models.StartServiceRequest service)Result<String>stopService(com.alibaba.graphscope.interactive.models.StopServiceRequest request)Result<String>updateEdge(String graphName, List<com.alibaba.graphscope.interactive.models.EdgeRequest> edgeRequest)Result<String>updateProcedure(String graphId, String procedureId, com.alibaba.graphscope.interactive.models.UpdateProcedureRequest procedure)Result<String>updateVertex(String graphId, com.alibaba.graphscope.interactive.models.VertexEdgeRequest requests)Result<com.alibaba.graphscope.interactive.models.UploadFileResponse>uploadFile(File fileStorage)Upload a file to the server.
-
-
-
Method Detail
-
newInstance
public static DefaultSession newInstance(String adminUri, Config config)
-
newInstance
public static DefaultSession newInstance(String adminUri)
-
newInstance
public static DefaultSession newInstance(String adminUri, String storedProcUri, Config config)
-
newInstance
public static DefaultSession newInstance(String adminUri, String storedProcUri)
-
queryInterfaceOnly
public static QueryInterface queryInterfaceOnly(String storedProcUri, Config config)
Create defaultSession in stored procedure only mode, which means the session will only connect to query service, for launching queries.- Parameters:
storedProcUri- http uri, points to query service.- Returns:
- the procedure interface.
-
getEdge
public Result<com.alibaba.graphscope.interactive.models.EdgeData> getEdge(String graphName, String edgeLabel, String srcLabel, Object srcPrimaryKeyValue, String dstLabel, Object dstPrimaryKeyValue)
- Specified by:
getEdgein interfaceEdgeInterface
-
addEdge
public Result<String> addEdge(String graphName, List<com.alibaba.graphscope.interactive.models.EdgeRequest> edgeRequest)
- Specified by:
addEdgein interfaceEdgeInterface
-
deleteEdge
public Result<String> deleteEdge(String graphName, List<com.alibaba.graphscope.interactive.models.DeleteEdgeRequest> requests)
- Specified by:
deleteEdgein interfaceEdgeInterface
-
updateEdge
public Result<String> updateEdge(String graphName, List<com.alibaba.graphscope.interactive.models.EdgeRequest> edgeRequest)
- Specified by:
updateEdgein interfaceEdgeInterface
-
bulkLoading
public Result<com.alibaba.graphscope.interactive.models.JobResponse> bulkLoading(String graphId, com.alibaba.graphscope.interactive.models.SchemaMapping mapping)
- Specified by:
bulkLoadingin interfaceGraphInterface
-
createGraph
public Result<com.alibaba.graphscope.interactive.models.CreateGraphResponse> createGraph(com.alibaba.graphscope.interactive.models.CreateGraphRequest graph)
- Specified by:
createGraphin interfaceGraphInterface
-
deleteGraph
public Result<String> deleteGraph(String graphId)
- Specified by:
deleteGraphin interfaceGraphInterface
-
getGraphSchema
public Result<com.alibaba.graphscope.interactive.models.GetGraphSchemaResponse> getGraphSchema(String graphId)
- Specified by:
getGraphSchemain interfaceGraphInterface
-
getGraphStatistics
public Result<com.alibaba.graphscope.interactive.models.GetGraphStatisticsResponse> getGraphStatistics(String graphId)
- Specified by:
getGraphStatisticsin interfaceGraphInterface
-
getGraphMeta
public Result<com.alibaba.graphscope.interactive.models.GetGraphResponse> getGraphMeta(String graphId)
- Specified by:
getGraphMetain interfaceGraphInterface
-
getAllGraphs
public Result<List<com.alibaba.graphscope.interactive.models.GetGraphResponse>> getAllGraphs()
- Specified by:
getAllGraphsin interfaceGraphInterface
-
cancelJob
public Result<String> cancelJob(String jobId)
- Specified by:
cancelJobin interfaceJobInterface
-
getJobStatus
public Result<com.alibaba.graphscope.interactive.models.JobStatus> getJobStatus(String jobId)
- Specified by:
getJobStatusin interfaceJobInterface
-
listJobs
public Result<List<com.alibaba.graphscope.interactive.models.JobStatus>> listJobs()
- Specified by:
listJobsin interfaceJobInterface
-
createProcedure
public Result<com.alibaba.graphscope.interactive.models.CreateProcedureResponse> createProcedure(String graphId, com.alibaba.graphscope.interactive.models.CreateProcedureRequest procedure)
- Specified by:
createProcedurein interfaceProcedureInterface
-
deleteProcedure
public Result<String> deleteProcedure(String graphId, String procedureName)
- Specified by:
deleteProcedurein interfaceProcedureInterface
-
getProcedure
public Result<com.alibaba.graphscope.interactive.models.GetProcedureResponse> getProcedure(String graphId, String procedureId)
- Specified by:
getProcedurein interfaceProcedureInterface
-
listProcedures
public Result<List<com.alibaba.graphscope.interactive.models.GetProcedureResponse>> listProcedures(String graphId)
- Specified by:
listProceduresin interfaceProcedureInterface
-
updateProcedure
public Result<String> updateProcedure(String graphId, String procedureId, com.alibaba.graphscope.interactive.models.UpdateProcedureRequest procedure)
- Specified by:
updateProcedurein interfaceProcedureInterface
-
callProcedure
public Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults> callProcedure(String graphId, com.alibaba.graphscope.interactive.models.QueryRequest request)
- Specified by:
callProcedurein interfaceQueryInterface
-
callProcedureAsync
public CompletableFuture<Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults>> callProcedureAsync(String graphId, com.alibaba.graphscope.interactive.models.QueryRequest queryRequest)
- Specified by:
callProcedureAsyncin interfaceQueryInterface
-
callProcedure
public Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults> callProcedure(com.alibaba.graphscope.interactive.models.QueryRequest request)
- Specified by:
callProcedurein interfaceQueryInterface
-
callProcedureAsync
public CompletableFuture<Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults>> callProcedureAsync(com.alibaba.graphscope.interactive.models.QueryRequest queryRequest)
- Specified by:
callProcedureAsyncin interfaceQueryInterface
-
callProcedure
public Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults> callProcedure(String graphId, com.alibaba.graphscope.gaia.proto.StoredProcedure.Query request)
- Specified by:
callProcedurein interfaceQueryInterface
-
callProcedureAsync
public CompletableFuture<Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults>> callProcedureAsync(String graphId, com.alibaba.graphscope.gaia.proto.StoredProcedure.Query request)
- Specified by:
callProcedureAsyncin interfaceQueryInterface
-
callProcedure
public Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults> callProcedure(com.alibaba.graphscope.gaia.proto.StoredProcedure.Query request)
- Specified by:
callProcedurein interfaceQueryInterface
-
callProcedureAsync
public CompletableFuture<Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults>> callProcedureAsync(com.alibaba.graphscope.gaia.proto.StoredProcedure.Query request)
- Specified by:
callProcedureAsyncin interfaceQueryInterface
-
callProcedureRaw
public Result<byte[]> callProcedureRaw(String graphId, byte[] request)
Call procedure with raw bytes.- Specified by:
callProcedureRawin interfaceQueryInterface
-
callProcedureRawAsync
public CompletableFuture<Result<byte[]>> callProcedureRawAsync(String graphId, byte[] request)
- Specified by:
callProcedureRawAsyncin interfaceQueryInterface
-
callProcedureRaw
public Result<byte[]> callProcedureRaw(byte[] request)
- Specified by:
callProcedureRawin interfaceQueryInterface
-
callProcedureRawAsync
public CompletableFuture<Result<byte[]>> callProcedureRawAsync(byte[] request)
- Specified by:
callProcedureRawAsyncin interfaceQueryInterface
-
runAdhocQuery
public Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults> runAdhocQuery(String graphId, com.alibaba.graphscope.gaia.proto.GraphAlgebraPhysical.PhysicalPlan physicalPlan)
Submit a adhoc query, represented via physical plan.- Specified by:
runAdhocQueryin interfaceQueryInterface- Parameters:
graphId- the identifier of the graphphysicalPlan- physical execution plan.- Returns:
- the results.
-
runAdhocQueryAsync
public CompletableFuture<Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults>> runAdhocQueryAsync(String graphId, com.alibaba.graphscope.gaia.proto.GraphAlgebraPhysical.PhysicalPlan physicalPlan)
- Specified by:
runAdhocQueryAsyncin interfaceQueryInterface
-
runAdhocQuery
public Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults> runAdhocQuery(com.alibaba.graphscope.gaia.proto.GraphAlgebraPhysical.PhysicalPlan physicalPlan)
Submit a adhoc query, represented via physical plan.- Specified by:
runAdhocQueryin interfaceQueryInterface- Parameters:
physicalPlan- physical execution plan.- Returns:
- the results.
-
runAdhocQueryAsync
public CompletableFuture<Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults>> runAdhocQueryAsync(com.alibaba.graphscope.gaia.proto.GraphAlgebraPhysical.PhysicalPlan physicalPlan)
- Specified by:
runAdhocQueryAsyncin interfaceQueryInterface
-
getServiceStatus
public Result<com.alibaba.graphscope.interactive.models.ServiceStatus> getServiceStatus()
- Specified by:
getServiceStatusin interfaceQueryServiceInterface
-
restartService
public Result<String> restartService()
- Specified by:
restartServicein interfaceQueryServiceInterface
-
startService
public Result<String> startService(com.alibaba.graphscope.interactive.models.StartServiceRequest service)
- Specified by:
startServicein interfaceQueryServiceInterface
-
stopService
public Result<String> stopService(com.alibaba.graphscope.interactive.models.StopServiceRequest request)
- Specified by:
stopServicein interfaceQueryServiceInterface
-
addVertex
public Result<String> addVertex(String graphId, com.alibaba.graphscope.interactive.models.VertexEdgeRequest request)
- Specified by:
addVertexin interfaceVertexInterface
-
updateVertex
public Result<String> updateVertex(String graphId, com.alibaba.graphscope.interactive.models.VertexEdgeRequest requests)
- Specified by:
updateVertexin interfaceVertexInterface
-
getVertex
public Result<com.alibaba.graphscope.interactive.models.VertexData> getVertex(String graphId, String label, Object primaryKey)
- Specified by:
getVertexin interfaceVertexInterface
-
deleteVertex
public Result<String> deleteVertex(String graphId, List<com.alibaba.graphscope.interactive.models.DeleteVertexRequest> requests)
- Specified by:
deleteVertexin interfaceVertexInterface
-
close
public void close() throws ExceptionCloses this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by thetry-with-resources statement.While this interface method is declared to throw
Exception, implementers are strongly encouraged to declare concrete implementations of theclosemethod to throw more specific exceptions, or to throw no exception at all if the close operation cannot fail.Cases where the close operation may fail require careful attention by implementers. It is strongly advised to relinquish the underlying resources and to internally mark the resource as closed, prior to throwing the exception. The
closemethod is unlikely to be invoked more than once and so this ensures that the resources are released in a timely manner. Furthermore it reduces problems that could arise when the resource wraps, or is wrapped, by another resource.Implementers of this interface are also strongly advised to not have the
closemethod throwInterruptedException.This exception interacts with a thread's interrupted status, and runtime misbehavior is likely to occur if an
InterruptedExceptionis suppressed.More generally, if it would cause problems for an exception to be suppressed, the
AutoCloseable.closemethod should not throw it.Note that unlike the
closemethod ofCloseable, thisclosemethod is not required to be idempotent. In other words, calling thisclosemethod more than once may have some visible side effect, unlikeCloseable.closewhich is required to have no effect if called more than once.However, implementers of this interface are strongly encouraged to make their
closemethods idempotent.- Specified by:
closein interfaceAutoCloseable- Throws:
Exception- if this resource cannot be closed
-
uploadFile
public Result<com.alibaba.graphscope.interactive.models.UploadFileResponse> uploadFile(File fileStorage)
Upload a file to the server.- Specified by:
uploadFilein interfaceUtilsInterface- Parameters:
fileStorage- the file to upload (required)- Returns:
- the response from the server
-
-