Neo4j Server: Batch

Bulbs API for Neo4j batch requests.

Neo4j Batch (Experimental)

class bulbs.neo4jserver.batch.Neo4jBatchRequest(config, content_type)[source]

Makes HTTP requests to Neo4j Server and returns a Neo4jResponse.

request(method, path, params)[source]

Adds request to the messages list and returns a placeholder.

Parameters:
  • method (str) – HTTP method: GET, PUT, POST, or DELETE.
  • path (str) – Path to the server resource, relative to the root URI.
  • params (dict) – Optional URI parameters for the resource.
Return type:

str

send()[source]

Convenience method that sends request messages to the client.

Parameters:
  • message – Tuple containing: (HTTP method, path, params)
  • params (dict) – Optional URI params for the resource.
Return type:

Response

delete(path, params=None)

Convenience method that sends DELETE requests to the client.

Parameters:
  • path (str) – Path to the server resource, relative to the root URI.
  • params (dict) – Optional URI params for the resource.
Return type:

Response

get(path, params=None)

Convenience method that sends GET requests to the client.

Parameters:
  • path (str) – Path to the server resource, relative to the root URI.
  • params (dict) – Optional URI params for the resource.
Return type:

Response

post(path, params=None)

Convenience method that sends POST requests to the client.

Parameters:
  • path (str) – Path to the server resource, relative to the root URI.
  • params (dict) – Optional URI params for the resource.
Return type:

Response

put(path, params=None)

Convenience method that sends PUT requests to the client.

Parameters:
  • path (str) – Path to the server resource, relative to the root URI.
  • params (dict) – Optional URI params for the resource.
Return type:

Response

response_class

alias of Neo4jResponse

class bulbs.neo4jserver.batch.Neo4jBatchClient(config=None)[source]
request_class

alias of Neo4jBatchRequest

bothE(_id, label=None, start=None, limit=None)

Returns the incoming and outgoing edges of the vertex.

Parameters:
  • _id (dict) – Vertex ID.
  • label (str) – Optional edge label. Defaults to None.
Return type:

Neo4jResponse

bothV(_id, label=None, start=None, limit=None)

Returns the incoming- and outgoing-adjacent vertices of the vertex.

Parameters:
  • _id (dict) – Vertex ID.
  • label (str) – Optional edge label. Defaults to None.
Return type:

Neo4jResponse

create_edge(outV, label, inV, data=None)

Creates a edge and returns the Response.

Parameters:
  • outV (int) – Outgoing vertex ID.
  • label (str) – Edge label.
  • inV (int) – Incoming vertex ID.
  • data (dict or None) – Property data.
Return type:

Neo4jResponse

create_edge_index(index_name, *args, **kwds)

Creates a edge index with the specified params.

Parameters:index_name (str) – Name of the index.
Return type:Neo4jResponse
create_indexed_edge(outV, label, inV, data, index_name, keys=None)

Creates a edge, indexes it, and returns the Response.

Parameters:
  • outV (int) – Outgoing vertex ID.
  • label (str) – Edge label.
  • inV (int) – Incoming vertex ID.
  • data (dict) – Property data.
  • index_name (str) – Name of the index.
  • keys (list) – Property keys to index. Defaults to None (indexes all properties).
Return type:

Neo4jResponse

create_indexed_vertex(data, index_name, keys=None)

Creates a vertex, indexes it, and returns the Response.

Parameters:
  • data (dict) – Property data.
  • index_name (str) – Name of the index.
  • keys (list) – Property keys to index.
Return type:

Neo4jResponse

create_vertex(data)

Creates a vertex and returns the Response.

Parameters:data (dict) – Property data.
Return type:Neo4jResponse
create_vertex_index(index_name, *args, **kwds)

Creates a vertex index with the specified params.

Parameters:index_name (str) – Name of the index to create.
Return type:Neo4jResponse
cypher(query, params=None)

Executes a Cypher query and returns the Response.

Parameters:
  • query (str) – Cypher query to execute.
  • params (dict) – Param bindings for the query.
Return type:

Neo4jResponse

delete_edge(_id)

Deletes a edge with the _id and returns the Response.

Parameters:_id (dict) – Edge ID.
Return type:Neo4jResponse
delete_edge_index(index_name)

Deletes the edge index with the index_name.

Parameters:index_name (str) – Name of the index.
Return type:Neo4jResponse
delete_vertex(_id)

Deletes a vertex with the _id and returns the Response.

Parameters:_id (dict) – Vertex ID.
Return type:Neo4jResponse
delete_vertex_index(index_name)

Deletes the vertex index with the index_name.

Parameters:index_name (str) – Name of the index.
Return type:Neo4jResponse
get_all_edges()

Returns a Response containing all the edges in the Graph.

Return type:Neo4jResponse
get_all_vertices()

Returns a Response containing all the vertices in the Graph.

Return type:Neo4jResponse
get_edge(_id)

Gets the edge with the _id and returns the Response.

Parameters:data (int) – Edge ID.
Return type:Neo4jResponse
get_edge_index(index_name)

Returns the edge index with the index_name.

Parameters:index_name (str) – Name of the index.
Return type:Neo4jResponse
get_edge_indices()

Returns a dict of all the vertex indices.

Return type:Neo4jResponse
get_metadata(key, default_value=None)

Returns the value of metadata for the key.

Parameters:
  • key (str) – Metadata key
  • default_value (str, int, or list) – Default value to return if the key is not found.
Return type:

Neo4jResponse

