# Innovator Integration

## Ontology Source Naming

Innovator ontology sources for entity and relationship models use the following name pattern:

```text
Innovator.elements.<model_id>.<stereotype>
```

The `<model_id>` segment identifies the Innovator model. The source configuration table extracts the unique model IDs from this segment and exposes them as a filter when `External Integration: Innovator` is selected.

The model filter matches sources beginning with:

```text
Innovator.elements.<model_id>.
```

Matching is case-insensitive. The `All` model selection does not apply a model prefix filter. The model filter is combined with the source ID filter using AND logic.

## Package and Diagram Selection Persistence

The source-configuration page displays a single unified "Packages & Diagrams Selection"
tree using nodes that carry both `:Entity` and `:Innovator`. The model root is identified
by the additional `:innovatorModelRoot` label. A node is included in the tree when either
`is_structure = true` (a structural package) or `is_diagram = true` (a diagram); non-structural,
non-diagram nodes are excluded from the tree. Diagram identity is determined solely by the
`is_diagram` boolean property — stereotype labels are not a reliable way to identify diagrams,
since Innovator/MIRA-imported models use free-form, inconsistent stereotype naming.

The selected package and diagram element IDs are persisted together as graph relationships:

```cypher
(:Ontology)-[:SYNCHRONIZE_SOURCE]->(:Entity:Innovator)
```

Only explicitly selected package or diagram nodes are targets of this relationship. Partially
selected states are derived in memory from selected descendants and are never
persisted. Save replaces the ontology's existing `SYNCHRONIZE_SOURCE` relationships
with the current explicit selections (packages and diagrams together, from the single unified
panel), while Cancel discards the current draft.

## Package Element Ownership and Counts

Innovator packages and their directly contained elements use the same `owner`
relationship as the package hierarchy. The relationship always points from the
child to its owner:

```cypher
(child:Entity:Innovator)-[:owner]->(package:Entity:Innovator)
```

The `is_structure` property distinguishes the two kinds of child nodes:

- `is_structure = true` identifies a structural package.
- `is_structure = false` identifies an element contained directly in a package.

For example, the imported `Services` package is structural and owns three direct
`ApplicationISService` elements through incoming `owner` relationships: `AI driven
model QA`, `EA Chat Bot`, and `Model tranformation`. The last name reflects the
spelling stored in the imported Innovator data.

The source-configuration package tree loads all direct element counts in one
batched Cypher query. Package identity uses the Neo4j `elementId()` value when
available and the node's `id` property as a fallback. A package's descendant count
is calculated in memory as the recursive sum of the direct counts on all structural
descendants (including any descendant diagrams); no database query is executed per tree node.

## Diagram Element Occurrences

Diagram nodes (`is_diagram = true`) are attached to their parent package via the same `owner`
relationship used by the package hierarchy, and separately carry the elements placed on them
via an incoming `diagram_occurrences` relationship:

```cypher
(element:Entity:Innovator)-[:diagram_occurrences]->(diagram:Entity:Innovator)
```

Selecting a diagram in the Packages & Diagrams Selection panel synchronizes the diagram entity
itself plus every element linked to it via `diagram_occurrences` — not merely the diagram node
in isolation. The Relationships Selection panel's scope toggle honors this: for a selected diagram,
the in-scope element set is the union of the diagram's own id and every `occurrenceElement` reachable
via `diagram_occurrences`, mirroring how a selected package's scope is the union of its `owner`-linked
descendants.

## Related Documentation

The Innovator knowledge-graph import pipeline is documented in [INNOVATOR_KNOWLEDGE_GRAPH_IMPORT_PIPELINE.md](INNOVATOR_KNOWLEDGE_GRAPH_IMPORT_PIPELINE.md).