How to Query through path of 3 vertex types

I have a schema where 3 of its vertexes are:
Concept
Round
User

Concept links to Round, Round links to User.

I tried to expand/modify this working query:

CREATE QUERY GetConceptRounds(vertex<Concept> inputConcept) FOR GRAPH MyGraph { 
	Start = {inputConcept};	
	Rounds = SELECT t FROM Start:s-(Concept2Round:e)-Round:t;	
	PRINT Rounds;	
	}

to show all users linked to concepts via rounds, but obviously I failed. Can someone kindly advise how to revise this to pull users?

CREATE QUERY GetConceptRoundsUsers(vertex<Concept> inputConcept) FOR GRAPH MyGraph {   
	Start = {inputConcept};		
	Users = SELECT tU FROM Start:s-(<Concept2Round:e)-Round:t-(User2Round>:eU)-User:tU;		
	PRINT Users;
	}

The above code was modeled after this example:
https://docs.tigergraph.com/intro/gsql-102/multiple-hop-pattern#multiple-hop-pattern-shortest-path-semantics

and this was the result:

and the error is:
<<<
This query does not conform to pre-v2 syntax.
If you intent to use the pattern match syntax, please specify the v2 syntax version by one of the methods below:

  1. Use syntax_version session variable (set syntax_version=“v2”)
  2. Add the syntax clause to query header, e.g. create query q() syntax(“v2”)

Thank you.

Hi Geodge,

Could you follow the promote and change your query to syntax v2?

CREATE QUERY GetConceptRoundsUsers(vertex inputConcept) FOR GRAPH MyGraph syntax v2 {
Start = {inputConcept};
Users = SELECT tU FROM Start:s-(Concept2Round:e)-Round:t-(User2Round:eU)-User:tU;
PRINT Users;
}

2 Likes

Thanks. Xinyu,
I copied that code and tried to publish it but get this msg and no indication as to what the error is.

OK I got it. it was missing this “>”.

1 Like