@@ -162,6 +162,13 @@ private predicate sinkModel(string row) { any(SinkModelCsv s).row(row) }
162162
163163private predicate summaryModel ( string row ) { any ( SummaryModelCsv s ) .row ( row ) }
164164
165+ bindingset [ input]
166+ private predicate getKind ( string input , string kind , boolean generated ) {
167+ input .splitAt ( ":" , 0 ) = "generated" and kind = input .splitAt ( ":" , 1 ) and generated = true
168+ or
169+ not input .matches ( "%:%" ) and kind = input and generated = false
170+ }
171+
165172/** Holds if a source model exists for the given parameters. */
166173predicate sourceModel (
167174 string namespace , string type , boolean subtypes , string name , string signature , string ext ,
@@ -177,8 +184,7 @@ predicate sourceModel(
177184 row .splitAt ( ";" , 4 ) = signature and
178185 row .splitAt ( ";" , 5 ) = ext and
179186 row .splitAt ( ";" , 6 ) = output and
180- row .splitAt ( ";" , 7 ) = kind and
181- generated = false
187+ exists ( string k | row .splitAt ( ";" , 7 ) = k and getKind ( k , kind , generated ) )
182188 )
183189}
184190
@@ -197,8 +203,7 @@ predicate sinkModel(
197203 row .splitAt ( ";" , 4 ) = signature and
198204 row .splitAt ( ";" , 5 ) = ext and
199205 row .splitAt ( ";" , 6 ) = input and
200- row .splitAt ( ";" , 7 ) = kind and
201- generated = false
206+ exists ( string k | row .splitAt ( ";" , 7 ) = k and getKind ( k , kind , generated ) )
202207 )
203208}
204209
@@ -218,8 +223,7 @@ predicate summaryModel(
218223 row .splitAt ( ";" , 5 ) = ext and
219224 row .splitAt ( ";" , 6 ) = input and
220225 row .splitAt ( ";" , 7 ) = output and
221- row .splitAt ( ";" , 8 ) = kind and
222- generated = false // We need to split the "kind" field on ":".
226+ exists ( string k | row .splitAt ( ";" , 8 ) = k and getKind ( k , kind , generated ) )
223227 )
224228}
225229
0 commit comments