| 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 "COptimizedSubClassOntologyClassificationItem.h" |
| 22 |
|
| 23 |
|
| 24 |
namespace Konclude { |
| 25 |
|
| 26 |
namespace Reasoner { |
| 27 |
|
| 28 |
namespace Classifier { |
| 29 |
|
| 30 |
|
| 31 |
COptimizedSubClassOntologyClassificationItem::COptimizedSubClassOntologyClassificationItem(CConfigurationBase *configuration, CClassifierStatistics *nextClassificationStatistics) |
| 32 |
: COntologyClassClassificationItem(configuration,nextClassificationStatistics) { |
| 33 |
|
| 34 |
mTopSatTestItem = nullptr; |
| 35 |
mBottomSatTestItem = nullptr; |
| 36 |
|
| 37 |
mRemainingSatTests = 0; |
| 38 |
mRunningSatTests = 0; |
| 39 |
} |
| 40 |
|
| 41 |
COptimizedSubClassOntologyClassificationItem::~COptimizedSubClassOntologyClassificationItem() { |
| 42 |
} |
| 43 |
|
| 44 |
QHash<CConcept*,COptimizedSubClassSatisfiableTestingItem*>* COptimizedSubClassOntologyClassificationItem::getConceptSatisfiableTestItemHash() { |
| 45 |
return &mConceptSatItemHash; |
| 46 |
} |
| 47 |
QList<COptimizedSubClassSatisfiableTestingItem*>* COptimizedSubClassOntologyClassificationItem::getConceptSatisfiableTestItemContainer() { |
| 48 |
return &mSatTestItemContainer; |
| 49 |
} |
| 50 |
|
| 51 |
COptimizedSubClassSatisfiableTestingItem* COptimizedSubClassOntologyClassificationItem::getTopConceptSatisfiableTestItem() { |
| 52 |
return mTopSatTestItem; |
| 53 |
} |
| 54 |
|
| 55 |
COptimizedSubClassSatisfiableTestingItem* COptimizedSubClassOntologyClassificationItem::getBottomConceptSatisfiableTestItem() { |
| 56 |
return mBottomSatTestItem; |
| 57 |
} |
| 58 |
|
| 59 |
QList<COptimizedSubClassSatisfiableTestingItem*>* COptimizedSubClassOntologyClassificationItem::getNextSatisfiableTestingItemList() { |
| 60 |
return &mNextItemList; |
| 61 |
} |
| 62 |
|
| 63 |
|
| 64 |
QSet<COptimizedSubClassSatisfiableTestingItem*>* COptimizedSubClassOntologyClassificationItem::getNextCandidateSatisfiableTestingItemSet() { |
| 65 |
return &mNextCandItemSet; |
| 66 |
} |
| 67 |
|
| 68 |
QSet<COptimizedSubClassSatisfiableTestingItem*>* COptimizedSubClassOntologyClassificationItem::getRemainingCandidateSatisfiableTestingItemSet() { |
| 69 |
return &mRemainingCandItemSet; |
| 70 |
} |
| 71 |
|
| 72 |
|
| 73 |
COptimizedSubClassOntologyClassificationItem* COptimizedSubClassOntologyClassificationItem::initTopBottomSatisfiableTestingItems(COptimizedSubClassSatisfiableTestingItem* topItem, COptimizedSubClassSatisfiableTestingItem* bottomItem) { |
| 74 |
mTopSatTestItem = topItem; |
| 75 |
mBottomSatTestItem = bottomItem; |
| 76 |
return this; |
| 77 |
} |
| 78 |
|
| 79 |
COptimizedSubClassSatisfiableTestingItem* COptimizedSubClassOntologyClassificationItem::getConceptSatisfiableTestItem(CConcept* satTestConcept, bool create) { |
| 80 |
COptimizedSubClassSatisfiableTestingItem* item = nullptr; |
| 81 |
item = mConceptSatItemHash.value(satTestConcept); |
| 82 |
if (!item && create) { |
| 83 |
item = new COptimizedSubClassSatisfiableTestingItem(); |
| 84 |
item->initSatisfiableTestingItem(satTestConcept); |
| 85 |
mConceptSatItemHash.insert(satTestConcept,item); |
| 86 |
mSatTestItemContainer.append(item); |
| 87 |
} |
| 88 |
return item; |
| 89 |
} |
| 90 |
|
| 91 |
|
| 92 |
bool COptimizedSubClassOntologyClassificationItem::hasAllSatisfiableTestsCompleted() { |
| 93 |
return mRemainingSatTests <= 0 && mRunningSatTests <= 0; |
| 94 |
} |
| 95 |
|
| 96 |
bool COptimizedSubClassOntologyClassificationItem::hasRemainingSatisfiableTests() { |
| 97 |
return mRemainingSatTests > 0; |
| 98 |
} |
| 99 |
|
| 100 |
cint64 COptimizedSubClassOntologyClassificationItem::getRemainingSatisfiableTestsCount() { |
| 101 |
return mRemainingSatTests; |
| 102 |
} |
| 103 |
|
| 104 |
cint64 COptimizedSubClassOntologyClassificationItem::getRunningSatisfiableTestsCount() { |
| 105 |
return mRunningSatTests; |
| 106 |
} |
| 107 |
|
| 108 |
COptimizedSubClassOntologyClassificationItem* COptimizedSubClassOntologyClassificationItem::incRemainingSatisfiableTestsCount(cint64 incCount) { |
| 109 |
mRemainingSatTests += incCount; |
| 110 |
return this; |
| 111 |
} |
| 112 |
|
| 113 |
COptimizedSubClassOntologyClassificationItem* COptimizedSubClassOntologyClassificationItem::incRunningSatisfiableTestsCount(cint64 incCount) { |
| 114 |
mRunningSatTests += incCount; |
| 115 |
return this; |
| 116 |
} |
| 117 |
|
| 118 |
|
| 119 |
COptimizedSubClassOntologyClassificationItem* COptimizedSubClassOntologyClassificationItem::decRemainingSatisfiableTestsCount(cint64 decCount) { |
| 120 |
mRemainingSatTests -= decCount; |
| 121 |
return this; |
| 122 |
} |
| 123 |
|
| 124 |
COptimizedSubClassOntologyClassificationItem* COptimizedSubClassOntologyClassificationItem::decRunningSatisfiableTestsCount(cint64 decCount) { |
| 125 |
mRunningSatTests -= decCount; |
| 126 |
return this; |
| 127 |
} |
| 128 |
|
| 129 |
|
| 130 |
QList<COptimizedSubClassSatisfiableTestingItem*>* COptimizedSubClassOntologyClassificationItem::getSatisfiableConceptItemList() { |
| 131 |
return &mSatisfiableItemList; |
| 132 |
} |
| 133 |
|
| 134 |
COptimizedSubClassOntologyClassificationItem* COptimizedSubClassOntologyClassificationItem::addSatisfiableConceptItem(COptimizedSubClassSatisfiableTestingItem* item) { |
| 135 |
mSatisfiableItemList.append(item); |
| 136 |
return this; |
| 137 |
} |
| 138 |
|
| 139 |
|
| 140 |
QHash<CConcept*,CClassificationSatisfiableCalculationConceptReferenceLinking*>* COptimizedSubClassOntologyClassificationItem::getConceptReferenceLinkingDataHash() { |
| 141 |
return &mConceptRefLinkData; |
| 142 |
} |
| 143 |
|
| 144 |
|
| 145 |
}; // end namespace Classifier |
| 146 |
|
| 147 |
}; // end namespace Reasoner |
| 148 |
|
| 149 |
}; // end namespace Konclude |