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)
void
close()
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 DefaultSession
newInstance(String adminUri)
static DefaultSession
newInstance(String adminUri, Config config)
static DefaultSession
newInstance(String adminUri, String storedProcUri)
static DefaultSession
newInstance(String adminUri, String storedProcUri, Config config)
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.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:
getEdge
in interfaceEdgeInterface
-
addEdge
public Result<String> addEdge(String graphName, List<com.alibaba.graphscope.interactive.models.EdgeRequest> edgeRequest)
- Specified by:
addEdge
in interfaceEdgeInterface
-
deleteEdge
public Result<String> deleteEdge(String graphName, List<com.alibaba.graphscope.interactive.models.DeleteEdgeRequest> requests)
- Specified by:
deleteEdge
in interfaceEdgeInterface
-
updateEdge
public Result<String> updateEdge(String graphName, List<com.alibaba.graphscope.interactive.models.EdgeRequest> edgeRequest)
- Specified by:
updateEdge
in interfaceEdgeInterface
-
bulkLoading
public Result<com.alibaba.graphscope.interactive.models.JobResponse> bulkLoading(String graphId, com.alibaba.graphscope.interactive.models.SchemaMapping mapping)
- Specified by:
bulkLoading
in interfaceGraphInterface
-
createGraph
public Result<com.alibaba.graphscope.interactive.models.CreateGraphResponse> createGraph(com.alibaba.graphscope.interactive.models.CreateGraphRequest graph)
- Specified by:
createGraph
in interfaceGraphInterface
-
deleteGraph
public Result<String> deleteGraph(String graphId)
- Specified by:
deleteGraph
in interfaceGraphInterface
-
getGraphSchema
public Result<com.alibaba.graphscope.interactive.models.GetGraphSchemaResponse> getGraphSchema(String graphId)
- Specified by:
getGraphSchema
in interfaceGraphInterface
-
getGraphStatistics
public Result<com.alibaba.graphscope.interactive.models.GetGraphStatisticsResponse> getGraphStatistics(String graphId)
- Specified by:
getGraphStatistics
in interfaceGraphInterface
-
getGraphMeta
public Result<com.alibaba.graphscope.interactive.models.GetGraphResponse> getGraphMeta(String graphId)
- Specified by:
getGraphMeta
in interfaceGraphInterface
-
getAllGraphs
public Result<List<com.alibaba.graphscope.interactive.models.GetGraphResponse>> getAllGraphs()
- Specified by:
getAllGraphs
in interfaceGraphInterface
-
cancelJob
public Result<String> cancelJob(String jobId)
- Specified by:
cancelJob
in interfaceJobInterface
-
getJobStatus
public Result<com.alibaba.graphscope.interactive.models.JobStatus> getJobStatus(String jobId)
- Specified by:
getJobStatus
in interfaceJobInterface
-
listJobs
public Result<List<com.alibaba.graphscope.interactive.models.JobStatus>> listJobs()
- Specified by:
listJobs
in interfaceJobInterface
-
createProcedure
public Result<com.alibaba.graphscope.interactive.models.CreateProcedureResponse> createProcedure(String graphId, com.alibaba.graphscope.interactive.models.CreateProcedureRequest procedure)
- Specified by:
createProcedure
in interfaceProcedureInterface
-
deleteProcedure
public Result<String> deleteProcedure(String graphId, String procedureName)
- Specified by:
deleteProcedure
in interfaceProcedureInterface
-
getProcedure
public Result<com.alibaba.graphscope.interactive.models.GetProcedureResponse> getProcedure(String graphId, String procedureId)
- Specified by:
getProcedure
in interfaceProcedureInterface
-
listProcedures
public Result<List<com.alibaba.graphscope.interactive.models.GetProcedureResponse>> listProcedures(String graphId)
- Specified by:
listProcedures
in interfaceProcedureInterface
-
updateProcedure
public Result<String> updateProcedure(String graphId, String procedureId, com.alibaba.graphscope.interactive.models.UpdateProcedureRequest procedure)
- Specified by:
updateProcedure
in interfaceProcedureInterface
-
callProcedure
public Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults> callProcedure(String graphId, com.alibaba.graphscope.interactive.models.QueryRequest request)
- Specified by:
callProcedure
in interfaceQueryInterface
-
callProcedureAsync
public CompletableFuture<Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults>> callProcedureAsync(String graphId, com.alibaba.graphscope.interactive.models.QueryRequest queryRequest)
- Specified by:
callProcedureAsync
in interfaceQueryInterface
-
callProcedure
public Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults> callProcedure(com.alibaba.graphscope.interactive.models.QueryRequest request)
- Specified by:
callProcedure
in interfaceQueryInterface
-
callProcedureAsync
public CompletableFuture<Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults>> callProcedureAsync(com.alibaba.graphscope.interactive.models.QueryRequest queryRequest)
- Specified by:
callProcedureAsync
in interfaceQueryInterface
-
callProcedure
public Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults> callProcedure(String graphId, com.alibaba.graphscope.gaia.proto.StoredProcedure.Query request)
- Specified by:
callProcedure
in 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:
callProcedureAsync
in interfaceQueryInterface
-
callProcedure
public Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults> callProcedure(com.alibaba.graphscope.gaia.proto.StoredProcedure.Query request)
- Specified by:
callProcedure
in interfaceQueryInterface
-
callProcedureAsync
public CompletableFuture<Result<com.alibaba.graphscope.gaia.proto.IrResult.CollectiveResults>> callProcedureAsync(com.alibaba.graphscope.gaia.proto.StoredProcedure.Query request)
- Specified by:
callProcedureAsync
in interfaceQueryInterface
-
callProcedureRaw
public Result<byte[]> callProcedureRaw(String graphId, byte[] request)
Call procedure with raw bytes.- Specified by:
callProcedureRaw
in interfaceQueryInterface
-
callProcedureRawAsync
public CompletableFuture<Result<byte[]>> callProcedureRawAsync(String graphId, byte[] request)
- Specified by:
callProcedureRawAsync
in interfaceQueryInterface
-
callProcedureRaw
public Result<byte[]> callProcedureRaw(byte[] request)
- Specified by:
callProcedureRaw
in interfaceQueryInterface
-
callProcedureRawAsync
public CompletableFuture<Result<byte[]>> callProcedureRawAsync(byte[] request)
- Specified by:
callProcedureRawAsync
in 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:
runAdhocQuery
in 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:
runAdhocQueryAsync
in 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:
runAdhocQuery
in 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:
runAdhocQueryAsync
in interfaceQueryInterface
-
getServiceStatus
public Result<com.alibaba.graphscope.interactive.models.ServiceStatus> getServiceStatus()
- Specified by:
getServiceStatus
in interfaceQueryServiceInterface
-
restartService
public Result<String> restartService()
- Specified by:
restartService
in interfaceQueryServiceInterface
-
startService
public Result<String> startService(com.alibaba.graphscope.interactive.models.StartServiceRequest service)
- Specified by:
startService
in interfaceQueryServiceInterface
-
stopService
public Result<String> stopService(com.alibaba.graphscope.interactive.models.StopServiceRequest request)
- Specified by:
stopService
in interfaceQueryServiceInterface
-
addVertex
public Result<String> addVertex(String graphId, com.alibaba.graphscope.interactive.models.VertexEdgeRequest request)
- Specified by:
addVertex
in interfaceVertexInterface
-
updateVertex
public Result<String> updateVertex(String graphId, com.alibaba.graphscope.interactive.models.VertexEdgeRequest requests)
- Specified by:
updateVertex
in interfaceVertexInterface
-
getVertex
public Result<com.alibaba.graphscope.interactive.models.VertexData> getVertex(String graphId, String label, Object primaryKey)
- Specified by:
getVertex
in interfaceVertexInterface
-
deleteVertex
public Result<String> deleteVertex(String graphId, List<com.alibaba.graphscope.interactive.models.DeleteVertexRequest> requests)
- Specified by:
deleteVertex
in interfaceVertexInterface
-
close
public void close() throws Exception
Closes 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 theclose
method 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
close
method 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
close
method throwInterruptedException
.This exception interacts with a thread's interrupted status, and runtime misbehavior is likely to occur if an
InterruptedException
is suppressed.More generally, if it would cause problems for an exception to be suppressed, the
AutoCloseable.close
method should not throw it.Note that unlike the
close
method ofCloseable
, thisclose
method is not required to be idempotent. In other words, calling thisclose
method more than once may have some visible side effect, unlikeCloseable.close
which is required to have no effect if called more than once.However, implementers of this interface are strongly encouraged to make their
close
methods idempotent.- Specified by:
close
in 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:
uploadFile
in interfaceUtilsInterface
- Parameters:
fileStorage
- the file to upload (required)- Returns:
- the response from the server
-
-