nebula icon indicating copy to clipboard operation
nebula copied to clipboard

support {match UNION match UNION mathc...} with ... Return syntax

Open Reid00 opened this issue 1 year ago • 0 comments

as neo4j support below statement, we want to migrate to nebula, could you please support this syntax? detail according to here https://discuss.nebula-graph.com.cn/t/topic/15776

{ MATCH p = (self:Company)<-[sr:Invest|Legal]-(target)
WHERE id(self)== -7835036839804393803 AND id(target)== -531217911035008506
RETURN target, p, 'C' AS nodeType, 1 AS orderWeight 
UNION
MATCH p = (self:Company)<-[sr:FinalBenefit]-(target:Company)
WHERE id(self)== -7835036839804393803 AND id(target)== -531217911035008506 AND sr.percent >= 5
RETURN target, p, 'BE5' AS nodeType, 5 AS orderWeight 
UNION 
MATCH p = (self:Company)<-[sr:FinalBenefit]-(target:Person) 
WHERE id(self)== -7835036839804393803 AND id(target)== -531217911035008506 AND sr.percent >= 5 
RETURN target, p, 'BP5' AS nodeType, 5 AS orderWeight
UNION
MATCH p = (self:Company)<-[sr:Employ]-(target:Person) 
WHERE id(self)== -7835036839804393803 AND id(target)== -531217911035008506 
RETURN target, p, 'DJG' AS nodeType, 7 AS orderWeight 
UNION 
MATCH p = (self:Company)-[sr:Invest]->(target:Company) 
WHERE id(self)== -7835036839804393803 AND id(target)== -531217911035008506
RETURN target, p, 'HE' AS nodeType, 4 AS orderWeight }  
WITH target, p, nodeType, orderWeight 
RETURN target AS target, collect(p) AS path, collect(nodeType) AS nodeType, min(orderWeight) AS orderWeight, CASE target.status WHEN 'Yes' THEN 0 WHEN 'No' THEN 0 WHEN '' THEN 0 WHEN 'Yes_1' THEN 1 WHEN 'xx' THEN 1 WHEN 'xxx' THEN 10 WHEN 'xxxx' THEN 10 WHEN '***' THEN 11 WHEN '*' THEN 11 ELSE 8 END AS status ORDER BY status, orderWeight SKIP 0 LIMIT 100

Reid00 avatar Nov 20 '24 05:11 Reid00