What are tags? What is their function?

I came accross the following documentation:
https://docs.tigergraph.com/dev/gsql-ref/querying/func/vertex-methods#vlac-vertex-alias-methods

It mentions about functions that can add, remove tags to a vertex.

Further more, it looks like you can query by the tags, for example:

CREATE QUERY findVertexWithTag(STRING tag) {
  seed = { ANY };
  res =
SELECT v
FROM seed:v
WHERE v.hasTags(tag)
ORDER BY v.id;
  PRINT res WITH TAGS;
}

Where can I find more info on the tags? Are they indexed? Is querying by tags fast? What is their intended purpose?

TIA,
karol

Hi Karol,

Tags are primarily used for access control to vertices on a graph. Tags can be used to define which vertices in a graph a specific user has access to based on their privileges.
You can read more about Tags and VLAC (vertex level access control) here.

Tags are stored like attributes (on disk instead of RAM), so accessing them will incur the same performance penalty as accessing an attribute.

3 Likes

Tags are similar to labels in some other property graphs. You can label an individual vertex with one or more tags. The point, as Dan said, is that they really are intended for access control.

In a well-managed system, only certain users would have the privilege to manual set or access tags. Most users would be assigned to a tag-based graph domain, e.g. all the vertices that have the tag “Public”. Users in the Public group can only access data with that tag. If they have permission to insert or load data, their data is automatically tagged with Public; they have no manual control over that.

2 Likes

Thanks for the answers.

Can I create index on tags just like on attribute?

Hi zhipeng,

You can use indexes on a tagged vertex just as you could with a non-tagged vertex.

1 Like