"Global" variables shared among queries

If I understand it correctly, global variables as defined in TigherGraph only have the scope within the same query. Is there a way to create global variables with scope of all queries. For example, below is the psudo code what I am trying to accomplish:

bool config_loaded = False;
create query load_config() {
    ...load configuration
    config_loaded = True;
}

create query run_test() {
    if config_loaded == False then
        load_config() 
    end;

    ... run my tests

}

Method 1: put the shared state in a physical file, and each query load that file first.

Method 2: put the shared state in a special vertex, and each query check the vertex first.

create query run_test() {

OrAccum @@config_loaded= false;

S= SELECT tgt
      FROM A:tgt
      WHERE tgt.id == "config1"
      ACCUM @@config_loaded = tgt.flag;

IF @@config_loaded THEN DO
 //your stuff
END;

}
1 Like