Query
Use Apis Management Studio (AMS) to connect to the Apis Hive instance you want to query, then browse the Asset Registry to the object that is the to hierarchy node for your query. The node you selects will be used as a hierarchy filter. Only variables below the selected node will be included in the result.
Right-click the node you want to use as base for the query and select "Query Variables".
The node that you selected as base will be set as the first Hierarchies filter. The figure below shows the default query window based on selection of the "0,Objects/3.FluidFactory/4,ProcessCell1" path.
The view consists of five parts:
- Status and query saving
- Attribute selections
- Attribute conditions
- Hierarchies
- Query execution, progress and result
Status and query saving
The Model Index must be in Service status "Ready" to be able to run a query. If others are running queries, the service could be "Busy" for a moment.
Use "Save" or "Save as" buttons to save the query for later, This will not save the results of a query, just the definition. Use "Load" to open a previously saved query.
Attribute selections
This is where you selects what the query result should consist of.
As a start, four variable attributes are pre-selected for the result:
- NodeId
- BrowseName
- DisplayName
- Desription
Other possible attributes to select is:
- NodeClass
- DataValue
- DataType
- Type
Add new select definitions by clicking "Add Select Definition" button. To include item information, check the "Include item info check box".
When checked, information on the function item behind the variables are included in the result set, so are the function item expression and up to 5 external items.
The selected attribute will be added to the result, either by using the name of the attribute or by a alias of choice. The alias can be set in the "Result Column name" field behind the attribute selection.
It also possible to add attribute selections for parent or child components relative to the variables. This is achieved by adding type and/or BrowseName traversal from the variables that are returned from the query.
For a more thorough description of how to get parent and child information relative to the variables, go here.
Attribute conditions
It is possible to add attribute conditions on all variable attributes or on attributes on parent or child components relative to the variables.
To create a condition based on one of the attribute selections, press the "+" button to the right of the attribute selection
The selection is added as a condition:
You can also use the "Add condition" button to add condition types that are not equal to any of the attribute selections.
The following filter operators are supported:
-
Equal. Test 100% equality with value. It's case sensitive and no wildcards are allowed.
-
**NotEqual.**Test for not equality. It's case sensitive and no wildcards are allowed.
-
IsNull. Tests if value is null. Empty values will not be returned.
-
GreaterThat, LessThan, GreaterThanOrEqual, LessThanOrEqual. Works for both string and numeric values. Unicode order of quality is used.
-
Like. Tests whether the attribute matches the pattern specified in the value field. The pattern can consist of regular characters and wildcards. The supported wildcards are _ to match a single arbitrary character, and % to match any number of arbitrary characters. Literal % and _ need to be escaped with a backslash.
-
"abc" LIKE "a%" // true
-
"abc" LIKE "_bc" // true
-
"a_b_foo" LIKE "a\_b\_foo" // true
-
-
InList. Tests if a value is contained in an array
- 1.5 IN [ 2, 3, 1.5 ] // true
-
NotInList. Test if a value is not contained in an array
- 42 NOT IN [ 17, 40, 50 ] // true
-
MatchRegExpr. Tests if a string value matches a regular expression
- "foo" MatchRegExpr "^f[o].$" // true
-
NotMatchRegExpr. Tests if a string value does not match a regular expression
- "foo" NotMatchRegExpr "[a-z]+bar$" // true
Hierarchies
Hierarchy filters are essential for the variable query. Only variables that are in the hierarchy below every node selected as hierarchy filter are returned.
Both types and instance node can be used as filter.
- If an object type is used: Only variables below instances of the object type are returned.
- If a variable type is used: Only variables of that type are returned.
Here only variables below "ProcessCell1" and objects of type "6,PidControllertype" is returned:
Query execution, progress and result
To execute the query, check the status(should not be busy or indexing) and press "Execute Query". The progress of the query is indicated in the progressbar.
It is also possible to export the result to a comma separated file, with optional namespace array included.
The namespace array will show what indexes is mapped to which URI's at time of query.