From 52758de478aae8c256403763400bd7f2477d76af Mon Sep 17 00:00:00 2001 From: Saud Khan Date: Wed, 4 Dec 2024 23:31:38 +0100 Subject: [PATCH] chore(irs): updated irs guide --- dpp-tutorial/irs-drill-down.md | 169 ++++++++++++++++++++++++--------- 1 file changed, 126 insertions(+), 43 deletions(-) diff --git a/dpp-tutorial/irs-drill-down.md b/dpp-tutorial/irs-drill-down.md index 1cc546c6d..410e94a43 100644 --- a/dpp-tutorial/irs-drill-down.md +++ b/dpp-tutorial/irs-drill-down.md @@ -238,9 +238,9 @@ curl --location '/' \ --header 'Content-Type: application/json' \ ``` -## 6° Attach BOMAsBuilt to Existing Digital Twin +## 6° Add BOMAsBuilt and SerialPart to Existing Digital Twin -* Get existing digital Twin by Base64 encoded digital twin Id +* To get the existing digital twin, get your part Id from the given paper and encode it into Base64. The digital twin registered can be checked/verified from the following command: @@ -269,7 +269,6 @@ Example JSON response: "id": "urn:uuid:a530baad-77ad-4ffc-a925-f3a207839791", "specificAssetIds": [ { - "supplementalSemanticIds": [], "name": "manufacturerPartId", "value": "MPI7654", "externalSubjectId": { @@ -284,68 +283,152 @@ Example JSON response: } ], "submodelDescriptors": [ - { - "endpoints": [ - { ... } - ] - } + { + "endpoints": [ + { + "interface": "SUBMODEL-3.0", + "protocolInformation": { + ... + } + } + ], + "idShort": "digitalProductPass", + "id": "urn:uuid:d2e47115-c430-4145-bbde-1c743804a379", + ... + } ] } ``` -Copy the actual json response and paste it into the notepad editor. You will need the values later. +- Search for the `submodelDescriptors` array. We need to add more elements to the submodelDescriptors array. -### Update Digital Twin +- Copy your response and add the following json content into the submodelDescriptors array: +```json +{ + "endpoints": [ + { + "interface": "SUBMODEL-3.0", + "protocolInformation": { + "href": "/api/public/", + "endpointProtocol": "HTTP", + "endpointProtocolVersion": ["1.1"], + "subprotocol": "DSP", + "subprotocolBody": "id=urn:uuid:0c3d2db0-e5c6-27f9-5875-15a9a00e7a27;dspEndpoint=", + "subprotocolBodyEncoding": "plain", + "securityAttributes": [ + { + "type": "NONE", + "key": "NONE", + "value": "NONE" + } + ] + } + } + ], + "idShort": "singleLevelBomAsBuilt", + "id": "", + "semanticId": { + "type": "ExternalReference", + "keys": [ + { + "type": "Submodel", + "value": "urn:samm:io.catenax.single_level_bom_as_built:3.0.0#SingleLevelBomAsBuilt" + } + ] + }, + "description": [ + { + "language": "en", + "text": "DPP singleLevelBOMAsBuilt Submodel" + } + ], + "displayName": [] +}, +{ + "endpoints": [ + { + "interface": "SUBMODEL-3.0", + "protocolInformation": { + "href": "/api/public/", + "endpointProtocol": "HTTP", + "endpointProtocolVersion": ["1.1"], + "subprotocol": "DSP", + "subprotocolBody": "id=urn:uuid:0c3d2db0-e5c6-27f9-5875-15a9a00e7a27;dspEndpoint=", + "subprotocolBodyEncoding": "plain", + "securityAttributes": [ + { + "type": "NONE", + "key": "NONE", + "value": "NONE" + } + ] + } + } + ], + "idShort": "serialPart", + "id": "", + "semanticId": { + "type": "ExternalReference", + "keys": [ + { + "type": "Submodel", + "value": "urn:samm:io.catenax.serial_part:3.0.0#SerialPart" + } + ] + }, + "description": [ + { + "language": "en", + "text": "DPP serial part Submodel" + } + ], + "displayName": [] +} +``` -Attach the following **SingleLevelBOMAsBuilt** and **SerialPart** aspects to the existing Digital Twin object that you retrieved and substitute the corresponding placeholders **>** and **>** with their Ids generated in [step 1](#1-generate-the-ids). +- Substitute the corresponding placeholders **>** and **>** with their Ids generated in [step 1](#1-generate-the-ids). -Example to find the placeholders: -1 - Get access to the file [example-dt-irs](./resources/digital-twins/example-dt-irs.json) +> [!IMPORTANT] +> `` and `` are given in a paper -2 - Get the placeholders from the below table and search with CTRL + F in [example-dt-irs](./resources/digital-twins/example-dt-irs.json): +> [!CAUTION] +> Please make sure that you substitute all the placeholders with their values -3 - Substitute the following placeholders with their values. The values you will get them from the existing digital twin object that was retrieved. +- Search for the `supplementalSemanticId` keyword (if any) and remove that line. +- Save your changes to a json file. -| Placeholder | Path | -|------------------------- |-----------------------------------------------------------------| -| > | globalAssetId | -| | id | -| | idShort | -| > | specificAssetIds[1].value | -| | submodelDescriptors[0].endpoints[0].protocolInformation.href | -| | submodelDescriptors[1].endpoints[0].protocolInformation.href | -| | submodelDescriptors[2].endpoints[0].protocolInformation.href | -| > | submodelDescriptors[0].endpoints[0].protocolInformation.href | -| | submodelDescriptors[0].id | -| | submodelDescriptors[0].endpoints[0].subprotocolBody | -| | submodelDescriptors[1].endpoints[0].subprotocolBody | -| | submodelDescriptors[2].endpoints[0].subprotocolBody | -| > | submodelDescriptors[1].endpoints[0].protocolInformation.href | -| | submodelDescriptors[1].id | -| > | submodelDescriptors[2].endpoints[0].protocolInformation.href | -| | submodelDescriptors[2].id | -> [!TIP] -> The table shows number of occurences of a specific property, for example > has two occurences: `globalAssetId` and `id` +### Update Digital Twin with BOMAsBuilt and SerialPart Submodels +Update the digital twin submodel using the following command: -> [!CAUTION] -> Please make sure that you substitute all the placeholders with their values from the above table +> PUT /shell-descriptors/ -> Please only use your assigned UUID from [here](./resources/test-data/carParts.json) that matches the UUID on the given paper +*Windows* +
+ Click to see the Windows command -4 - Save your modified digital twin in json format. +```bash +curl.exe -v -X PUT "/shell-descriptors/" ` + -H "Content-Type: application/json" + --data-binary "@.json"`" +``` -Now, you can update the modified digital twin object using the following command: +
-> PUT /shell-descriptors/ +*Mac & Linux* +
+ Click here to see the Mac & Linux command ```bash -curl --location --request PUT '/shell-descriptors/' \ ---header 'Content-Type: application/json' --data '@resources/.json' +curl --location '/shell-descriptors/' \ +--header 'Content-Type: application/json' \ +--data "@.json" ``` +
+ Congratulations, you have successfully attached BOMAsBuilt relationships and serial part to the existing Digital Twin object.