How to call a subquery

I wrote a query in tigergraph to call another query. After the uploading program entered the parameters, I ran the query, but it was always in the loading interface, and no results were displayed. What is the reason? How to modify it?
The following is the code of the subquery and the main query:

CREATE QUERY tg_shortest_ss_any_wt (VERTEX source, SET<STRING> v_type_set, SET<STRING> e_type_set,
 STRING weight_attribute="R", STRING image_attribute="X", STRING weight_type="DOUBLE", INT print_limit = 100, BOOL print_results = TRUE,
 STRING result_attribute = "", STRING file_path = "/home/tigergraph/EMS_EMARKET_FINAL/Input/findmin.csv", BOOL display_edges = TRUE)  FOR GRAPH gsql_EMS RETURNS( ListAccum<STRING>)  

CREATE QUERY xunhuan( SET<STRING> v_type_set, SET<STRING> e_type_set) FOR GRAPH gsql_EMS { 
  ListAccum<STRING>@@path;
  SetAccum<VERTEX>@@start;
 T0={TopoND.*};
  start=SELECT s
  FROM T0:s
  WHERE s.LdP>0
  ACCUM @@start+=s;
  FOREACH v IN @@start DO
  PRINT v;
@@path+=tg_shortest_ss_any_wt(v,v_type_set,e_type_set,"R","X","DOUBLE",100,TRUE,"","/home/tigergraph/EMS_EMARKET_FINAL/Input/findmin.csv",TRUE);
  END;
PRINT @@path;
}

Because there are too many subqueries, only the parameter part is shown here. Return value added at the end.

I have another question: how to select the point with the smallest attribute value in a point set and only store this point in the set?

Not sure if this is what you mean, but you can sort and filter like this

NEWSET = SELECT p FROM PointSet:p ORDER BY p.attributeValue ASC LIMIT 1;

Thank you for your answer. Is my previous procedure for calling sub-queries correct? Why is there a phenomenon that the operation cannot produce results? How to modify it?

I would probably start with a simpler example of a sub-query and just make sure its installed properly and that you are getting back results.

For instance, this example involves finding an external file on the file system, and that may be part of the issue. So I would want to rule some things out first

The problem has been solved. Thank you for your reply.

1 Like