Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[kbl2vec] Added support for signals conversion.#490

Open
beckerjohannes wants to merge 3 commits into
developfrom
feat/kbl2vec-signals
Open

[kbl2vec] Added support for signals conversion.#490
beckerjohannes wants to merge 3 commits into
developfrom
feat/kbl2vec-signals

Conversation

@beckerjohannes

@beckerjohannes beckerjohannes commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Pull Request

Changes

  • Code
  • Documentation
  • Other:

Description

What

The KBL2VEC converter did not produce any VEC Signals. This adds support for converting KBL connection signal information into a dedicated VEC signal list.

Changes

  • New "Signal list" document — emits a standalone DocumentVersion (DocumentType=SignalList, DocumentNumber=Signals, DocumentVersion=1, De/En descriptions "Signalliste"/"Signal list") containing a single SignalSpecification. Company name comes from ConversionProperties.
  • Signals from connections — one VecSignal per KblConnection with a non-blank Signal_name, using that name as both identification and signalName.
  • Wire linking — WireElementReference.signal (single- and multi-core) is now linked to the signal of the wire's referenced connection.
  • Deduplication — a post-processor collapses signals sharing a name into one canonical signal and repoints references, guaranteeing identification uniqueness within the SignalSpecification. It runs before XML-id assignment.

Design note

Signals are created 1:1 per connection (not deduplicated up front) so the KblConnection → VecSignal entity mapping stays unique and wire→signal linking resolves; duplicates are then merged in the post-processor.

New files

  • transform/signal/SignalListDocumentVersionTransformer, SignalSpecificationTransformer, SignalTransformer
  • post/SignalDeduplicationPostProcessor

Testing

  • Unit tests for all three transformers and the dedup post-processor; updated both WireElementReferenceTransformer tests.
  • End-to-end KblToVecConverterTest snapshot regenerated (all four samples now include the signal list); passes VEC schema validation, confirming all IDREFs resolve.
  • Full module suite green (163 tests).

⚠️ Reviewer note: KblToVecConverterTest.snap is regenerated — the diff is large but mechanical (added SignalList document + references).

@sonarqubecloud

sonarqubecloud Bot commented Jul 8, 2026

Copy link
Copy Markdown


private List<KblConnection> firstConnectionWithSignal(final KblCoreOccurrence source) {
return source.getRefConnection().stream()
.filter(connection -> !Strings.isNullOrEmpty(connection.getSignalName()))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A sort is missing here to guarantee determinism.

private List<KblConnection> firstConnectionWithSignal(final KblGeneralWireOccurrence source) {
if (source instanceof final KblWireOccurrence wireOccurrence) {
return wireOccurrence.getRefConnection().stream()
.filter(connection -> !Strings.isNullOrEmpty(connection.getSignalName()))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

registry, new ConversionProperties());

// Deduplicate signals (and repoint their references) before XML ids are assigned.
orchestrator.addPostProcessor(new SignalDeduplicationPostProcessor());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the fact, that we "fix" this in post. Do you see a way where we do this during transformation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants