Queries
Table of Contents
The "Queries" page can be opened via the Application Menu (top right corner).
The main purpose of the "Queries" page is to search for graph elements or patterns and visualize them.
1. Queries page elements
1.1. Header buttons (1)
Project Switch
The project switch is used to change the project context of the Queries page.
Search Settings
Opens the Search Settings widget with the fulltext search configuration. See Search Settings for more information.
Import File
Data (nodes or relationships) can be imported from CSV or XLS files with this widget. See the Import file page for more details.
1.2. Queries Panel (2)
Queries are used to organize and save search queries for repeated use. For example, if your domain is Configuration Management then you can create separate queries for Services, Applications, Servers and Racks.
All queries are organized into two groups:
My Queries - these queries are visible only to the logged-in user. Every user can create and organize his queries in this group.
Add new query - A new query can be created with the "Add" button which shows all available types of queries that can be added. A new query is created in the user's "My Queries" group.
Project Queries - these queries are available to all users in the project. Only users with the "Project Settings" permission can manage these queries, other users can run the queries, or copy them to their "My Queries" group. Project queries can have an API name defined which allows to call the query using the dynamic Query API.
Query Libraries - when a library is connected to a Project all queries from this library are available as sections in the queries panel. For more information about libraries please see Query Libraries. Queries in libraries can have an API name defined which allows to call the query using the dynamic Query API.
1.3. Query Builder Panel (3)
Query Builder panel contains all configuration options for the selected query. Any change in the query configuration is saved after the "Run Query" button is clicked.
Query configuration is specific depending on the type of the query:
Node Filter and Relationship Filter: configuration of the condition and columns in the Query Result.
Cypher/Gremlin: input for the custom query.
Template: textual representation of the Template query and dynamic parameters of the Template.
1.4. Query Result Panel (4)
The Query Result panel contains all data returned by the query which can be used to create a new visualization or can be added to the currently opened visualization. The result is shown in different ways depending on the type of the Query. See the next chapters for more details.
2. Query Types
There are several types of queries that can be created:
Node Filter and Relationship Filter Query: these types of search queries are used for fulltext searching for nodes or relationships. The Query Builder for this type of query allows the filtering of nodes or relationships based on labels/types or property values. Found elements are presented in a table in the Query Results panel with configurable columns and sorting. Rows representing elements can be selected and visualized in a graph or exported in CSV format (can be opened in MS Excel).
Cypher/Gremlin Query: this type of query lets the user enter any Cypher or Gremlin query (based on the connected graph DB). Based on the user's permissions only ready queries can be executed or any query, if the user has the "Read all data" permission. The Result Panel for this type of query shows basic statistical information about the returned elements and allows to visualize the result.
Query Template: a template is a custom Cypher/Gremlin query presented to the user as a form with dynamic parameters (with suggestions) that the user can use to change and use the query without any Cypher/Gremlin knowledge. The Result Panel for this type of query shows basic statistical information about the returned elements and allows to visualize the result.
2.1. Node Filter and Relationship Filter queries
Query Builder
With this type of query, the user can
construct a simple condition for filtering elements (nodes or relationships),
combine it with the fulltext search term (searching in indexed properties),
specify columns of the results table (every column is one property of the found elements).
The condition consists of sub-conditions on labels/types and properties. Multiple properties can be added and for every property, multiple values can be specified. In order for an element to pass the condition it has to have at least one of the specified labels/types (OR between values) and for every specified property (AND between properties) at least one of the values (OR between property values). For the setting in the picture above the condition can be read as follows: Return the properties (specified as columns) of all nodes with the label ("Database" OR "Application Component") AND with the property "Problem Priority" set to ("2 - High" OR "1 - Critical" OR "3 - Medium").
The resulting table has columns in the order as specified in the columns picker. If you want to reorder columns in the table you can do it by reordering the values (drag & drop) in the columns picker.
Query Result
The Query Result panel contains all data that meet the combined search criteria defined by the fulltext search and the condition in the Query Builder.
The header of the Result table includes:
Button Visualize - Start a new visualization for selected elements. See Visualization.
Button Add To Opened Visualization - Add selected elements to the currently opened visualization (the name of the visualization is in the left top corner). See Visualization.
Search field - Full-text search input:
The fulltext search runs only within the data defined by the queries query condition in the Query Builder.
If the search is configured to work automatically, the searching starts automatically every time the text in the Search field is changed (can be configured, see Graph Connections#FulltextSearchConfiguration).
If the search is configured to work manually, press "Enter" to start a fulltext search with the current input in the Search field.
Which properties can be searched is configured in Graph Connections#FulltextSearchConfiguration.
Both settings, Search mode and Fulltext index can also be configured directly on the Search page with the Search Settings button.
CSV export - export results in CSV format (can be opened in Microsoft Excel or other CSV editing tools). Exported columns, column names and the maximal number of exported rows can be configured (see Export).
Elements in the table can be selected:
To select 1 element: click on the record.
To select more elements: hold CTRL and click on several records.
To select more consecutive elements: click on the first record, then hold SHIFT and click on the last record - every record between the first and the last record will be selected.
Selected elements can be used to start a new visualization, or can be added to the currently opened visualization, or can be exported. Export options can be configured (see CSV export).
The table contains only some properties of elements (selected in Query Builder). To see all properties press the "Details" icon on the right side of the record. Tabs of the detail panel can be configured (see Data Schema).
If there are too many columns in the result table, some of them are automatically hidden (the table is responsive). Press the "+" icon on the left side of a row to show the hidden properties.
The sorting of any column can be changed by pressing the arrow next to the column title.
2.2. Cypher/Gremlin query
Query Builder
With this type of query, the user can execute Cypher or Gremlin queries (based on the type of graph DB in the project) and start a new visualization with the query result as a starting point for the visualization.
Note that:
Read queries are available for all users.
Write queries are available for users with "Data management" permissions.
Fulltext search and CSV export are not available in combination with Cypher/Gremlin queries.
you can export nodes or relationships as a CSV file in the visualization - just click "New visualization" and then export the data
Query Result
The result of the Cypher query is summarized in the Query Result panel. The counts of the different record types are displayed, and simple data distribution tables for node labels and relationship types are available. If there is at least one node, relationship or path in the result then the "Visualize" and "Add To Opened Visualization" buttons are enabled.
2.3. Query Template
Query Builder
Custom Cypher/Gremlin query presented to the user in a human-readable form with dynamic parameters (with suggestions) that the user can use to change and use the query without any coding knowledge.
The query template can be edited by an experienced user using the "Edit Template" button (available only to users with the "Settings" permission. See the next chapters for more information about all the options in building Query Templates.
Parts of the Query Template builder:
Text template (optional) - textual representation of the query. It’s a combination of text and dynamic parameters (e.g. $labels in the example).
Query template (mandatory) - actual query (Cypher or Gremlin, based on your graph DB type). Contains dynamic parameters (e.g. $labels in the example) that are replaced with chosen values in the runtime.
Parameters (mandatory) - definitions of the dynamic parameters used in the template. This configuration gives the template additional logic, e.g. defining restrictions for values or providing suggestions in the form of a list of values. See the next chapters for more information about all the dynamic parameter types and options.
Query Result
The result of the Template query is summarized in the Query Result panel. The counts of the different record types are displayed, and simple data distribution tables for node labels and relationship types are available. If there is at least one node, relationship or path in the result then the "Visualize" and "Add To Opened Visualization" buttons are enabled.
2.3.1. NODE_FULLTEXT_SEARCH
Returns node's ID (internal database ID) or a list of IDs. It uses a fulltext index for searching for the nodes. The fulltext search configuration like min length and throttle delay from the Search Settings is used.
Option | Description |
---|---|
Placeholder | Text shown in an empty input. |
Prefix | String, that will be placed before the parameter's value in the final query. |
Suffix | String, that will be placed after the parameter's value in the final query. |
Multiple | Boolean value whether the num of selected values can be more than 1. |
Mandatory | If false, the input is optional. |
Use Array Brackets | If true, the replaced value is in brackets, e.g. [ "value1", "value2" ]. If false, the replaced value is without brackets, just values separated with a comma, e.g. "value1", "value2". |
Exact Match | Boolean value whether the fulltext search should perform an exact match (a faster option) or a non-exact match (a slower option but its returning results matching the search pattern anywhere in the indexed properties). |
Result Properties mandatory | List of properties that will be used in the result set to identify nodes. |
Selection Properties | List of properties that will be used in the selection set to identify nodes. The "resultProperties" value is used if empty. |
Filter | An object containing "labels" and "properties" that will filter the nodes in the result set. The node in the result set must have at least one of the listed labels and at least one of the listed values in the properties defined in the filter. |
2.3.2. NODE_PROPERTY_VALUES
Returns node's prop value or a list of prop values.
PDO.config | Description |
---|---|
Placeholder | Text shown in an empty input. |
Prefix | String, that will be placed before the parameter's value in the final query. |
Suffix | String, that will be placed after the parameter's value in the final query. |
Multiple | Boolean value whether the num of selected values can be more than 1. |
Mandatory | If false, the input is optional. |
Labels | List of node labels for which the property values should be returned. All nodes will be used if empty. |
Property mandatory | Property name of the property that should be returned. |
Default Values | Default selected value or array of values. |
2.3.3. REL_PROPERTY_VALUES
Returns rel's prop value or a list of prop values.
PDO.config | Description |
---|---|
Placeholder | Text shown in an empty input. |
Prefix | String, that will be placed before the parameter's value in the final query. |
Suffix | String, that will be placed after the parameter's value in the final query. |
Multiple | Boolean value whether the num of selected values can be more than 1. |
Mandatory | If false, the input is optional. |
Relationship Types | List of rel types for which the property values should be returned. |
Property mandatory | Property name of the property that should be returned. All relationships will be used if empty. |
Default Values | Default selected value or array of values. |
2.3.4. NODE_LABELS
Returns node's label or a list of labels.
PDO.config | Description |
---|---|
Placeholder | Text shown in an empty input. |
Prefix | String, that will be placed before the parameter's value in the final query. |
Suffix | String, that will be placed after the parameter's value in the final query. |
Multiple | Boolean value whether the num of selected values can be more than 1. |
Mandatory | If false, the input is optional. |
Cypher Colon Format | If true then the resulting value is returned in the cypher colon format, e.g. ":LABEL_1:LABEL_2", that can be used in the MATCH part of cypher queries. |
Default Values | Default selected value or array of values. |
2.3.5. REL_TYPES
Returns rel's type or a list of types.
PDO.config | Description |
---|---|
Placeholder | Text shown in an empty input. |
Prefix | String, that will be placed before the parameter's value in the final query. |
Suffix | String, that will be placed after the parameter's value in the final query. |
Multiple | Boolean value whether the num of selected values can be more than 1. |
Mandatory | If false, the input is optional. |
Cypher Colon Format | If true then the resulting value is returned in the cypher colon format, e.g. ":REL_TYPE_1|REL_TYPE_2|REL_TYPE_3", which can be used in the MATCH part of cypher queries. |
Default Values | Default selected value or array of values. |
2.3.6. STRING
Simple input for any string values and arrays of strings.
PDO.config | Description |
---|---|
Placeholder | Text shown in an empty input. |
Prefix | String, that will be placed before the parameter's value in the final query. |
Suffix | String, that will be placed after the parameter's value in the final query. |
Multiple | Boolean value whether the num of selected values can be more than 1. |
Mandatory | If false, the input is optional. |
Strict | If true then only values defined in "Values" can be entered by the user. |
Default Values | Default selected value or array of values. |
Values | A defined list of values in the suggestion list. |
2.3.7. NUMBER
Simple input for any number values and arrays of numbers.
PDO.config | Description |
---|---|
Placeholder | Text shown in an empty input. |
Prefix | String, that will be placed before the parameter's value in the final query. |
Suffix | String, that will be placed after the parameter's value in the final query. |
Multiple | Boolean value whether the num of selected values can be more than 1. |
Mandatory | If false, the input is optional. |
Strict | If true then only values defined in "Values" can be entered by the user. |
Default Values | Default selected value or array of values. |
Values | A defined list of values in the suggestion list. |
2.3.8. CYPHER
Select from values loaded with a cypher query.
PDO.config | Description |
---|---|
Placeholder | Text shown in an empty input. |
Multiple | Boolean value whether the num of selected values can be more than 1. |
Prefix | String, that will be placed before the parameter's value in the final query. |
Suffix | String, that will be placed after the parameter's value in the final query. |
Mandatory | If false, the input is optional. |
Default Values | Default selected value or array of values. |
Query mandatory | Cypher query for loading the values in suggestions. |