Var message = var().isa("message");
Var relation = var().isa("connection")
This is the expected behaviour. You're correct at guessing that assigning an id will solve the issue:
Var message = var().id("my-message").isa("message");
The reason this happens is because a
Var does not represent a single concept. Instead, it represents a pattern to match in the graph. In this instance, the
Var only says "things that are messages", not any particular message.
You could also assign a variable name, e.g.
Var message = var("x"). ...
For this to work, you would have to execute only a single