View Source RedisGraph.QueryResult (ex_redisgraph v0.1.0)
A QueryResult is responsible for processing the data that was returned by RedisGraph.
https://redis.io/docs/stack/graph/design/result_structure/
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 labels attribute in Node entities
in the graph, The property keys are the keys found in any Node or Relationship
property maps. The relationship types are the type attributes of
Relationship entities in the graph.
example
Example
alias RedisGraph.Graph
# Create a connection using Redix
{:ok, conn} = Redix.start_link("redis://localhost:6379")
# Create a graph
graph = Graph.new(%{name: "imdb"})
# Create queries and send them to RedisGraph
create_query = "CREATE (a:actor {name: 'Hugh Jackman'})-[:act]->(m:movie {title:'Wolverine'}) RETURN a"
{:ok, _query_result} = RedisGraph.query(conn, graph.name, create_query)
match_query = "MATCH (a:actor {name: 'Hugh Jackman'})-[:act]->(m:movie {title:'Wolverine'}) RETURN a"
{:ok, query_result} = RedisGraph.query(conn, graph.name, match_query)
# Show the resulting statistics
IO.inspect(query_result.statistics)
# 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
}
Link to this section Summary
Functions
Get the indices created quantity from a QueryResult.
Get the indices deleted quantity from a QueryResult.
Return a boolean indicating emptiness of a QueryResult.
Get the labels added quantity from a QueryResult.
Get the labels removed 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.
Get the properties removed quantity from a QueryResult.
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 the results_set from QueryResult into a list of maps as records.
Link to this section Types
@type t() :: %RedisGraph.QueryResult{ conn: pid(), graph_name: String.t(), header: [atom()], labels: %{required(number()) => String.t()}, property_keys: %{required(number()) => String.t()}, raw_result_set: [any()] | String.t(), relationship_types: %{required(number()) => String.t()}, result_set: [[any()]], statistics: %{required(String.t()) => String.t()} }
Link to this section Functions
Get the indices created quantity from a QueryResult.
Get the indices deleted quantity from a QueryResult.
Return a boolean indicating emptiness of a QueryResult.
Get the labels added quantity from a QueryResult.
Get the labels removed quantity from a QueryResult.
Create a new QueryResult from a map.
Pass a map with a connection, graph name, and raw RedisGraph result/response.
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.query/3, RedisGraph.delete/2 and RedisGraph.call_procedure/5
will also return a new RedisGraph.QueryResult.
Get the nodes created quantity from a QueryResult.
Get the nodes deleted quantity from a QueryResult.
Get the properties removed quantity from a QueryResult.
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 the results_set from QueryResult into a list of maps as records.