GraphServer

A class for defining and running a Raphtory GraphQL server

Methods

MethodDescription
runRun the server until completion.
set_embeddingsSetup the server to vectorise graphs with a default template.
startStart the server and return a handle to it.
turn_off_indexTurn off index for all graphs
with_vectorised_graphsVectorise a subset of the graphs of the server.

Method Details

run

Signature: run(port=1736, timeout_ms=180000)

Run the server until completion.

Parameters

NameTypeDefaultDescription
portint, optional1736The port to use. Defaults to 1736.
timeout_msint, optional180000Timeout for waiting for the server to start. Defaults to 180000.

Returns

TypeDescription
None

set_embeddings

Signature: set_embeddings(cache, embedding=None, nodes=True, edges=True)

Setup the server to vectorise graphs with a default template.

Parameters

NameTypeDefaultDescription
cachestr-the directory to use as cache for the embeddings.
embeddingCallable, optionalNonethe embedding function to translate documents to embeddings.
nodesbool | str, optionalTrueif nodes have to be embedded or not or the custom template to use if a str is provided. Defaults to True.
edgesbool | str, optionalTrueif edges have to be embedded or not or the custom template to use if a str is provided. Defaults to True.

Returns

TypeDescription
GraphServerA new server object with embeddings setup.

start

Signature: start(port=1736, timeout_ms=5000)

Start the server and return a handle to it.

Parameters

NameTypeDefaultDescription
portint, optional1736the port to use. Defaults to 1736.
timeout_msint, optional5000wait for server to be online. Defaults to 5000. The server is stopped if not online within timeout_ms but manages to come online as soon as timeout_ms finishes!

Returns

TypeDescription
RunningGraphServerThe running server

turn_off_index

Turn off index for all graphs

Returns

TypeDescription
GraphServerThe server with indexing disabled

with_vectorised_graphs

Signature: with_vectorised_graphs(graph_names, nodes=True, edges=True)

Vectorise a subset of the graphs of the server.

Parameters

NameTypeDefaultDescription
graph_nameslist[str]-the names of the graphs to vectorise. All by default.
nodesbool | str, optionalTrueif nodes have to be embedded or not or the custom template to use if a str is provided. Defaults to True.
edgesbool | str, optionalTrueif edges have to be embedded or not or the custom template to use if a str is provided. Defaults to True.

Returns

TypeDescription
GraphServerA new server object containing the vectorised graphs.