redisgraph v0.1.0 RedisGraph.QueryResult View Source
A QueryResult containing returned fields and query metadata.
The resulting struct contains the result set header and records, statistics about the query executed, and referential lists of entity identifiers, specifically labels, property keys, and relationship types.
The labels refer to the label
attribute of either Node entities
in the graph, The property keys are the keys found in any Node or Edge
property maps. The relationship types are the relation
attributes of
Edge entities in the graph.
Example
# Create a query to fetch some data
query = "MATCH (p:person)-[v:visited]->(c:country) RETURN p.name, p.age, v.purpose, c.name"
# Execute the query
{:ok, query_result} = RedisGraph.query(conn, graph.name, query)
# Show the resulting statistics
IO.inspect(query_result.statistics)
# Pretty print the results using the Scribe lib
IO.puts(QueryResult.pretty_print(query_result))
which gives the following results:
# Query result statistics
%{
"Labels added" => nil,
"Nodes created" => nil,
"Nodes deleted" => nil,
"Properties set" => nil,
"Query internal execution time" => "0.228669",
"Relationships created" => nil,
"Relationships deleted" => nil
}
# Pretty printed output
+----------------+-------------+-----------------+--------------+
| "p.name" | "p.age" | "v.purpose" | "c.name" |
+----------------+-------------+-----------------+--------------+
| "John Doe" | 33 | nil | "Japan" |
+----------------+-------------+-----------------+--------------+
Link to this section Summary
Functions
Return a boolean indicating emptiness of a QueryResult.
Get the labels added
quantity from a QueryResult.
Create a new QueryResult from a map.
Get the nodes created
quantity from a QueryResult.
Get the nodes deleted
quantity from a QueryResult.
Pretty print a QueryResult to a tabular string using Scribe
.
Get the properties set
quantity from a QueryResult.
Get the query internal execution time
(ms) from a QueryResult.
Get the relationships created
quantity from a QueryResult.
Get the relationships deleted
quantity from a QueryResult.
Transform a QueryResult into a list of maps as records.
Link to this section Types
Link to this section Functions
Return a boolean indicating emptiness of a QueryResult.
Get the labels added
quantity from a QueryResult.
Create a new QueryResult from a map.
Pass a map with a connection, graph name, and raw redisgraph result.
The raw result is the output of the function Redix.command/2
.
This function is invoked by the RedisGraph.command/2
function.
The functions RedisGraph.commit/2
, RedisGraph.query/3
, RedisGraph.delete/2
,
and RedisGraph.merge/3
will also return a new RedisGraph.QueryResult
.
Get the nodes created
quantity from a QueryResult.
Get the nodes deleted
quantity from a QueryResult.
Pretty print a QueryResult to a tabular string using Scribe
.
Get the properties set
quantity from a QueryResult.
Get the query internal execution time
(ms) from a QueryResult.
Get the relationships created
quantity from a QueryResult.
Get the relationships deleted
quantity from a QueryResult.
Transform a QueryResult into a list of maps as records.