Previous topic

<no title>

Next topic

Client

Graph

Abstract base class for client-specific implementations.

class bulbs.base.graph.Graph(config=None)[source]

Abstract base class for the server-specific Graph implementations.

Parameters:

config (Config) – Optional Config object. Defaults to the default config.

Variables:
  • client_class – Client class.
  • default_index – Default index class.
  • client – Client object.
  • config – Config object.
  • vertices – VertexProxy object.
  • edges – EdgeProxy object.

Example:

>>> from bulbs.neo4jserver 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 Client

default_index

alias of Index

V[source]

Returns a list of all the vertices in the graph.

Return type:list or None
E[source]

Returns a list of all the edges in the graph.

Return type:list or None
add_proxy(proxy_name, element_class, index_class=None)[source]

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)[source]

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

load_graphml(uri)[source]

Loads a GraphML file into the database and returns the response.

Parameters:uri (str) – URI of the GraphML file.
Return type:Response
get_graphml()[source]

Returns a GraphML file representing the entire database.

Return type:Response
warm_cache()[source]

Warms the server cache by loading elements into memory.

Return type:Response
clear()[source]

Deletes all the elements in the graph.

Return type:Response

WARNING

This will delete all your data!