TeamcenterKnowledge

MBSE Integration Services for Integrating Modeling Tools

Filter data from the importCollection API output

Note: Several short passages on this source page (mostly a table of tool-type/expression examples and a couple of brief transitional sentences) could not be captured cleanly during extraction — the browser tooling's content filter redacted small fragments it flagged as resembling cookie/query-string data. The content below reflects everything that was recoverable; nothing has been fabricated to fill the gaps.

There are two types of string expressions:

  • String expression to compare attribute value: attr[ATTRIBUTE_NAME]
  • String expression to compare the attribute value of the child component: comp.attr[ATTRIBUTE_NAME] — matches component attribute with the specified attribute name. comp[TYPE_NAME].attr[ATTRIBUTE_NAME] matches a component type with the specified attribute name.

Type expressions

Type names correspond to the component name in the integration definition file while attribute names correspond to the attributes in the integration definition file.

The filter expression structure: the attribute to be compared is equal to or not equal to a single-quoted string literal.

attr[Kind] == 'Electrical'

In the filtering expression, you specify the tool type and the expression. The filtering expression is evaluated based on the tool type and the expression.

Tool Type Expression
SystemBlock attr[Kind] == 'ee_Software'
ElectricalBlock attr[Attr1] == 'abc' || attr[Attr2] == 'xyz'

Example:

"Filters": {
    "Expressions": {
        "Block": "attr[Kind] != 'UNSET'",
        "Function": "attr[Kind] == 'FUNCTION'",
        "pa.PhysicalFunction":"comp[fa.FunctionInputPort].attr[Attr1] == 'abc' || comp.attr[Attr2] == 'xyz'"
    }
}

Filter expressions evaluation process

For every model element:

IF tool type of the model element or parent type exists in filter expression map THEN
  IF expression = true THEN
    Include element in output
  ELSE
    Exclude element from output
ELSE IF no expression exists THEN
  Include element in output

Example:

"Filters": {
    "Expressions": {
        "Function": "attr[Kind] == 'FUNCTION'",
    }
}

In this example, if parent type Function has attr[Kind] == 'FUNCTION', the element is included.

Filter objects based on selector expressions

You can control output in a more granular manner by:

  • Filtering based on tags and stereotypes applied to the typing elements of objects.
  • Traversing of relationships between components and their containers. You can look inside a container for specific components, and then look at the container of those components, and so on.
  • Using a function-call like syntax such as hasComponents() and container(), which can be chained together.
    • hasComponents() — Selects components within the current context, for example, a container.
    • container() — Selects the parent container of the components identified by the previous hasComponents() call. Resolves to TRUE if a selected set of components or containers is not empty, providing conditional logic.

How selector expressions work

Selector expressions are evaluated against each container in the importCollection output. They use a function-call-like syntax and can be chained together to construct complex filtering criteria that navigate the model hierarchy.

They use the following functions:

Function Purpose Criteria Result
hasComponents(criteria) Selects components within the current container that meet specified criteria. Can include component type and attr[ATTRIBUTE_NAME] comparisons. If no criteria are specified, it selects all components. A set of components that satisfy the criteria. If this is the end of the expression, it resolves to TRUE if the set is not empty, FALSE otherwise.
container(criteria) Used in conjunction with hasComponents() to select the containers of the components identified by the preceding hasComponents() call. Can include container type and attr[ATTRIBUTE_NAME] comparisons. A set of containers that meet the criteria. If this is the end of the expression, it resolves to TRUE if the set is not empty, FALSE otherwise.
Chaining hasComponents() and container() can be chained multiple times to traverse deeper into the model hierarchy, for example hasComponents().container().hasComponents().
empty() A function to check if the final set resulting from a selector expression chain is empty: selectorExpressionChain.empty(). Returns TRUE if the final set is empty, FALSE otherwise. This is functionally equivalent to applying a Boolean NOT operator to the selector expression chain.

The criteria passed as arguments to hasComponents() and container() reuse the existing attribute value expression syntax, for example, attr[Kind] == 'Electrical'.

Sub-assembly filtering behavior

If a top-level occurrence is filtered out, its sub-assembly is not filtered out.

Top Parent
  B1
    Occurrence 1 of B21
      B21
        Occurrence 1 of B211
          B211

In this example, if Occurrence 1 of B21 is filtered, the sub-assembly of B21 is not filtered out.

Component type filter does not support inheritance.

Source: https://docs.sw.siemens.com/en-US/doc/282219420/PL20251212545240207.xid1913857/bwm3556671528912 · retrieved Fri Jul 10 2026 00:00:00 GMT+0000 (Coordinated Universal Time)