Rexster: Graph¶
Bulbs API for the Rexster Graph.
- class bulbs.rexster.graph.Graph(config=None)[source]¶
The primary interface to Rexster.
Instantiates the database Client object using the specified Config and sets up proxy objects to the database.
Parameters: config (bulbs.config.Config) – Optional. Defaults to the default config.
Variables: - client_class – RexsterClient class.
- default_index – Default index class.
- client – RexsterClient object.
- vertices – VertexProxy object.
- edges – EdgeProxy object.
- config – Config object.
- gremlin – Gremlin object.
- scripts – GroovyScripts object.
Example:
>>> from bulbs.rexster import Graph >>> g = Graph() >>> james = g.vertices.create(name="James") >>> julie = g.vertices.create(name="Julie") >>> g.edges.create(james, "knows", julie)
- client_class¶
alias of RexsterClient
- default_index¶
alias of ManualIndex
- load_graphml(uri)[source]¶
Loads a GraphML file into the database and returns the response.
Parameters: uri (str) – URI of the GraphML file to load. Return type: RexsterResult
- get_graphml()[source]¶
Returns a GraphML file representing the entire database.
Return type: RexsterResult
- warm_cache()[source]¶
Warms the server cache by loading elements into memory.
Return type: RexsterResult
- clear()[source]¶
Deletes all the elements in the graph.
Return type: RexsterResult WARNING
This will delete all your data!
- E¶
Returns a list of all the edges in the graph.
Return type: list or None
- V¶
Returns a list of all the vertices in the graph.
Return type: list or None
- add_proxy(proxy_name, element_class, index_class=None)¶
Adds an element proxy to the Graph object for the element class.
Parameters: - proxy_name (str) – Attribute name to use for the proxy.
- element_class (Element) – Element class managed by this proxy.
- index_class (Index) – Index class for Element’s primary index. Defaults to default_index.
Return type: None
- build_proxy(element_class, index_class=None)¶
Returns an element proxy built to specifications.
Parameters: - element_class (Element) – Element class managed by this proxy.
- index_class (Index) – Optional Index class for Element’s primary index. Defaults to default_index.
Return type: Element proxy