# Virtual Relationships

Available since : 2.8

# Introduction

While graph visualisation offers many insights that are hard to identify with other shapes of data, there are still some problems analysts encounter during daily tasks, often refered to as the hairball problem.

Taking our usual Wine schema as an example

If one of our common needs would be to understand which countries are producing wines of a certain variety, we would have to perform the following steps :

  • Expand the IS_OF relationship from a Variety to its related Wines
  • Expand the PRODUCED_IN relationship from above expanded Wines to their respective Regions
  • Expand then Region and Province up to the Country nodes

Taking the Sauvignon variety, we can easily guess that bringing so many related wines in the first step will already lead to some undersirable amount of noise on the screen.

You can potentially create Managed Relationships with local actions but Hume has better to offer : Virtual Relationships natively built into the product.

At a high level, virtual relationships are a concept bound to a Perspective and will generally be used to create exploration shortcuts between two schema classes.

Once visualising elements of interest, expanding a virtual relationship will represent an aggregation of the concrete paths into one unified relationship to traverse, reducing the amount of visual elements to return.

Analysts wishing to understand the concrete data that has been used to form such a virtual relationship can selectively right click a relationship and choose to reveal the underlying information onto the canvas.

# Creating a virtual relationship

To create virtual relationships, open or create a Perspective. In the Perspective editor, you have the ability to hover a class and draw a relationship to another class.

Once you release your mouse on the other class, you will be prompted to enter the relationship label.

The virtual relationship is now created but so far will still not appear on right clicking a Variety node, we need first to define how to traverse from a Variety to a Country, don't worry it can be done in a couple of clicks.

# Specifying a virtual relationship underlying paths

To specify which the inner paths a virtual relationship represents, open the Virtual Rels side panel in the Perspective editor, select your virtual relationship by its label and click on the + ADD PATH button.

The Start and End node of the virtual relationship will be marked with a hint :

You can now click the relationships that form the path from Variety to Country, a number will appear on them and the editor also automatically completes the paths once only one possible path remains existing between the current selection of relationships and the end class.

Lastly click on the CREATE button.

That's it ! Let's now use it in our visualisations.

# Expanding virtual relationships

Let's bring our Sauvignon back again on the canvas and let's right click on it to see its expandable relationships.

Now, click on the FOUND_IN_COUNTRY virtual relationship in the expand menu :

# Revealing underlying paths

As an analyst, you might be interested to know the information that was used to build a particular relationship. If the Perspective allows you to see it, right clicking on a virtual relationship offers you a reveal option, clicking on it will bring the underlying information to the canvas and remove the virtual relationship between the two nodes.


The reveal option will only appear if the perspective has the underlying paths marked as visible

# Configuring the visual appearance of virtual relationships

As you could have observed, virtual relationships are styled differently from the normal relationships, their label is coloured in blue.

You can configure virtual relationships to appear as any other normal relationships when editing the perspective and enabling the Hide virtual appearance option.

The setting enabled will render the labels like other usual relationships

# Using Cypher for complex virtual relationships

Sometimes, just specifying the paths is not sufficient and one might want to add some predicates that will determine the existence of a virtual relationship.

As of today, it's only possible by using the Cypher query option during the configuration of the virtual relationship.

To better explain how to define the Cypher query, let's create a new virtual relationship between two wines called SIMILAR.

And the use case will be that two Wines are similar if they share flavours in common and share also two varieties in common.

This can be expressed using the following Cypher query, thinking that startNode is the beginning node of a virtual relationship and endNode is the end.

MATCH path=(startNode)-[:FLAVOUR]->(f)<-[:FLAVOUR]-(endNode)
WHERE size([x IN (startNode)-[:IS_OF]->()<-[:IS_OF]-(endNode)]) > 1

You can enable the Cypher query and enter it in the Virtual Rels side panel :

You can see that the Cypher query is prefilled with a beginning and end of the full query. It forces you to keep startNode, endNode and path accessible in the query so it can be manipulated in order to handle scenarios where you expand a node from the endNode and we also use the path information for revealing the underlying paths.

If you go back to your visualisation, you can now expand a Wine node to find similar wines based on the logic of the Cypher query

And as with the simple virtual relationships, you can reveal the underlying paths

# Known Limitations

The following limitations are in effect :

  • Expand statistics are not returned for virtual relationships for performance reasons.
  • When the visibility of an underlying path changes, the reveal menu option is recalculated and displayed only if the user has a visibile access to the underlying classes and relationships. This is only possible for non-Cypher defined virtual relationships. For Cypher defined virtual relationships already added to a visualisation, if the visibility of an underlying path changes to hidden, the reveal menu option will still be visible. Clicking on it will make the virtual relationship disappear and not bring new nodes or links to the canvas, since the user doesn't have access to the class and relationships.
  • Virtual relationships are not searchable.
  • Virtual relationships are not expandable from the Schema View.
  • Virtual relationships cannot have attributes, yet.