| 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 "COptimizedComplexCompositionOntologyAnsweringItem.h" |
| 22 |
|
| 23 |
|
| 24 |
namespace Konclude { |
| 25 |
|
| 26 |
namespace Reasoner { |
| 27 |
|
| 28 |
namespace Answerer { |
| 29 |
|
| 30 |
|
| 31 |
COptimizedComplexCompositionOntologyAnsweringItem::COptimizedComplexCompositionOntologyAnsweringItem(CConcreteOntology* ontology, CConfigurationBase* configuration) : COntologyAnsweringItem(ontology,configuration) { |
| 32 |
mCalcStatCollStrings = new CAnsweringCalculationStatisticsCollectionStrings(); |
| 33 |
mDiffStoredStatCollStrings = nullptr; |
| 34 |
|
| 35 |
mConfCollectProcessStatistics = CConfigDataReader::readConfigBoolean(configuration, "Konclude.Calculation.Answering.CollectProcessStatistics", false); |
| 36 |
mConfLogProcessingProgressStatistics = CConfigDataReader::readConfigBoolean(configuration, "Konclude.Answering.LogCompositionQueriesProcessingProgressStatistics", false); |
| 37 |
mConfLogProcessingFinishedStatistics = CConfigDataReader::readConfigBoolean(configuration, "Konclude.Answering.LogCompositionQueriesProcessingFinishedStatistics", false); |
| 38 |
mCurrentlyAnsweringQueryCount = 0; |
| 39 |
|
| 40 |
} |
| 41 |
|
| 42 |
COptimizedComplexCompositionOntologyAnsweringItem::~COptimizedComplexCompositionOntologyAnsweringItem() { |
| 43 |
delete mDiffStoredStatCollStrings; |
| 44 |
} |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
CAnsweringStatisticsCollectionStrings* COptimizedComplexCompositionOntologyAnsweringItem::getDifferenceStoredAnsweringStatisticsCollectionStrings() { |
| 49 |
return mDiffStoredStatCollStrings; |
| 50 |
} |
| 51 |
|
| 52 |
COptimizedComplexCompositionOntologyAnsweringItem* COptimizedComplexCompositionOntologyAnsweringItem::setDifferenceStoredAnsweringStatisticsCollectionStrings(CAnsweringStatisticsCollectionStrings* stats) { |
| 53 |
if (mDiffStoredStatCollStrings) { |
| 54 |
delete mDiffStoredStatCollStrings; |
| 55 |
} |
| 56 |
mDiffStoredStatCollStrings = stats; |
| 57 |
return this; |
| 58 |
} |
| 59 |
|
| 60 |
|
| 61 |
CAnsweringCalculationStatisticsCollectionStrings* COptimizedComplexCompositionOntologyAnsweringItem::getAnsweringStatisticsCollectionStrings() { |
| 62 |
return mCalcStatCollStrings; |
| 63 |
} |
| 64 |
|
| 65 |
|
| 66 |
CAnsweringCalculationStatisticsCollection* COptimizedComplexCompositionOntologyAnsweringItem::getCalculationStatisticsCollection() { |
| 67 |
CAnsweringCalculationStatisticsCollection* statColl = nullptr; |
| 68 |
if (!mReuseStatCollList.isEmpty()) { |
| 69 |
statColl = mReuseStatCollList.takeFirst(); |
| 70 |
} |
| 71 |
if (!statColl && mCalcStatCollStrings) { |
| 72 |
statColl = mCalcStatCollStrings->createCalculationStatisticsCollection(); |
| 73 |
} |
| 74 |
return statColl; |
| 75 |
} |
| 76 |
|
| 77 |
COptimizedComplexCompositionOntologyAnsweringItem* COptimizedComplexCompositionOntologyAnsweringItem::reuseCalculationStatisticsCollection(CAnsweringCalculationStatisticsCollection* statColl) { |
| 78 |
mReuseStatCollList.append(statColl); |
| 79 |
return this; |
| 80 |
} |
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
bool COptimizedComplexCompositionOntologyAnsweringItem::isProcessStatisticsCollectionConfigured() { |
| 85 |
return mConfCollectProcessStatistics; |
| 86 |
} |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
bool COptimizedComplexCompositionOntologyAnsweringItem::isLogProcessingProgressStatisticsConfigured() { |
| 91 |
return mConfLogProcessingProgressStatistics; |
| 92 |
} |
| 93 |
|
| 94 |
|
| 95 |
bool COptimizedComplexCompositionOntologyAnsweringItem::isLogProcessingFinishedStatisticsConfigured() { |
| 96 |
return mConfLogProcessingFinishedStatistics; |
| 97 |
} |
| 98 |
|
| 99 |
CAnsweringHandlingStatistics* COptimizedComplexCompositionOntologyAnsweringItem::getAnsweringHandlingStatistics() { |
| 100 |
return &mAnsweringHandlingStatistics; |
| 101 |
} |
| 102 |
|
| 103 |
QList<CComplexQueryCompositionProcessingData*>* COptimizedComplexCompositionOntologyAnsweringItem::getScheduledQueriesProcessingDataList() { |
| 104 |
return &mScheduledQueriesProcDataList; |
| 105 |
} |
| 106 |
|
| 107 |
COptimizedComplexCompositionOntologyAnsweringItem* COptimizedComplexCompositionOntologyAnsweringItem::addScheduledQueriesProcessingData(CComplexQueryCompositionProcessingData* procData) { |
| 108 |
mScheduledQueriesProcDataList.append(procData); |
| 109 |
return this; |
| 110 |
} |
| 111 |
|
| 112 |
COptimizedComplexCompositionOntologyAnsweringItem* COptimizedComplexCompositionOntologyAnsweringItem::decCurrentlyAnsweringQueryCount() { |
| 113 |
mCurrentlyAnsweringQueryCount--; |
| 114 |
return this; |
| 115 |
} |
| 116 |
|
| 117 |
COptimizedComplexCompositionOntologyAnsweringItem* COptimizedComplexCompositionOntologyAnsweringItem::incCurrentlyAnsweringQueryCount() { |
| 118 |
mCurrentlyAnsweringQueryCount++; |
| 119 |
return this; |
| 120 |
} |
| 121 |
|
| 122 |
bool COptimizedComplexCompositionOntologyAnsweringItem::isCurrentlyAnsweringQueryCount() { |
| 123 |
return mCurrentlyAnsweringQueryCount; |
| 124 |
} |
| 125 |
|
| 126 |
|
| 127 |
}; // end namespace Answerer |
| 128 |
|
| 129 |
}; // end namespace Reasoner |
| 130 |
|
| 131 |
}; // end namespace Konclude |