Skip to content

Commit

Permalink
merged new changed by Gennie Mansi, logic for custom queries are added
Browse files Browse the repository at this point in the history
  • Loading branch information
Sahar Mehrpour committed Jan 14, 2020
1 parent 167cda5 commit 9b1ac6f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
18 changes: 13 additions & 5 deletions src/core/mineRulesCore/sci_class.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const findCustomRelations = (id_start, customQueries, attributeList, quer

export const addCustomRelations = (allAttributes, customQueries, classGroupings,
analysisFileName, classLocations,
parentInfo, fileAnalysisMap, dataMap) => {
parentInfo, fileAnalysisMap, dataMap, xmlFiles) => {

var parentClass = classGroupings[classGroupings.length-1];
var classTree;
Expand All @@ -133,10 +133,18 @@ export const addCustomRelations = (allAttributes, customQueries, classGroupings,

if(f != undefined){
f = f.split("\\")[(f.split("\\")).length - 1]
f = f.split(".")[0] + ".xml";
f = f.split(".")[0] + ".java";

// var data = fs.readFileSync(f).toString();
// classTree = et.parse(data);

var data = fs.readFileSync(f).toString();
classTree = et.parse(data);
let filtered = xmlFiles.filter(d => d["filePath"].endsWith(f));
if (filtered.length > 0)
classTree = et.parse(filtered[0]["xml"]);
if (filtered.length === 0) {
console.log("file not found: ", f);
continue;
}

}
else{
Expand Down Expand Up @@ -176,7 +184,7 @@ export const addCustomRelations = (allAttributes, customQueries, classGroupings,
classesVisited.push(childName);

// Get the list of attributes for this class
let fileN = analysisFileName + "_subClassOf" + parentClass + ".txt";
let fileN = analysisFileName + "_subClassOf_" + parentClass + ".txt";
var entry = (dataMap.get(fileN));

// Go through each of the customQueries. If the customQuery is present
Expand Down
2 changes: 1 addition & 1 deletion src/core/miningRules.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export const mineRulesFromXmlFiles = (xmlFiles, support, metaData, ws) => {
for (const group of groupList.keys()){
var grouping = groupList.get(group);
addCustomRelations(allAttributes, customQueries, grouping, analysisFileName,
classLocations, parentInfo, fileAnalysisMap, dataMap);
classLocations, parentInfo, fileAnalysisMap, dataMap, xmlFiles);
}

outputDataBases(dataMap, ws);
Expand Down

0 comments on commit 9b1ac6f

Please sign in to comment.