1
1
[
2
- {
3
- "id" : " 739f17c6.5cdae8" ,
4
- "type" : " inject" ,
5
- "z" : " 51af8c53.929c6c" ,
6
- "name" : " Non-standard (JSON) message" ,
7
- "topic" : " " ,
8
- "payload" : " {\" id\" :\" vehicle:WasteManagement:1\" ,\" type\" :\" BasicVehicle\" ,\" vehicleType\" :\" lorry\" ,\" category1\" :\" municipalServices\" ,\" latitude\" :-3.164485591715449,\" longitude\" :40.62785133667262,\" name\" :\" C Recogida 1\" ,\" speed\" :50,\" cargoWeight\" :314,\" serviceStatus\" :\" onRoute\" ,\" serviceProvided1\" :\" garbageCollection\" ,\" serviceProvided2\" :\" wasteContainerCleaning\" ,\" areaServed\" :\" Centro\" ,\" refVehicleModel\" :\" vehiclemodel:econic\" ,\" vehiclePlateIdentifier\" :\" 3456ABC\" }" ,
9
- "payloadType" : " json" ,
10
- "repeat" : " " ,
11
- "crontab" : " " ,
12
- "once" : false ,
13
- "onceDelay" : 0.1 ,
14
- "x" : 210 ,
15
- "y" : 820 ,
16
- "wires" : [
17
- [
18
- " 707f7dae.377adc"
19
- ]
20
- ]
21
- },
22
2
{
23
3
"id" : " 707f7dae.377adc" ,
24
4
"type" : " json-multi-schema-transformer" ,
25
5
"z" : " 51af8c53.929c6c" ,
26
6
"name" : " " ,
27
- "transformsUrl" : " https://raw.githubusercontent.com/alexandrainst/node-red-contrib-json-multi-schema/master/examples/smart-data-transforms.json" ,
28
- "x" : 590 ,
29
- "y" : 820 ,
7
+ "x" : 650 ,
8
+ "y" : 840 ,
30
9
"wires" : [
31
10
[
32
11
" 1a287ba9.00e0d4"
39
18
"z" : " 51af8c53.929c6c" ,
40
19
"name" : " " ,
41
20
"mappingsUrl" : " https://raw.githubusercontent.com/alexandrainst/node-red-contrib-json-multi-schema/master/examples/smart-data-models.json" ,
42
- "x" : 580 ,
43
- "y" : 900 ,
21
+ "x" : 640 ,
22
+ "y" : 920 ,
44
23
"wires" : [
45
24
[
46
25
" 80ef3fce.aa4c2"
52
31
"type" : " json-multi-schema-validator" ,
53
32
"z" : " 51af8c53.929c6c" ,
54
33
"name" : " " ,
55
- "x" : 580 ,
56
- "y" : 980 ,
34
+ "x" : 640 ,
35
+ "y" : 1000 ,
57
36
"wires" : [
58
37
[
59
38
" 935312e9.392738"
65
44
"type" : " function" ,
66
45
"z" : " 51af8c53.929c6c" ,
67
46
"name" : " Result formatter based on \" msg.error\" " ,
68
- "func" : " if (msg.error) {\n msg.payload = '❌ Invalid according to ' + msg.schemaUrl + ' : ' + msg.error;\n } else {\n msg.payload = '✔ Valid️ according to ' + msg.schemaUrl ;\n }\n return msg;\n " ,
47
+ "func" : " if (msg.error || !msg.validUrl ) {\n msg.result = '❌ Invalid according to ' + msg.validUrl + ' : ' + msg.error;\n } else {\n msg.result = '✔ Valid️ according to ' + msg.validUrl ;\n }\n return msg;\n " ,
69
48
"outputs" : 1 ,
70
49
"noerr" : 0 ,
71
- "x" : 610 ,
72
- "y" : 1060 ,
50
+ "x" : 670 ,
51
+ "y" : 1080 ,
73
52
"wires" : [
74
53
[
75
54
" e3a048d.4f836b8"
85
64
"tosidebar" : true ,
86
65
"console" : false ,
87
66
"tostatus" : false ,
88
- "complete" : " payload " ,
67
+ "complete" : " result " ,
89
68
"targetType" : " msg" ,
90
- "x" : 890 ,
91
- "y" : 1060 ,
69
+ "x" : 950 ,
70
+ "y" : 1080 ,
92
71
"wires" : []
93
72
},
94
73
{
97
76
"z" : " 51af8c53.929c6c" ,
98
77
"name" : " Standard message with unknown schema" ,
99
78
"topic" : " " ,
100
- "payload" : " {\" id\" :\" vehicle:WasteManagement:1 \" ,\" type\" :\" Vehicle \" ,\" vehicleType \" :\" lorry \" ,\" category\" :[\" municipalServices \" ],\" location \" :{ \" type \" : \" Point \" ,\" coordinates \" :[40.62785133667262,-3.164485591715449]}, \" name \" : \" C Recogida 1 \" ,\" speed \" :50, \" cargoWeight \" :314 ,\" serviceStatus \" :\" onRoute \" ,\" serviceProvided \" :[\" garbageCollection \" ,\" wasteContainerCleaning \" ], \" areaServed \" :\" Centro \" ,\" refVehicleModel \" :\" vehiclemodel:econic \" ,\" vehiclePlateIdentifier \" :\" 3456ABC \" }" ,
79
+ "payload" : " {\" id\" :\" wastecontainer:Fleming:12a \" ,\" type\" :\" WasteContainer \" ,\" status \" :\" ok \" ,\" category\" :[\" underground \" ],\" dateLastEmptying \" :\" 2016-06-21T15:05:59.408Z \" ,\" serialNumber \" :\" ab56kjl \" ,\" nextActuationDeadline \" :\" 2016-06-28T15:05:59.408Z \" ,\" refWasteContainerIsle \" :\" wastecontainerisle:Fleming:12 \" ,\" refDevice \" :[\" device-Fleming:12a:1 \" ] ,\" location \" :{ \" type \" :\" Point \" ,\" coordinates \" :[-3.164485591715,40.62785133667]}, \" fillingLevel \" :0.4 ,\" refWasteContainerModel \" :\" wastecontainermodel:c1 \" }" ,
101
80
"payloadType" : " json" ,
102
81
"repeat" : " " ,
103
82
"crontab" : " " ,
104
83
"once" : false ,
105
84
"onceDelay" : 0.1 ,
106
- "x" : 240 ,
107
- "y" : 900 ,
85
+ "x" : 200 ,
86
+ "y" : 920 ,
108
87
"wires" : [
109
88
[
110
89
" 1a287ba9.00e0d4"
123
102
"crontab" : " " ,
124
103
"once" : false ,
125
104
"onceDelay" : 0.1 ,
126
- "x" : 130 ,
127
- "y" : 1060 ,
105
+ "x" : 90 ,
106
+ "y" : 1000 ,
128
107
"wires" : [
129
108
[
130
109
" c16edc29.b8e628"
136
115
"type" : " function" ,
137
116
"z" : " 51af8c53.929c6c" ,
138
117
"name" : " Standard message with known schema" ,
139
- "func" : " msg.payload = {\n \" id\" : \" vehicle:WasteManagement:1\" ,\n \" type\" : \" Vehicle\" ,\n \" vehicleType\" : \" lorry\" ,\n \" category\" : [\n \" municipalServices\"\n ],\n \" location\" : {\n \" type\" : \" Point\" ,\n \" coordinates\" : [\n 40.62785133667262,\n -3.164485591715449\n ]\n },\n \" name\" : \" C Recogida 1\" ,\n \" speed\" : 50,\n \" cargoWeight\" : 314,\n \" serviceStatus\" : \" onRoute\" ,\n \" serviceProvided\" : [\n \" garbageCollection\" ,\n \" wasteContainerCleaning\"\n ],\n \" areaServed\" : \" Centro\" ,\n \" refVehicleModel\" : \" vehiclemodel:econic\" ,\n \" vehiclePlateIdentifier\" : \" 3456ABC\"\n };\n msg.schemaUrl = \" https://smart-data-models.github.io/data-models/specs/Transportation/Vehicle/Vehicle/schema.json\" ;\n return msg;\n " ,
118
+ "func": "msg.payload = {\n \"id\": \"urn:ngsi-ld:Alert:Alert:1\",\n \"type\": \"Alert\",\n \"createdAt\": \"2019-06-06T12:06:06\",\n \"modifiedAt\": \"2019-06-07T12:07:06\",\n \"category\": {\n \"type\": \"Property\",\n \"value\": \"traffic\"\n },\n \"subCategory\": {\n \"type\": \"Property\",\n \"value\": \"trafficJam\"\n },\n \"validTo\": {\n \"type\": \"Property\",\n \"value\": {\n \"@type\": \"DateTime\",\n \"@value\": \"2017-01-02T10:25:55.00Z\"\n }\n },\n \"description\": {\n \"type\": \"Property\",\n \"value\": \"The road is completely blocked for 3kms\"\n },\n \"location\": {\n \"type\": \"GeoProperty\",\n \"value\": {\n \"type\": \"Point\",\n \"coordinates\": [-3.712247222222222, 40.423852777777775]\n }\n },\n \"dateIssued\": {\n \"type\": \"Property\",\n \"value\": {\n \"@type\": \"DateTime\",\n \"@value\": \"2017-01-02T09:25:55.00Z\"\n }\n },\n \"alertSource\": {\n \"type\": \"Property\",\n \"value\": \"https://account.lab.fiware.org/users/8\"\n },\n \"validFrom\": {\n \"type\": \"Property\",\n \"value\": {\n \"@type\": \"DateTime\",\n \"@value\": \"2017-01-02T09:25:55.00Z\"\n }\n },\n \"severity\": {\n \"type\": \"Property\",\n \"value\": \"high\"\n },\n \"@context\": [\n \"https://schema.lab.fiware.org/ld/context\",\n \"https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld\"\n ]\n};\nmsg.schemaUrl = \"https://smart-data-models.github.io/data-models/specs/Alert/alert-schema.json\";\nreturn msg;\n",
140
119
"outputs" : 1 ,
141
120
"noerr" : 0 ,
142
- "x" : 240 ,
143
- "y" : 980 ,
121
+ "x" : 320 ,
122
+ "y" : 1000 ,
144
123
"wires" : [
145
124
[
146
125
" 80ef3fce.aa4c2"
153
132
"z" : " 51af8c53.929c6c" ,
154
133
"name" : " using \" Mappings URL\" property" ,
155
134
"info" : " " ,
156
- "x" : 890 ,
135
+ "x" : 950 ,
157
136
"y" : 900 ,
158
137
"wires" : []
159
138
},
160
139
{
161
- "id" : " 7f14c104.4f98e8" ,
140
+ "id" : " 51317bda.0a468c" ,
141
+ "type" : " inject" ,
142
+ "z" : " 51af8c53.929c6c" ,
143
+ "name" : " Non-standard message with unknown transformation" ,
144
+ "topic" : " " ,
145
+ "payload" : " {\" id\" :\" TA120-T246177\" ,\" type\" :\" Cesva-TA120\" ,\" NoiseLevelObserved\" :{\" id\" :\" TA120-T246177-NoiseLevelObserved-2018-09-17T07:01:09.000000Z\" ,\" sonometerClass\" :\" 1\" ,\" location\" :{\" coordinates\" :[24.985891,60.274286],\" type\" :\" Point\" },\" measurand\" :[\" LAeq | 48.6 | A-weighted, equivalent, sound level\" ],\" dateObserved\" :\" 2018-09-17T07:01:09.000000Z\" ,\" LAeq\" :48.6,\" type\" :\" NoiseLevelObserved\" }}" ,
146
+ "payloadType" : " json" ,
147
+ "repeat" : " " ,
148
+ "crontab" : " " ,
149
+ "once" : false ,
150
+ "onceDelay" : 0.1 ,
151
+ "x" : 230 ,
152
+ "y" : 760 ,
153
+ "wires" : [
154
+ [
155
+ " cd146fe0.82e9f"
156
+ ]
157
+ ]
158
+ },
159
+ {
160
+ "id" : " cd146fe0.82e9f" ,
161
+ "type" : " json-multi-schema-resolver" ,
162
+ "z" : " 51af8c53.929c6c" ,
163
+ "name" : " " ,
164
+ "mappingsUrl" : " https://raw.githubusercontent.com/alexandrainst/node-red-contrib-json-multi-schema/master/examples/smart-data-transforms.json" ,
165
+ "x" : 640 ,
166
+ "y" : 760 ,
167
+ "wires" : [
168
+ [
169
+ " 707f7dae.377adc"
170
+ ]
171
+ ]
172
+ },
173
+ {
174
+ "id" : " 80f398e9.42f2c" ,
162
175
"type" : " comment" ,
163
176
"z" : " 51af8c53.929c6c" ,
164
- "name" : " using \" Transforms URL\" property" ,
177
+ "name" : " using \" Mappings URL\" property" ,
165
178
"info" : " " ,
166
- "x" : 890 ,
167
- "y" : 820 ,
179
+ "x" : 950 ,
180
+ "y" : 760 ,
168
181
"wires" : []
182
+ },
183
+ {
184
+ "id" : " c9e40c.0b8663f8" ,
185
+ "type" : " inject" ,
186
+ "z" : " 51af8c53.929c6c" ,
187
+ "name" : " Trigger" ,
188
+ "topic" : " " ,
189
+ "payload" : " " ,
190
+ "payloadType" : " date" ,
191
+ "repeat" : " " ,
192
+ "crontab" : " " ,
193
+ "once" : false ,
194
+ "onceDelay" : 0.1 ,
195
+ "x" : 90 ,
196
+ "y" : 840 ,
197
+ "wires" : [
198
+ [
199
+ " 67995555.798d54"
200
+ ]
201
+ ]
202
+ },
203
+ {
204
+ "id" : " 67995555.798d54" ,
205
+ "type" : " function" ,
206
+ "z" : " 51af8c53.929c6c" ,
207
+ "name" : " Standard message with known schema" ,
208
+ "func" : " msg.payload = {\n \" id\" : \" TA120-T246177\" ,\n \" type\" : \" Cesva-TA120\" ,\n \" NoiseLevelObserved\" : {\n \" id\" : \" TA120-T246177-NoiseLevelObserved-2018-09-17T07:01:09.000000Z\" ,\n \" sonometerClass\" : \" 1\" ,\n \" location\" : {\n \" coordinates\" : [\n 24.985891,\n 60.274286\n ],\n \" type\" : \" Point\"\n },\n \" measurand\" : [\n \" LAeq | 48.6 | A-weighted, equivalent, sound level\"\n ],\n \" dateObserved\" : \" 2018-09-17T07:01:09.000000Z\" ,\n \" LAeq\" : 48.6,\n \" type\" : \" NoiseLevelObserved\"\n }\n };\n msg.schemaUrl = \" https://raw.githubusercontent.com/alexandrainst/node-red-contrib-json-multi-schema/master/examples/Cesva-TA120-to-NoiseLevelObserved.jsonata.js\" ;\n return msg;\n " ,
209
+ "outputs" : 1 ,
210
+ "noerr" : 0 ,
211
+ "x" : 320 ,
212
+ "y" : 840 ,
213
+ "wires" : [
214
+ [
215
+ " 707f7dae.377adc"
216
+ ]
217
+ ]
169
218
}
170
219
]
0 commit comments