Skip to content

Commit fd8bd71

Browse files
created example of code
1 parent 933d38c commit fd8bd71

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

CarbonFootprint/code/code_for_using_dataModel.Environment_CarbonFootprint.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,25 @@
3030
serverUrl = "http://localhost:1026" # supposed that your broker is installed in localhost. Edit to match your configuration
3131
dataModel = "CarbonFootprint"
3232
subject = "dataModel.Environment"
33-
emissionSource = "Transport"
33+
emissionSource = "{'type': 'Property', 'value': 'Transport'}"
3434
attribute = "emissionSource"
3535
value = emissionSource
3636
# The next line creates the query for inserting this attribute in a NGSI-LD context broker if the attribute does not exist it creates it
3737
print(sdm.update_broker(dataModel, subject, attribute, value, serverUrl=serverUrl, updateThenCreate=True))
3838

39-
CO2eq = 25.5
39+
CO2eq = {'type': 'Property', 'value': 25.5}
4040
attribute = "CO2eq"
4141
value = CO2eq
4242
# The next line creates the query for inserting this attribute in a NGSI-LD context broker if the attribute does not exist it creates it
4343
print(sdm.update_broker(dataModel, subject, attribute, value, serverUrl=serverUrl, updateThenCreate=True))
4444

45-
emissionDate = "2025-05-12T10:00:00Z"
45+
emissionDate = "{'type': 'Property', 'value': {'@type': 'date-time', '@value': '2025-05-12T10:00:00Z'}}"
4646
attribute = "emissionDate"
4747
value = emissionDate
4848
# The next line creates the query for inserting this attribute in a NGSI-LD context broker if the attribute does not exist it creates it
4949
print(sdm.update_broker(dataModel, subject, attribute, value, serverUrl=serverUrl, updateThenCreate=True))
5050

51-
relatedSource = "urn:ngsi-ld:Source:001"
51+
relatedSource = "{'type': 'Relationship', 'object': 'urn:ngsi-ld:Source:001'}"
5252
attribute = "relatedSource"
5353
value = relatedSource
5454
# The next line creates the query for inserting this attribute in a NGSI-LD context broker if the attribute does not exist it creates it

0 commit comments

Comments
 (0)