Beispiel #1
0
 def one(self, **properties):
     from gremlin import select
     from gremlin import get
     query = self.query(select(**properties), get)
     try:
         element = query()[0]
     except IndexError:
         return None
     else:
         return element
Beispiel #2
0
 def one(self, label, **properties):
     import gremlin
     query = gremlin.query(gremlin.vertices(label),
                           gremlin.where(**properties), gremlin.limit(1),
                           gremlin.get)
     try:
         element = query(self._graphdb)[0]
     except IndexError:
         return None
     else:
         return element
Beispiel #3
0
 def query(self, *steps):
     from gremlin import query
     return lambda iterator=None: query(*steps)(self, iterator)