@@ -124,17 +124,10 @@ predicate sinkModel(string row) { any(SinkModelCsv s).row(row) }
124124/** Holds if `row` is a summary model. */
125125predicate summaryModel ( string row ) { any ( SummaryModelCsv s ) .row ( row ) }
126126
127- bindingset [ input]
128- private predicate getKind ( string input , string kind , boolean generated ) {
129- input .splitAt ( ":" , 0 ) = "generated" and kind = input .splitAt ( ":" , 1 ) and generated = true
130- or
131- not input .matches ( "%:%" ) and kind = input and generated = false
132- }
133-
134127/** Holds if a source model exists for the given parameters. */
135128predicate sourceModel (
136129 string namespace , string type , boolean subtypes , string name , string signature , string ext ,
137- string output , string kind , boolean generated
130+ string output , string kind , string provenance
138131) {
139132 exists ( string row |
140133 sourceModel ( row ) and
@@ -146,14 +139,15 @@ predicate sourceModel(
146139 row .splitAt ( ";" , 4 ) = signature and
147140 row .splitAt ( ";" , 5 ) = ext and
148141 row .splitAt ( ";" , 6 ) = output and
149- exists ( string k | row .splitAt ( ";" , 7 ) = k and getKind ( k , kind , generated ) )
142+ row .splitAt ( ";" , 7 ) = kind and
143+ provenance = "manual"
150144 )
151145}
152146
153147/** Holds if a sink model exists for the given parameters. */
154148predicate sinkModel (
155149 string namespace , string type , boolean subtypes , string name , string signature , string ext ,
156- string input , string kind , boolean generated
150+ string input , string kind , string provenance
157151) {
158152 exists ( string row |
159153 sinkModel ( row ) and
@@ -165,34 +159,30 @@ predicate sinkModel(
165159 row .splitAt ( ";" , 4 ) = signature and
166160 row .splitAt ( ";" , 5 ) = ext and
167161 row .splitAt ( ";" , 6 ) = input and
168- exists ( string k | row .splitAt ( ";" , 7 ) = k and getKind ( k , kind , generated ) )
162+ row .splitAt ( ";" , 7 ) = kind and
163+ provenance = "manual"
169164 )
170165}
171166
172167/** Holds if a summary model exists for the given parameters. */
173168predicate summaryModel (
174169 string namespace , string type , boolean subtypes , string name , string signature , string ext ,
175- string input , string output , string kind , boolean generated
170+ string input , string output , string kind , string provenance
176171) {
177- summaryModel ( namespace , type , subtypes , name , signature , ext , input , output , kind , generated , _)
178- }
179-
180- /** Holds if a summary model `row` exists for the given parameters. */
181- predicate summaryModel (
182- string namespace , string type , boolean subtypes , string name , string signature , string ext ,
183- string input , string output , string kind , boolean generated , string row
184- ) {
185- summaryModel ( row ) and
186- row .splitAt ( ";" , 0 ) = namespace and
187- row .splitAt ( ";" , 1 ) = type and
188- row .splitAt ( ";" , 2 ) = subtypes .toString ( ) and
189- subtypes = [ true , false ] and
190- row .splitAt ( ";" , 3 ) = name and
191- row .splitAt ( ";" , 4 ) = signature and
192- row .splitAt ( ";" , 5 ) = ext and
193- row .splitAt ( ";" , 6 ) = input and
194- row .splitAt ( ";" , 7 ) = output and
195- exists ( string k | row .splitAt ( ";" , 8 ) = k and getKind ( k , kind , generated ) )
172+ exists ( string row |
173+ summaryModel ( row ) and
174+ row .splitAt ( ";" , 0 ) = namespace and
175+ row .splitAt ( ";" , 1 ) = type and
176+ row .splitAt ( ";" , 2 ) = subtypes .toString ( ) and
177+ subtypes = [ true , false ] and
178+ row .splitAt ( ";" , 3 ) = name and
179+ row .splitAt ( ";" , 4 ) = signature and
180+ row .splitAt ( ";" , 5 ) = ext and
181+ row .splitAt ( ";" , 6 ) = input and
182+ row .splitAt ( ";" , 7 ) = output and
183+ row .splitAt ( ";" , 8 ) = kind
184+ ) and
185+ provenance = "manual"
196186}
197187
198188/** Holds if `package` have CSV framework coverage. */
@@ -241,25 +231,25 @@ predicate modelCoverage(string package, int pkgs, string kind, string part, int
241231 part = "source" and
242232 n =
243233 strictcount ( string subpkg , string type , boolean subtypes , string name , string signature ,
244- string ext , string output , boolean generated |
234+ string ext , string output , string provenance |
245235 canonicalPackageHasASubpackage ( package , subpkg ) and
246- sourceModel ( subpkg , type , subtypes , name , signature , ext , output , kind , generated )
236+ sourceModel ( subpkg , type , subtypes , name , signature , ext , output , kind , provenance )
247237 )
248238 or
249239 part = "sink" and
250240 n =
251241 strictcount ( string subpkg , string type , boolean subtypes , string name , string signature ,
252- string ext , string input , boolean generated |
242+ string ext , string input , string provenance |
253243 canonicalPackageHasASubpackage ( package , subpkg ) and
254- sinkModel ( subpkg , type , subtypes , name , signature , ext , input , kind , generated )
244+ sinkModel ( subpkg , type , subtypes , name , signature , ext , input , kind , provenance )
255245 )
256246 or
257247 part = "summary" and
258248 n =
259249 strictcount ( string subpkg , string type , boolean subtypes , string name , string signature ,
260- string ext , string input , string output , boolean generated |
250+ string ext , string input , string output , string provenance |
261251 canonicalPackageHasASubpackage ( package , subpkg ) and
262- summaryModel ( subpkg , type , subtypes , name , signature , ext , input , output , kind , generated )
252+ summaryModel ( subpkg , type , subtypes , name , signature , ext , input , output , kind , provenance )
263253 )
264254 )
265255}
@@ -298,9 +288,8 @@ module CsvValidation {
298288 }
299289
300290 private string getInvalidModelKind ( ) {
301- exists ( string row , string k , string kind | summaryModel ( row ) |
302- k = row .splitAt ( ";" , 8 ) and
303- getKind ( k , kind , _) and
291+ exists ( string row , string kind | summaryModel ( row ) |
292+ kind = row .splitAt ( ";" , 8 ) and
304293 not kind = [ "taint" , "value" ] and
305294 result = "Invalid kind \"" + kind + "\" in summary model."
306295 )
0 commit comments