|
30 | 30 | serverUrl = "http://localhost:1026" # supposed that your broker is installed in localhost. Edit to match your configuration |
31 | 31 | dataModel = "CarbonFootprint" |
32 | 32 | subject = "dataModel.Environment" |
33 | | -emissionSource = "Transport" |
| 33 | +emissionSource = "{'type': 'Property', 'value': 'Transport'}" |
34 | 34 | attribute = "emissionSource" |
35 | 35 | value = emissionSource |
36 | 36 | # 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 |
37 | 37 | print(sdm.update_broker(dataModel, subject, attribute, value, serverUrl=serverUrl, updateThenCreate=True)) |
38 | 38 |
|
39 | | -CO2eq = 25.5 |
| 39 | +CO2eq = {'type': 'Property', 'value': 25.5} |
40 | 40 | attribute = "CO2eq" |
41 | 41 | value = CO2eq |
42 | 42 | # 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 |
43 | 43 | print(sdm.update_broker(dataModel, subject, attribute, value, serverUrl=serverUrl, updateThenCreate=True)) |
44 | 44 |
|
45 | | -emissionDate = "2025-05-12T10:00:00Z" |
| 45 | +emissionDate = "{'type': 'Property', 'value': {'@type': 'date-time', '@value': '2025-05-12T10:00:00Z'}}" |
46 | 46 | attribute = "emissionDate" |
47 | 47 | value = emissionDate |
48 | 48 | # 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 |
49 | 49 | print(sdm.update_broker(dataModel, subject, attribute, value, serverUrl=serverUrl, updateThenCreate=True)) |
50 | 50 |
|
51 | | -relatedSource = "urn:ngsi-ld:Source:001" |
| 51 | +relatedSource = "{'type': 'Relationship', 'object': 'urn:ngsi-ld:Source:001'}" |
52 | 52 | attribute = "relatedSource" |
53 | 53 | value = relatedSource |
54 | 54 | # 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