1
1
/**
2
2
* INTERNAL use only. This is an experimental API subject to change without notice.
3
3
*
4
- * Provides classes and predicates for dealing with flow models specified in CSV format.
4
+ * Provides classes and predicates for dealing with flow models specified
5
+ * in data extensions and CSV format.
5
6
*
6
7
* The CSV specification has the following columns:
7
8
* - Sources:
8
- * `namespace ; type; subtypes; name; signature; ext; output; kind; provenance`
9
+ * `package ; type; subtypes; name; signature; ext; output; kind; provenance`
9
10
* - Sinks:
10
- * `namespace ; type; subtypes; name; signature; ext; input; kind; provenance`
11
+ * `package ; type; subtypes; name; signature; ext; input; kind; provenance`
11
12
* - Summaries:
12
- * `namespace ; type; subtypes; name; signature; ext; input; output; kind; provenance`
13
+ * `package ; type; subtypes; name; signature; ext; input; output; kind; provenance`
13
14
* - Negative Summaries:
14
- * `namespace ; type; name; signature; provenance`
15
+ * `package ; type; name; signature; provenance`
15
16
* A negative summary is used to indicate that there is no flow via a callable.
16
17
*
17
18
* The interpretation of a row is similar to API-graphs with a left-to-right
18
19
* reading.
19
- * 1. The `namespace ` column selects a package.
20
+ * 1. The `package ` column selects a package.
20
21
* 2. The `type` column selects a type within that package.
21
22
* 3. The `subtypes` is a boolean that indicates whether to jump to an
22
23
* arbitrary subtype of that type.
@@ -433,12 +434,12 @@ predicate negativeSummaryModel(string row) { any(NegativeSummaryModelCsv s).row(
433
434
434
435
/** Holds if a source model exists for the given parameters. */
435
436
predicate sourceModel (
436
- string namespace , string type , boolean subtypes , string name , string signature , string ext ,
437
+ string package , string type , boolean subtypes , string name , string signature , string ext ,
437
438
string output , string kind , string provenance
438
439
) {
439
440
exists ( string row |
440
441
sourceModel ( row ) and
441
- row .splitAt ( ";" , 0 ) = namespace and
442
+ row .splitAt ( ";" , 0 ) = package and
442
443
row .splitAt ( ";" , 1 ) = type and
443
444
row .splitAt ( ";" , 2 ) = subtypes .toString ( ) and
444
445
subtypes = [ true , false ] and
@@ -453,12 +454,12 @@ predicate sourceModel(
453
454
454
455
/** Holds if a sink model exists for the given parameters. */
455
456
predicate sinkModel (
456
- string namespace , string type , boolean subtypes , string name , string signature , string ext ,
457
+ string package , string type , boolean subtypes , string name , string signature , string ext ,
457
458
string input , string kind , string provenance
458
459
) {
459
460
exists ( string row |
460
461
sinkModel ( row ) and
461
- row .splitAt ( ";" , 0 ) = namespace and
462
+ row .splitAt ( ";" , 0 ) = package and
462
463
row .splitAt ( ";" , 1 ) = type and
463
464
row .splitAt ( ";" , 2 ) = subtypes .toString ( ) and
464
465
subtypes = [ true , false ] and
@@ -473,19 +474,19 @@ predicate sinkModel(
473
474
474
475
/** Holds if a summary model exists for the given parameters. */
475
476
predicate summaryModel (
476
- string namespace , string type , boolean subtypes , string name , string signature , string ext ,
477
+ string package , string type , boolean subtypes , string name , string signature , string ext ,
477
478
string input , string output , string kind , string provenance
478
479
) {
479
- summaryModel ( namespace , type , subtypes , name , signature , ext , input , output , kind , provenance , _)
480
+ summaryModel ( package , type , subtypes , name , signature , ext , input , output , kind , provenance , _)
480
481
}
481
482
482
483
/** Holds if a summary model `row` exists for the given parameters. */
483
484
predicate summaryModel (
484
- string namespace , string type , boolean subtypes , string name , string signature , string ext ,
485
+ string package , string type , boolean subtypes , string name , string signature , string ext ,
485
486
string input , string output , string kind , string provenance , string row
486
487
) {
487
488
summaryModel ( row ) and
488
- row .splitAt ( ";" , 0 ) = namespace and
489
+ row .splitAt ( ";" , 0 ) = package and
489
490
row .splitAt ( ";" , 1 ) = type and
490
491
row .splitAt ( ";" , 2 ) = subtypes .toString ( ) and
491
492
subtypes = [ true , false ] and
@@ -500,11 +501,11 @@ predicate summaryModel(
500
501
501
502
/** Holds if a summary model exists indicating there is no flow for the given parameters. */
502
503
predicate negativeSummaryModel (
503
- string namespace , string type , string name , string signature , string provenance
504
+ string package , string type , string name , string signature , string provenance
504
505
) {
505
506
exists ( string row |
506
507
negativeSummaryModel ( row ) and
507
- row .splitAt ( ";" , 0 ) = namespace and
508
+ row .splitAt ( ";" , 0 ) = package and
508
509
row .splitAt ( ";" , 1 ) = type and
509
510
row .splitAt ( ";" , 2 ) = name and
510
511
row .splitAt ( ";" , 3 ) = signature and
@@ -534,7 +535,7 @@ private predicate canonicalPkgLink(string package, string subpkg) {
534
535
}
535
536
536
537
/**
537
- * Holds if CSV framework coverage of `package` is `n` api endpoints of the
538
+ * Holds if MaD framework coverage of `package` is `n` api endpoints of the
538
539
* kind `(kind, part)`.
539
540
*/
540
541
predicate modelCoverage ( string package , int pkgs , string kind , string part , int n ) {
@@ -566,8 +567,8 @@ predicate modelCoverage(string package, int pkgs, string kind, string part, int
566
567
)
567
568
}
568
569
569
- /** Provides a query predicate to check the CSV data for validation errors. */
570
- module CsvValidation {
570
+ /** Provides a query predicate to check the MaD models for validation errors. */
571
+ module ModelValidation {
571
572
private string getInvalidModelInput ( ) {
572
573
exists ( string pred , string input , string part |
573
574
sinkModel ( _, _, _, _, _, _, input , _, _) and pred = "sink"
@@ -668,22 +669,22 @@ module CsvValidation {
668
669
669
670
private string getInvalidModelSignature ( ) {
670
671
exists (
671
- string pred , string namespace , string type , string name , string signature , string ext ,
672
+ string pred , string package , string type , string name , string signature , string ext ,
672
673
string provenance
673
674
|
674
- sourceModel ( namespace , type , _, name , signature , ext , _, _, provenance ) and pred = "source"
675
+ sourceModel ( package , type , _, name , signature , ext , _, _, provenance ) and pred = "source"
675
676
or
676
- sinkModel ( namespace , type , _, name , signature , ext , _, _, provenance ) and pred = "sink"
677
+ sinkModel ( package , type , _, name , signature , ext , _, _, provenance ) and pred = "sink"
677
678
or
678
- summaryModel ( namespace , type , _, name , signature , ext , _, _, _, provenance ) and
679
+ summaryModel ( package , type , _, name , signature , ext , _, _, _, provenance ) and
679
680
pred = "summary"
680
681
or
681
- negativeSummaryModel ( namespace , type , name , signature , provenance ) and
682
+ negativeSummaryModel ( package , type , name , signature , provenance ) and
682
683
ext = "" and
683
684
pred = "negative summary"
684
685
|
685
- not namespace .regexpMatch ( "[a-zA-Z0-9_\\.]+" ) and
686
- result = "Dubious namespace \"" + namespace + "\" in " + pred + " model."
686
+ not package .regexpMatch ( "[a-zA-Z0-9_\\.]+" ) and
687
+ result = "Dubious package \"" + package + "\" in " + pred + " model."
687
688
or
688
689
not type .regexpMatch ( "[a-zA-Z0-9_\\$<>]+" ) and
689
690
result = "Dubious type \"" + type + "\" in " + pred + " model."
@@ -702,7 +703,7 @@ module CsvValidation {
702
703
)
703
704
}
704
705
705
- /** Holds if some row in a CSV-based flow model appears to contain typos. */
706
+ /** Holds if some row in a MaD flow model appears to contain typos. */
706
707
query predicate invalidModelRow ( string msg ) {
707
708
msg =
708
709
[
@@ -714,15 +715,15 @@ module CsvValidation {
714
715
715
716
pragma [ nomagic]
716
717
private predicate elementSpec (
717
- string namespace , string type , boolean subtypes , string name , string signature , string ext
718
+ string package , string type , boolean subtypes , string name , string signature , string ext
718
719
) {
719
- sourceModel ( namespace , type , subtypes , name , signature , ext , _, _, _)
720
+ sourceModel ( package , type , subtypes , name , signature , ext , _, _, _)
720
721
or
721
- sinkModel ( namespace , type , subtypes , name , signature , ext , _, _, _)
722
+ sinkModel ( package , type , subtypes , name , signature , ext , _, _, _)
722
723
or
723
- summaryModel ( namespace , type , subtypes , name , signature , ext , _, _, _, _)
724
+ summaryModel ( package , type , subtypes , name , signature , ext , _, _, _, _)
724
725
or
725
- negativeSummaryModel ( namespace , type , name , signature , _) and ext = "" and subtypes = false
726
+ negativeSummaryModel ( package , type , name , signature , _) and ext = "" and subtypes = false
726
727
}
727
728
728
729
private string paramsStringPart ( Callable c , int i ) {
@@ -747,10 +748,10 @@ cached
747
748
string paramsString ( Callable c ) { result = concat ( int i | | paramsStringPart ( c , i ) order by i ) }
748
749
749
750
private Element interpretElement0 (
750
- string namespace , string type , boolean subtypes , string name , string signature
751
+ string package , string type , boolean subtypes , string name , string signature
751
752
) {
752
- elementSpec ( namespace , type , subtypes , name , signature , _) and
753
- exists ( RefType t | t .hasQualifiedName ( namespace , type ) |
753
+ elementSpec ( package , type , subtypes , name , signature , _) and
754
+ exists ( RefType t | t .hasQualifiedName ( package , type ) |
754
755
exists ( Member m |
755
756
(
756
757
result = m
@@ -773,10 +774,10 @@ private Element interpretElement0(
773
774
774
775
/** Gets the source/sink/summary/negativesummary element corresponding to the supplied parameters. */
775
776
Element interpretElement (
776
- string namespace , string type , boolean subtypes , string name , string signature , string ext
777
+ string package , string type , boolean subtypes , string name , string signature , string ext
777
778
) {
778
- elementSpec ( namespace , type , subtypes , name , signature , ext ) and
779
- exists ( Element e | e = interpretElement0 ( namespace , type , subtypes , name , signature ) |
779
+ elementSpec ( package , type , subtypes , name , signature , ext ) and
780
+ exists ( Element e | e = interpretElement0 ( package , type , subtypes , name , signature ) |
780
781
ext = "" and result = e
781
782
or
782
783
ext = "Annotated" and result .( Annotatable ) .getAnAnnotation ( ) .getType ( ) = e
@@ -831,7 +832,7 @@ predicate parseContent(AccessPathToken component, Content content) {
831
832
cached
832
833
private module Cached {
833
834
/**
834
- * Holds if `node` is specified as a source with the given kind in a CSV flow
835
+ * Holds if `node` is specified as a source with the given kind in a MaD flow
835
836
* model.
836
837
*/
837
838
cached
@@ -840,7 +841,7 @@ private module Cached {
840
841
}
841
842
842
843
/**
843
- * Holds if `node` is specified as a sink with the given kind in a CSV flow
844
+ * Holds if `node` is specified as a sink with the given kind in a MaD flow
844
845
* model.
845
846
*/
846
847
cached
0 commit comments