Defining the structure of a Visual Query

The first part of creating a Visual Query is to define its structure by adding query items.

Procedure

  1. On the Home tab of the ribbon, in the Information Store group, click Visual Query.
    The Information Store Visual Query window opens. If you have used the Visual Query feature before, there might be a list of saved queries in the window.
  2. Open a saved query, or click New query to create one.
    Analyst's Notebook opens a new tab in the Information Store Visual Query window.

    For a new query, the Edit query structure window opens immediately. For a saved query, you can click the Edit structure button Edit query.

  3. In the Edit query structure window, add the query entities that represent the structure that you want to find. To add a query entity, drag an entity type from the query palette to the query surface.
    When you place or select a query entity on the query surface, the details about that entity are displayed. Query items must have unique labels. You can overtype the default label should you want to change it.
  4. Link the query entities in the structure with query links. To create a link, select the two query entities that you want to link.
    If there are no suitable link types available between the selected entities, you see the No valid link types message.
  5. From the Multiple query items window, select a link type.
    When you select a link type, the options that you can apply to the link are displayed. Like entities, links must have unique labels, however you can overtype the default label should you want to change it.
  6. Optional: To prevent results from being returned for a particular query item, deselect the Include in results box. For example, from your query structure of a Person, a Vehicle and an Owner link, you might want to see the owners but not the vehicle details. You should leave Include in results selected for the Person query entity. When you turn off the option for the Vehicle query entity, the link is automatically turned off too, and an icon is displayed next to all the query items that are not included.
    Be aware that a link record can only be returned if both end records are present. When you choose to exclude entities, you also exclude their associated links.
  7. Optional: To add a direction to a query link, choose an option from the Direction list.
  8. Optional: To indicate that results must contain multiple records for a query item, set a count on the query item. For example, using your query structure of a Person, a Vehicle and an Owner link, you might want to find people who own a certain number of cars. Select the Vehicle query entity in the query structure, then click the Count condition button. Click OK and in the count condition structure, select Equal to and type the number.
    You can set a count on only one item in the query structure. If you set a count on a second item, the first one is removed.
  9. Optional: If you have enabled Count condition on a query entity that's linked to two or more query entities, you can select which relationship to apply the count condition to. By default, it applies to all relationships. Click the checkbox to deselect a query entity to which the condition does not apply. You cannot deselect all the query entities in the list.
  10. Click OK.
    After you click OK, you can edit the query structure at any time by clicking the Edit structure button edit query.

What to do next

After you define the query structure, add conditions to the items in the structure, and then run the query.