@@ -49,6 +49,11 @@ signature module ExtensionsSig {
4949 predicate neutralModel (
5050 string namespace , string type , string name , string signature , string kind , string provenance
5151 ) ;
52+
53+ /**
54+ * Holds if the package `package` is part of the group `group`.
55+ */
56+ predicate packageGrouping ( string group , string package ) ;
5257}
5358
5459signature module InputSig {
@@ -157,21 +162,44 @@ module ModelsAsData<ExtensionsSig Extensions, InputSig Input> {
157162 )
158163 }
159164
165+ /** Gets the prefix for a group of packages/namespaces. */
166+ private string groupPrefix ( ) { result = "group:" }
167+
168+ /**
169+ * Gets a package/namespace represented by `namespaceOrGroup`.
170+ *
171+ * If `namespaceOrGroup` is of the form `group:<groupname>` then `result` is a
172+ * package/namespace in the group `<groupname>`, as determined by `packageGrouping`.
173+ * Otherwise, `result` is `namespaceOrGroup`.
174+ */
175+ bindingset [ namespaceOrGroup]
176+ private string getNamespace ( string namespaceOrGroup ) {
177+ not exists ( string group | namespaceOrGroup = groupPrefix ( ) + group ) and
178+ result = namespaceOrGroup
179+ or
180+ exists ( string group |
181+ Extensions:: packageGrouping ( group , result ) and
182+ namespaceOrGroup = groupPrefix ( ) + group
183+ )
184+ }
185+
160186 /**
161187 * Holds if a source model exists for the given parameters.
162188 */
163189 predicate sourceModel (
164190 string namespace , string type , boolean subtypes , string name , string signature , string ext ,
165191 string output , string kind , string provenance , string model
166192 ) {
167- exists ( QlBuiltins:: ExtensionId madId |
168- Extensions:: sourceModel ( namespace , type , subtypes , name , signature , ext , output , kind ,
169- provenance , madId ) and
170- model = "MaD:" + madId .toString ( )
193+ exists ( string namespaceOrGroup | namespace = getNamespace ( namespaceOrGroup ) |
194+ exists ( QlBuiltins:: ExtensionId madId |
195+ Extensions:: sourceModel ( namespaceOrGroup , type , subtypes , name , signature , ext , output ,
196+ kind , provenance , madId ) and
197+ model = "MaD:" + madId .toString ( )
198+ )
199+ or
200+ Input:: additionalSourceModel ( namespaceOrGroup , type , subtypes , name , signature , ext , output ,
201+ kind , provenance , model )
171202 )
172- or
173- Input:: additionalSourceModel ( namespace , type , subtypes , name , signature , ext , output , kind ,
174- provenance , model )
175203 }
176204
177205 /**
@@ -181,14 +209,42 @@ module ModelsAsData<ExtensionsSig Extensions, InputSig Input> {
181209 string namespace , string type , boolean subtypes , string name , string signature , string ext ,
182210 string input , string kind , string provenance , string model
183211 ) {
184- exists ( QlBuiltins:: ExtensionId madId |
185- Extensions:: sinkModel ( namespace , type , subtypes , name , signature , ext , input , kind ,
212+ exists ( string namespaceOrGroup | namespace = getNamespace ( namespaceOrGroup ) |
213+ exists ( QlBuiltins:: ExtensionId madId |
214+ Extensions:: sinkModel ( namespaceOrGroup , type , subtypes , name , signature , ext , input , kind ,
215+ provenance , madId ) and
216+ model = "MaD:" + madId .toString ( )
217+ )
218+ or
219+ Input:: additionalSinkModel ( namespaceOrGroup , type , subtypes , name , signature , ext , input ,
220+ kind , provenance , model )
221+ )
222+ }
223+
224+ /** Holds if a barrier model exists for the given parameters. */
225+ predicate barrierModel (
226+ string namespace , string type , boolean subtypes , string name , string signature , string ext ,
227+ string output , string kind , string provenance , string model
228+ ) {
229+ exists ( string namespaceOrGroup , QlBuiltins:: ExtensionId madId |
230+ namespace = getNamespace ( namespaceOrGroup ) and
231+ Extensions:: barrierModel ( namespaceOrGroup , type , subtypes , name , signature , ext , output , kind ,
186232 provenance , madId ) and
187233 model = "MaD:" + madId .toString ( )
188234 )
189- or
190- Input:: additionalSinkModel ( namespace , type , subtypes , name , signature , ext , input , kind ,
191- provenance , model )
235+ }
236+
237+ /** Holds if a barrier guard model exists for the given parameters. */
238+ predicate barrierGuardModel (
239+ string namespace , string type , boolean subtypes , string name , string signature , string ext ,
240+ string input , string acceptingvalue , string kind , string provenance , string model
241+ ) {
242+ exists ( string namespaceOrGroup , QlBuiltins:: ExtensionId madId |
243+ namespace = getNamespace ( namespaceOrGroup ) and
244+ Extensions:: barrierGuardModel ( namespaceOrGroup , type , subtypes , name , signature , ext , input ,
245+ acceptingvalue , kind , provenance , madId ) and
246+ model = "MaD:" + madId .toString ( )
247+ )
192248 }
193249
194250 /**
@@ -198,14 +254,27 @@ module ModelsAsData<ExtensionsSig Extensions, InputSig Input> {
198254 string namespace , string type , boolean subtypes , string name , string signature , string ext ,
199255 string input , string output , string kind , string provenance , string model
200256 ) {
201- exists ( QlBuiltins:: ExtensionId madId |
202- Extensions:: summaryModel ( namespace , type , subtypes , name , signature , ext , input , output , kind ,
203- provenance , madId ) and
204- model = "MaD:" + madId .toString ( )
257+ exists ( string namespaceOrGroup | namespace = getNamespace ( namespaceOrGroup ) |
258+ exists ( QlBuiltins:: ExtensionId madId |
259+ Extensions:: summaryModel ( namespaceOrGroup , type , subtypes , name , signature , ext , input ,
260+ output , kind , provenance , madId ) and
261+ model = "MaD:" + madId .toString ( )
262+ )
263+ or
264+ Input:: additionalSummaryModel ( namespaceOrGroup , type , subtypes , name , signature , ext , input ,
265+ output , kind , provenance , model )
266+ )
267+ }
268+
269+ /**
270+ * Holds if a neutral model exists for the given parameters.
271+ */
272+ predicate neutralModel (
273+ string namespace , string type , string name , string signature , string kind , string provenance
274+ ) {
275+ exists ( string namespaceOrGroup | namespace = getNamespace ( namespaceOrGroup ) |
276+ Extensions:: neutralModel ( namespaceOrGroup , type , name , signature , kind , provenance )
205277 )
206- or
207- Input:: additionalSummaryModel ( namespace , type , subtypes , name , signature , ext , input , output ,
208- kind , provenance , model )
209278 }
210279
211280 private predicate relevantNamespace ( string namespace ) {
0 commit comments