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
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
def query(self, *steps): from gremlin import query return lambda iterator=None: query(*steps)(self, iterator)