Settings on this tab define the query that returns data from the model you select. The model data is returned as data rows in the dataflow output. You can complete options on this tab to build a query, or you can create a custom query. You can also select from or modify existing queries.
- Model
- Choose the Context Graph model on which to query.
- Query
- Specifies the query to be used on the model. Select a query from this list box to use or modify an existing model. Select <Custom> to create a new named query, then click Save to enter a name for the query.
- Use custom query
- Select this option to enter code for a custom query instead of configuring the query options on this tab. Custom queries are written in the Neo4j Cypher graph query language.
- Input Data
- This option is only visible if on the Selection tab, you choose Field for Property value.
- Include results from partial traversals
- Select this check box to include the results from each step in the query. Leave the box
unchecked to include only the results that meet the requirements of the last
step. For example, let's say that you are looking at a model that depicts
world-wide terrorist activity for the events leading up to September 11,
2001, and you want to return data for any meetings that both Osama bin Laden
and Mohamed Atta attended. Your query might include the following steps:
- An initial step that includes an exact search type for entities with
an
_stp_id
property that has a literal value ofPerson:Osama bin Laden
- An Entity to Relationship step of connected with a relationship label of "Meeting"
- A Relationship to Entity step of connected with a condition of an
_stp_id
property that contains "Atta"
- An initial step that includes an exact search type for entities with
an
- Include results from circular traversals
- Select this check box to include elements that occur more than once in each traversal.
Uncheck the box to include those elements just once in each traversal. For
example, let's say you are using the same model mentioned in step 1, and you
initially want to return data for any meetings that Mohamed Atta attended
but once you have those results, you want to see all attendees of a
particular meeting. Your query might include the following steps:
- An initial step that includes an exact search type for entities with
an
_stp_id
property that has a literal value ofPerson:Mohamed Atta
, which will return his entity - An Entity to Relationship step of connected with a relationship label of "Attended", which will return all events that he attended, including a meeting in Kandahar
- A Relationship to Entity step of connected with a condition of an Event property that contains "Kandahar", which will return just the Kandahar meeting
- An Entity to Relationship step of connected with a relationship label of "Attended", which will return relationships that connect to three other entities who attended the meeting in Kandahar and may or may not return the (already traversed) relationship that connects to Mohamed Atta, depending on whether you use this option.
Person:Mohamed Atta->Attended->Meeting:Kandahar
) was already traversed in the first step of the query. - An initial step that includes an exact search type for entities with
an
- Limit results to
- Select this check box and enter a number to specify the total maximum number of entities and relationships to return from the query. The default is 5000. The number entered here applies to unique elements, so if the same element appears in multiple results, they will count as one result. If your root step returns a list and you are querying a large model, we strongly suggest entering a limit in this field to prevent the server from becoming unresponsive.
- Add Operations
- Specify the steps you want the query to take by selecting the appropriate option in the Add Operations drop-down. You can complete this step for the Flow, Conditions, or Output tab. Note that your options vary by whether the root element is an entity or a relationship.
Selection
- All entities
- Choose this option to query against all entities in a model.
- All relationships
- Choose this option to query against all relationships in a model.
- Specify starting entities
- Choose this option to determine at what point in the model you want to begin your search. For example, in a model that has country names for entities, you may choose to examine data for Canada instead of executing the query against all countries. In this case you would select "All" for Search type, select "Country" for Property name, choose Literal, and enter "Germany" for the Property value.
Conditions
Complete settings on the Conditions tab if you want to place additional constraints on the query. The Conditions tab has four entry fields:
- Logical operator
- This field remains empty for the first condition. For subsequent conditions, specify whether this condition should be used in conjunction with previous conditions ("And") or if it should be used instead of previous conditions ("Or").
- Data source
- Select the property on which the condition will be based.
- Operator
- Select an operator for the condition that is appropriate for the data type. For more information, see Condition operators (Query Model)
- Literal
- To use a literal string in the query, choose this option and enter a text string in the Value field.
- Field
- To use a field value, choose this option and select the field whose data should be searched in the Value field.
In subsequent conditions, select a previous step (such as "Root" or "Step1") and then a property in the Value field to compare property values for the current step against values returned in a previous step.
Note: If you named the output on the Output
tab of previous steps, those names will appear in the drop-down rather than "Root"
or "Step1".
In this case, the properties shown in the Value field are based on properties for the
previous step. For example, if you knew the name of one person (Mohamed Atta) who
attended a particular event (a meeting in Kandahar) but wanted to know the names of
the other attendees, you could create the following query that includes a property
value comparison:
- A root step that looks for an entity type Person with an
_stp_id
of that contains "Mohamed" - An Entity to Relationship step with a relationship label of "Attended"
- A Relationship to Entity step with a condition that includes an Event that contains "Kandahar"
- An Entity to Relationship step with a relationship label of "Attended" plus
a condition that this step's _stp_id does not contain the same
_stp_id
value that was found in the root step.
_stp_id
value is
not "Mohamed".- Ignore case
- Select this check box if the query results can be either upper or lower case.
Output
- Include in results
- Select this check box if you want the results from this step to be included in the output.
- Specify name
- Choose this option to provide a name for this step in the output, choose this option and enter text in the Name field. Using the example from step 3, you might call this step "Afghanistan". Output fields from this step may be named "Afghanistan.Latitude" or "Afghanistan.Date".
- Use type name
- Choose this option to use the field type as the name for this step in the output. Entities will use entity types and relationships will use relationship labels. Continuing with the same example, output fields with this selection may be named "Person.Latitude" or "Person.Date". If you select this option and enter a name in the Name field, that name will also be added as a prefix for all output fields in addition to the field type. Continuing with the same example, output fields with this selection may be named "Afghanistan.Person.Latitude" or "Afghanistan.Person.Date".
- List
- Select this check box to use this entry as the name and type of the field in hierarchical output; leave it unchecked to have this entry added as a prefix for all output fields.