Skip to content

Commit 111d228

Browse files
authored
Query examples
1 parent 7fbebca commit 111d228

1 file changed

Lines changed: 359 additions & 0 deletions

File tree

examples/queries

Lines changed: 359 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,359 @@
1+
# Recursive search for SMEs with values
2+
3+
POST https://plugfest10.aas-voyager.com/query/submodels/debug?limit=50000
4+
5+
{
6+
"Query": {
7+
"$select": "id",
8+
"$condition":
9+
{ "$or": [
10+
{ "$starts-with": [
11+
{ "$field": "$sme.ManufacturerName#value" },
12+
{ "$strVal": "ZVEI" }
13+
] },
14+
{ "$and": [
15+
{ "$eq": [
16+
{ "$field": "$sme.FootprintInformationModule2.CO2eq#value" },
17+
{ "$numVal": 103 }
18+
] },
19+
{ "$eq": [
20+
{ "$field": "$sme#value" },
21+
{ "$strVal": "2500" }
22+
] }
23+
] },
24+
{ "$and": [
25+
{ "$eq": [
26+
{ "$field": "$sme#value" },
27+
{ "$hexVal": "16#3DFFAF" }
28+
] }
29+
] }
30+
] }
31+
}
32+
}
33+
34+
# Combination of match with %, path and recursive search
35+
36+
POST https://plugfest10.aas-voyager.com/query/submodels/debug?limit=500000
37+
38+
{
39+
"Query": {
40+
"$select": "id",
41+
"$condition":
42+
{ "$or": [
43+
{ "$and": [
44+
{ "$boolean": true },
45+
{ "$eq": [
46+
{ "$field": "$sm#idShort" },
47+
{ "$strVal": "HandoverDocumentation" }
48+
] },
49+
{ "$match": [
50+
{ "$eq": [
51+
{ "$field": "$sme.Document%.DocumentVersion.Language%#value" },
52+
{ "$strVal": "ru" }
53+
] },
54+
{ "$eq": [
55+
{ "$field": "$sme.Document%.DocumentVersion.StatusValue#value" },
56+
{ "$strVal": "Released" }
57+
] }
58+
] }
59+
] },
60+
{ "$and": [
61+
{ "$boolean": true },
62+
{ "$eq": [
63+
{ "$field": "$sm#idShort" },
64+
{ "$strVal": "Nameplate" }
65+
] },
66+
{ "$starts-with": [
67+
{ "$field": "$sme.OrderCodeOfManufacturer#value" },
68+
{ "$strVal": "01" }
69+
] }
70+
] },
71+
{ "$and": [
72+
{ "$boolean": true },
73+
{ "$eq": [
74+
{ "$field": "$sm#idShort" },
75+
{ "$strVal": "TechnicalData" }
76+
] },
77+
{ "$eq": [
78+
{ "$field": "$sme#value" },
79+
{ "$hexVal": "16#3DFFAF" }
80+
] }
81+
] }
82+
] }
83+
}
84+
}
85+
86+
# recursive search edge case with not equal
87+
88+
https://plugfest10.aas-voyager.com/query/submodels/debug?limit=50000
89+
90+
{
91+
"Query": {
92+
"$select": "id",
93+
"$condition":
94+
{ "$or": [
95+
{ "$ne": [
96+
{ "$field": "$sme#value" },
97+
{ "$strVal": "" }
98+
] },
99+
{ "$ne": [
100+
{ "$field": "$sme#value" },
101+
{ "$numVal": 0 }
102+
] }
103+
] }
104+
}
105+
}
106+
107+
# And values in submodel by path
108+
109+
POST https://discovery.aas-voyager.com/query/submodels
110+
111+
{
112+
"Query": {
113+
"$condition": {
114+
"$and": [
115+
{
116+
"$eq": [
117+
{
118+
"$field": "$sm#idShort"
119+
},
120+
{
121+
"$strVal": "TechnicalData"
122+
}
123+
]
124+
},
125+
{
126+
"$and": [
127+
{
128+
"$eq": [
129+
{
130+
"$field": "$sme.TechnicalProperties.Number_of_HW_interfaces_Industrial_Ethernet#value"
131+
},
132+
{
133+
"$numVal": 2.0
134+
}
135+
]
136+
},
137+
{
138+
"$eq": [
139+
{
140+
"$field": "$sme.TechnicalProperties.max__supply_voltage_with_DC#value"
141+
},
142+
{
143+
"$numVal": 30.0
144+
}
145+
]
146+
},
147+
{
148+
"$lt": [
149+
{
150+
"$field": "$sme.TechnicalProperties.height#value"
151+
},
152+
{
153+
"$numVal": 130.0
154+
}
155+
]
156+
},
157+
{
158+
"$gt": [
159+
{
160+
"$field": "$sme.TechnicalProperties.height#value"
161+
},
162+
{
163+
"$numVal": 120.0
164+
}
165+
]
166+
},
167+
{
168+
"$eq": [
169+
{
170+
"$field": "$sme.TechnicalProperties.width#value"
171+
},
172+
{
173+
"$numVal": 45.0
174+
}
175+
]
176+
}
177+
]
178+
}
179+
]
180+
}
181+
}
182+
}
183+
184+
# And values in submodel by semanticId and match %
185+
186+
POST https://discovery.aas-voyager.com/query/submodels/debug
187+
188+
{
189+
"Query": {
190+
"$condition": {
191+
"$and": [
192+
{
193+
"$eq": [
194+
{
195+
"$field": "$sm#idShort"
196+
},
197+
{
198+
"$strVal": "TechnicalData"
199+
}
200+
]
201+
},
202+
{
203+
"$and": [
204+
{
205+
"$match": [
206+
{
207+
"$eq": [
208+
{
209+
"$field": "$sme.%#semanticId"
210+
},
211+
{
212+
"$strVal": "0173-1#02-AAO494#002"
213+
}
214+
]
215+
},
216+
{
217+
"$eq": [
218+
{
219+
"$field": "$sme.%#value"
220+
},
221+
{
222+
"$numVal": 2.0
223+
}
224+
]
225+
}
226+
]
227+
},
228+
{
229+
"$match": [
230+
{
231+
"$eq": [
232+
{
233+
"$field": "$sme.%#semanticId"
234+
},
235+
{
236+
"$strVal": "0173-1#02-AAB909#008"
237+
}
238+
]
239+
},
240+
{
241+
"$eq": [
242+
{
243+
"$field": "$sme.%#value"
244+
},
245+
{
246+
"$numVal": 30.0
247+
}
248+
]
249+
}
250+
]
251+
},
252+
{
253+
"$match": [
254+
{
255+
"$eq": [
256+
{
257+
"$field": "$sme.%#semanticId"
258+
},
259+
{
260+
"$strVal": "0173-1#02-BAA020#010"
261+
}
262+
]
263+
},
264+
{
265+
"$lt": [
266+
{
267+
"$field": "$sme.%#value"
268+
},
269+
{
270+
"$numVal": 130.0
271+
}
272+
]
273+
}
274+
]
275+
},
276+
{
277+
"$match": [
278+
{
279+
"$eq": [
280+
{
281+
"$field": "$sme.%#semanticId"
282+
},
283+
{
284+
"$strVal": "0173-1#02-BAA020#010"
285+
}
286+
]
287+
},
288+
{
289+
"$gt": [
290+
{
291+
"$field": "$sme.%#value"
292+
},
293+
{
294+
"$numVal": 120.0
295+
}
296+
]
297+
}
298+
]
299+
},
300+
{
301+
"$match": [
302+
{
303+
"$eq": [
304+
{
305+
"$field": "$sme.%#semanticId"
306+
},
307+
{
308+
"$strVal": "0173-1#02-BAF016#006"
309+
}
310+
]
311+
},
312+
{
313+
"$eq": [
314+
{
315+
"$field": "$sme.%#value"
316+
},
317+
{
318+
"$numVal": 45.0
319+
}
320+
]
321+
}
322+
]
323+
}
324+
]
325+
}
326+
]
327+
}
328+
}
329+
}
330+
331+
# match with 2 levels of SML
332+
333+
POST https://uc2.aas-voyager.com/query/submodels/debug
334+
335+
{
336+
"Query": {
337+
"$select": "match",
338+
"$condition":
339+
{ "$or": [
340+
{ "$and": [
341+
{ "$match": [
342+
{ "$eq": [
343+
{ "$field": "$sme.Records[].ItemOfChange.TechnicalData_Changes[].ReasonId#value" },
344+
{ "$strVal": "SOFTW" }
345+
] },
346+
{ "$eq": [
347+
{ "$field": "$sme.Records[].ItemOfChange.TechnicalData_Changes[].Version#value" },
348+
{ "$strVal": "1.4.0.3" }
349+
] },
350+
{ "$ge": [
351+
{ "$field": "$sme.Records[].DateOfRecord#value" },
352+
{ "$strVal": "2024-04-24T07:53Z" }
353+
] }
354+
] }
355+
] }
356+
] }
357+
}
358+
}
359+

0 commit comments

Comments
 (0)