Is it possible to build upon vars?

As some relationships can be called the same thing but be found along different paths, is it possible to build upon or add to an existing variable?

For my current use case, I am building a filter using DQL to find family members of a node. A sibling-in-law can either be the spouse of the child (not me) of my parent, but a sibling-in-law can also be the child (not my spouse) of a parent of my spouse.

Building these out gets quite complex but I am now at a point where I am defining siblingInLaw1, siblingInLaw2, but now I need to use them in the next layer out, and it adds additional steps. What would be nice if I could sort of add to an existing var and then when I have to build out on that layer I only have to do it once.

The only way I can do this right now is to do a var block with a type and then add a filter using OR on the siblingInLaw1 and siblingInLaw2 to create a new variable siblingInLaw.

Any better way to combine variables into a single variable or to add to variables?

Incidentally I think you stumbled upon the correct answer. Even the language used is suggestive of the correct answer - you want to “add to” the variable. In classical computer science, “addition” is isomorphic to OR in logic and to UNION in set theory. :slight_smile:

1 Like