graphit.graph_query package¶
graphit.graph_query.graph_query module¶
-
class
graphit.graph_query.graph_query.
GraphQuery
(sep='.')¶ Bases:
object
Graph query engine
Query mini language:
- . = positional argument as either:
key = search at rootlevel .key = search at current node ..key = search at any level
- {} = node or edge argument based search:
‘type’: seach in ‘node’ or ‘edge’ ‘attr’: attribute name to match
-
query
(graph, querystring, nid=None)¶
-
query_edges
(graph, pos='R', attr='key', key=None, **kwargs)¶
-
query_nodes
(nid, pos='R', attr='key', key=None, **kwargs)¶
graphit.graph_query.query_xpath module¶
file: query_xpath.py
XPath based query of Axis based graphs.
-
class
graphit.graph_query.query_xpath.
XpathExpressionEvaluator
(sep='/')¶ Bases:
object
-
static
parse_attr
(attr)¶ Parse XPath attribute definitions
-
parse_xpath_expression
(expression)¶
-
resolve
(expression, graph)¶ Resolve XPath expression
Always returns a graph that can be empty if the XPath evaluation failed.
- Parameters
expression (:py:str) – XPath expression to evaluate
graph (:graphit:GraphAxis) – GraphAxis instance to apply XPath evaluation on
- Returns
Graph nodes or attributes
-
static