get_or_create_edge_index(index_name, *args, **kwds)

Get a Edge Index or create it if it doesn’t exist.

Parameters:
  • index_name (str) – Index name.
  • index_config (dict) – Index configuration.
Return type:

bulbs.neo4jserver.index.Index

get_or_create_vertex_index(index_name, *args, **kwds)

Get a Vertex Index or create it if it doesn’t exist.

Parameters:
  • index_name (str) – Index name.
  • index_config (dict) – Index configuration.
Return type:

bulbs.neo4jserver.index.Index

get_vertex(_id)

Gets the vertex with the _id and returns the Response.

Parameters:data (int) – Vertex ID.
Return type:Neo4jResponse
get_vertex_index(index_name)

Returns the vertex index with the index_name.

Parameters:index_name (str) – Name of the index.
Return type:Neo4jResponse
get_vertex_indices()

Returns all the vertex indices.

Return type:Neo4jResponse
gremlin(script, params=None)

Executes a Gremlin script and returns the Response.

Parameters:
  • script (str) – Gremlin script to execute.
  • params (dict) – Param bindings for the script.
Return type:

Neo4jResponse

inE(_id, label=None, start=None, limit=None)

Returns the incoming edges of the vertex.

Parameters:
  • _id (dict) – Vertex ID.
  • label (str) – Optional edge label. Defaults to None.
Return type:

Neo4jResponse

inV(_id, label=None, start=None, limit=None)

Returns the in-adjacent vertices of the vertex.

Parameters:
  • _id (dict) – Vertex ID.
  • label (str) – Optional edge label. Defaults to None.
Return type:

Neo4jResponse

lookup_edge(index_name, key, value)

Looks up an edge in the index and returns the Response.

Parameters:
  • index_name (str) – Name of the index.
  • key (str) – Name of the key.
  • value (str) – Value of the key.
Return type:

Neo4jResponse

lookup_vertex(index_name, key, value)

Returns the vertices indexed with the key and value.

Parameters:
  • index_name (str) – Name of the index.
  • key (str) – Name of the key.
  • value (str) – Value of the key.
Return type:

Neo4jResponse

outE(_id, label=None, start=None, limit=None)

Returns the outgoing edges of the vertex.

Parameters:
  • _id (dict) – Vertex ID.
  • label (str) – Optional edge label. Defaults to None.
Return type:

Neo4jResponse

outV(_id, label=None, start=None, limit=None)

Returns the out-adjacent vertices of the vertex.

Parameters:
  • _id (dict) – Vertex ID.
  • label (str) – Optional edge label. Defaults to None.
Return type:

Neo4jResponse

put_edge(index_name, key, value, _id)

Adds an edge to the index and returns the Response.

Parameters:
  • index_name (str) – Name of the index.
  • key (str) – Name of the key.
  • value (str) – Value of the key.
  • _id (int) – Edge ID
Return type:

Neo4jResponse

put_vertex(index_name, key, value, _id)

Adds a vertex to the index with the index_name.

Parameters:
  • index_name (str) – Name of the index.
  • key (str) – Name of the key.
  • value (str) – Value of the key.
  • _id (int) – Vertex ID
Return type:

Neo4jResponse

query_edge(index_name, query)

Queries the index and returns the Response.

Parameters:
  • index_name (str) – Name of the index.
  • query (str) – Lucene query string
Return type:

Neo4jResponse

query_vertex(index_name, query)

Queries the index and returns the Response.

Parameters:
  • index_name (str) – Name of the index.
  • query (str) – Lucene query string
Return type:

Neo4jResponse

remove_edge(index_name, _id, key=None, value=None)

Removes an edge from the index and returns the Response.

Parameters:
  • index_name (str) – Name of the index.
  • _id (int) – Edge ID
  • key (str) – Optional. Name of the key.
  • value (str) – Optional. Value of the key.
Return type:

Neo4jResponse

remove_metadata(key)

Removes the metadata key and value.

Parameters:key (str) – Metadata key
Return type:Neo4jResponse
remove_vertex(index_name, _id, key=None, value=None)

Removes a vertex from the index and returns the Response.

Parameters:
  • index_name (str) – Name of the index.
  • key (str) – Optional. Name of the key.
  • value (str) – Optional. Value of the key.
Return type:

Neo4jResponse

set_metadata(key, value)

Sets the metadata key to the supplied value.

Parameters:
  • key (str) – Metadata key
  • value (str, int, or list) – Metadata value.
Return type:

Neo4jResponse

update_edge(_id, data)

Updates the edge with the _id and returns the Response.

Parameters:
  • _id (dict) – Edge ID.
  • data (dict) – Property data.
Return type:

Neo4jResponse

update_indexed_edge(_id, data, index_name, keys=None)

Updates an indexed edge and returns the Response.

Parameters:
  • _id (int) – Edge ID.
  • data (dict) – Property data.
  • index_name (str) – Name of the index.
  • keys (list) – Property keys to index. Defaults to None (indexes all properties).
Return type:

Neo4jResponse

update_indexed_vertex(_id, data, index_name, keys=None)

Updates an indexed vertex and returns the Response.

Parameters:
  • index_name (str) – Name of the index.
  • data (dict) – Property data.
  • index_name – Name of the index.
  • keys (list) – Property keys to index.
Return type:

Neo4jResponse

update_vertex(_id, data)

Updates the vertex with the _id and returns the Response.

Parameters:
  • _id (dict) – Vertex ID.
  • data (dict) – Property data.
Return type:

Neo4jResponse