Skip to content

Commit

Permalink
chore(irs): updated irs guide
Browse files Browse the repository at this point in the history
  • Loading branch information
saudkhan116 committed Dec 4, 2024
1 parent 1ab26a6 commit 52758de
Showing 1 changed file with 126 additions and 43 deletions.
169 changes: 126 additions & 43 deletions dpp-tutorial/irs-drill-down.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ curl --location '<DATA_SERVICE_URL>/<SerialPartID>' \
--header 'Content-Type: application/json' \
```

## Attach BOMAsBuilt to Existing Digital Twin
## 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:

Expand Down Expand Up @@ -269,7 +269,6 @@ Example JSON response:
"id": "urn:uuid:a530baad-77ad-4ffc-a925-f3a207839791",
"specificAssetIds": [
{
"supplementalSemanticIds": [],
"name": "manufacturerPartId",
"value": "MPI7654",
"externalSubjectId": {
Expand All @@ -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": "<EDC_DATAPLANE_URL>/api/public/<BOMAsBuiltID>",
"endpointProtocol": "HTTP",
"endpointProtocolVersion": ["1.1"],
"subprotocol": "DSP",
"subprotocolBody": "id=urn:uuid:0c3d2db0-e5c6-27f9-5875-15a9a00e7a27;dspEndpoint=<EDC_CONTROLPLANE_URL>",
"subprotocolBodyEncoding": "plain",
"securityAttributes": [
{
"type": "NONE",
"key": "NONE",
"value": "NONE"
}
]
}
}
],
"idShort": "singleLevelBomAsBuilt",
"id": "<BOMAsBuiltID>",
"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": "<EDC_DATAPLANE_URL>/api/public/<serialPartID>",
"endpointProtocol": "HTTP",
"endpointProtocolVersion": ["1.1"],
"subprotocol": "DSP",
"subprotocolBody": "id=urn:uuid:0c3d2db0-e5c6-27f9-5875-15a9a00e7a27;dspEndpoint=<EDC_CONTROLPLANE_URL>",
"subprotocolBodyEncoding": "plain",
"securityAttributes": [
{
"type": "NONE",
"key": "NONE",
"value": "NONE"
}
]
}
}
],
"idShort": "serialPart",
"id": "<serialPartID>",
"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 **<BOMAsBuiltID<BOMAsBuiltID>>** and **<SerialPart<SerialPart>>** with their Ids generated in [step 1](#1-generate-the-ids).
- Substitute the corresponding placeholders **<BOMAsBuiltID<BOMAsBuiltID>>** and **<SerialPart<SerialPart>>** 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]
> `<EDC_CONTROLLANE_URL>` and `<EDC_DATAPLANE_URL>` 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 |
|------------------------- |-----------------------------------------------------------------|
| <digitalTwinId<digitalTwinId>> | globalAssetId |
| | id |
| <PART_NAME> | idShort |
| <YOUR PART INSTANCE ID<y>> | specificAssetIds[1].value |
| <EDC_DATAPLANE_URL> | submodelDescriptors[0].endpoints[0].protocolInformation.href |
| | submodelDescriptors[1].endpoints[0].protocolInformation.href |
| | submodelDescriptors[2].endpoints[0].protocolInformation.href |
| <digitalTwinSubmodelId<y>> | submodelDescriptors[0].endpoints[0].protocolInformation.href |
| | submodelDescriptors[0].id |
| <EDC_CONTROLPLANE_URL> | submodelDescriptors[0].endpoints[0].subprotocolBody |
| | submodelDescriptors[1].endpoints[0].subprotocolBody |
| | submodelDescriptors[2].endpoints[0].subprotocolBody |
| <BOMAsBuiltID<BOMAsBuiltID>> | submodelDescriptors[1].endpoints[0].protocolInformation.href |
| | submodelDescriptors[1].id |
| <serialPartID<serialPartID>> | submodelDescriptors[2].endpoints[0].protocolInformation.href |
| | submodelDescriptors[2].id |

> [!TIP]
> The table shows number of occurences of a specific property, for example <digitalTwinId<y>> 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/<DIGITAL_TWIN_ID_BASE64_ENCODED>
> Please only use your assigned UUID from [here](./resources/test-data/carParts.json) that matches the UUID on the given paper
*Windows*
<details>
<summary>Click to see the Windows command</summary>

4 - Save your modified digital twin in json format.
```bash
curl.exe -v -X PUT "<DIGITAL_TWIN_REGISTRY_URL>/shell-descriptors/<DIGITAL_TWIN_ID_BASE64_ENCODED>" `
-H "Content-Type: application/json"
--data-binary "@<YOUR_JSON_FILE>.json"`"
```
Now, you can update the modified digital twin object using the following command:
</details>
> PUT /shell-descriptors/<DIGITAL_TWIN_ID_BASE64_ENCODED>
*Mac & Linux*
<details>
<summary>Click here to see the Mac & Linux command</summary>
```bash
curl --location --request PUT '<DIGITAL_TWIN_REGISTRY_URL>/shell-descriptors/<DIGITAL_TWIN_ID_BASE64_ENCODED>' \
--header 'Content-Type: application/json' --data '@resources/<YOUR_DT_JSON>.json'
curl --location '<DIGITAL_TWIN_REGISTRY_URL>/shell-descriptors/<DIGITAL_TWIN_ID_BASE64_ENCODED>' \
--header 'Content-Type: application/json' \
--data "@<YOUR_JSON_FILE>.json"
```
</details>
Congratulations, you have successfully attached BOMAsBuilt relationships and serial part to the existing Digital Twin object.

0 comments on commit 52758de

Please sign in to comment.