Gremlin

class mogwai.gremlin.base.BaseGremlinMethod(path=None, method_name=None, classmethod=False, property=False, defaults={}, transaction=True)

Maps a function in a groovy file to a method on a python class

configure_method(klass, attr_name, gremlin_path)

Sets up the methods internals

Parameters:
  • klass (object) – The class object this function is being added to
  • attr_name (str) – The attribute name this function will be added as
  • gremlin_path (str) – The path to the gremlin file containing method
transform_params_to_database(params)

Takes a dictionary of parameters and recursively translates them into parameters appropriate for sending over Rexpro.

Parameters:params (dict) – The parameters to be sent to the function
Return type:dict
class mogwai.gremlin.base.GremlinMethod(path=None, method_name=None, classmethod=False, property=False, defaults={}, transaction=True)

Gremlin method that returns a graph element

configure_method(klass, attr_name, gremlin_path)

Sets up the methods internals

Parameters:
  • klass (object) – The class object this function is being added to
  • attr_name (str) – The attribute name this function will be added as
  • gremlin_path (str) – The path to the gremlin file containing method
transform_params_to_database(params)

Takes a dictionary of parameters and recursively translates them into parameters appropriate for sending over Rexpro.

Parameters:params (dict) – The parameters to be sent to the function
Return type:dict
class mogwai.gremlin.base.GremlinTable(path=None, method_name=None, classmethod=False, property=False, defaults={}, transaction=True)

Gremlin method that returns a table as its result

configure_method(klass, attr_name, gremlin_path)

Sets up the methods internals

Parameters:
  • klass (object) – The class object this function is being added to
  • attr_name (str) – The attribute name this function will be added as
  • gremlin_path (str) – The path to the gremlin file containing method
transform_params_to_database(params)

Takes a dictionary of parameters and recursively translates them into parameters appropriate for sending over Rexpro.

Parameters:params (dict) – The parameters to be sent to the function
Return type:dict
class mogwai.gremlin.base.GremlinValue(path=None, method_name=None, classmethod=False, property=False, defaults={}, transaction=True)

Gremlin Method that returns one value

configure_method(klass, attr_name, gremlin_path)

Sets up the methods internals

Parameters:
  • klass (object) – The class object this function is being added to
  • attr_name (str) – The attribute name this function will be added as
  • gremlin_path (str) – The path to the gremlin file containing method
transform_params_to_database(params)

Takes a dictionary of parameters and recursively translates them into parameters appropriate for sending over Rexpro.

Parameters:params (dict) – The parameters to be sent to the function
Return type:dict
class mogwai.gremlin.groovy.GroovyFunctionParser

Given a string containing a single function definition this class will parse the function definition and return information regarding it.

FuncDefn = {{{{{"def" Re:('[A-Za-z_]\\w*')} "("} Re:('[A-Za-z_]\\w*') [, Re:('[A-Za-z_]\\w*')]...} ")"} "{"}
FuncName = Re:('[A-Za-z_]\\w*')
class GroovyFunction

GroovyFunction(name, args, body, defn)

args

Alias for field number 1

body

Alias for field number 2

count(value) → integer -- return number of occurrences of value
defn

Alias for field number 3

index(value[, start[, stop]]) → integer -- return first index of value.

Raises ValueError if the value is not present.

name

Alias for field number 0

GroovyFunctionParser.KeywordDef = "def"
GroovyFunctionParser.VarName = Re:('[A-Za-z_]\\w*')
classmethod GroovyFunctionParser.parse(data)

Parse the given function definition and return information regarding the contained definition.

Parameters:data (str) – The function definition in a string
Return type:dict
mogwai.gremlin.groovy.parse(file)

Parse Groovy code in the given file and return a list of information about each function necessary for usage in queries to database.

Parameters:file (str) – The file containing groovy code.
Return type:list