def E(self): """ Returns a list of all the edges in the graph. :rtype: list """ resp = self.client.get_all_edges() edges = initialize_elements(self.client, resp) return list(edges)
def V(self): """ Returns a list of all the vertices in the graph. :rtype: list """ resp = self.client.get_all_vertices() vertices = initialize_elements(self.client, resp) return list(vertices)
def E(self): """ Returns a list of all the edges in the graph. :rtype: list or None """ resp = self.client.get_all_edges() if resp.total_size > 0: edges = initialize_elements(self.client, resp) return list(edges)
def query(self, query_string): """ Return elements mathing the query. :param query_string: The query formatted in the Lucene query language. See http://lucene.apache.org/java/3_1_0/queryparsersyntax.html """ resp = self.client.query_fulltext_index(self.index_name,query_string) return initialize_elements(self.client,resp)
def query(self, query_string): """ Return elements mathing the query. :param query_string: The query formatted in the Lucene query language. See http://lucene.apache.org/java/3_1_0/queryparsersyntax.html """ resp = self.resource.query_fulltext_index(self.index_name, query_string) return initialize_elements(self.resource, resp)
def query(self, query_string): """ Return elements mathing the query. See http://lucene.apache.org/core/3_6_0/queryparsersyntax.html :param query_string: The query formatted in the Lucene query language. :type query_string: str :rtype: Element generator """ query = self._get_method(vertex="query_vertex", edge="query_edge") resp = query(self.index_name, query_string) return initialize_elements(self.client,resp)
def query(self, query_string): """ Return elements mathing the query. See http://lucene.apache.org/core/3_6_0/queryparsersyntax.html :param query_string: The query formatted in the Lucene query language. :type query_string: str :rtype: Element generator """ query = self._get_method(vertex="query_vertex", edge="query_edge") resp = query(self.index_name, query_string) return initialize_elements(self.client, resp)
def query(self, key, query_string): """ Return all the elements in the index matching the query. :param key: The index key. :type key: str :param query_string: The query string. Example: "Jam*". :type value: str or int :rtype: Element generator """ # TODO: is there a way to do this via the REST API? script = self.client.scripts.get('query_exact_index') params = dict(index_name=self.index_name, key=key, query_string=query_string) resp = self.client.gremlin(script, params) return initialize_elements(self.client, resp)
def lookup(self, key=None, value=None, **pair): """ Return all the elements in the index where key equals value. :param key: The index key. :type key: str :param value: The key's value. :type value: str or int :param pair: Optional key/value pair. Example: name="James" :type pair: key/value pair :rtype: Element generator """ key, value = self._get_key_value(key, value, pair) lookup = self._get_method(vertex="lookup_vertex", edge="lookup_edge") resp = lookup(self.index_name, key, value) return initialize_elements(self.client, resp)
def query(self, key, query_string): """ Return all the elements in the index matching the query. :param key: The index key. :type key: str :param query_string: The query string. Example: "Jam*". :type value: str or int :rtype: Element generator """ # TODO: Maybe update this to use the REST endpoint. script = self.client.scripts.get('query_exact_index') params = dict(index_name=self.index_name, key=key, query_string=query_string) resp = self.client.gremlin(script, params) return initialize_elements(self.client, resp)
def lookup(self, key=None, value=None, **pair): """ Return all the elements in the index where key equals value. :param key: The index key. :type key: str :param value: The key's value. :type value: str or int :param pair: Optional key/value pair. Example: name="James" :type pair: key/value pair :rtype: Element generator """ key, value = self._get_key_value(key,value,pair) lookup = self._get_method(vertex="lookup_vertex", edge="lookup_edge") resp = lookup(self.index_name,key,value) return initialize_elements(self.client, resp)
def lookup(self, key=None, value=None, **pair): """ Return a generator containing all the elements with key property equal to value in the index. :param key: The index key. This is optional because you can instead supply a key/value pair such as name="James". :param value: The index key's value. This is optional because you can instead supply a key/value pair such as name="James". :param raw: Optional keyword param. If set to True, it won't try to initialize the results. Defaults to False. :param pair: Optional keyword param. Instead of supplying key=name and value = 'James', you can supply a key/value pair in the form of name='James'. """ key, value = self._get_key_value(key, value, pair) resp = self.client.lookup_vertex(self.index_name,key,value) return initialize_elements(self.client,resp)
def get(self,key=None,value=None,**pair): """ Return a generator containing all the elements with key property equal to value in the index. :param key: The index key. This is optional because you can instead supply a key/value pair such as name="James". :param value: The index key's value. This is optional because you can instead supply a key/value pair such as name="James". :param raw: Optional keyword param. If set to True, it won't try to initialize the results. Defaults to False. :param **pair: Optional keyword param. Instead of supplying key=name and value = 'James', you can supply a key/value pair in the form of name='James'. """ key, value = self._parse_args(key,value,pair) resp = self.resource.lookup_vertex(self.index_name,key,value) return initialize_elements(self.resource,result)
def query(self, query, params=None): resp = self.resource.cypher(query, params) return initialize_elements(self.resource, resp)
def get(self, key=None, value=None, **pair): """Return all the elements with key property equal to value in the index.""" key, value = self._parse_args(key, value, pair) resp = self.resource.lookup_vertex(self.index_name, key, value) return initialize_elements(self.resource, resp)
def lookup(self, key=None, value=None, **pair): """Return all the elements with key property equal to value in the index.""" key, value = self._get_key_value(key,value,pair) lookup = self._get_method(vertex="lookup_vertex", edge="lookup_edge") resp = lookup(self.index_name,key,value) return initialize_elements(self.client,resp)
def query(self, query, params=None): resp = self.client.cypher(query,params) return initialize_elements(self.client, resp)
def query(self, query, params=None): # Like a normal Gremlin query (returns elements) resp = self.client.cypher(query, params) return initialize_elements(self.client, resp)
def query(self, query, params=None): resp = self.resource.cypher(query,params) return initialize_elements(self.resource, resp)
def get(self,key=None,value=None,**pair): """Return all the elements with key property equal to value in the index.""" key, value = self._get_key_value(key,value,pair) resp = self.resource.lookup_vertex(self.index_name,key,value) return initialize_elements(self.resource,resp)