How to get vertex type? [SOLVED]

I was inspecting some datasets. Wrote a few queries for that.
I got stuck with something really simple, fortunately for a short time.

In the following query I wanted to list all vertex types that comments can have REPLY_TO edges:

  SetAccum<STRING> @@types;

  OrAccum<BOOL> @has_outgoing;
  OrAccum<BOOL> @has_incoming;

  tmp =
        SELECT c1
        FROM Comment:c1 -(REPLY_OF>)- _:c2
  ACCUM c1.@has_outgoing += true, c2.@has_incoming += true, @@types += c2.type;

I had no idea how to obtain the vertex type dynamically.

Funny thing is my first try (using .type attribute) worked, but I was not able to locate related information in the docs… I found items like: Edge/Vertex functions, Data Types, Data type conversions, etc.

Case closed. Just writing this down for anybody who will look for similar information.

@gruby_karol Good call out! Thank you for giving back to other developers. I brought this up to our internal team. For those that find this topic in the future the location for .type is located here:

Using .type with Vertex: Data Types :: Docs
Using .type with Edge: Data Types :: Docs

Same happened to me, I looked under functions

but it wasn’t listed there - thanks for sharing

1 Like