How to use vertex as parameter in restpp /gsqlserver/interpreted_query?

Hi,

I’m using tiger graph version 2.5.0 enterprise edition.

I’d like to get all edges connected to a vertex.

Following is the query statement:

INTERPRET QUERY query_test (vertex v) FOR GRAPH test_graph {
SetAccum @@edgeSetAccum;
source = {v};
results=SELECT t FROM source:s-(:e)->:t

ACCUM @@edgeSetAccum += e;

PRINT @@edgeSetAccum;

}

How to send the query by using RESTPP /gsqlserver/interpreted_query?

I tried different ways to set the parameter, for example, v=“id1”, v=id1, v=(“id1”), v=(id1), but get following error:

{“version”:{“edition”:“enterprise”,“api”:“v2”,“schema”:198},“error”:true,“message”:“Failed to convert address vertex id for parameter v”,“code”:“GSQL-2500”}

Hi He,

What’s the full curl you’re using?

v=id1 should be the right way, could you confirm this vertex is in your graph?

Also, it would be helpful if you can post your full query running command here.

Thanks.

Thanks.

Running into a similar issue…
Trying to run an interpreted query with a vertex ID as an input parameter, but I get the same error:
Failed to convert VType vertex id for parameter vert","code":"GSQL-2500"}

request url: https://<server>:14240/gsqlserver/interpreted_query?vert=<vertex_id>

INTERPRET QUERY (Vertex<VType> vert) FOR GRAPH MyGraph {
	PRINT vert;
	V = {vert};
	PRINT V;
}

Am I missing something?

Can you try:

INTERPRET QUERY (Vertex<VType> vert) FOR GRAPH MyGraph {
	PRINT vert;
	V(vert) = {vert};
	PRINT V;
}

Any change in errors?

@robrossmiller Also try

INTERPRET QUERY (Vertex<VType> vert) FOR GRAPH MyGraph {
	PRINT vert;
	V = {vert.*};
	PRINT V;
}

Just want to see if it works…

INTERPRET QUERY (Vertex<VType> vert) FOR GRAPH MyGraph {
	PRINT vert;
	V(vert) = {vert};
	PRINT V;
}
-> {"error":true,"message":"\nType Check Error in query  (TYP-152): line 3, col 16\n'vert' is not a valid vertex type in the graph schema.\n"}
INTERPRET QUERY (Vertex<VType> vert) FOR GRAPH MyGraph {
	PRINT vert;
	V = {vert.*};
	PRINT V;
}
-> {"error":true,"message":"\nType Check Error in query  (TYP-500): line 3, col 19\nVertex type can only be STRING type.\n"}

I was able to get it work with to_vertex_set(v_id, type):

INTERPRET QUERY (Set<String> vertex_ids) FOR GRAPH MyGraph {
	SourceSet = to_vertex_set(vertex_ids, "VERTEX_TYPE");

	ResultSet = Select t FROM SourceSet:s-(Edge:e)->VERTEX_TYPE:t;
	print ResultSet;
}

Make sure that your argument is of type Set

1 Like