CreateAssociationUpdate@1
Der Node CreateAssociationUpdate@1 wird verwendet, um ein Update-Info-Objekt zum Erstellen oder Löschen von Assoziationen zwischen Entitäten zu erzeugen. Assoziations-Update-Info-Objekte dienen dazu, Änderungen an den Beziehungen zwischen Entitäten im Asset Repository von OctoMesh nachzuverfolgen.
- Siehe ApplyChanges@1 für ein Beispiel, wie das Update-Info-Objekt angewendet wird.
- Siehe FilterLatestUpdateInfo@1 für ein Beispiel, wie das neueste Update-Info-Objekt gefiltert wird.
Adapter-Voraussetzungen
Node-Konfiguration
Für die Felder path, targetPath, targetValueWriteMode und targetValueKind siehe Überblick.
transformations:
- type: CreateAssociationUpdate@1
targetPath: _updateItems # Path where the update info object should be stored in the payload
targetValueKind: Array # The target value kind; should be 'Array' to store multiple update info objects
targetValueWriteMode: Append # The target value write mode; should be 'Append' to add the update info object to the array
updateKind: CREATE # The update kind; 'CREATE' to create an association, 'DELETE' to delete an association
sourceRtId: 5fc8fda18b2fc75f925e21af # The runtime ID of the source entity in the association
sourceRtIdPath: $.sourceAssetId # The path to the source runtime ID in the payload; any valid JSON path is allowed. This property can be defined instead of the 'sourceRtId' property
sourceCkTypeId: Industry.Energy/Photovoltaic.Module # The CK type ID of the source entity
sourceCkTypeIdPath: $.sourceCkTypeId # The path to the source CK type ID in the payload; any valid JSON path is allowed
targetRtId: 5fc8fda18b2fc75f925e21bf # The runtime ID of the target entity in the association
targetRtIdPath: $.targetAssetId # The path to the target runtime ID in the payload; any valid JSON path is allowed. This property can be defined instead of the 'targetRtId' property
targetCkTypeId: Industry.Energy/Photovoltaic.Inverter # The CK type ID of the target entity
targetCkTypeIdPath: $.targetCkTypeId # The path to the target CK type ID in the payload; any valid JSON path is allowed
associationRoleId: Industry.Energy/Photovoltaic.ModuleToInverter # The CK association role ID defining the association
associationRoleIdPath: $.associationRoleId # The path to the association role ID in the payload; any valid JSON path is allowed
Konfigurationseigenschaften
-
updateKind(AssociationUpdateKind?): Die Art des durchzuführenden Updates. Verwenden Sie'CREATE', um eine Assoziation zu erstellen, oder'DELETE', um eine Assoziation zu löschen. -
updateKindPath(string?): Der JSON-Pfad zur Update-Art im Payload. Diese Eigenschaft kann anstelle der EigenschaftupdateKinddefiniert werden. -
sourceRtId(OctoObjectId?): Die Runtime-ID der Quellentität in der Assoziation. -
sourceRtIdPath(string?): Der JSON-Pfad zur Runtime-ID der Quelle im Payload. Diese Eigenschaft kann anstelle der EigenschaftsourceRtIddefiniert werden. -
sourceCkTypeId(CkId<CkTypeId>?): Die CK type ID der Quellentität. -
sourceCkTypeIdPath(string?): Der JSON-Pfad zur CK type ID der Quelle im Payload. Diese Eigenschaft kann anstelle der EigenschaftsourceCkTypeIddefiniert werden. -
targetRtId(OctoObjectId?): Die Runtime-ID der Zielentität in der Assoziation. -
targetRtIdPath(string?): Der JSON-Pfad zur Runtime-ID des Ziels im Payload. Diese Eigenschaft kann anstelle der EigenschafttargetRtIddefiniert werden. -
targetCkTypeId(CkId<CkTypeId>?): Die CK type ID der Zielentität. -
targetCkTypeIdPath(string?): Der JSON-Pfad zur CK type ID des Ziels im Payload. Diese Eigenschaft kann anstelle der EigenschafttargetCkTypeIddefiniert werden. -
associationRoleId(CkId<CkAssociationRoleId>?): Die CK association role ID, die die Assoziation zwischen der Quell- und der Zielentität definiert. -
associationRoleIdPath(string?): Der JSON-Pfad zur association role ID im Payload. Diese Eigenschaft kann anstelle der EigenschaftassociationRoleIddefiniert werden.
Verwendungsbeispiel
Hier ist ein Beispiel, wie Sie den Node CreateAssociationUpdate@1 in einer Transformations-Pipeline verwenden könnten:
transformations:
- type: CreateAssociationUpdate@1
targetPath: _associationUpdates # Store the association update info object in this path in the payload
targetValueKind: Array # Store multiple association update info objects in an array
targetValueWriteMode: Append # Append the new update info object to the array
updateKind: CREATE # Create a new association
sourceRtIdPath: $.rtId # Source entity runtime ID from the payload
sourceCkTypeId: Industry.Basic-1.0.0/Alarm-1.0.0 # Source entity CK type ID from the payload
targetRtId: 0123456789012asdfb # Target entity runtime ID from the payload
targetCkTypeIdPath: $.location.ckTypeId # Target entity CK type ID from the payload
associationRoleId: Industry.Basic/Alarm # The CK association role ID defining the "LocatedAt" relationship
In diesem Beispiel:
- Wir erstellen eine Assoziation zwischen einem Gerät und einem Standort.
updateKindist auf'CREATE'gesetzt, was bedeutet, dass wir eine neue Assoziation erstellen.- Die Runtime-IDs und CK type IDs von Quelle und Ziel werden mithilfe von JSON-Pfaden aus dem Payload extrahiert.
associationRoleIdgibt die Art der Assoziation zwischen den beiden Entitäten an.
Hinweise
- Wenn sowohl der direkte Wert als auch der zugehörige Pfad für eine Eigenschaft angegeben sind (z. B. sowohl
sourceRtIdals auchsourceRtIdPath), hat der direkte Wert (sourceRtId) Vorrang. - Stellen Sie sicher, dass alle erforderlichen IDs (Runtime-IDs und CK type IDs) entweder direkt oder über JSON-Pfade angegeben sind; andernfalls protokolliert der Node einen Fehler und bricht die Verarbeitung für dieses Element ab.
targetValueKindsollte auf'Array'undtargetValueWriteModeauf'Append'gesetzt werden, um mehrere Assoziations-Updates im Payload zu sammeln.
Verwandte Nodes
- ApplyChanges@1: Wendet die gesammelten Update-Info-Objekte auf den Mesh Adapter an.
- FilterLatestUpdateInfo@1: Filtert die neuesten Update-Info-Objekte aus dem Payload und ruft sie ab.