Skip to content

Munduruca/gremlinpython-fml

Repository files navigation

whats going on

Let's struggle together using gremlinpython

how to install it

pip install gremlinpython

For the super beginners, I'll leave simple stuff that I know how to do. Those files will have the prefix "OK_" in the name.
What I mean by simple stuff is how to create vertices and edges as well as how to run queries.

I'll have in this repo examples of things that I know how to do using pure gremlin (gremlin-console)
and I don't know how to do using gremlinpython.

Example:
I'll have a file called "_finding_one_simple_query.py" and "_finding_one_simple_query.txt". In the second file, I'll post everything I did
using gremlin-console. In the first, I'll show how I tried to do that but did not manage to succeed.

"_finding_one_simple_query.txt"
graph = TinkerGraph.open()
g = graph.traversal()
g.addV('employee').property('name','rico').property('position','data guy')
g.V().has('name','rico').values().fold()
==> [rico,data_guy]

"_finding_one_simple_query.py"
from gremlin_python.structure.graph import Graph
graph = Graph()
g = graph.traversal()
g.addV("employee").property("name", "rico").property('position','data guy')
my_stuff = g.V().has('name','rico').values()
In [39]: my_stuff
Out[39]: [['V'], ['has', 'name', 'rico'], ['values'], ['values', '_ipython_display_']]

^^^^
As we can see above the result is not the same :(
My first attempt was to get thiings from this object that looks like a list
using index position e.g. my_stuff[0]
After trying that, I've go this error: TypeError: NoneType object is not an iterator

leaving some sample stuff with what I discovered by myself.
happy to receive help with the things I'm struggling with.

About

Struggling with gremlinpython

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages