Hi ,
Do we have a way to select and see the edge attributes in GSQLShell like we do for vertices ?
For Eg :
select * from Person where GDPRFlag == false - query gives us the Person vertex attributes . Do we have similar query to get HAS_PERSON_NAME edge attributes ?
Hi @Sneha_S_S ,
You can “collect” the edges and print it out by doing a GSQL query like below:
CREATE OR REPLACE QUERY get_has_person_name_edge_info() FOR GRAPH <your-graph-name> {
ListAccum<EDGE> @@edge_list;
all_person = {Person.*};
all_person = SELECT s
FROM all_person:s -(HAS_PERSON_NAME:e) - PersonName:t
WHERE s.GDPRFlag == FALSE
ACCUM @@edge_list += e;
PRINT @@edge_list AS has_person_name_edges;
}
Note that, in this query, we do a 1-hop query (edge traversal) and utilize the accumulator to gather the edges. After that, we would print out the edges.
More info here:
1-hop query tutorial: Develop Parameterized Queries - GSQL 101 :: GSQL Language Reference
Accumulator tutorial: Accumulators Tutorial :: GSQL Language Reference
TigerGraph GSQL video lectures list (covers content like SELECT and ACCUM statement): https://www.youtube.com/playlist?list=PLq4l3NnrSRp6vaCWmookIZJefDkAPvaxS
If you want some more advanced info, you can check out the docs page, as seen here:
SELECT statement (ACCUM clause): SELECT Statement :: GSQL Language Reference
Accumulator: Accumulators :: GSQL Language Reference
I hope this helps! Please let us know if you have any further questions.
Best,
Supawish Limprasert (Jim)