| 1 |
/* |
| 2 |
* Copyright (C) 2013-2015, 2019 by the Konclude Developer Team. |
| 3 |
* |
| 4 |
* This file is part of the reasoning system Konclude. |
| 5 |
* For details and support, see <http://konclude.com/>. |
| 6 |
* |
| 7 |
* Konclude is free software: you can redistribute it and/or modify |
| 8 |
* it under the terms of version 3 of the GNU Lesser General Public |
| 9 |
* License (LGPLv3) as published by the Free Software Foundation. |
| 10 |
* |
| 11 |
* Konclude is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU (Lesser) General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU (Lesser) General Public |
| 17 |
* License along with Konclude. If not, see <http://www.gnu.org/licenses/>. |
| 18 |
* |
| 19 |
*/ |
| 20 |
|
| 21 |
#include "CReasonerEvaluationGroupRequestReasonerCSVComparisonAnalyser.h" |
| 22 |
|
| 23 |
|
| 24 |
namespace Konclude { |
| 25 |
|
| 26 |
namespace Test { |
| 27 |
|
| 28 |
namespace Evaluation { |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
CReasonerEvaluationGroupRequestReasonerCSVComparisonAnalyser::CReasonerEvaluationGroupRequestReasonerCSVComparisonAnalyser() { |
| 33 |
} |
| 34 |
|
| 35 |
|
| 36 |
CReasonerEvaluationGroupRequestReasonerCSVComparisonAnalyser::~CReasonerEvaluationGroupRequestReasonerCSVComparisonAnalyser() { |
| 37 |
} |
| 38 |
|
| 39 |
|
| 40 |
bool CReasonerEvaluationGroupRequestReasonerCSVComparisonAnalyser::analyseGroupedEvaluationData(const QStringList& groubList, const QStringList& requestList, const QStringList& reasonerList, const QString& outputDirectory, CReasonerEvaluationAnalyseContext* context, CReasonerEvaluationGroupRequestSelector* selector) { |
| 41 |
|
| 42 |
mOutputFileName = QString("%1").arg(selector->getOutputString()); |
| 43 |
bool hasSelectedRequestFile = false; |
| 44 |
|
| 45 |
|
| 46 |
foreach (QString groupString, groubList) { |
| 47 |
|
| 48 |
if (selector->isGroupSelected(groupString)) { |
| 49 |
|
| 50 |
QSet<QString>* groupRequestList = getGroupRequests(groupString); |
| 51 |
foreach (QString requestString, *groupRequestList) { |
| 52 |
if (selector->isRequestSelected(groupString,requestString)) { |
| 53 |
hasSelectedRequestFile = true; |
| 54 |
} |
| 55 |
} |
| 56 |
} |
| 57 |
} |
| 58 |
|
| 59 |
if (hasSelectedRequestFile) { |
| 60 |
|
| 61 |
QDir outDir(outputDirectory); |
| 62 |
outDir.mkpath(mOutputFileName); |
| 63 |
QFile outputFile(outputDirectory+mOutputFileName+context->getAdditionalFileString()+"time-table.csv"); |
| 64 |
if (outputFile.open(QIODevice::WriteOnly)) { |
| 65 |
|
| 66 |
QString reasonerTabList("OntologyRequest"); |
| 67 |
foreach (QString reasonerString, reasonerList) { |
| 68 |
reasonerTabList += QString("\t%1").arg(reasonerString); |
| 69 |
} |
| 70 |
reasonerTabList += QString("\r\n"); |
| 71 |
outputFile.write(reasonerTabList.toLocal8Bit()); |
| 72 |
|
| 73 |
foreach (QString groupString, groubList) { |
| 74 |
|
| 75 |
QSet<QString>* groupRequestList = getGroupRequests(groupString); |
| 76 |
foreach (QString requestString, *groupRequestList) { |
| 77 |
|
| 78 |
if (selector->isRequestSelected(groupString,requestString)) { |
| 79 |
|
| 80 |
bool allDataAvailable = true; |
| 81 |
foreach (QString reasonerString, reasonerList) { |
| 82 |
CReasonerEvaluationDataValue* evalData = getGroupRequestReasonerEvaluationData(groupString,requestString,reasonerString); |
| 83 |
if (!evalData || evalData->hasDataNotAvailableFlag()) { |
| 84 |
allDataAvailable = false; |
| 85 |
} |
| 86 |
} |
| 87 |
|
| 88 |
|
| 89 |
if (allDataAvailable) { |
| 90 |
QString requestReasonerTabList(requestString); |
| 91 |
foreach (QString reasonerString, reasonerList) { |
| 92 |
CReasonerEvaluationDataValue* evalData = getGroupRequestReasonerEvaluationData(groupString,requestString,reasonerString); |
| 93 |
if (evalData) { |
| 94 |
requestReasonerTabList += QString("\t%1").arg(evalData->generateString()); |
| 95 |
} else { |
| 96 |
requestReasonerTabList += QString("\t-"); |
| 97 |
} |
| 98 |
} |
| 99 |
requestReasonerTabList += QString("\r\n"); |
| 100 |
outputFile.write(requestReasonerTabList.toLocal8Bit()); |
| 101 |
} |
| 102 |
} |
| 103 |
} |
| 104 |
} |
| 105 |
|
| 106 |
outputFile.close(); |
| 107 |
} |
| 108 |
} |
| 109 |
|
| 110 |
return true; |
| 111 |
} |
| 112 |
|
| 113 |
|
| 114 |
}; // end namespace Evaluation |
| 115 |
|
| 116 |
}; // end namespace Test |
| 117 |
|
| 118 |
}; // end namespace Konclude |