Debian Codegraph @

Source/Reasoner/Consistiser/COntologyPrecomputationItem.cpp

raw
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 "COntologyPrecomputationItem.h"
22
23
24 namespace Konclude {
25
26 namespace Reasoner {
27
28 namespace Consistiser {
29
30
31 COntologyPrecomputationItem::COntologyPrecomputationItem() {
32 }
33
34 COntologyPrecomputationItem* COntologyPrecomputationItem::initPrecomputationItem(CConcreteOntology* ontology, CConfigurationBase* config) {
35 mOntology = ontology;
36 mConfig = config;
37 mPrecomputationFinishedFlag = false;
38
39 mConsistenceStatCollStrings = new CConsistenceStatisticsCollectionStrings();
40
41 mConfCollectProcessStatistics = CConfigDataReader::readConfigBoolean(config, "Konclude.Calculation.Precomputation.CollectProcessStatistics", false);
42
43 return this;
44 }
45
46
47 bool COntologyPrecomputationItem::isProcessStatisticsCollectionConfigured() {
48 return mConfCollectProcessStatistics;
49 }
50
51 COntologyPrecomputationItem* COntologyPrecomputationItem::addPrecomputationRequirement(COntologyProcessingRequirement* ontoRequirement) {
52 ontoRequirement->submitRequirementUpdate(COntologyProcessingStatus::PSCOMPLETELYYPROCESSED, COntologyProcessingStatus::PSFAILED | COntologyProcessingStatus::PSUNSUPPORTED);
53 return this;
54 }
55
56 bool COntologyPrecomputationItem::isPrecomputationFinished() {
57 return mPrecomputationFinishedFlag;
58 }
59
60 COntologyPrecomputationItem* COntologyPrecomputationItem::setPrecomputationFinished(bool finished, bool doCallbacks) {
61 mPrecomputationFinishedFlag = finished;
62 doPrecomputationFinishedCallback(doCallbacks);
63 return this;
64 }
65
66 COntologyPrecomputationItem* COntologyPrecomputationItem::doPrecomputationFinishedCallback(bool doCallbacks) {
67 if (doCallbacks) {
68 mCallbackExecuter.doCallback();
69 }
70 return this;
71 }
72
73 COntologyPrecomputationItem* COntologyPrecomputationItem::addPrecomputationFinishedCallback(CCallbackData* callback) {
74 mCallbackExecuter.addCallbackData(callback);
75 return this;
76 }
77
78 CConcreteOntology* COntologyPrecomputationItem::getOntology() {
79 return mOntology;
80 }
81
82
83 CConfigurationBase* COntologyPrecomputationItem::getConfiguration() {
84 return mConfig;
85 }
86
87 QSet<CPrecomputationTestingItem*>* COntologyPrecomputationItem::getPrecomputationTestingItemSet() {
88 return &mTestItemSet;
89 }
90
91
92 cint64 COntologyPrecomputationItem::getCurrentPrecomputationTestingCount() {
93 return mTestItemSet.count();
94 }
95
96
97 bool COntologyPrecomputationItem::hasCurrentPrecomputationTesting() {
98 return mTestItemSet.count() > 0;
99 }
100
101
102
103 CPrecomputatorStatistics* COntologyPrecomputationItem::getPrecomputatorStatistics() {
104 return &mPrecomputatorStatistics;
105 }
106
107
108
109 CConsistenceStatisticsCollectionStrings* COntologyPrecomputationItem::getConsistenceStatisticsCollectionStrings() {
110 return mConsistenceStatCollStrings;
111 }
112
113
114 CConsistenceCalculationStatisticsCollection* COntologyPrecomputationItem::getCalculationStatisticsCollection() {
115 CConsistenceCalculationStatisticsCollection* statColl = nullptr;
116 if (!mReuseStatCollList.isEmpty()) {
117 statColl = mReuseStatCollList.takeFirst();
118 }
119 if (!statColl && mConsistenceStatCollStrings) {
120 statColl = mConsistenceStatCollStrings->createCalculationStatisticsCollection();
121 }
122 return statColl;
123 }
124
125 COntologyPrecomputationItem* COntologyPrecomputationItem::reuseCalculationStatisticsCollection(CConsistenceCalculationStatisticsCollection* statColl) {
126 mReuseStatCollList.append(statColl);
127 return this;
128 }
129
130 }; // end namespace Consistiser
131
132 }; // end namespace Reasoner
133
134 }; // end namespace Konclude