goblin.gremlin package¶
Submodules¶
goblin.gremlin.base module¶
-
class
goblin.gremlin.base.
BaseGremlinMethod
(path=None, method_name=None, classmethod=False, property=False, defaults=None, transaction=True, imports=None)[source]¶ Bases:
object
Maps a function in a groovy file to a method on a python class
-
class
goblin.gremlin.base.
GremlinMethod
(path=None, method_name=None, classmethod=False, property=False, defaults=None, transaction=True, imports=None)[source]¶ Bases:
goblin.gremlin.base.BaseGremlinMethod
Gremlin method that returns a graph element
-
class
goblin.gremlin.base.
GremlinTable
(path=None, method_name=None, classmethod=False, property=False, defaults=None, transaction=True, imports=None)[source]¶ Bases:
goblin.gremlin.base.GremlinMethod
Gremlin method that returns a table as its result
-
class
goblin.gremlin.base.
GremlinValue
(path=None, method_name=None, classmethod=False, property=False, defaults=None, transaction=True, imports=None)[source]¶ Bases:
goblin.gremlin.base.GremlinMethod
Gremlin Method that returns one value
goblin.gremlin.groovy module¶
-
goblin.gremlin.groovy.
GroovyFileDef
¶ alias of
GroovyFileDefinition
-
class
goblin.gremlin.groovy.
GroovyFunction
(name, args, body, defn)¶ Bases:
tuple
-
args
¶ Alias for field number 1
-
body
¶ Alias for field number 2
-
defn
¶ Alias for field number 3
-
name
¶ Alias for field number 0
-
-
class
goblin.gremlin.groovy.
GroovyFunctionParser
[source]¶ Bases:
object
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*')¶
-
KeywordDef
= "def"¶
-
VarName
= Re:('[A-Za-z_]\\w*')¶
-
-
class
goblin.gremlin.groovy.
GroovyImport
(comment_list, import_strings, import_list)¶ Bases:
tuple
-
comment_list
¶ Alias for field number 0
-
import_list
¶ Alias for field number 2
-
import_strings
¶ Alias for field number 1
-
-
class
goblin.gremlin.groovy.
GroovyImportParser
[source]¶ Bases:
object
Given a string containing a single import definition this class will parse the import definition and return information regarding it.
-
CommentVar
= comment¶
-
ImportDef
= Suppress:("import")¶
-
ImportDefn
= {{{Suppress:("import") Re:('[A-Za-z_.\\*]*') [. Re:('[A-Za-z_.\\*]*')]...} Suppress:(";")} [{Suppress:("//") comment [Empty comment]...}]}¶
-
ImportVarName
= Re:('[A-Za-z_.\\*]*')¶
-
OptionalSpace
= [" "]¶
-
goblin.gremlin.table module¶
-
class
goblin.gremlin.table.
Table
(gremlin_result)[source]¶ Bases:
object
A table accepts the results of a GremlinTable in it’s constructor. It can be iterated over like a normal list, but within the rows the dictionaries are accessible via .notation
For example:
# returns a table of people & my friend edge to them # the edge contains my nickname for that person friends = goblin.gremlin.GremlinTable()
- def get_friends_and_my_nickname(self):
result = self.friends() for i in result:
print “{}:{}”.format(i.friend_edge.nickname, i.person.name)
-
class
goblin.gremlin.table.
Row
(data)[source]¶ Bases:
object
A row represent a table row, from which it’s columns can be accessed like a tuple or dict. Rows are read-only and accept elements or dicts with as initializers as a result of a GremlinTable query. Also the . getattr notation can be used to access elements
Example: row = Row({‘person’: Friend.create(....), ‘myval’: 3}) print “{}:{} - {}”.format(row.friend_edge.nickname, row.person.name, row.myval)