Associations of Views

Let us imagine we have a view with customers and another view with orders. We can assume they are related to each other: one order is related to one and only one customer, whereas a customer may be related to zero, one or many orders. This kind of relationships are represented in Virtual DataPort using associations.

An association establishes a relationship between two views. To be more specific, an association is defined as a pair of endpoints, where each endpoint consists of:

  • A view.

  • The role played by the other entity from the point of view of this endpoint.

  • The multiplicity, i.e., how many members of the view participate in the relationship.

In addition, you can mark one endpoint in the association as principal and the other as dependent, since one entity may need the other one to exist. In our example, an order only exists if there is a customer, but not the other way around.

Therefore, we can express the relationship between customer and order with the following endpoints:

  1. Principal endpoint.

    • View: customer

    • Role: my_orders

    • Multiplicity: 1

  2. Dependent endpoint.

    • View: order

    • Role: purchaser

    • Multiplicity: 0,*

See also

Find more details on associations in the Virtual DataPort Administration Guide.

As we have already seen, associations between views are useful when building and executing queries on a view, since they allow you to navigate through its relationships and retrieve not only the tuples of the current view, but the tuples of its related views. They are also useful for discovering new views. You can start from a view you are familiar with and discover those views related to it, which may be of interest to you.

The Relationships tab displays a graph where you can check all the related views to the current view. You can zoom in, zoom out or export the graph as an image.

Graph with the current view and the views related to it.

The relationships graph of the employee view shows that it is related to two views: retailer_order and branch.

The views are represented as nodes in the graph. The node for the current view is always highlighted in orange. In case a related view belongs to a different database, its name will be highlighted in orange. You can move your mouse over the info icon of a node and a tooltip will appear with information about its view. Click the more-info icon in the tooltip to get even more information.

Relationships graph with information for one view in a tooltip.

The relationships graph with information about the employee view.

At first, the graph only shows the relationships of the current view. However, you can click a node with a plus icon and expand the graph with its related views.

Relationships graph after expanding the relationships of a view

The relationships graph of the employee view after expanding the relationships of the retailer_order view.

The arrows in the graph represent a relationship between the two views it connects. Notice that the arrows start from the principal endpoint and end in the dependent one. If you move your mouse over an arrow, a tooltip will appear with information about the role and multiplicity of each endpoint. Click the more-info icon to get more information about one endpoint or click the more-info-association icon to get more information about the association.

Relationships graph with information for one association in a tooltip.

The relationships graph with information about the association between employee and retailer_order