Skip to content

Sparse graph queries

Gerard edited this page Apr 25, 2018 · 12 revisions

Basics

A sparse graph query is a query with which an attribute can be set in the sparse graph. This is usually a combination of an input from ETLocal and a serie of queryable attributes.

The file name has to be chosen carefully as it will detail which part of the graph you are going to change and which attribute. Semantically this looks like:

  • <node_key>+<attribute> (for example: households_final_demand_electricity+demand)
  • <edge_key>+<attribute> (for example: households_water_heater_coal-households_water_heater_coal_aggregator@useable_heat+child_share)

Syntax

A sparse graph query is a GQL with some quirks. There is one attribute which you can set:

query

A GQL statement.

Allowed GQL statements:

  • DATASET_INPUT(key) (Reads an input from the ETLocal front-end, unless the key is a direct sparse graph key)
  • SPARSE_GRAPH_QUERY(graph_key, attribute) (Executes a sparse graph query inline)
  • NODE_VALUE(node_key, attribute) (Fetches an attribute from a node with a node_key)
  • NODE_EFFICIENCY(node_key, direction, carrier) (Fetches an efficiency from a node_key with a certain direction)
  • EDGE_VALUE(edge_key, attribute) (Fetches an attribute from an edge with an edge_key)
  • EB(use, carrier) (Reads from the parent's dataset energy balance)
  • AREA(key) (Reads from the parent's dataset area file)
  • SHARE(key, attribute) (Reads from the parent's dataset share values)
  • EFFICIENCY(key, direction, carrier) (Reads from the parent's dataset efficiencies)
  • CENTRAL_PRODUCTION(key, attr = :demand) (Reads from the parent's dataset central production csv)
  • PRIMARY_PRODUCTION(key, attr) (Reads from the parent's dataset primary production)
  • TIME_CURVE(key, attr) (Reads from the parent's dataset time curve)
  • DEMAND(key, attr) (Reads a demand from the parent's dataset demands)

Example:

# households_final_demand_electricity+demand.ad
- query = DATASET_INPUT(etlocal_test_key) * 5

This query will set the demand of households_final_demand_electricity by multiplying the input from etlocal_test_key by 5.

Clone this wiki locally