ExpandPipe should use relation type indices when possible

This change lets ExpandPipe use relationships ids instead of names whenever all ids in question are resolved.
VarLengthExpandPipe uses token ids whenever possible.

When all relationships tokens are resolved VarLengthExpandPipe
uses these instead of using the name.
Merge pull request #3153 from pontusmelke/expand-pipe-using-ids

[2.2] ExpandPipe and VarLengthExpandPipe should use relation type token id when possible