Connecting from your application

Linked Data

In the previous section, you learned how to issue queries from the RESTful interface of Denodo. Now you will see how to enable linked data using a new Denodo element: associations.

Associations in Denodo

Associations represent a relationship between elements of two Denodo views. The concept is very similar to the Primary Key / Foreign Key restrictions in relational databases.

Associations allow third-party consumers (like Modeling or Analytical BI tools) to instrospect relationships between virtual views.

NOTE

For example, the elements of the client view can be related with the elements of the address view (every customer is related with an address).

Based on the definition of the associations, the Denodo RESTful Web service will show links that will allow you to traverse the associations. Let's see how it works with an example, by using the views created in previous sections of the tutorial.

How to create a new association

To create a new association in Denodo, you can follow these steps:

  1. Right-click inside the elements tree and select New > Association.
  2. Drag & drop the client and address views involved in the association into the workspace.
  3. Link the client_id and client_fid fields that map the association.
  4. Go to the Output tab and give a name for the association: client_address.
  5. You have to provide names for each of the endpoints (Role name fields).
    • Endpoint 'client': address.
    • Endpoint 'address': belongs_to_client.
  6. Mark the Referential contraint checkbox: this will allow the association to be exposed like as a Primary Key / Foreign Key restriction (for JDBC and ODBC clients).
  7. Finally, click Save.

Using the association

Now it's time to return to the RESTful Web service and get the results of the client view: http://localhost:9090/denodo-restfulws/tutorial/views/client (see the previous section for more information about how to query using the RESTful Web Sevice).

As you can see in the screenshot below, a new column with a link is added to the output table and the text of the link is the Role name configured in the association for the endpoint. In this example, if we click on address link for the customer John Smith, Denodo will follow the association and display his address.

In the same way, since we made the association, a belongs_to_client column appears with the address that loads the associated customer information when clicked.