Skip to content

KnowledgeBaseImpl should catch IllegalArgumentExcetion #783

@bnouwt

Description

@bnouwt

When the KnowledgeBaseImpl is syncing its Knowledge Interactions and one of the KI URLs is already registered, the thrown IllegalArgumentException should not cause the whole syncing of KIs to be interrupted and never continue again. The problem below occurred with the storage-kb malfunctioning in one of our projects which was caused by the fact that two different KBs had a KI with the same name. Of course, we should also make sure the storage-kb does not only use the name of a KI to create the KI-name, but also the KB name or some random number.

storage-kb-1  | 2026-01-16 16:17:34 [main] INFO  e.k.e.s.i.SmartConnectorImpl-Storage Knowledge Base - Registered React KI <http://www.knowledge-engine.eu/storage-knowledge-base/interaction/test-post-ki>.
storage-kb-1  | Exception in thread "main" java.lang.IllegalArgumentException: The Knowledge Interaction with URI 'http://www.knowledge-engine.eu/storage-knowledge-base/interaction/test-post-ki' should not be already registered.
storage-kb-1  |         at eu.knowledge.engine.smartconnector.impl.KnowledgeBaseStoreImpl.tryPut(KnowledgeBaseStoreImpl.java:215)
storage-kb-1  |         at eu.knowledge.engine.smartconnector.impl.KnowledgeBaseStoreImpl.register(KnowledgeBaseStoreImpl.java:197)
storage-kb-1  |         at eu.knowledge.engine.smartconnector.impl.SmartConnectorImpl.register(SmartConnectorImpl.java:237)
storage-kb-1  |         at eu.knowledge.engine.smartconnector.util.KnowledgeBaseImpl.syncKIs(KnowledgeBaseImpl.java:524)
storage-kb-1  |         at eu.knowledge.engine.admin.MetadataKB.syncKIs(MetadataKB.java:103)
storage-kb-1  |         at eu.knowledge.engine.storage.StorageKB.registerInverses(StorageKB.java:180)
storage-kb-1  |         at eu.knowledge.engine.storage.StorageKB.syncKIs(StorageKB.java:186)
storage-kb-1  |         at eu.knowledge.engine.smartconnector.util.KnowledgeNetwork.startAndWaitForReady(KnowledgeNetwork.java:99)
storage-kb-1  |         at eu.knowledge.engine.smartconnector.util.KnowledgeNetwork.sync(KnowledgeNetwork.java:53)
storage-kb-1  |         at eu.knowledge.engine.storage.StorageKB.main(StorageKB.java:298)

Maybe also create a Unit Test for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions