Skip to content

Commit e8be176

Browse files
David AndersonDavid Anderson
authored andcommitted
added tostring method to QueryString structures to make pattern matching much easier. will update QCP4SubcaseAnalysis to reflect this.
1 parent bb95dba commit e8be176

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

QCPAnalysis/src/QCPAnalysis/QCP4SubcaseAnalysis.rsc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void analyzeQCP4(){
3939
println("Types of dynamic snippets: <types>");
4040
println("Counts for each type:\n <(n : size(d) | n <- groupDynamicSnippetsByType(ds), d := groupDynamicSnippetsByType(ds)[n])>");
4141
println("Counts for each role:\n <(n : size(d) | n <- groupQCP4ByRole(qcp4), d := groupQCP4ByRole(qcp4)[n])>");
42-
//for(x <- groupQCP4ByRole(qcp4)["not param"]) {println(x); println("\n");}
42+
//for(x <- groupQCP4ByRole(qcp4)["not param"]) println(queryStringToString(x));
4343
}
4444

4545
private map[str, list[QuerySnippet]] groupDynamicSnippetsByType(list[QuerySnippet] ds){

QCPAnalysis/src/QCPAnalysis/QueryStringAnalysis.rsc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,19 @@ data QuerySnippet = staticsnippet(str staticpart)
4343

4444
// collection of boolean flags for each construction pattern
4545
data PatternFlags = flags(bool unclassified, bool qcp1, bool qcp2, bool qcp3a, bool qcp3b, bool qcp4, bool qcp5);
46+
47+
public str queryStringToString(QueryString qs){
48+
res = "";
49+
for(s <- qs.snippets){
50+
if(staticsnippet(_) := s){
51+
res += s.staticpart;
52+
}
53+
else{
54+
res += "ø";
55+
}
56+
}
57+
return res;
58+
}
4659

4760
// builds query string structures for all mysql_query calls in the corpus without classifying them
4861
public set[QueryString] buildQueryStrings() = {s | call <- getMSQCorpusList(), s := buildQueryString(call)};

0 commit comments

Comments
 (0)