How to filter a Set<String> field

I’ve been trying to query a Set field. I’ve an argument that is also a Set and I’m trying to see if the argument matches the actual field in the vertex.

This is my query:

CREATE DISTRIBUTED QUERY Select_Offscreen_With(SET<string> offscreen_flags, SET<string> groups_flags) FOR GRAPH my_graph { 
  start = {Offscreen.*};
  
  res =
    SELECT s 
    FROM   start:s
    WHERE (s.offscreen_flags MINUS offscreen_flags).size() == 0;

  PRINT res; 
}

But TigerGraph shows the following error:
The identifier '(s.offscreen_flagsminusoffscreen_flags)' of type is invalid to call any function

Is there somewhere in the documentation where this type of query is clarified? How can I achieve this?

try this ( i would also recommend changing the parameter name to avoid confusion)

res =
SELECT s
FROM start:s
WHERE s.offscreen_flags == offscreen_flags;

1 Like

This is for extra credit - if you want to allow for handing a subset or superset of the argument, you can do this:

CREATE DISTRIBUTED QUERY test(SET<STRING> valuesArg) FOR GRAPH my_graph { 

  SumAccum<INT> @leftoverSize;
  SetAccum<STRING> @leftovers;
  res = SELECT s FROM Offscreen:s 
           ACCUM s.@leftovers += s.offscreen_flags MINUS valuesArg
           POST-ACCUM s.@leftoverSize = s.@leftovers.size()
           HAVING s.@leftoverSize == 0;
  PRINT res ;
  
}