Defining Tuple with graph studio in tg cloud version 3.6


i want to define a tuple. Normally i would create a command

TYPEDEF TUPLE <attr1 Int, attr2 Float, attr3 String> MyTuple

but im using tg cloud version 3.6 and the only tool available is graph studio. So im wondering if and how can i define a tuple with graph studio.

Kind regards

@Phan Hopefully this example helps you. Let me know if you need further clarification.

CREATE QUERY tuple_ex(VERTEX<Person> p) FOR GRAPH Investment_Net{

    TYPEDEF TUPLE <STRING ticker, FLOAT price, DATETIME order_time> Order_Record;

    SetAccum<Secret_Info> @@info;
    ListAccum<Order_Record> @@order_records;
    MapAccum<STRING, DOUBLE> @@portf;

    INIT = {p};

    // Get person p's secret_info and portfolio
        ACCUM @@portf += v.portfolio, @@info += v.secret_info;

    // Search person p's orders to record ticker, price, and order time.
    // Note that the tuple gathers info from both edges and vertices.
    orders = SELECT t
        FROM INIT:s -(Make_Order:e)-Stock_Order:t
        ACCUM @@order_records += Order_Record(t.ticker, t.price, e.order_time);

    PRINT @@portf, @@info;
    PRINT @@order_records;

More Information: Data Types :: GSQL Language Reference

1 Like

I think Phan’s comment is that they know how to do it in GSQL, but how do you do it in GraphStudio?

In the latest release of TigerGraph Cloud (using the 3.7 database), you can open up a GSQL shell, so you CAN run GSQL commands with TG Cloud.

1 Like