MCPcopy Create free account
hub / github.com/alibaba/GraphScope / InteractiveQuery

Class InteractiveQuery

python/graphscope/interactive/query.py:41–237  ·  view source on GitHub ↗

`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

Source from the content-addressed store, hash-verified

39
40
41class InteractiveQuery(object):
42 """`InteractiveQuery` class, is a simple wrapper around
43 `Gremlin-Python <https://pypi.org/project/gremlinpython/>`_,
44 which implements Gremlin within the Python language.
45 It also can expose gremlin endpoint which can be used by
46 any other standard gremlin console, with the method `gremlin_url()`.
47
48 It also has a method called `subgraph` which can extract some fragments
49 from origin graph, produce a new, smaller but concise graph stored in vineyard,
50 which lifetime is independently of the origin graph.
51
52 User can either use `execute()` to submit a script, or use `traversal_source()`
53 to get a `GraphTraversalSource` for further traversal.
54 """
55
56 def __init__(self, graph, frontend_gremlin_endpoint, frontend_cypher_endpoint):
57 """Construct a :class:`InteractiveQuery` object."""
58 # graph object id stored in vineyard
59 self._graph = graph
60 self._session = graph._session
61 self._gremlin_url = [
62 f"ws://{endpoint}/gremlin"
63 for endpoint in frontend_gremlin_endpoint.split(",")
64 ]
65 self._cypher_url = [
66 f"neo4j://{endpoint}" for endpoint in frontend_cypher_endpoint.split(",")
67 ]
68 self._conn = None
69 self._gremlin_client = None
70 self._cypher_driver = None
71 self.closed = False
72
73 @property
74 @deprecated("Please use `gremlin_url` instead")
75 def graph_url(self):
76 """This will be deprecated in the future, use `gremlin_url` instead."""
77 return self._gremlin_url
78
79 @property
80 def gremlin_url(self):
81 """The gremlin graph url can be used with any standard gremlin console,
82 e.g., tinkerpop."""
83 return self._gremlin_url
84
85 @property
86 def cypher_url(self):
87 """The cypher graph url can be used with any standard cypher console,
88 e.g., neo4j."""
89 return self._cypher_url
90
91 @property
92 def object_id(self):
93 return self._graph.vineyard_id
94
95 @property
96 def session(self):
97 return self._session
98

Callers 1

interactiveMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected