Creating a service model or rules template by using a visual query
To open the visual query builder
The visual query builder provides a way of selecting the nodes that you want in your rules-based service model or template by using the visual query builder. To do this:
From the modeling home page (Model > Services & Applications), click Create/Import.

- Click Create with Visual Query to open the visual query builder.
- To create a service model, see To create a service model by using a visual query.
- To create a service model template, see To create a rules template by using a visual query
- To create a service model from a rules template, see To create a service model from a rules template
To create a service model by using a visual query
From the visual query builder:
Select a starting node kind, and continue from there.
- Enter a name for the model.
- Click Add a starting node kind.
The Node Kinds selector panel is displayed.
- The default panel is the Common node kinds list.
- You can also select a list of nodes by category or search the kinds displayed by using the Search box.
- You can also select a 'wildcard' node that matches any node kind.
- Select a starting node kind, For example, Host.

- Click Apply to save the changes.
Mousing over the node shows controls available for that node:

- Click Add or modify a filter. See Filters for information on how to use the filters. In this example, we selected an OS containing the word "Windows".
- Click Add a related node. A new node, with a link from the previous node is displayed, with a Node Kinds selector.
- Choose the kind of related node.

- Click Add or modify a filter, and select the Filter tab. See Filters for information on how to use the filters. In this example, we selected an SI name containing the word "Outpost".

- You can also use named values to provide an identity in human-readable naming conventions that help you differentiate between instances. A named value is a text variable whose value is derived from a starting attribute on the node by a transformation. For example, hosts have a naming convention of hostname-prod or hostname-qa depending on whether they are in the Production or Quality Assurance environment. The transformation creates the value prod from the hostname helix490-prod.
- Select the Named Values tab, and click Define a New Named Value.
- Enter a name for the named value. For example, Environment.
- Select a starting attribute. For example hostname.
- Enter a test value for the attribute.
- To use the named value to identify instances (Production or Quality Assurance environment) select Use to identify instances.
- To use the named value to name instances, select Use for instance name.
- The environment is defined by the part of the hostname after the dash in hostname-prod or hostname-qa.
- To add the logic that creates the resulting name, click Add Transformation, and select split on [delimeter, index].
- Enter a dash in the delimeter row, and number for the group. In this case, the second (index 1) is the required group.
- To convert the resulting prod or qa into a more readable description we can use a table. Click Add Transformation, and select table [default, (key,value)...].
- Enter:
- A default: unknown
prod for the from value and Production for the to value.
Click Add another row.- qa for the from value and Quality Assurance for the to value.
The bottom section of the panel shows sample values and their transformations. Modify the transformations until the results are satisfactory, and click Save Definition.

Click Apply to save the changes.
- The relationship between the two nodes does not have a kind. It is labelled Any Relationship. Click the relationship's context menu and select Edit relationship.

- Select the required relationship.

- Click Apply to save the changes.
To create a rules template by using a visual query
You create a rules template in exactly the same way as a service model. The only difference is that a rules template has one or more parameters. To add a parameter:
- Add a node kind, for example a host.
- Click Add or modify a filter.
- Either:
from the Select attribute drop down, select Define an attribute parameter.
or:- choose an attribute from the list and from the Filter Operator drop down, select Define a parameter.
Once you have added a parameter, the Save button becomes a Save template button. Once saved, the template cannot be changed back into a model, although you can go on to make many models from that template.

To create a service model from a rules template
A rules template provides a starting point for creating a rules-based service model by using the visual query builder.
- Click Create with Visual Query to open the visual query builder.
Click Choose a rules templatestarting node kind

- Select a template from the list, and click Apply.
- To help find the template you are looking for, enter text in the Filter rules templates dialog.
- Select Show only favorites to reduce the number of templates in the list.
- Enter a name for the model and click Save.
- Continue to create your model from the steps in To create a service model by using a visual query