| 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 "CReasonerEvaluationProfileRequestSelector.h" |
| 22 |
|
| 23 |
|
| 24 |
namespace Konclude { |
| 25 |
|
| 26 |
namespace Test { |
| 27 |
|
| 28 |
namespace Evaluation { |
| 29 |
|
| 30 |
|
| 31 |
CReasonerEvaluationProfileRequestSelector::CReasonerEvaluationProfileRequestSelector(cint64 profile, const QString& baseExpressivityDir) { |
| 32 |
mProfile = profile; |
| 33 |
mBaseExpressivityDir = baseExpressivityDir; |
| 34 |
} |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
bool CReasonerEvaluationProfileRequestSelector::isGroupSelected(const QString& groupString) { |
| 39 |
return true; |
| 40 |
} |
| 41 |
|
| 42 |
|
| 43 |
QString CReasonerEvaluationProfileRequestSelector::getProfileKeyString(cint64 profile) { |
| 44 |
if (profile == REPRS_PROFILE_DL) { |
| 45 |
return "DLProfile:"; |
| 46 |
} else if (profile == REPRS_PROFILE_EL) { |
| 47 |
return "ELProfile:"; |
| 48 |
} else if (profile == REPRS_PROFILE_QL) { |
| 49 |
return "QLProfile:"; |
| 50 |
} else if (profile == REPRS_PROFILE_RL) { |
| 51 |
return "RLProfile:"; |
| 52 |
} |
| 53 |
return ""; |
| 54 |
} |
| 55 |
|
| 56 |
bool CReasonerEvaluationProfileRequestSelector::isRequestSelected(const QString& groupString, const QString& requestString) { |
| 57 |
QString profileString; |
| 58 |
bool foundProfile = false; |
| 59 |
QString infoFileString = mBaseExpressivityDir+groupString+requestString+".txt"; |
| 60 |
QFile infoFile(infoFileString); |
| 61 |
if (infoFile.open(QIODevice::ReadOnly)) { |
| 62 |
while (!foundProfile && !infoFile.atEnd()) { |
| 63 |
QString line = infoFile.readLine(); |
| 64 |
QStringList keyValueLists = line.split("\t"); |
| 65 |
if (keyValueLists.count() >= 2) { |
| 66 |
QString profileKeyString = getProfileKeyString(mProfile); |
| 67 |
if (keyValueLists.first().trimmed() == profileKeyString) { |
| 68 |
foundProfile = true; |
| 69 |
profileString = keyValueLists.last().trimmed(); |
| 70 |
} |
| 71 |
} |
| 72 |
} |
| 73 |
infoFile.close(); |
| 74 |
} |
| 75 |
if (!foundProfile) { |
| 76 |
return false; |
| 77 |
} else { |
| 78 |
if (profileString == "1") { |
| 79 |
return true; |
| 80 |
} else if (profileString == "0") { |
| 81 |
return false; |
| 82 |
} |
| 83 |
} |
| 84 |
return true; |
| 85 |
} |
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
}; // end namespace Evaluation |
| 90 |
|
| 91 |
}; // end namespace Test |
| 92 |
|
| 93 |
}; // end namespace Konclude |