Queries in Knowledge Studio support query parameters. Once written, queries are static, parameters in the query allow parts of the query to be dynamic. A query parameter is a variable in the query for which the value is defined when the query is run. This allows users to run the same query with different values without having to modify the query.
For example, you can write a query to find all directly related entities to a person: MATCH (p:Person)-[]-(n) WHERE p.Name = "John Doe" RETURN n. Query parameters replace John Doe with a variable $name that can be configured to be any name: MATCH (p:Person)-[]-(n) WHERE p.Name = $name RETURN n. The Parameters pane in the query view allows you to define the $name parameter and then change the value without modifying the query.
Parameter Type | Description |
---|---|
Any set of alphanumeric characters. | |
Matches graph properties of any number type except Big Integer. | |
Set geometries for use in any of the spatial operators supported in queries. Only supports rectangle geometries at this time. | |
Date values only with no time values. | |
Time only values up to seconds only precision with no date values. | |
Date and time value precision in seconds (low precision) or milliseconds (high precision). | |
Date, time, and offset from the Coordinated Universal Time (UTC) zone. | |
Entities in the knowledge graph. | |
Relationships in the knowledge graph. |
Configure new parameters
The configure pane lets you define and initialize the parameters in your query. Each parameter used in the query must be configured for the query to run. Parameters can be one of the following types:
String parameter
Configure a String parameter.
- On the context toolbar, click Parameters.
The Parameters pane opens.
- Click Create new parameter
The new Parameter form opens.
- Name your parameter.
- Click the options menu next to the Parameter heading.
- Click Rename.
- Type a descriptive name for the parameter in the Title box.
- Click Apply.
The heading for the parameter is updated to the new name.
- Define the parameter in the Bind Parameter input using one of the following methods:
- Type the name of the parameter in the input box.
- If you have written a query that contains parameters, select the parameter from the drop-down.
- Select String from theType drop-down
- Enter the string in the input box to use as the initial Value for the parameter . The default is Single value, see Define value list to set a list of values for the parameter.
- Click Apply to run the query with the configured parameters.
The query results will update based the new parameter values.
Number parameter
Configure a Number parameter
- On the context toolbar, click Parameters.
The Parameters pane opens.
- Click Create new parameter
The new Parameter form opens.
- Name your parameter.
- Click the options menu next to the Parameter heading.
- Click Rename.
- Type a descriptive name for the parameter in the Title box.
- Click Apply.
The heading for the parameter is updated to the new name.
- Define the parameter in the Bind Parameter input using one of the following methods:
- Type the name of the parameter in the input box.
- If you have written a query that contains parameters, select the parameter from the drop-down.
- Select Number from theType dropdown
- Enter the number in the input box to use as the initial Value for the parameter . The default is Single value, see Define value list to set a list of values for the parameter.
- Click Apply to run the query with the configured parameters.
The query results will update based the new parameter values.
Geometry parameter
Configure a Geometry parameter.
Learn more about spatial operators in queries.
- On the context toolbar, click Parameters.
The Parameters pane opens.
- Click Create new parameter
The new Parameter form opens.
- Name your parameter.
- Click the options menu next to the Parameter heading.
- Click Rename.
- Type a descriptive name for the parameter in the Title box.
- Click Apply.
The heading for the parameter is updated to the new name.
- Define the parameter in the Bind Parameter input using one of the following methods:
- Type the name of the parameter in the input box.
- If you have written a query that contains parameters, select the parameter from the drop-down.
- Select Geometry from theType dropdown
- Click Set Geometry to define the initial Value for the parameter . The default is Single value , see Define value list to set a list of values for the parameter. .
The geometry sketch modal opens.
- Click the rectangle tool in the graphics toolbar.
- Click and drag on the map to draw a rectangle around the area of interest.
If configuring a list of geometries, this step for each geometry.
- Optionally, select the geometry using one of the following methods on the graphics toolbar.
- Select feature - Click the feature to select it.
- Select by rectangle - Click the map and drag a rectangle across the feature to select it.
- Select by lasso - Click the map or link chart and draw with the pointer to create a freehand shape selection.
- Optionally modify or remove a feature:
- resize the feature by clicking on one of the rectangles on the edges or corners and dragging to resize.
- move the feature by clicking anywhere in the feature and dragging it to a new location on the map.
- Click Delete feature in the graphics toolbar to remove the feature.
- Click Clear to reset the map.
- Click Ok
- Click Apply to run the query with the configured parameters.
The query results will update based the new parameter values.
Date Only
Configure a Date Only parameter.
Learn more about using date-time values in queries
- On the context toolbar, click Parameters.
The Parameters pane opens.
- Click Create new parameter
The new Parameter form opens.
- Name your parameter.
- Click the options menu next to the Parameter heading.
- Click Rename.
- Type a descriptive name for the parameter in the Title box.
- Click Apply.
The heading for the parameter is updated to the new name.
- Define the parameter in the Bind Parameter input using one of the following methods:
- Type the name of the parameter in the input box.
- If you have written a query that contains parameters, select the parameter from the drop-down.
- Select Date Only from the Type dropdown
- Set the date to use for the Value. The default is Single value, see Define value list to set a list of values for the parameter. Define the date using one of the following methods:
- Type the date in the input box in MM/DD/YYYY format.
- Click input box and select a date using the calendar.
- Click Apply to run the query with the configured parameters.
The query results will update based the new parameter values.
Time Only
Configure a Time Only parameter.
Learn more about using date-time values in queries
- On the context toolbar, click Parameters.
The Parameters pane opens.
- Click Create new parameter
The new Parameter form opens.
- Name your parameter.
- Click the options menu next to the Parameter heading.
- Click Rename.
- Type a descriptive name for the parameter in the Title box.
- Click Apply.
The heading for the parameter is updated to the new name.
- Define the parameter in the Bind Parameter input using one of the following methods:
- Type the name of the parameter in the input box.
- If you have written a query that contains parameters, select the parameter from the drop-down.
- Select Time Only from the Type dropdown
- Set the time to use for theValue. . The default is Single value, see Define value list to set a list of values for the parameter. Define the time using one of the following methods:
- Type the time in the input box in HH:MM:SS.SSS format.
- Optionally, define the time using the time picker.
- Click Apply to run the query with the configured parameters.
The query results will update based the new parameter values.
Date
Configure a Date parameter.
Learn more about using date-time values in queries
- On the context toolbar, click Parameters.
The Parameters pane opens.
- Click Create new parameter
The new Parameter form opens.
- Name your parameter.
- Click the options menu next to the Parameter heading.
- Click Rename.
- Type a descriptive name for the parameter in the Title box.
- Click Apply.
The heading for the parameter is updated to the new name.
- Define the parameter in the Bind Parameter input using one of the following methods:
- Type the name of the parameter in the input box.
- If you have written a query that contains parameters, select the parameter from the drop-down.
- Select Date from theType dropdown
- Set the date and time for the Value. The default is Single value, see Define value list to set a list of values for the parameter. Define the date using one of the following methods:
- Type the date in the input box in MM/DD/YYYY format.
- Click input box and select a date using the calendar.
- Define the time using one of the following methods:
- Type the time in the input box in HH:MM:SS.SSS format.
- Optionally, define the time using the time picker.
- Click Apply to run the query with the configured parameters.
The query results will update based the new parameter values.
Timestamp offset parameter
Configure a Timestamp Offset parameter.
Learn more about using date-time values in queries
- On the context toolbar, click Parameters.
The Parameters pane opens.
- Click Create new parameter
The new Parameter form opens.
- Name your parameter.
- Click the options menu next to the Parameter heading.
- Click Rename.
- Type a descriptive name for the parameter in the Title box.
- Click Apply.
The heading for the parameter is updated to the new name.
- Define the parameter in the Bind Parameter input using one of the following methods:
- Type the name of the parameter in the input box.
- If you have written a query that contains parameters, select the parameter from the drop-down.
- Select Timestamp Offset from theType dropdown
- Set the date, time and UTC offset for the Value. The default is Single value, see Define value list to set a list of values for the parameter. Define the date using one of the following methods:
- Type the date in the input box in MM/DD/YYYY format.
- Click input box and select a date using the calendar.
- Define the time using one of the following methods:
- Type the time in the input box in HH:MM:SS.SSS format.
- Optionally, define the time using the time picker.
- Enter the number of minutes for the time zone offset in UTC offset in minutes.
The default is zero. The minimum value is -720 (-12:00 hours) and the maximum value is 840 (+14:00 hours)
- Click Apply to run the query with the configured parameters.
The query results will update based the new parameter values.
Entity or Relationship
Configure an Entity or Relationship parameter. Configuring an entity or relationship parameter uses the unique identifier for the entity or relationship as the parameter.
For example MATCH (p:Person)-[]-(m) WHERE ID(p) = $entityOrRelationshipUniqueID
- On the context toolbar, click Parameters.
The Parameters pane opens.
- Click Create new parameter
The new Parameter form opens.
- Name your parameter.
- Click the options menu next to the Parameter heading.
- Click Rename.
- Type a descriptive name for the parameter in the Title box.
- Click Apply.
The heading for the parameter is updated to the new name.
- Define the parameter in the Bind Parameter input using one of the following methods:
- Type the name of the parameter in the input box.
- If you have written a query that contains parameters, select the parameter from the drop-down.
- Select Entity or Relationshiprom theType dropdown.
- Start typing the name of the entity in the input box to defined the entity or relationship to use for the Value. The default is Single value, see Define value list to set a list of values for the parameter.
A drop-down list with the top five matched records will appear. The list will update as you type.
- Select the record from the drop-down list.
- Click Apply to run the query with the configured parameters.
The query results will update based the new parameter values.
Use lists for parameter values
Any parameter can be a list of values, but the list can only contain one type of values. For example, to find all people who have common last names, you might use the query MATCH (p:People) where n.lastName in $lastNameList RETURN n and define lastNameList as a String list containing Smith, Jones, and Johnson using the parameters pane.
If you have a delimited list of values, such as a comma separated list of names, use List from Text to add values to the list.
Define list of values
You can use the same set of steps used to define a value to create a list of values by selecting Value List instead of Single Value. After defining each value, add it to the list, or manage the list of values to remove items.
- Click Value List to define a list of values for the parameter.
- Use the same input method as the single value for the type selected (starting at step six). Or see a summary of the steps for each type in the table below.
Type the string into the input field.
Type the number into the input field
Click Set Geometry and draw multiple geometries
Type the date in MM/DD/YYYY format or use the calendar to enter the date.
Type the time in HH:MM:SS.sss format or use the time picker to enter the time
Type the date in HH:MM:SS.sss format or use the calendar to enter the date.
Type the time in MM/DD/YYYY format or use the time picker to enter the time
Type the date in HH:MM:SS.sss format or use the calendar to enter the date.
Type the time in MM/DD/YYYY format or use the time picker to enter the time.
Type the UTC offset in minutes.
Use the input field to find and select an entity.
Use the input field to find and select a relationship.
- Click Add
- Repeat steps one and two until all values are added to the list.
- Optionally, manage the values in the list.
- Click the Values heading to show the values in the list.
- Click Clear next to a value to remove it from the list.
- Click Clear to clear the list.
- Click Copy to copy the values in the list to the system clipboard.
- Click Apply to run the query with the configured parameters.
The query results will update based the new parameter values.
Custom list from text
If you have many values to add to a list, you can use the List from text feature to generate the list of values. List from text accepts a delimited list, such as a comma separated list of names, and generates a list of values for the parameter of the type you've chosen (see the list ofsupported types).
- Click List from text.
The List from text modal opens.
- Type character or characters that separate the values in your list as the Delimiter input. The default is a comma. If the list is delimited by a tab or new lines (Enter) click the appropriate option.
- Paste the delimited list in the text box.
The parameter type will be listed above the text box. All values in the list must match this type.
- Click Generate List.
The Result List is generated below the text box.
- Optionally click the result list to view the results
- Optionally click the X next to a value to remove it from the list.
- Optionally click Clear to clear all the values from the list
- Click Add Values to List to add the generate values to the parameter list.
- Click Apply to run the query with the configured parameters.
The query results will update based the new parameter values.
Remove parameter
Configured parameters can be removed from the query.
- On the context toolbar, click Parameters.
The Parameters pane opens.
- If the pane opens to the edit tab click the Configure tab.
- Click the Options menu next to the parameter name.
The options menu opens.
- Click Delete.
The parameter is removed.
Note:
If the query still contains the parameter it will return an error when run unless the parameter is removed from the query or reconfigured.
Edit values
If parameters have been configured for a stored query, when that query is opened the Parameters pane automatically opens to the Edit Values tab.
- If the Parameters pane is not open, click Parameters on the context toolbar.
The Parameters pane opens. The parameters configured for the query will be listed.
- Update the value based on the Type of the parameter.
The type of each parameter will be shown below the heading. If the parameter uses a list of values List will be included after the type. See Define value list to update values in a list. The current values used in the query will be shown in the input elements for each parameter. The steps for each type are summarized below.
Type the string into the input field.
Type the number into the input field
Click Set Geometry and draw multiple geometries
Type the date in MM/DD/YYYY format or use the calendar to enter the date.
Type the time in HH:MM:SS.sss format or use the time picker to enter the time
Type the date in HH:MM:SS.sss format or use the calendar to enter the date.
Type the time in MM/DD/YYYY format or use the time picker to enter the time
Type the date in HH:MM:SS.sss format or use the calendar to enter the date.
Type the time in MM/DD/YYYY format or use the time picker to enter the time.
Type the UTC offset in minutes.
Use the input field to find and select an entity.
Use the input field to find and select a relationship.
- Click Apply to run the query with the updated values.
The query results will update based the new parameter values.