Can we use data filter for seperate mappings in an edge.Source column is same from where the data is loaded and mapped to the source and target of edge

Hi Team,

Can we use data filter for seperate mappings in an edge.Source column is same from where the data isloaded and mapped to the source and target of edge

if site_type value is Factory then data should get loaded to source attribute of the edge else if site_type value is Fulfillment then data should get loaded to target attribute of the edge as shown in the attached images.



Regards,
Ashwith

I have seen an example of this. This has been supported in GSQL loading jobs for a very long time (e.g. from TigerGraph v2.0 or even earlier). I will try to find the example. However, I’m not sure if this is supported from the GraphStudio UI.

In the LOAD ... TO VERTEX or LOAD ... TO EDGE clause, there is an optional WHERE clause. The condition is evaluated for each row of input data. The load is performed only if the WHERE condition is true. Logically, this is the same as IF (condition is true) THEN (load).

So, something like this should work:

CREATE LOADING JOB foo FOR GRAPH myGraph {
  DEFINE FILENAME f;
  LOAD f
    TO VERTEX Site ($source, ...) WHERE $Site_Type == "FACTORY",
    TO VERTEX Site ($target, ...) WHERE $Site_Type == "FULFILLMENT";