Interactive Query#

class graphscope.interactive.query.InteractiveQuery(graph, frontend_gremlin_endpoint, frontend_cypher_endpoint)[source]#

InteractiveQuery class, is a simple wrapper around Gremlin-Python, which implements Gremlin within the Python language. It also can expose gremlin endpoint which can be used by any other standard gremlin console, with the method gremlin_url().

It also has a method called subgraph which can extract some fragments from origin graph, produce a new, smaller but concise graph stored in vineyard, which lifetime is independently of the origin graph.

User can either use execute() to submit a script, or use traversal_source() to get a GraphTraversalSource for further traversal.

__init__(graph, frontend_gremlin_endpoint, frontend_cypher_endpoint)[source]#

Construct a InteractiveQuery object.

property cypher_driver#
property cypher_url#

The cypher graph url can be used with any standard cypher console, e.g., neo4j.

execute(query, lang='gremlin', request_options=None, **kwargs)[source]#

A simple wrapper around submit, for compatibility

property graph_url#
property gremlin_client#
property gremlin_url#

The gremlin graph url can be used with any standard gremlin console, e.g., tinkerpop.

property object_id#
property session#
property session_id#
subgraph(gremlin_script, lang='gremlin', request_options=None)[source]#

We currently only support subgraph using gremlin script.

Create a subgraph, which input is the executor result of gremlin_script.

Any gremlin script that output a set of edges can be used to construct a subgraph.

  • gremlin_script (str) – Gremlin script to be executed.

  • request_options (dict, optional) – Gremlin request options. format:

  • { – “engine”: “gae”

  • }


A new graph constructed by the gremlin output, that also stored in vineyard.

Return type:


submit(query, lang='gremlin', request_options=None, **kwargs)[source]#

We currently only support traversal_source using gremlin.

Create a GraphTraversalSource and return. Once g has been created using a connection, we can start to write Gremlin traversals to query the remote graph.


RuntimeError – If the interactive script is not running.


sess = graphscope.session()
graph = load_modern_graph(sess, modern_graph_data_dir)
interactive = sess.gremlin(graph)
g = interactive.traversal_source()