| 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 "CCalculationTableauApproximationSaturationTaskHandleAlgorithm.h" |
| 22 |
|
| 23 |
|
| 24 |
namespace Konclude { |
| 25 |
|
| 26 |
namespace Reasoner { |
| 27 |
|
| 28 |
namespace Kernel { |
| 29 |
|
| 30 |
namespace Algorithm { |
| 31 |
|
| 32 |
CCalculationTableauApproximationSaturationTaskHandleAlgorithm::CCalculationTableauApproximationSaturationTaskHandleAlgorithm(CSaturationNodeBackendAssociationCacheHandler* backendAssCaceHandler, CSatisfiableTaskSaturationOccurrenceStatisticsCollector* satTaskOccStatCollector) { |
| 33 |
mProcessingDataBox = nullptr; |
| 34 |
mCalcAlgContext = nullptr; |
| 35 |
|
| 36 |
mBackendAssCaceHandler = backendAssCaceHandler; |
| 37 |
mSatTaskOccStatCollector = satTaskOccStatCollector; |
| 38 |
|
| 39 |
mProcessingDataBox = nullptr; |
| 40 |
mCalcAlgContext = nullptr; |
| 41 |
|
| 42 |
mPosJumpFuncVec = &mPosTableauRuleJumpFuncVec[mRuleFuncCount/2]; |
| 43 |
mNegJumpFuncVec = &mNegTableauRuleJumpFuncVec[mRuleFuncCount/2]; |
| 44 |
|
| 45 |
for (cint64 i = 0; i < mRuleFuncCount; ++i) { |
| 46 |
mPosTableauRuleJumpFuncVec[i] = nullptr; |
| 47 |
mNegTableauRuleJumpFuncVec[i] = nullptr; |
| 48 |
} |
| 49 |
|
| 50 |
|
| 51 |
mPosJumpFuncVec[CCDATATYPE] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyDATATYPERule; |
| 52 |
//mNegJumpFuncVec[CCDATATYPE] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyNotDATATYPERule; |
| 53 |
mPosJumpFuncVec[CCBOTTOM] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyBOTTOMRule; |
| 54 |
mPosJumpFuncVec[CCATOM] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyNONERule; |
| 55 |
mPosJumpFuncVec[CCTOP] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyANDRule; |
| 56 |
mPosJumpFuncVec[CCAND] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyANDRule; |
| 57 |
mPosJumpFuncVec[CCAQAND] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyANDRule; |
| 58 |
mPosJumpFuncVec[CCIMPLAQAND] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyANDRule; |
| 59 |
mPosJumpFuncVec[CCBRANCHAQAND] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyANDRule; |
| 60 |
mPosJumpFuncVec[CCSUB] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyANDRule; |
| 61 |
mPosJumpFuncVec[CCALL] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyALLRule; |
| 62 |
mPosJumpFuncVec[CCAQALL] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyALLRule; |
| 63 |
mPosJumpFuncVec[CCSOME] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applySOMERule; |
| 64 |
mPosJumpFuncVec[CCAQSOME] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applySOMERule; |
| 65 |
mPosJumpFuncVec[CCAQCHOOCE] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyAutomatChooseRule; |
| 66 |
mPosJumpFuncVec[CCIMPLTRIG] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyANDRule; |
| 67 |
mPosJumpFuncVec[CCBRANCHTRIG] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyANDRule; |
| 68 |
mPosJumpFuncVec[CCIMPLALL] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyALLRule; |
| 69 |
mPosJumpFuncVec[CCBRANCHALL] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyALLRule; |
| 70 |
mPosJumpFuncVec[CCBRANCHAQALL] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyALLRule; |
| 71 |
mPosJumpFuncVec[CCIMPLAQALL] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyALLRule; |
| 72 |
mPosJumpFuncVec[CCOR] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyORRule; |
| 73 |
mPosJumpFuncVec[CCIMPL] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyIMPLICATIONRule; |
| 74 |
mPosJumpFuncVec[CCBRANCHIMPL] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyIMPLICATIONRule; |
| 75 |
mPosJumpFuncVec[CCEQCAND] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyEQCANDRule; |
| 76 |
mPosJumpFuncVec[CCEQ] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyANDRule; |
| 77 |
mPosJumpFuncVec[CCSELF] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applySELFRule; |
| 78 |
|
| 79 |
mPosJumpFuncVec[CCATLEAST] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyATLEASTRule; |
| 80 |
mNegJumpFuncVec[CCATMOST] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyATLEASTRule; |
| 81 |
|
| 82 |
mPosJumpFuncVec[CCATMOST] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyATMOSTRule; |
| 83 |
mNegJumpFuncVec[CCATLEAST] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyATMOSTRule; |
| 84 |
|
| 85 |
mNegJumpFuncVec[CCOR] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyANDRule; |
| 86 |
mNegJumpFuncVec[CCALL] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applySOMERule; |
| 87 |
mNegJumpFuncVec[CCSOME] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyALLRule; |
| 88 |
mNegJumpFuncVec[CCAQCHOOCE] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyAutomatChooseRule; |
| 89 |
|
| 90 |
mNegJumpFuncVec[CCAND] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyORRule; |
| 91 |
mNegJumpFuncVec[CCEQ] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyORRule; |
| 92 |
mNegJumpFuncVec[CCSUB] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyNONERule; |
| 93 |
mNegJumpFuncVec[CCATOM] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyNONERule; |
| 94 |
|
| 95 |
mPosJumpFuncVec[CCVALUE] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyVALUERule; |
| 96 |
mPosJumpFuncVec[CCNOMINAL] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyNOMINALRule; |
| 97 |
mPosJumpFuncVec[CCDATALITERAL] = &CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyDATALITERALRule; |
| 98 |
|
| 99 |
|
| 100 |
mLastConfig = nullptr; |
| 101 |
|
| 102 |
mAppliedALLRuleCount = 0; |
| 103 |
mAppliedSOMERuleCount = 0; |
| 104 |
mAppliedANDRuleCount = 0; |
| 105 |
mAppliedORRuleCount = 0; |
| 106 |
mAppliedATLEASTRuleCount = 0; |
| 107 |
mAppliedATMOSTRuleCount = 0; |
| 108 |
mAppliedTOTALRuleCount = 0; |
| 109 |
|
| 110 |
mAddedALLConcepts = 0; |
| 111 |
mAddedSOMEConcepts = 0; |
| 112 |
mAddedIMPLConcepts = 0; |
| 113 |
mAddedTRIGGConcepts = 0; |
| 114 |
mAddedSUBConcepts = 0; |
| 115 |
mAddedELSEConcepts = 0; |
| 116 |
mSubstituitedIndiNodeCount = 0; |
| 117 |
mCopiedIndiNodeCount = 0; |
| 118 |
|
| 119 |
mALLSuccExtInitializedCount = 0; |
| 120 |
|
| 121 |
mDirectUpdatedStatusIndiNodeCount = 0; |
| 122 |
mIndirectUpdatedStatusIndiNodeCount = 0; |
| 123 |
|
| 124 |
mDisjunctionInitializedSkippedCount = 0; |
| 125 |
|
| 126 |
mDebugTestingSaturationTask = nullptr; |
| 127 |
|
| 128 |
mConfImplicationAddingSkipping = true; |
| 129 |
mConfForceAllConceptInsertion = false; |
| 130 |
mConfDebuggingWriteData = false; |
| 131 |
mConfDebuggingWriteDataSaturationTasks = false; |
| 132 |
mConfForceAllCopyInsteadOfSubstituition = false; |
| 133 |
|
| 134 |
mConfAddCriticalConceptsToQueues = false; |
| 135 |
mConfDirectlyCriticalToInsufficient = true; |
| 136 |
mConfCheckCriticalConcepts = false; |
| 137 |
mConfALLConceptsExtensionProcessing = false; |
| 138 |
mConfFUNCTIONALConceptsExtensionProcessing = false; |
| 139 |
mConfConceptsExtensionProcessing = false; |
| 140 |
|
| 141 |
mConfResolveOperandConceptSize = 100; |
| 142 |
mConfReferredNodeManyConceptCount = 500; |
| 143 |
mConfManyConceptReferredNodeCountProcessLimit = 2; |
| 144 |
mConfReferredNodeConceptCountProcessLimit = 1500; |
| 145 |
mConfReferredNodeUnprocessedCountProcessLimit = 1; |
| 146 |
mConfReferredNodeCheckingDepth = 5; |
| 147 |
mConfOccurrenceStatisticsCollection = true; |
| 148 |
|
| 149 |
mConfCopyNodeFromTopIndividualForManyConcepts = true; |
| 150 |
mConfForceManyConceptSaturation = false; |
| 151 |
mWroteFunctionalSuccPredMergingDebugString = false; |
| 152 |
|
| 153 |
mConfDetailedMergingTestForATMOSTCriticalTesting = true; |
| 154 |
mConfSimpleMergingTestForATMOSTCriticalTesting = true; |
| 155 |
|
| 156 |
mConfDelayedMergingCriticalATMOSTConcepts = true; |
| 157 |
mConfDelayedMergingCriticalATMOSTConceptsCardinalitySize = 100; |
| 158 |
|
| 159 |
mSuccessorConnectedNominalUpdatedCount = 0; |
| 160 |
mMaximumCardinalityCandidatesUpdatedCount = 0; |
| 161 |
} |
| 162 |
|
| 163 |
|
| 164 |
CCalculationTableauApproximationSaturationTaskHandleAlgorithm::~CCalculationTableauApproximationSaturationTaskHandleAlgorithm() { |
| 165 |
} |
| 166 |
|
| 167 |
|
| 168 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::readCalculationConfig(CSatisfiableCalculationTask* satCalcTask) { |
| 169 |
CCalculationConfigurationExtension *config = satCalcTask->getCalculationConfiguration(); |
| 170 |
if (config != mLastConfig) { |
| 171 |
if (config) { |
| 172 |
CConcreteOntology* ontology = satCalcTask->getProcessingDataBox()->getOntology(); |
| 173 |
COntologyStructureSummary* ontStructureSummary = ontology->getStructureSummary(); |
| 174 |
mConfForceAllConceptInsertion = false; |
| 175 |
mConfForceAllCopyInsteadOfSubstituition = false; |
| 176 |
mConfImplicationAddingSkipping = true; |
| 177 |
mConfDebuggingWriteData = config->isDebuggingWriteDataActivated(); |
| 178 |
mConfDebuggingWriteDataSaturationTasks = config->isDebuggingWriteDataSaturationTasksActivated(); |
| 179 |
if (!ontStructureSummary || !ontStructureSummary->hasOnlyELConceptClasses() || ontology->getABox()->getIndividualCount() > 0) { |
| 180 |
mConfForceAllConceptInsertion = true; |
| 181 |
mConfImplicationAddingSkipping = false; |
| 182 |
} |
| 183 |
|
| 184 |
mConfDirectlyCriticalToInsufficient = config->isSaturationDirectCriticalToInsufficientActivated(); |
| 185 |
mConfAddCriticalConceptsToQueues = config->isSaturationCriticalConceptTestingActivated(); |
| 186 |
mConfCheckCriticalConcepts = config->isSaturationCriticalConceptTestingActivated(); |
| 187 |
mConfConceptsExtensionProcessing = config->isSaturationSuccessorExtensionActivated(); |
| 188 |
mConfNominalProcessing = config->isNominalSaturationActivated(); |
| 189 |
|
| 190 |
mConfReferredNodeManyConceptCount = config->getSaturationReferredNodeManyConceptCount(); |
| 191 |
mConfManyConceptReferredNodeCountProcessLimit = config->getSaturationManyConceptReferredNodeCountProcessLimit(); |
| 192 |
mConfReferredNodeConceptCountProcessLimit = config->getSaturationReferredNodeConceptCountProcessLimit(); |
| 193 |
mConfReferredNodeUnprocessedCountProcessLimit = config->getSaturationReferredNodeUnprocessedCountProcessLimit(); |
| 194 |
mConfReferredNodeCheckingDepth = config->getSaturationReferredNodeCheckingDepth(); |
| 195 |
|
| 196 |
mConfOccurrenceStatisticsCollection = config->isOccurrenceStatisticsCollectionActivated(); |
| 197 |
|
| 198 |
} else { |
| 199 |
mConfForceAllCopyInsteadOfSubstituition = false; |
| 200 |
mConfForceAllConceptInsertion = true; |
| 201 |
mConfImplicationAddingSkipping = true; |
| 202 |
mConfNominalProcessing = true; |
| 203 |
mConfDebuggingWriteData = false; |
| 204 |
mConfDebuggingWriteDataSaturationTasks = false; |
| 205 |
|
| 206 |
mConfDirectlyCriticalToInsufficient = true; |
| 207 |
mConfAddCriticalConceptsToQueues = false; |
| 208 |
mConfCheckCriticalConcepts = false; |
| 209 |
mConfConceptsExtensionProcessing = false; |
| 210 |
|
| 211 |
mConfOccurrenceStatisticsCollection = true; |
| 212 |
|
| 213 |
mConfReferredNodeManyConceptCount = 500; |
| 214 |
mConfManyConceptReferredNodeCountProcessLimit = 2; |
| 215 |
mConfReferredNodeConceptCountProcessLimit = 1500; |
| 216 |
mConfReferredNodeUnprocessedCountProcessLimit = 1; |
| 217 |
mConfReferredNodeCheckingDepth = 5; |
| 218 |
|
| 219 |
} |
| 220 |
|
| 221 |
mConfALLConceptsExtensionProcessing = mConfConceptsExtensionProcessing; |
| 222 |
mConfFUNCTIONALConceptsExtensionProcessing = mConfConceptsExtensionProcessing; |
| 223 |
|
| 224 |
mLastConfig = config; |
| 225 |
mBackendAssCaceHandler->readCalculationConfig(config); |
| 226 |
mBackendAssCaceHandler->setWorkingOntology(satCalcTask->getProcessingDataBox()->getOntology()); |
| 227 |
} |
| 228 |
|
| 229 |
|
| 230 |
//mConfForceAllConceptInsertion = true; |
| 231 |
} |
| 232 |
|
| 233 |
|
| 234 |
CCalculationAlgorithmContextBase* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::createCalculationAlgorithmContext(CTaskProcessorContext *processorContext, CProcessContext* processContext, CSatisfiableCalculationTask* satCalcTask) { |
| 235 |
CCalculationAlgorithmContextBase* calcAlgContext = CObjectAllocator< CCalculationAlgorithmContextBase >::allocateAndConstruct(processContext->getUsedMemoryAllocationManager()); |
| 236 |
calcAlgContext->initTaskProcessContext(processContext,satCalcTask); |
| 237 |
calcAlgContext->initCalculationAlgorithmContext(processorContext); |
| 238 |
return calcAlgContext; |
| 239 |
} |
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::handleTask(CTaskProcessorContext *processorContext, CTask* task) { |
| 244 |
|
| 245 |
//lastBranchingMergingProcRest = nullptr; |
| 246 |
|
| 247 |
CTaskHandleMemoryAllocationManager* processorMemoryManager = processorContext->getTaskHandleMemoryAllocationManager(); |
| 248 |
CTaskProcessorCommunicator* processorCommunicator = processorContext->getTaskProcessorCommunicator(); |
| 249 |
|
| 250 |
CTaskHandleMemoryAllocationManager* taskHandleMemMan = processorContext->getTaskHandleMemoryAllocationManager(); |
| 251 |
taskHandleMemMan->releaseAllMemory(); |
| 252 |
|
| 253 |
CSatisfiableCalculationTask* satCalcTask = dynamic_cast<CSatisfiableCalculationTask*>(task); |
| 254 |
if (satCalcTask) { |
| 255 |
|
| 256 |
if (!processorCommunicator->verifyContinueTaskProcessing(satCalcTask)) { |
| 257 |
if (!satCalcTask->getTaskStatus()->isProcessable()) { |
| 258 |
processorCommunicator->communicateTaskComplete(satCalcTask); |
| 259 |
return false; |
| 260 |
} else { |
| 261 |
// continue later |
| 262 |
return true; |
| 263 |
} |
| 264 |
} |
| 265 |
|
| 266 |
readCalculationConfig(satCalcTask); |
| 267 |
|
| 268 |
|
| 269 |
mInsufficientALLCount = 0; |
| 270 |
mInsufficientATMOSTCount = 0; |
| 271 |
|
| 272 |
|
| 273 |
mCachedCompletionGraphLoaded = false; |
| 274 |
mRepresentativeDataLoaded = false; |
| 275 |
mCachedCompletionGraphMissing = false; |
| 276 |
mDetCachedCGIndiVector = nullptr; |
| 277 |
mNonDetCachedCGIndiVector = nullptr; |
| 278 |
mNonDetConsistencyCG = false; |
| 279 |
mDetConsistencyCG = false; |
| 280 |
|
| 281 |
|
| 282 |
CProcessContext* processContext = satCalcTask->getProcessContext(processorContext); |
| 283 |
CCalculationAlgorithmContextBase* calcAlgContext = createCalculationAlgorithmContext(processorContext,processContext,satCalcTask); |
| 284 |
mCalcAlgContext = calcAlgContext; |
| 285 |
mProcessingDataBox = satCalcTask->getProcessingDataBox(); |
| 286 |
bool clashed = false; |
| 287 |
bool satisfiable = false; |
| 288 |
bool completed = false; |
| 289 |
bool paused = false; |
| 290 |
bool error = false; |
| 291 |
cint64 errorCode = 0; |
| 292 |
|
| 293 |
CProcessTagger* processTagger = calcAlgContext->getUsedProcessTagger(); |
| 294 |
|
| 295 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 296 |
|
| 297 |
CNodeSwitchHistory* nodeSwitchHistory = processingDataBox->getNodeSwitchHistory(true); |
| 298 |
|
| 299 |
cint64 indiProcessedCount = 0; |
| 300 |
|
| 301 |
CIndividualSaturationProcessNode* indiProcSatNode = nullptr; |
| 302 |
CConceptProcessDescriptor* conProcDes = nullptr; |
| 303 |
|
| 304 |
cint64 processRuleToTaskProcessingVerificationCount = 10; |
| 305 |
cint64 remainProcessRuleToTaskProcessingVerification = processRuleToTaskProcessingVerificationCount; |
| 306 |
bool separatedSaturation = false; |
| 307 |
bool hasFirstProcessedNodeID = false; |
| 308 |
cint64 firstProcessedNodeID = 0; |
| 309 |
|
| 310 |
CIndividualSaturationProcessNode* lastindiProcSatNode = nullptr; |
| 311 |
try { |
| 312 |
STATINC(TASKPROCESSCHANGECOUNT,calcAlgContext); |
| 313 |
|
| 314 |
|
| 315 |
continueNominalDelayedIndividualNodeProcessing(mProcessingDataBox,calcAlgContext); |
| 316 |
|
| 317 |
bool wroteExtensionProcDebugString = false; |
| 318 |
|
| 319 |
while (hasRemainingMergingCriticalExtensionProcessingNodes(mProcessingDataBox,calcAlgContext)) { |
| 320 |
|
| 321 |
while (hasRemainingExtensionProcessingNodes(mProcessingDataBox,calcAlgContext)) { |
| 322 |
|
| 323 |
while (hasRemainingProcessingNodes(mProcessingDataBox,calcAlgContext)) { |
| 324 |
|
| 325 |
while (mProcessingDataBox->hasIndividualSaturationProcessNodeLinker()) { |
| 326 |
CIndividualSaturationProcessNodeLinker* indiProcessSaturationNodeLinker = mProcessingDataBox->takeIndividualSaturationProcessNodeLinker(); |
| 327 |
CIndividualSaturationProcessNode* indiProcSatNode = indiProcessSaturationNodeLinker->getData(); |
| 328 |
if (indiProcSatNode->isSeparated()) { |
| 329 |
separatedSaturation = true; |
| 330 |
} |
| 331 |
if (!hasFirstProcessedNodeID || indiProcSatNode->getIndividualID() < firstProcessedNodeID) { |
| 332 |
hasFirstProcessedNodeID = true; |
| 333 |
firstProcessedNodeID = indiProcSatNode->getIndividualID(); |
| 334 |
} |
| 335 |
|
| 336 |
lastindiProcSatNode = indiProcSatNode; |
| 337 |
STATINC(INDIVIDUALNODESWITCHCOUNT,calcAlgContext); |
| 338 |
++indiProcessedCount; |
| 339 |
KONCLUCE_TASK_ALGORITHM_SATURATION_SATURATION_MODEL_STRING_INSTRUCTION(mRuleBeginDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext)); |
| 340 |
if (individualNodeInitializing(indiProcSatNode,calcAlgContext)) { |
| 341 |
CConceptSaturationProcessLinker* conceptSaturationProcessLinker = indiProcSatNode->takeConceptSaturationProcessLinker(); |
| 342 |
while (conceptSaturationProcessLinker) { |
| 343 |
STATINC(RULEAPPLICATIONCOUNT,calcAlgContext); |
| 344 |
KONCLUCE_TASK_ALGORITHM_SATURATION_SATURATION_MODEL_STRING_INSTRUCTION(mRuleBeginDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext)); |
| 345 |
applyTableauSaturationRule(indiProcSatNode,conceptSaturationProcessLinker); |
| 346 |
KONCLUCE_TASK_ALGORITHM_SATURATION_SATURATION_MODEL_STRING_INSTRUCTION(mRuleEndDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext)); |
| 347 |
releaseConceptSaturationProcessLinker(conceptSaturationProcessLinker,calcAlgContext); |
| 348 |
conceptSaturationProcessLinker = indiProcSatNode->takeConceptSaturationProcessLinker(); |
| 349 |
} |
| 350 |
} |
| 351 |
indiProcessSaturationNodeLinker->clearProcessingQueued(); |
| 352 |
individualNodeConclusion(indiProcSatNode,calcAlgContext); |
| 353 |
|
| 354 |
//if ((indiProcessedCount % 100000) == 0) { |
| 355 |
// writeIndividualSaturationStatistics(calcAlgContext); |
| 356 |
//} |
| 357 |
} |
| 358 |
|
| 359 |
|
| 360 |
if (mProcessingDataBox->hasIndividualDisjunctCommonConceptExtractProcessLinker()) { |
| 361 |
CIndividualSaturationProcessNodeLinker* indiDisjCommonConExtProcessLinker = mProcessingDataBox->takeIndividualDisjunctCommonConceptExtractProcessLinker(); |
| 362 |
indiDisjCommonConExtProcessLinker->setProcessingQueued(false); |
| 363 |
CIndividualSaturationProcessNode* indiProcSatNode = indiDisjCommonConExtProcessLinker->getData(); |
| 364 |
lastindiProcSatNode = indiProcSatNode; |
| 365 |
STATINC(INDIVIDUALNODESWITCHCOUNT,calcAlgContext); |
| 366 |
++indiProcessedCount; |
| 367 |
if (individualNodeInitializing(indiProcSatNode,calcAlgContext)) { |
| 368 |
updateExtractDisjunctCommonConcept(indiProcSatNode,calcAlgContext); |
| 369 |
} |
| 370 |
individualNodeConclusion(indiProcSatNode,calcAlgContext); |
| 371 |
} |
| 372 |
} |
| 373 |
|
| 374 |
//if (mConfDebuggingWriteData && mConfDebuggingWriteDataSaturationTasks && !wroteExtensionProcDebugString) { |
| 375 |
// wroteExtensionProcDebugString = true; |
| 376 |
// mEndSaturationDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 377 |
// QString fileName("./Debugging/SaturationTasks/saturation-model-ext-proc.txt"); |
| 378 |
// QFile tmpFile(fileName); |
| 379 |
// if (tmpFile.open(QIODevice::WriteOnly)) { |
| 380 |
// tmpFile.write(mEndSaturationDebugIndiModelString.replace("<br>","").replace("<p>","\n").toLocal8Bit()); |
| 381 |
// tmpFile.close(); |
| 382 |
// } |
| 383 |
//} |
| 384 |
|
| 385 |
processNextSuccessorExtensions(calcAlgContext); |
| 386 |
|
| 387 |
} |
| 388 |
|
| 389 |
|
| 390 |
//if (mConfDebuggingWriteData && mConfDebuggingWriteDataSaturationTasks) { |
| 391 |
// wroteExtensionProcDebugString = true; |
| 392 |
// mEndSaturationDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 393 |
// QString fileName("./Debugging/SaturationTasks/saturation-model-bc.txt"); |
| 394 |
// QFile tmpFile(fileName); |
| 395 |
// if (tmpFile.open(QIODevice::WriteOnly)) { |
| 396 |
// tmpFile.write(mEndSaturationDebugIndiModelString.replace("<br>","").replace("<p>","\n").toLocal8Bit()); |
| 397 |
// tmpFile.close(); |
| 398 |
// } |
| 399 |
//} |
| 400 |
|
| 401 |
if (mConfCheckCriticalConcepts && hasNextCriticalConcepts(mCalcAlgContext)) { |
| 402 |
while (hasNextCriticalConcepts(mCalcAlgContext)) { |
| 403 |
checkNextCriticalConcepts(mCalcAlgContext); |
| 404 |
} |
| 405 |
checkCriticalIndividuals(mCalcAlgContext); |
| 406 |
} |
| 407 |
|
| 408 |
|
| 409 |
//if (mConfDebuggingWriteData && mConfDebuggingWriteDataSaturationTasks) { |
| 410 |
// wroteExtensionProcDebugString = true; |
| 411 |
// mEndSaturationDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 412 |
// QString fileName("./Debugging/SaturationTasks/saturation-model-ac.txt"); |
| 413 |
// QFile tmpFile(fileName); |
| 414 |
// if (tmpFile.open(QIODevice::WriteOnly)) { |
| 415 |
// tmpFile.write(mEndSaturationDebugIndiModelString.replace("<br>","").replace("<p>","\n").toLocal8Bit()); |
| 416 |
// tmpFile.close(); |
| 417 |
// } |
| 418 |
//} |
| 419 |
|
| 420 |
if (mProcessingDataBox->hasSaturationATMOSTMergingProcessLinker()) { |
| 421 |
tryATMOSTConceptSuccessorMerging(calcAlgContext); |
| 422 |
} |
| 423 |
|
| 424 |
} |
| 425 |
|
| 426 |
|
| 427 |
completeSaturatedIndividualNodes(mProcessingDataBox,mCalcAlgContext); |
| 428 |
|
| 429 |
|
| 430 |
|
| 431 |
if (mConfDebuggingWriteData && mConfDebuggingWriteDataSaturationTasks) { |
| 432 |
writeIndividualSaturationStatistics(calcAlgContext); |
| 433 |
QString fileName("./Debugging/SaturationTasks/saturation-model.txt"); |
| 434 |
if (separatedSaturation) { |
| 435 |
fileName = QString("./Debugging/SaturationTasks/saturation-model-individuals-%1.txt").arg(firstProcessedNodeID); |
| 436 |
} |
| 437 |
mEndSaturationDebugIndiModelString = writeGeneratedExtendedDebugIndiModelStringList(fileName, calcAlgContext); |
| 438 |
} |
| 439 |
satisfiable = true; |
| 440 |
|
| 441 |
//testRelevantConceptRoleRatio(calcAlgContext); |
| 442 |
|
| 443 |
} catch (const CCalculationErrorProcessingException& calcErrorProcException) { |
| 444 |
if (calcErrorProcException.hasError()) { |
| 445 |
error = true; |
| 446 |
errorCode = (cint64)calcErrorProcException.getErrorCode(); |
| 447 |
LOG(ERROR,"::Konclude::Reasoner::Kernel::Algorithm::TableauSaturationAlgorihm",logTr("Error occurred, computation stopped."),this); |
| 448 |
} |
| 449 |
} catch (const CMemoryAllocationException& memAllocException) { |
| 450 |
error = true; |
| 451 |
errorCode = 2; |
| 452 |
} catch (...) { |
| 453 |
error = true; |
| 454 |
errorCode = 3; |
| 455 |
} |
| 456 |
|
| 457 |
|
| 458 |
CBooleanTaskResult* satResult = satCalcTask->getSatisfiableCalculationTaskResult(); |
| 459 |
if (clashed) { |
| 460 |
if (!satResult->hasResult()) { |
| 461 |
satResult->installResult(false); |
| 462 |
} |
| 463 |
completed = true; |
| 464 |
} |
| 465 |
if (satisfiable) { |
| 466 |
STATINC(ROOTTASKSATISFIABLECOUNT,calcAlgContext); |
| 467 |
|
| 468 |
//mSubsumAnalyser.analyseSatisfiableTask(satCalcTask,calcAlgContext); |
| 469 |
|
| 470 |
mSatTaskSaturationIndiAnalyser.analyseSatisfiableTask(satCalcTask,mCalcAlgContext); |
| 471 |
|
| 472 |
mSatTaskSaturationPreyAnalyser.analyseSatisfiableTask(satCalcTask,mCalcAlgContext); |
| 473 |
|
| 474 |
tryAssociateIndividualNodesWithBackendCache(satCalcTask,mCalcAlgContext); |
| 475 |
|
| 476 |
//testInsufficientIndividuls(mCalcAlgContext); |
| 477 |
|
| 478 |
satResult->installResult(true); |
| 479 |
completed = true; |
| 480 |
} |
| 481 |
|
| 482 |
if (completed) { |
| 483 |
if (mConfOccurrenceStatisticsCollection && satCalcTask->getOccurrenceStatisticsCollectingAdapter() || satCalcTask->getSaturationIndividualsAnalysationObserver()) { |
| 484 |
mSatTaskOccStatCollector->analyseSatisfiableTask(satCalcTask, calcAlgContext); |
| 485 |
} |
| 486 |
} |
| 487 |
|
| 488 |
if (error) { |
| 489 |
satCalcTask->getTaskStatus()->setError(error,errorCode); |
| 490 |
processorCommunicator->communicateTaskError(satCalcTask); |
| 491 |
return false; |
| 492 |
} |
| 493 |
|
| 494 |
if (completed) { |
| 495 |
processorCommunicator->communicateTaskComplete(satCalcTask); |
| 496 |
return false; |
| 497 |
} |
| 498 |
return true; |
| 499 |
|
| 500 |
} |
| 501 |
|
| 502 |
return false; |
| 503 |
} |
| 504 |
|
| 505 |
|
| 506 |
|
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
|
| 511 |
|
| 512 |
|
| 513 |
|
| 514 |
|
| 515 |
|
| 516 |
|
| 517 |
|
| 518 |
|
| 519 |
|
| 520 |
|
| 521 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::writeIndividualSaturationStatistics(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 522 |
CIndividualSaturationProcessNodeVector* indiVec = calcAlgContext->getProcessingDataBox()->getIndividualSaturationProcessNodeVector(false); |
| 523 |
cint64 insufficientCount = 0; |
| 524 |
QFile tmpFile("./Debugging/SaturationTasks/saturation-statistics.txt"); |
| 525 |
if (tmpFile.open(QIODevice::WriteOnly)) { |
| 526 |
QString headerString = QString("IndividualID\tIndividualName\tTotalCount\tConceptCount\tTriggerCount\tRoleBackConnectionCount\tRoleBackPropagationCount\tRoleBackLinkedCount\r\n"); |
| 527 |
tmpFile.write(headerString.toUtf8()); |
| 528 |
if (indiVec) { |
| 529 |
cint64 indiCount = indiVec->getItemCount(); |
| 530 |
for (cint64 i = 0; i < indiCount; ++i) { |
| 531 |
CIndividualSaturationProcessNode* indi = indiVec->getData(i); |
| 532 |
if (indi) { |
| 533 |
QString indiName = getDebugIndividualConceptName(indi,calcAlgContext); |
| 534 |
if (indiName == "") { |
| 535 |
indiName = "-"; |
| 536 |
} |
| 537 |
cint64 indiID = indi->getIndividualID(); |
| 538 |
cint64 conCount = 0; |
| 539 |
cint64 totalCount = 0; |
| 540 |
cint64 implCount = 0; |
| 541 |
cint64 roleBackCount = 0; |
| 542 |
cint64 roleBackPropCount = 0; |
| 543 |
cint64 roleBackLinkCount = 0; |
| 544 |
QString indiDirectFlags = generateStatusFlagsStringList(indi->getDirectStatusFlags(),calcAlgContext).join(","); |
| 545 |
QString indiIndirectFlags = generateStatusFlagsStringList(indi->getIndirectStatusFlags(),calcAlgContext).join(","); |
| 546 |
CReapplyConceptSaturationLabelSet* labelConSet = indi->getReapplyConceptSaturationLabelSet(false); |
| 547 |
if (labelConSet) { |
| 548 |
conCount = labelConSet->getConceptCount(); |
| 549 |
totalCount = labelConSet->getTotalCount(); |
| 550 |
implCount = totalCount-conCount; |
| 551 |
} |
| 552 |
CRoleBackwardSaturationPropagationHash* roleBackPropHash = indi->getRoleBackwardPropagationHash(false); |
| 553 |
if (roleBackPropHash) { |
| 554 |
CPROCESSHASH<CRole*,CRoleBackwardSaturationPropagationHashData>* rolePropHash = roleBackPropHash->getRoleBackwardPropagationDataHash(); |
| 555 |
roleBackCount = rolePropHash->size(); |
| 556 |
for (CPROCESSHASH<CRole*,CRoleBackwardSaturationPropagationHashData>::const_iterator rolePropHashIt = rolePropHash->constBegin(), rolePropHashEndIt = rolePropHash->constEnd(); rolePropHashIt != rolePropHashEndIt; ++rolePropHashIt) { |
| 557 |
CRole* role = rolePropHashIt.key(); |
| 558 |
const CRoleBackwardSaturationPropagationHashData& roleBackData = rolePropHashIt.value(); |
| 559 |
for (CBackwardSaturationPropagationLink* linkLinkerIt = roleBackData.mLinkLinker; linkLinkerIt; linkLinkerIt = linkLinkerIt->getNext()) { |
| 560 |
++roleBackLinkCount; |
| 561 |
} |
| 562 |
for (CBackwardSaturationPropagationReapplyDescriptor* reapDesIt = roleBackData.mReapplyLinker; reapDesIt; reapDesIt = reapDesIt->getNext()) { |
| 563 |
++roleBackPropCount; |
| 564 |
} |
| 565 |
} |
| 566 |
} |
| 567 |
QString indiString = QString("%1\t%2\t%3\t%4\t%5\t%6\t%7\t%8\t").arg(indiID).arg(indiName).arg(totalCount).arg(conCount).arg(implCount).arg(roleBackCount).arg(roleBackPropCount).arg(roleBackLinkCount); |
| 568 |
indiString += QString("%1\t%2\r\n").arg(indiDirectFlags).arg(indiIndirectFlags); |
| 569 |
tmpFile.write(indiString.toUtf8()); |
| 570 |
|
| 571 |
} |
| 572 |
} |
| 573 |
} |
| 574 |
tmpFile.close(); |
| 575 |
} |
| 576 |
} |
| 577 |
|
| 578 |
|
| 579 |
|
| 580 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::testInsufficientIndividuls(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 581 |
CIndividualSaturationProcessNodeVector* indiVec = calcAlgContext->getProcessingDataBox()->getIndividualSaturationProcessNodeVector(false); |
| 582 |
cint64 insufficientCount = 0; |
| 583 |
if (indiVec) { |
| 584 |
cint64 indiCount = indiVec->getItemCount(); |
| 585 |
for (cint64 i = 0; i < indiCount; ++i) { |
| 586 |
CIndividualSaturationProcessNode* indi = indiVec->getData(i); |
| 587 |
if (indi) { |
| 588 |
CIndividual* nominalIndi = indi->getNominalIndividual(); |
| 589 |
if (nominalIndi) { |
| 590 |
if (indi->getIndirectStatusFlags()->hasInsufficientFlag()) { |
| 591 |
++insufficientCount; |
| 592 |
} |
| 593 |
} |
| 594 |
} |
| 595 |
} |
| 596 |
} |
| 597 |
if (insufficientCount > 0) { |
| 598 |
bool bug = true; |
| 599 |
} |
| 600 |
} |
| 601 |
|
| 602 |
|
| 603 |
|
| 604 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::tryAssociateIndividualNodesWithBackendCache(CSatisfiableCalculationTask* statCalcTask, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 605 |
CProcessingDataBox* procDataBox = statCalcTask->getProcessingDataBox(); |
| 606 |
CIndividualSaturationProcessNodeLinker* indiSaturationAnalysingNodeLinker = procDataBox->getIndividualSaturationAnalysationNodeLinker(); |
| 607 |
if (indiSaturationAnalysingNodeLinker && calcAlgContext->getSatisfiableCalculationTask()->getSaturationIndividualsAnalysationObserver()) { |
| 608 |
for (CIndividualSaturationProcessNodeLinker* indiSaturationAnalysingNodeLinkerIt = indiSaturationAnalysingNodeLinker; indiSaturationAnalysingNodeLinkerIt; indiSaturationAnalysingNodeLinkerIt = indiSaturationAnalysingNodeLinkerIt->getNext()) { |
| 609 |
CIndividualSaturationProcessNode* satIndiNode = indiSaturationAnalysingNodeLinkerIt->getProcessingIndividual(); |
| 610 |
satIndiNode->setOccurrenceStatisticsCollectingRequired(true); |
| 611 |
CIndividualSaturationProcessNodeStatusFlags* indStatFlags = satIndiNode->getIndirectStatusFlags(); |
| 612 |
if (indStatFlags->hasClashedFlag()) { |
| 613 |
return; |
| 614 |
} |
| 615 |
} |
| 616 |
mBackendAssCaceHandler->tryAssociateNodesWithBackendCache(indiSaturationAnalysingNodeLinker, calcAlgContext->getSatisfiableCalculationTask()->getSatisfiableRepresentativeBackendCacheUpdatingAdapter(), calcAlgContext); |
| 617 |
} |
| 618 |
} |
| 619 |
|
| 620 |
|
| 621 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::testRelevantConceptRoleRatio(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 622 |
cint64 totalConceptCount = 0; |
| 623 |
cint64 relevantConceptCount = 0; |
| 624 |
cint64 totalRoleCount = 0; |
| 625 |
cint64 relevantRoleCount = 0; |
| 626 |
CIndividualSaturationProcessNodeVector* indiVec = calcAlgContext->getProcessingDataBox()->getIndividualSaturationProcessNodeVector(false); |
| 627 |
if (indiVec) { |
| 628 |
cint64 indiCount = indiVec->getItemCount(); |
| 629 |
for (cint64 i = 0; i < indiCount; ++i) { |
| 630 |
CIndividualSaturationProcessNode* indi = indiVec->getData(i); |
| 631 |
if (indi) { |
| 632 |
CReapplyConceptSaturationLabelSet* conSet = indi->getReapplyConceptSaturationLabelSet(false); |
| 633 |
if (conSet) { |
| 634 |
CConceptSaturationDescriptor* conDesIt = conSet->getConceptSaturationDescriptionLinker(); |
| 635 |
while (conDesIt) { |
| 636 |
bool relevantFlag = false; |
| 637 |
CConceptSaturationDescriptor* conDes = conDesIt; |
| 638 |
CConcept* concept = conDes->getConcept(); |
| 639 |
CConceptProcessData* conProData = (CConceptProcessData*)concept->getConceptData(); |
| 640 |
if (conProData) { |
| 641 |
if (conProData->hasInferRelevantFlag()) { |
| 642 |
relevantFlag = true; |
| 643 |
} |
| 644 |
} |
| 645 |
++totalConceptCount; |
| 646 |
if (relevantFlag) { |
| 647 |
++relevantConceptCount; |
| 648 |
} |
| 649 |
conDesIt = conDesIt->getNextConceptDesciptor(); |
| 650 |
} |
| 651 |
} |
| 652 |
|
| 653 |
CRoleBackwardSaturationPropagationHash* roleBackSatPropHash = indi->getRoleBackwardPropagationHash(false); |
| 654 |
if (roleBackSatPropHash) { |
| 655 |
CPROCESSHASH<CRole*,CRoleBackwardSaturationPropagationHashData>* backPropDataHash = roleBackSatPropHash->getRoleBackwardPropagationDataHash(); |
| 656 |
for (CPROCESSHASH<CRole*,CRoleBackwardSaturationPropagationHashData>::const_iterator it = backPropDataHash->constBegin(), itEnd = backPropDataHash->constEnd(); it != itEnd; ++it) { |
| 657 |
CRole* role = it.key(); |
| 658 |
const CRoleBackwardSaturationPropagationHashData& hashData = it.value(); |
| 659 |
bool relevantFlag = false; |
| 660 |
CRoleProcessData* roleProData = (CRoleProcessData*)role->getRoleData(); |
| 661 |
if (roleProData) { |
| 662 |
relevantFlag = roleProData->hasInferRelevantFlag(); |
| 663 |
} |
| 664 |
for (CBackwardSaturationPropagationLink* linkLinker = hashData.mLinkLinker; linkLinker; linkLinker = linkLinker->getNext()) { |
| 665 |
++totalRoleCount; |
| 666 |
if (relevantFlag) { |
| 667 |
++relevantRoleCount; |
| 668 |
} |
| 669 |
} |
| 670 |
} |
| 671 |
} |
| 672 |
} |
| 673 |
} |
| 674 |
} |
| 675 |
} |
| 676 |
|
| 677 |
|
| 678 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::hasRemainingExtensionProcessingNodes(CProcessingDataBox* processingDataBox, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 679 |
if (hasRemainingProcessingNodes(processingDataBox,calcAlgContext)) { |
| 680 |
return true; |
| 681 |
} |
| 682 |
CSaturationSuccessorExtensionIndividualNodeProcessingQueue* extProIndiQueue = processingDataBox->getSaturationSucessorExtensionIndividualNodeProcessingQueue(false); |
| 683 |
if (extProIndiQueue && !extProIndiQueue->isEmpty()) { |
| 684 |
return true; |
| 685 |
} |
| 686 |
return false; |
| 687 |
} |
| 688 |
|
| 689 |
|
| 690 |
|
| 691 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::hasRemainingMergingCriticalExtensionProcessingNodes(CProcessingDataBox* processingDataBox, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 692 |
if (mConfCheckCriticalConcepts && hasNextCriticalConcepts(calcAlgContext)) { |
| 693 |
return true; |
| 694 |
} |
| 695 |
if (processingDataBox->hasSaturationATMOSTMergingProcessLinker()) { |
| 696 |
return true; |
| 697 |
} |
| 698 |
if (hasRemainingExtensionProcessingNodes(processingDataBox,calcAlgContext)) { |
| 699 |
return true; |
| 700 |
} |
| 701 |
return false; |
| 702 |
} |
| 703 |
|
| 704 |
|
| 705 |
|
| 706 |
|
| 707 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::continueNominalDelayedIndividualNodeProcessing(CProcessingDataBox* processingDataBox, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 708 |
bool nominalDelayedIndividualNodeProcessingContinued = false; |
| 709 |
if (processingDataBox->hasNominalDelayedIndividualSaturationProcessNodeLinker()) { |
| 710 |
if (isConsistenceDataAvailable(calcAlgContext)) { |
| 711 |
while (processingDataBox->hasNominalDelayedIndividualSaturationProcessNodeLinker()) { |
| 712 |
CIndividualSaturationProcessNodeLinker* nominalDelayedIndSatProcNodeLinker = processingDataBox->takeNominalDelayedIndividualSaturationProcessNodeLinker(); |
| 713 |
CIndividualSaturationProcessNode* indiProcessNode = nominalDelayedIndSatProcNodeLinker->getProcessingIndividual(); |
| 714 |
nominalDelayedIndSatProcNodeLinker->setProcessingQueued(false); |
| 715 |
|
| 716 |
CCriticalSaturationConceptTypeQueues* criticalConceptQueues = indiProcessNode->getCriticalConceptTypeQueues(false); |
| 717 |
if (criticalConceptQueues) { |
| 718 |
if (criticalConceptQueues->hasCriticalSaturationConceptsQueued()) { |
| 719 |
CCriticalIndividualNodeProcessingQueue* criticalIndNodProcQueue = processingDataBox->getSaturationCriticalIndividualNodeProcessingQueue(true); |
| 720 |
criticalIndNodProcQueue->insertProcessIndiviudal(indiProcessNode); |
| 721 |
criticalConceptQueues->setProcessNodeQueued(true); |
| 722 |
} |
| 723 |
} |
| 724 |
|
| 725 |
CSaturationIndividualNodeNominalHandlingData* nominalHandlingData = indiProcessNode->getNominalHandlingData(false); |
| 726 |
if (nominalHandlingData) { |
| 727 |
if (nominalHandlingData->getDelayedNominalConceptSaturationProcessLinker()) { |
| 728 |
while (nominalHandlingData->getDelayedNominalConceptSaturationProcessLinker()) { |
| 729 |
CConceptSaturationProcessLinker* delConSatProLinker = nominalHandlingData->takeDelayedNominalConceptSaturationProcessLinker(); |
| 730 |
delConSatProLinker->clearNext(); |
| 731 |
indiProcessNode->addConceptSaturationProcessLinker(delConSatProLinker); |
| 732 |
} |
| 733 |
addIndividualToProcessingQueue(indiProcessNode,calcAlgContext); |
| 734 |
} |
| 735 |
} |
| 736 |
indiProcessNode->getIndividualSaturationCompletionNodeLinker(true)->setProcessingQueued(false); |
| 737 |
addIndividualToCompletionQueue(indiProcessNode,calcAlgContext); |
| 738 |
nominalDelayedIndividualNodeProcessingContinued = true; |
| 739 |
} |
| 740 |
|
| 741 |
calcAlgContext->getUsedProcessingDataBox()->setDelayedNominalProcessingOccured(false); |
| 742 |
|
| 743 |
} |
| 744 |
} |
| 745 |
return nominalDelayedIndividualNodeProcessingContinued; |
| 746 |
} |
| 747 |
|
| 748 |
|
| 749 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::completeSaturatedIndividualNodes(CProcessingDataBox* processingDataBox, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 750 |
|
| 751 |
cint64 completedIndividualCount = 0; |
| 752 |
if (processingDataBox->hasIndividualSaturationCompletionNodeLinker()) { |
| 753 |
while (processingDataBox->hasIndividualSaturationCompletionNodeLinker()) { |
| 754 |
CIndividualSaturationProcessNodeLinker* indiProcessNodeLinker = processingDataBox->takeIndividualSaturationCompletionNodeLinker(); |
| 755 |
CIndividualSaturationProcessNode* indiProcessNode = indiProcessNodeLinker->getProcessingIndividual(); |
| 756 |
bool completeIndividual = true; |
| 757 |
if (indiProcessNode->getIndirectStatusFlags()->hasMissedABoxConsistencyFlag()) { |
| 758 |
if (!isConsistenceDataAvailable(calcAlgContext)) { |
| 759 |
completeIndividual = false; |
| 760 |
processingDataBox->addNominalDelayedIndividualSaturationProcessNodeLinker(indiProcessNodeLinker); |
| 761 |
if (indiProcessNode->getReapplyConceptSaturationLabelSet(false)) { |
| 762 |
indiProcessNode->getReapplyConceptSaturationLabelSet(false)->setLastNominalIndependentConceptSaturationDescriptorLinker(indiProcessNode->getReapplyConceptSaturationLabelSet(false)->getConceptSaturationDescriptionLinker()); |
| 763 |
} |
| 764 |
} |
| 765 |
} |
| 766 |
if (completeIndividual) { |
| 767 |
processingDataBox->addIndividualSaturationCompletedNodeLinker(indiProcessNodeLinker); |
| 768 |
completedIndividualCount++; |
| 769 |
indiProcessNode->setCompleted(true); |
| 770 |
} |
| 771 |
} |
| 772 |
} |
| 773 |
return completedIndividualCount > 0; |
| 774 |
} |
| 775 |
|
| 776 |
|
| 777 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::hasRemainingProcessingNodes(CProcessingDataBox* processingDataBox, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 778 |
if (processingDataBox->hasIndividualSaturationProcessNodeLinker() || processingDataBox->hasIndividualDisjunctCommonConceptExtractProcessLinker()) { |
| 779 |
return true; |
| 780 |
} |
| 781 |
return false; |
| 782 |
} |
| 783 |
|
| 784 |
|
| 785 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::individualNodeInitializing(CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 786 |
if (!indiProcSatNode->isInitialized()) { |
| 787 |
|
| 788 |
if (indiProcSatNode->hasNominalIndividualTriplesAssertions() && !indiProcSatNode->areNominalIndividualTriplesAssertionsLoaded()) { |
| 789 |
|
| 790 |
CConcreteOntology* ontology = calcAlgContext->getUsedProcessingDataBox()->getOntology(); |
| 791 |
COntologyTriplesData* ontologyTriplesData = ontology->getOntologyTriplesData(); |
| 792 |
if (ontologyTriplesData) { |
| 793 |
COntologyTriplesAssertionsAccessor* triplesAssertionAccessor = ontologyTriplesData->getTripleAssertionAccessor(); |
| 794 |
if (triplesAssertionAccessor) { |
| 795 |
if (!indiProcSatNode->getNominalIndividual()) { |
| 796 |
CIndexedIndividualAssertionConvertionVisitor indiAssConvVisitor(indiProcSatNode->getIndividualID(), calcAlgContext); |
| 797 |
triplesAssertionAccessor->visitIndividualAssertions(indiProcSatNode->getIndividualID(), &indiAssConvVisitor); |
| 798 |
indiProcSatNode->setNominalIndividual(indiAssConvVisitor.getRetrievalIndividual()); |
| 799 |
} else { |
| 800 |
CIndexedIndividualAssertionConvertionVisitor indiAssConvVisitor(indiProcSatNode->getNominalIndividual(), calcAlgContext); |
| 801 |
triplesAssertionAccessor->visitIndividualAssertions(indiProcSatNode->getIndividualID(), &indiAssConvVisitor); |
| 802 |
indiProcSatNode->setNominalIndividual(indiAssConvVisitor.getRetrievalIndividual()); |
| 803 |
} |
| 804 |
} |
| 805 |
} |
| 806 |
|
| 807 |
indiProcSatNode->setNominalIndividualTriplesAssertionsLoaded(true); |
| 808 |
} |
| 809 |
|
| 810 |
initializeInitializationConcepts(indiProcSatNode,calcAlgContext); |
| 811 |
initializeRoleAssertions(indiProcSatNode,calcAlgContext); |
| 812 |
initializeDataAssertions(indiProcSatNode, calcAlgContext); |
| 813 |
|
| 814 |
indiProcSatNode->setInitialized(true); |
| 815 |
|
| 816 |
if (indiProcSatNode->getNominalIndividual() && calcAlgContext->getSatisfiableCalculationTask()->getSaturationIndividualsAnalysationObserver()) { |
| 817 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 818 |
CIndividualSaturationProcessNodeLinker* indiProcessNodeLinker = CObjectAllocator< CIndividualSaturationProcessNodeLinker >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 819 |
indiProcessNodeLinker->initProcessNodeLinker(indiProcSatNode,true); |
| 820 |
processingDataBox->addIndividualSaturationAnalysationNodeLinker(indiProcessNodeLinker); |
| 821 |
} |
| 822 |
} |
| 823 |
return true; |
| 824 |
} |
| 825 |
|
| 826 |
|
| 827 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::hasNextCriticalConcepts(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 828 |
CProcessingDataBox* procDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 829 |
CCriticalIndividualNodeProcessingQueue* critIndNodeProcQueue = procDataBox->getSaturationCriticalIndividualNodeProcessingQueue(false); |
| 830 |
if (critIndNodeProcQueue) { |
| 831 |
if (!critIndNodeProcQueue->isEmpty()) { |
| 832 |
return true; |
| 833 |
} |
| 834 |
} |
| 835 |
return false; |
| 836 |
} |
| 837 |
|
| 838 |
|
| 839 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::checkNextCriticalConcepts(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 840 |
CProcessingDataBox* procDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 841 |
CCriticalIndividualNodeProcessingQueue* critIndNodeProcQueue = procDataBox->getSaturationCriticalIndividualNodeProcessingQueue(false); |
| 842 |
if (critIndNodeProcQueue) { |
| 843 |
CIndividualSaturationProcessNode* indiProcSatNode = critIndNodeProcQueue->takeNextProcessIndividual(); |
| 844 |
|
| 845 |
bool checkCriticalConcepts = true; |
| 846 |
if (indiProcSatNode->getDirectStatusFlags()->hasMissedABoxConsistencyFlag()) { |
| 847 |
if (!isConsistenceDataAvailable(calcAlgContext)) { |
| 848 |
checkCriticalConcepts = false; |
| 849 |
CCriticalSaturationConceptTypeQueues* criticalConceptQueues = indiProcSatNode->getCriticalConceptTypeQueues(false); |
| 850 |
if (criticalConceptQueues) { |
| 851 |
criticalConceptQueues->setProcessNodeQueued(false); |
| 852 |
} |
| 853 |
} |
| 854 |
} |
| 855 |
if (checkCriticalConcepts) { |
| 856 |
checkCriticalConceptsForNode(indiProcSatNode,calcAlgContext); |
| 857 |
} |
| 858 |
} |
| 859 |
} |
| 860 |
|
| 861 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::checkCriticalIndividuals(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 862 |
CProcessingDataBox* procDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 863 |
CIndividualSaturationProcessNodeLinker* indiSaturationAnalysingNodeLinker = procDataBox->getIndividualSaturationAnalysationNodeLinker(); |
| 864 |
CCriticalIndividualNodeConceptTestSet* criticalIndiNodeConTestSet = procDataBox->getSaturationCriticalIndividualNodeConceptTestSet(true); |
| 865 |
if (indiSaturationAnalysingNodeLinker && calcAlgContext->getSatisfiableCalculationTask()->getSaturationIndividualsAnalysationObserver()) { |
| 866 |
for (CIndividualSaturationProcessNodeLinker* indiSaturationAnalysingNodeLinkerIt = indiSaturationAnalysingNodeLinker; indiSaturationAnalysingNodeLinkerIt; indiSaturationAnalysingNodeLinkerIt = indiSaturationAnalysingNodeLinkerIt->getNext()) { |
| 867 |
CIndividualSaturationProcessNode* satIndiNode = indiSaturationAnalysingNodeLinkerIt->getProcessingIndividual(); |
| 868 |
CIndividualSaturationProcessNodeStatusFlags* indStatFlags = satIndiNode->getIndirectStatusFlags(); |
| 869 |
CIndividualSaturationProcessNodeStatusFlags* dirStatFlags = satIndiNode->getDirectStatusFlags(); |
| 870 |
if (!indStatFlags->hasClashedFlag() && !dirStatFlags->hasPropagationIncompleteFlag()) { |
| 871 |
CReapplyConceptSaturationLabelSet* succConSet = satIndiNode->getReapplyConceptSaturationLabelSet(false); |
| 872 |
if (succConSet) { |
| 873 |
for (CConceptSaturationDescriptor* conSatDesIt = succConSet->getConceptSaturationDescriptionLinker(); conSatDesIt && !dirStatFlags->hasPropagationIncompleteFlag(); conSatDesIt = conSatDesIt->getNext()) { |
| 874 |
CConcept* concept = conSatDesIt->getConcept(); |
| 875 |
bool negation = conSatDesIt->isNegated(); |
| 876 |
if (!negation && concept->getConceptOperator()->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_ALL_AQALL_TYPE) || negation && concept->getConceptOperator()->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_SOME_TYPE)) { |
| 877 |
|
| 878 |
if (!criticalIndiNodeConTestSet->isConceptTestedForIndividual(conSatDesIt, satIndiNode)) { |
| 879 |
criticalIndiNodeConTestSet->insertConceptTestedForIndividual(conSatDesIt, satIndiNode); |
| 880 |
STATINC(SATURATIONCRITICALTESTCOUNT, calcAlgContext); |
| 881 |
if (isCriticalALLConceptDescriptorInsufficient(conSatDesIt, satIndiNode, calcAlgContext)) { |
| 882 |
updateDirectAddingIndividualStatusFlags(satIndiNode, CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT, calcAlgContext); |
| 883 |
updateDirectAddingIndividualStatusFlags(satIndiNode, CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGPROPAGATIONINCOMPLETE, calcAlgContext); |
| 884 |
setInsufficientNodeOccured(calcAlgContext); |
| 885 |
++mInsufficientALLCount; |
| 886 |
} |
| 887 |
} |
| 888 |
|
| 889 |
} |
| 890 |
} |
| 891 |
} |
| 892 |
} |
| 893 |
} |
| 894 |
} |
| 895 |
} |
| 896 |
|
| 897 |
CSaturationSuccessorExtensionData* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getSucessorExtensionData(CLinkedRoleSaturationSuccessorData* succData, bool create, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 898 |
CSaturationSuccessorExtensionData*& succExtData = succData->mExtensionData; |
| 899 |
if (!succExtData && create) { |
| 900 |
succExtData = CObjectParameterizingAllocator<CSaturationSuccessorExtensionData,CProcessContext*>::allocateAndConstructAndParameterize(calcAlgContext->getUsedProcessTaskMemoryAllocationManager(),calcAlgContext->getProcessContext()); |
| 901 |
succExtData->initSuccessorExtensionData(); |
| 902 |
} |
| 903 |
return succExtData; |
| 904 |
} |
| 905 |
|
| 906 |
|
| 907 |
|
| 908 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::initializeSuccessorALLConceptsExtensions(CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 909 |
CSaturationIndividualNodeSuccessorExtensionData* indiProcSatNodeSuccExt = indiProcSatNode->getSuccessorExtensionData(); |
| 910 |
CSaturationIndividualNodeALLConceptsExtensionData* indiProcSatNodeALLConSuccExt = indiProcSatNodeSuccExt->getALLConceptsExtensionData(true); |
| 911 |
|
| 912 |
CLinkedRoleSaturationSuccessorHash* linkedSuccHash = indiProcSatNode->getLinkedRoleSuccessorHash(false); |
| 913 |
if (linkedSuccHash) { |
| 914 |
CPROCESSHASH<CRole*,CLinkedRoleSaturationSuccessorData*>* succHash = linkedSuccHash->getLinkedRoleSuccessorHash(); |
| 915 |
CRoleBackwardSaturationPropagationHash* backwardPropHash = indiProcSatNode->getRoleBackwardPropagationHash(false); |
| 916 |
if (backwardPropHash) { |
| 917 |
CPROCESSHASH<CRole*,CRoleBackwardSaturationPropagationHashData>* backwardPropDataHash = backwardPropHash->getRoleBackwardPropagationDataHash(); |
| 918 |
|
| 919 |
for (CPROCESSHASH<CRole*,CLinkedRoleSaturationSuccessorData*>::const_iterator itSucc = succHash->constBegin(), itSuccEnd = succHash->constEnd(); itSucc != itSuccEnd; ++itSucc) { |
| 920 |
CRole* role(itSucc.key()); |
| 921 |
CLinkedRoleSaturationSuccessorData* succData(itSucc.value()); |
| 922 |
CRoleBackwardSaturationPropagationHashData* backwardPropData(backwardPropDataHash->valuePointer(role)); |
| 923 |
if (backwardPropData && backwardPropData->mReapplyLinker) { |
| 924 |
backwardPropData->mRoleALLConceptsProcessingQueued = false; |
| 925 |
updateSuccessorRoleALLConceptsExtensions(indiProcSatNode,role,succData,*backwardPropData,calcAlgContext); |
| 926 |
} |
| 927 |
} |
| 928 |
} |
| 929 |
} |
| 930 |
} |
| 931 |
|
| 932 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::updateSuccessorRoleALLConceptsExtensions(CIndividualSaturationProcessNode*& indiProcSatNode, CRole* role, CLinkedRoleSaturationSuccessorData* succData, const CRoleBackwardSaturationPropagationHashData& backwardPropData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 933 |
CSaturationIndividualNodeSuccessorExtensionData* indiProcSatNodeSuccExt = indiProcSatNode->getSuccessorExtensionData(); |
| 934 |
CSaturationIndividualNodeALLConceptsExtensionData* indiProcSatNodeALLConSuccExt = indiProcSatNodeSuccExt->getALLConceptsExtensionData(true); |
| 935 |
if (succData) { |
| 936 |
if (backwardPropData.mReapplyLinker) { |
| 937 |
bool succLinksUpdated = false; |
| 938 |
bool allConUpdated = false; |
| 939 |
CSaturationSuccessorExtensionData* satSuccExtData = getSucessorExtensionData(succData,true,calcAlgContext); |
| 940 |
CSaturationSuccessorData* lastExaminedLinkLinker = satSuccExtData->getLastExaminedLinkLinker(); |
| 941 |
CBackwardSaturationPropagationReapplyDescriptor* lastExaminedALLConReaDes = satSuccExtData->getLastExaminedALLConceptReapplyDescriptor(); |
| 942 |
bool iterateFullAllConReaDes = false; |
| 943 |
bool continueIterateLinks = false; |
| 944 |
if (lastExaminedALLConReaDes != backwardPropData.mReapplyLinker) { |
| 945 |
allConUpdated = true; |
| 946 |
continueIterateLinks = true; |
| 947 |
} |
| 948 |
if (lastExaminedLinkLinker != succData->mLastLink) { |
| 949 |
continueIterateLinks = true; |
| 950 |
succLinksUpdated = true; |
| 951 |
iterateFullAllConReaDes = true; |
| 952 |
} |
| 953 |
for (CSaturationSuccessorData* linkLinkerIt = succData->mLastLink; linkLinkerIt && continueIterateLinks; ) { |
| 954 |
|
| 955 |
if (!linkLinkerIt->mVALUENominalConnection) { |
| 956 |
|
| 957 |
CIndividualSaturationProcessNode* succIndiNode = linkLinkerIt->mSuccIndiNode; |
| 958 |
for (CXNegLinker<CRole*>* creationRoleLinkerIt = linkLinkerIt->mCreationRoleLinker; creationRoleLinkerIt; creationRoleLinkerIt = creationRoleLinkerIt->getNext()) { |
| 959 |
CRole* creationRole = creationRoleLinkerIt->getData(); |
| 960 |
CSaturationSuccessorALLConceptExtensionData* allConSuccExtData = indiProcSatNodeALLConSuccExt->getALLConceptsExtensionData(succIndiNode)->getRoleSuccessorALLConceptExtensionData(creationRole); |
| 961 |
|
| 962 |
bool conceptsForSuccIndiNodeModified = false; |
| 963 |
|
| 964 |
conceptsForSuccIndiNodeModified |= allConSuccExtData->addRequiredSuccessorCardinality(linkLinkerIt->mSuccCount); |
| 965 |
|
| 966 |
bool continueIterateALLReapConDes = true; |
| 967 |
for (CBackwardSaturationPropagationReapplyDescriptor* backReapplyIt = backwardPropData.mReapplyLinker; backReapplyIt && continueIterateALLReapConDes; ) { |
| 968 |
CConceptSaturationDescriptor* reapplyConDes = backReapplyIt->getReapplyConceptSaturationDescriptor(); |
| 969 |
CConcept* concept = reapplyConDes->getConcept(); |
| 970 |
bool conceptNegation = reapplyConDes->getNegation(); |
| 971 |
conceptsForSuccIndiNodeModified |= addSuccessorExtensionsALLConcept(indiProcSatNode,concept,conceptNegation,allConSuccExtData,calcAlgContext); |
| 972 |
|
| 973 |
backReapplyIt = backReapplyIt->getNext(); |
| 974 |
if (backReapplyIt == lastExaminedALLConReaDes) { |
| 975 |
if (!iterateFullAllConReaDes) { |
| 976 |
continueIterateALLReapConDes = false; |
| 977 |
} |
| 978 |
} |
| 979 |
} |
| 980 |
|
| 981 |
if (conceptsForSuccIndiNodeModified) { |
| 982 |
if (!allConSuccExtData->isExtensionProcessingQueued()) { |
| 983 |
allConSuccExtData->setExtensionProcessingQueued(true); |
| 984 |
indiProcSatNodeALLConSuccExt->addExtensionProcessData(allConSuccExtData); |
| 985 |
} |
| 986 |
} |
| 987 |
} |
| 988 |
} |
| 989 |
|
| 990 |
linkLinkerIt = linkLinkerIt->mNextLink; |
| 991 |
if (linkLinkerIt == lastExaminedLinkLinker) { |
| 992 |
if (!allConUpdated) { |
| 993 |
continueIterateLinks = false; |
| 994 |
} else { |
| 995 |
iterateFullAllConReaDes = false; |
| 996 |
} |
| 997 |
} |
| 998 |
} |
| 999 |
satSuccExtData->setLastExaminedLinkLinker(succData->mLastLink); |
| 1000 |
satSuccExtData->setLastExaminedALLConceptReapplyDescriptor(backwardPropData.mReapplyLinker); |
| 1001 |
} |
| 1002 |
} |
| 1003 |
} |
| 1004 |
|
| 1005 |
|
| 1006 |
|
| 1007 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::installSuccessorPredecessorRoleFunctionalityConceptsExtension(CIndividualSaturationProcessNode*& indiProcSatNode, CRole* role, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 1008 |
bool installed = false; |
| 1009 |
CLinkedRoleSaturationSuccessorHash* linkedSuccHash = indiProcSatNode->getLinkedRoleSuccessorHash(false); |
| 1010 |
if (linkedSuccHash) { |
| 1011 |
CPROCESSHASH<CRole*,CLinkedRoleSaturationSuccessorData*>* succHash = linkedSuccHash->getLinkedRoleSuccessorHash(); |
| 1012 |
CLinkedRoleSaturationSuccessorData* succData = linkedSuccHash->getLinkedRoleSuccessorData(role,true); |
| 1013 |
if (succData) { |
| 1014 |
if (!succData->mRoleFUNCTIONALConceptsQueuingRequired) { |
| 1015 |
succData->mRoleFUNCTIONALConceptsQueuingRequired = true; |
| 1016 |
installed = true; |
| 1017 |
} |
| 1018 |
} |
| 1019 |
} |
| 1020 |
CRoleBackwardSaturationPropagationHash* backwardPropHash = indiProcSatNode->getRoleBackwardPropagationHash(true); |
| 1021 |
if (backwardPropHash) { |
| 1022 |
CPROCESSHASH<CRole*,CRoleBackwardSaturationPropagationHashData>* backwardPropDataHash = backwardPropHash->getRoleBackwardPropagationDataHash(); |
| 1023 |
if (backwardPropDataHash) { |
| 1024 |
CRoleBackwardSaturationPropagationHashData& backPropData = (*backwardPropDataHash)[role]; |
| 1025 |
if (!backPropData.mRolePredecessorMergingQueuingRequired) { |
| 1026 |
backPropData.mRolePredecessorMergingQueuingRequired = true; |
| 1027 |
installed = true; |
| 1028 |
} |
| 1029 |
} |
| 1030 |
} |
| 1031 |
|
| 1032 |
return installed; |
| 1033 |
} |
| 1034 |
|
| 1035 |
|
| 1036 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::updateSuccessorRoleFUNCTIONALConceptsExtensions(CIndividualSaturationProcessNode*& indiProcSatNode, CRole* role, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 1037 |
bool updated = false; |
| 1038 |
CLinkedRoleSaturationSuccessorHash* linkedSuccHash = indiProcSatNode->getLinkedRoleSuccessorHash(false); |
| 1039 |
if (linkedSuccHash) { |
| 1040 |
CPROCESSHASH<CRole*,CLinkedRoleSaturationSuccessorData*>* succHash = linkedSuccHash->getLinkedRoleSuccessorHash(); |
| 1041 |
CLinkedRoleSaturationSuccessorData* succData = linkedSuccHash->getLinkedRoleSuccessorData(role,false); |
| 1042 |
if (succData && succData->mRoleFUNCTIONALConceptsQueuingRequired) { |
| 1043 |
succData->mRoleFUNCTIONALConceptsProcessingQueued = false; |
| 1044 |
if (succData->mSuccCount > 1) { |
| 1045 |
updated |= updateSuccessorRoleFUNCTIONALConceptsExtensions(indiProcSatNode,role,succData,calcAlgContext); |
| 1046 |
} |
| 1047 |
} |
| 1048 |
} |
| 1049 |
return updated; |
| 1050 |
} |
| 1051 |
|
| 1052 |
|
| 1053 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::updateSuccessorRoleQualifiedFUNCTIONALConceptsExtensions(CIndividualSaturationProcessNode*& indiProcSatNode, CRole* role, CSortedNegLinker<CConcept*>* qualifiyConLinker, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 1054 |
bool updated = false; |
| 1055 |
CLinkedRoleSaturationSuccessorHash* linkedSuccHash = indiProcSatNode->getLinkedRoleSuccessorHash(false); |
| 1056 |
if (linkedSuccHash) { |
| 1057 |
CPROCESSHASH<CRole*,CLinkedRoleSaturationSuccessorData*>* succHash = linkedSuccHash->getLinkedRoleSuccessorHash(); |
| 1058 |
CLinkedRoleSaturationSuccessorData* succData = linkedSuccHash->getLinkedRoleSuccessorData(role,false); |
| 1059 |
if (succData && succData->mSuccCount > 1) { |
| 1060 |
updated |= updateSuccessorRoleQualifiedFUNCTIONALConceptsExtensions(indiProcSatNode,role,qualifiyConLinker,succData,calcAlgContext); |
| 1061 |
} |
| 1062 |
} |
| 1063 |
return updated; |
| 1064 |
} |
| 1065 |
|
| 1066 |
|
| 1067 |
|
| 1068 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::updatePredecessorRoleFUNCTIONALConceptsExtensions(CIndividualSaturationProcessNode*& indiProcSatNode, CRole* role, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 1069 |
bool updated = false; |
| 1070 |
CRoleBackwardSaturationPropagationHash* backwardPropHash = indiProcSatNode->getRoleBackwardPropagationHash(true); |
| 1071 |
if (backwardPropHash) { |
| 1072 |
CPROCESSHASH<CRole*,CRoleBackwardSaturationPropagationHashData>* backwardPropDataHash = backwardPropHash->getRoleBackwardPropagationDataHash(); |
| 1073 |
if (backwardPropDataHash) { |
| 1074 |
CRoleBackwardSaturationPropagationHashData& backPropData = (*backwardPropDataHash)[role]; |
| 1075 |
if (backPropData.mRolePredecessorMergingQueuingRequired) { |
| 1076 |
backPropData.mRolePredecessorMergingProcessingQueued = false; |
| 1077 |
if (backPropData.mLinkLinker) { |
| 1078 |
CBackwardSaturationPropagationLink* backPropLinkLinker = backPropData.mLinkLinker; |
| 1079 |
CLinkedRoleSaturationSuccessorHash* linkedSuccHash = indiProcSatNode->getLinkedRoleSuccessorHash(false); |
| 1080 |
if (linkedSuccHash) { |
| 1081 |
CPROCESSHASH<CRole*,CLinkedRoleSaturationSuccessorData*>* succHash = linkedSuccHash->getLinkedRoleSuccessorHash(); |
| 1082 |
CLinkedRoleSaturationSuccessorData* succData = linkedSuccHash->getLinkedRoleSuccessorData(role,false); |
| 1083 |
if (succData->mSuccCount >= 1) { |
| 1084 |
updated |= updatePredecessorRoleFUNCTIONALConceptsExtensions(indiProcSatNode,role,succData,backPropLinkLinker,calcAlgContext); |
| 1085 |
} |
| 1086 |
} |
| 1087 |
} |
| 1088 |
} |
| 1089 |
} |
| 1090 |
} |
| 1091 |
return updated; |
| 1092 |
} |
| 1093 |
|
| 1094 |
|
| 1095 |
|
| 1096 |
|
| 1097 |
|
| 1098 |
|
| 1099 |
|
| 1100 |
|
| 1101 |
|
| 1102 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::updatePredecessorRoleFUNCTIONALConceptsExtensions(CIndividualSaturationProcessNode*& indiProcSatNode, CRole* role, CLinkedRoleSaturationSuccessorData* succData, CBackwardSaturationPropagationLink* backPropLinkLinker, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 1103 |
bool updated = false; |
| 1104 |
CLinkedRoleSaturationSuccessorHash* linkedSuccHash = indiProcSatNode->getLinkedRoleSuccessorHash(false); |
| 1105 |
CPROCESSHASH<CRole*,CLinkedRoleSaturationSuccessorData*>* succDataHash = linkedSuccHash->getLinkedRoleSuccessorHash(); |
| 1106 |
CSaturationIndividualNodeSuccessorExtensionData* indiProcSatNodeSuccExt = indiProcSatNode->getSuccessorExtensionData(); |
| 1107 |
CSaturationIndividualNodeFUNCTIONALConceptsExtensionData* indiProcSatNodeFunctionalConSuccExt = indiProcSatNodeSuccExt->getFUNCTIONALConceptsExtensionData(true); |
| 1108 |
if (succData) { |
| 1109 |
CSaturationPredecessorFUNCTIONALConceptExtensionData* predRoleFuncConExtData = indiProcSatNodeFunctionalConSuccExt->getPredecessorFUNCTIONALConceptsExtensionData(role,true); |
| 1110 |
CSaturationSuccessorData* lastLinkedSucc = succData->getLastSuccessorLinkData(); |
| 1111 |
|
| 1112 |
CSaturationSuccessorData* activeLinkedSucc = nullptr; |
| 1113 |
for (CSaturationSuccessorData* linkedSuccIt = lastLinkedSucc; linkedSuccIt && !activeLinkedSucc; linkedSuccIt = linkedSuccIt->mNextLink) { |
| 1114 |
if (linkedSuccIt->mActiveCount >= 1) { |
| 1115 |
activeLinkedSucc = linkedSuccIt; |
| 1116 |
} |
| 1117 |
} |
| 1118 |
|
| 1119 |
if (activeLinkedSucc) { |
| 1120 |
CIndividualSaturationProcessNode* succIndiNode = activeLinkedSucc->mSuccIndiNode; |
| 1121 |
if (succIndiNode) { |
| 1122 |
for (CBackwardSaturationPropagationLink* backPropLinkLinkerIt = backPropLinkLinker; backPropLinkLinkerIt; backPropLinkLinkerIt = backPropLinkLinkerIt->getNext()) { |
| 1123 |
CIndividualSaturationProcessNode* predAncIndiNode = backPropLinkLinkerIt->getSourceIndividual(); |
| 1124 |
if (succIndiNode != predAncIndiNode) { |
| 1125 |
updated |= createAncestorSuccessorMergingExtension(indiProcSatNode,role,succIndiNode,predAncIndiNode,activeLinkedSucc->mCreationRoleLinker,calcAlgContext); |
| 1126 |
} |
| 1127 |
} |
| 1128 |
} |
| 1129 |
} |
| 1130 |
} |
| 1131 |
return updated; |
| 1132 |
} |
| 1133 |
|
| 1134 |
|
| 1135 |
|
| 1136 |
|
| 1137 |
|
| 1138 |
|
| 1139 |
|
| 1140 |
|
| 1141 |
|
| 1142 |
|
| 1143 |
|
| 1144 |
|
| 1145 |
|
| 1146 |
|
| 1147 |
|
| 1148 |
|
| 1149 |
|
| 1150 |
|
| 1151 |
|
| 1152 |
|
| 1153 |
|
| 1154 |
|
| 1155 |
|
| 1156 |
|
| 1157 |
|
| 1158 |
|
| 1159 |
|
| 1160 |
|
| 1161 |
|
| 1162 |
|
| 1163 |
|
| 1164 |
CRole* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getInverseRole(CRole* role, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 1165 |
CRole* invRole = role->getInverseRole(); |
| 1166 |
if (!invRole) { |
| 1167 |
for (CSortedNegLinker<CRole*>* invEqRoleLinkerIt = role->getInverseEquivalentRoleList(); !invRole && invEqRoleLinkerIt; invEqRoleLinkerIt = invEqRoleLinkerIt->getNext()) { |
| 1168 |
if (invEqRoleLinkerIt->isNegated()) { |
| 1169 |
invRole = invEqRoleLinkerIt->getData(); |
| 1170 |
} |
| 1171 |
} |
| 1172 |
} |
| 1173 |
if (!invRole) { |
| 1174 |
for (CSortedNegLinker<CRole*>* invSuperRoleLinkerIt = role->getIndirectSuperRoleList(); !invRole && invSuperRoleLinkerIt; invSuperRoleLinkerIt = invSuperRoleLinkerIt->getNext()) { |
| 1175 |
if (invSuperRoleLinkerIt->isNegated()) { |
| 1176 |
CRole* invSuperRole = invSuperRoleLinkerIt->getData(); |
| 1177 |
for (CSortedNegLinker<CRole*>* superSuperRoleLinkerIt = invSuperRole->getIndirectSuperRoleList(); !invRole && superSuperRoleLinkerIt; superSuperRoleLinkerIt = superSuperRoleLinkerIt->getNext()) { |
| 1178 |
if (superSuperRoleLinkerIt->isNegated() && superSuperRoleLinkerIt->getData() == role) { |
| 1179 |
invRole = invSuperRole; |
| 1180 |
} |
| 1181 |
} |
| 1182 |
} |
| 1183 |
} |
| 1184 |
} |
| 1185 |
return invRole; |
| 1186 |
} |
| 1187 |
|
| 1188 |
|
| 1189 |
|
| 1190 |
|
| 1191 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::createAncestorSuccessorMergingExtension(CIndividualSaturationProcessNode*& indiProcSatNode, CRole* role, CIndividualSaturationProcessNode* succSatNode, CIndividualSaturationProcessNode* ancSatNode, CXNegLinker<CRole*>* creationRoleLinker, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 1192 |
|
| 1193 |
|
| 1194 |
CSaturationSuccessorData* ancSuccLinkData = nullptr; |
| 1195 |
collectLinkedSuccessorNodes(ancSatNode,calcAlgContext); |
| 1196 |
|
| 1197 |
CRole* invRole = getInverseRole(role,calcAlgContext); |
| 1198 |
|
| 1199 |
CLinkedRoleSaturationSuccessorData* ancSuccData = nullptr; |
| 1200 |
CLinkedRoleSaturationSuccessorHash* ancLinkedSuccHash = ancSatNode->getLinkedRoleSuccessorHash(true); |
| 1201 |
if (ancLinkedSuccHash) { |
| 1202 |
ancSuccData = ancLinkedSuccHash->getLinkedRoleSuccessorData(invRole,false); |
| 1203 |
if (ancSuccData) { |
| 1204 |
ancSuccLinkData = ancSuccData->mSuccNodeDataMap.value(indiProcSatNode->getIndividualID()); |
| 1205 |
} |
| 1206 |
} |
| 1207 |
|
| 1208 |
CXNegLinker<CRole*>* ancSuccCreationRoleLinker = nullptr; |
| 1209 |
if (ancSuccLinkData && ancSuccLinkData->mActiveCount >= 1) { |
| 1210 |
ancSuccCreationRoleLinker = ancSuccLinkData->mCreationRoleLinker; |
| 1211 |
|
| 1212 |
|
| 1213 |
bool updated = false; |
| 1214 |
|
| 1215 |
//if (mConfDebuggingWriteData && mConfDebuggingWriteDataSaturationTasks && !mWroteFunctionalSuccPredMergingDebugString) { |
| 1216 |
// mWroteFunctionalSuccPredMergingDebugString = true; |
| 1217 |
// mEndSaturationDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 1218 |
// QString fileName("./Debugging/SaturationTasks/saturation-model-fun-succ-pred-merged.txt"); |
| 1219 |
// QFile tmpFile(fileName); |
| 1220 |
// if (tmpFile.open(QIODevice::WriteOnly)) { |
| 1221 |
// tmpFile.write(mEndSaturationDebugIndiModelString.replace("<br>","").replace("<p>","\n").toLocal8Bit()); |
| 1222 |
// tmpFile.close(); |
| 1223 |
// } |
| 1224 |
//} |
| 1225 |
|
| 1226 |
CSaturationIndividualNodeFUNCTIONALConceptsExtensionData* funcConExtData = succSatNode->getSuccessorExtensionData(true)->getFUNCTIONALConceptsExtensionData(true); |
| 1227 |
if (!funcConExtData->hasIndividualNodeForwardingPredecessorMerged(ancSatNode)) { |
| 1228 |
|
| 1229 |
|
| 1230 |
CReapplyConceptSaturationLabelSet* succConSet = succSatNode->getReapplyConceptSaturationLabelSet(false); |
| 1231 |
if (succConSet) { |
| 1232 |
for (CConceptSaturationDescriptor* conSatDesIt = succConSet->getConceptSaturationDescriptionLinker(); conSatDesIt; conSatDesIt = conSatDesIt->getNext()) { |
| 1233 |
CConcept* concept = conSatDesIt->getConcept(); |
| 1234 |
bool negation = conSatDesIt->isNegated(); |
| 1235 |
addConceptFilteredToIndividual(concept,negation,ancSatNode,calcAlgContext); |
| 1236 |
} |
| 1237 |
} |
| 1238 |
|
| 1239 |
CXNegLinker<CIndividualSaturationProcessNode*>* depCopyLinker = CObjectAllocator< CXNegLinker<CIndividualSaturationProcessNode*> >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 1240 |
depCopyLinker->initNegLinker(ancSatNode,false); |
| 1241 |
succSatNode->addCopyDependingIndividualNodeLinker(depCopyLinker); |
| 1242 |
|
| 1243 |
preprocessResolvedIndividualNode(ancSatNode,calcAlgContext); |
| 1244 |
} |
| 1245 |
|
| 1246 |
|
| 1247 |
|
| 1248 |
for (CXNegLinker<CRole*>* creationRoleLinkerIt = creationRoleLinker; creationRoleLinkerIt; creationRoleLinkerIt = creationRoleLinkerIt->getNext()) { |
| 1249 |
if (!creationRoleLinkerIt->isNegated()) { |
| 1250 |
CRole* creationRole = creationRoleLinkerIt->getData(); |
| 1251 |
|
| 1252 |
if (!funcConExtData->hasIndividualNodeForwardingPredecessorMerged(ancSatNode,creationRole)) { |
| 1253 |
updated = true; |
| 1254 |
funcConExtData->setIndividualNodeForwardingPredecessorMerged(ancSatNode,creationRole); |
| 1255 |
|
| 1256 |
CRole* invCreationRole = getInverseRole(creationRole,calcAlgContext); |
| 1257 |
if (invCreationRole && !ancLinkedSuccHash->hasActiveLinkedSuccessor(invCreationRole,indiProcSatNode)) { |
| 1258 |
for (CSortedNegLinker<CRole*>* invCreationSuperRoleIt = invCreationRole->getIndirectSuperRoleList(); invCreationSuperRoleIt; invCreationSuperRoleIt = invCreationSuperRoleIt->getNext()) { |
| 1259 |
CRole* creationSuperRole = invCreationSuperRoleIt->getData(); |
| 1260 |
if (!invCreationSuperRoleIt->isNegated()) { |
| 1261 |
ancLinkedSuccHash->addExtensionSuccessor(creationSuperRole,indiProcSatNode,invCreationRole,1); |
| 1262 |
//ancLinkedSuccHash->setSuccessorMergedCreation(creationSuperRole,indiProcSatNode); |
| 1263 |
addNewLinkedExtensionProcessingRole(creationSuperRole,ancSatNode,true,true,calcAlgContext); |
| 1264 |
} else { |
| 1265 |
CBackwardSaturationPropagationLink* backPropLink = CObjectAllocator<CBackwardSaturationPropagationLink>::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 1266 |
backPropLink->initBackwardPropagationLink(ancSatNode,creationSuperRole); |
| 1267 |
|
| 1268 |
installBackwardPropagationLink(ancSatNode,indiProcSatNode,creationSuperRole,backPropLink,true,false,calcAlgContext); |
| 1269 |
} |
| 1270 |
} |
| 1271 |
} |
| 1272 |
} |
| 1273 |
} |
| 1274 |
} |
| 1275 |
|
| 1276 |
|
| 1277 |
return updated; |
| 1278 |
} |
| 1279 |
|
| 1280 |
return false; |
| 1281 |
} |
| 1282 |
|
| 1283 |
|
| 1284 |
|
| 1285 |
|
| 1286 |
|
| 1287 |
|
| 1288 |
|
| 1289 |
|
| 1290 |
|
| 1291 |
|
| 1292 |
|
| 1293 |
|
| 1294 |
|
| 1295 |
|
| 1296 |
|
| 1297 |
|
| 1298 |
|
| 1299 |
|
| 1300 |
|
| 1301 |
|
| 1302 |
|
| 1303 |
|
| 1304 |
|
| 1305 |
|
| 1306 |
|
| 1307 |
|
| 1308 |
|
| 1309 |
|
| 1310 |
|
| 1311 |
|
| 1312 |
|
| 1313 |
|
| 1314 |
|
| 1315 |
|
| 1316 |
|
| 1317 |
|
| 1318 |
|
| 1319 |
|
| 1320 |
|
| 1321 |
|
| 1322 |
|
| 1323 |
|
| 1324 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::isLinkedIndividualSuccessorNodeMergingSubset(CIndividualSaturationProcessNode*& indiProcSatNode, CSaturationSuccessorData* subsetIndiSuccData, CSaturationSuccessorData* superIndiSuccData, CRole* role, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 1325 |
CIndividualSaturationProcessNode* subsetIndiSuccNode = subsetIndiSuccData->mSuccIndiNode; |
| 1326 |
CIndividualSaturationProcessNode* superIndiSuccNode = superIndiSuccData->mSuccIndiNode; |
| 1327 |
return isLinkedIndividualSuccessorNodeMergingSubset(indiProcSatNode,subsetIndiSuccNode,subsetIndiSuccData,superIndiSuccNode,superIndiSuccData,role,calcAlgContext); |
| 1328 |
} |
| 1329 |
|
| 1330 |
|
| 1331 |
|
| 1332 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::isLinkedIndividualSuccessorNodeMergingSubset(CIndividualSaturationProcessNode*& indiProcSatNode, CIndividualSaturationProcessNode* subsetIndiSuccNode, CSaturationSuccessorData* subsetIndiSuccData, CIndividualSaturationProcessNode* superIndiSuccNode, CSaturationSuccessorData* superIndiSuccData, CRole* role, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 1333 |
if (subsetIndiSuccData->mVALUENominalConnection || superIndiSuccData->mVALUENominalConnection) { |
| 1334 |
return false; |
| 1335 |
} |
| 1336 |
if (subsetIndiSuccNode->hasNominalIntegrated()) { |
| 1337 |
return false; |
| 1338 |
} |
| 1339 |
if (subsetIndiSuccNode->hasDataValueApplied()) { |
| 1340 |
return false; |
| 1341 |
} |
| 1342 |
if (superIndiSuccData->mActiveCount <= 0) { |
| 1343 |
return false; |
| 1344 |
} |
| 1345 |
if (subsetIndiSuccData->mSuccCount > superIndiSuccData->mSuccCount) { |
| 1346 |
return false; |
| 1347 |
} |
| 1348 |
if (!isSuccessorCreationRoleMergingSubset(role,superIndiSuccData->mCreationRoleLinker,calcAlgContext)) { |
| 1349 |
return false; |
| 1350 |
} |
| 1351 |
if (!isIndividualNodeLabelMergingSubset(subsetIndiSuccNode,superIndiSuccNode,false,calcAlgContext)) { |
| 1352 |
return false; |
| 1353 |
} |
| 1354 |
return true; |
| 1355 |
} |
| 1356 |
|
| 1357 |
|
| 1358 |
|
| 1359 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::isSuccessorCreationRoleMergingSubset(CXNegLinker<CRole*>* subCreationRoleLinker, CXNegLinker<CRole*>* superCreationRoleLinker, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 1360 |
for (CXNegLinker<CRole*>* subCreationRoleLinkerIt = superCreationRoleLinker; subCreationRoleLinkerIt; subCreationRoleLinkerIt = subCreationRoleLinkerIt->getNext()) { |
| 1361 |
if (!subCreationRoleLinkerIt->isNegated()) { |
| 1362 |
CRole* subCreationRole = subCreationRoleLinkerIt->getData(); |
| 1363 |
if (!isSuccessorCreationRoleMergingSubset(subCreationRole,superCreationRoleLinker,calcAlgContext)) { |
| 1364 |
return false; |
| 1365 |
} |
| 1366 |
} |
| 1367 |
} |
| 1368 |
return true; |
| 1369 |
} |
| 1370 |
|
| 1371 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::isSuccessorCreationRoleMergingSubset(CRole* subCreationRole, CXNegLinker<CRole*>* superCreationRoleLinker, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 1372 |
for (CXNegLinker<CRole*>* superCreationRoleLinkerIt = superCreationRoleLinker; superCreationRoleLinkerIt; superCreationRoleLinkerIt = superCreationRoleLinkerIt->getNext()) { |
| 1373 |
if (!superCreationRoleLinkerIt->isNegated()) { |
| 1374 |
if (superCreationRoleLinkerIt->getData() == subCreationRole) { |
| 1375 |
return true; |
| 1376 |
} |
| 1377 |
} |
| 1378 |
} |
| 1379 |
return false; |
| 1380 |
} |
| 1381 |
|
| 1382 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::isIndividualNodeLabelMergingSubset(CIndividualSaturationProcessNode* subsetIndiSuccNode, CIndividualSaturationProcessNode* superIndiSuccNode, bool ignoreANDConcepts, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 1383 |
CReapplyConceptSaturationLabelSet* subsetConSet = subsetIndiSuccNode->getReapplyConceptSaturationLabelSet(false); |
| 1384 |
CReapplyConceptSaturationLabelSet* superConSet = superIndiSuccNode->getReapplyConceptSaturationLabelSet(false); |
| 1385 |
if (!superConSet && subsetConSet) { |
| 1386 |
return false; |
| 1387 |
} |
| 1388 |
if (subsetConSet && superConSet) { |
| 1389 |
if (subsetConSet->getConceptCount() <= superConSet->getConceptCount()) { |
| 1390 |
for (CConceptSaturationDescriptor* conDesIt = subsetConSet->getConceptSaturationDescriptionLinker(); conDesIt; conDesIt = conDesIt->getNext()) { |
| 1391 |
CConcept* concept = conDesIt->getConcept(); |
| 1392 |
bool negation = conDesIt->isNegated(); |
| 1393 |
cint64 conCode = concept->getOperatorCode(); |
| 1394 |
if (!ignoreANDConcepts || (!negation && (conCode != CCAND && conCode != CCAQAND && conCode != CCIMPLAQAND && conCode != CCBRANCHAQAND)) || (negation && (conCode != CCOR))) { |
| 1395 |
if (!superConSet->containsConcept(concept,negation)) { |
| 1396 |
return false; |
| 1397 |
} |
| 1398 |
} |
| 1399 |
} |
| 1400 |
} else { |
| 1401 |
return false; |
| 1402 |
} |
| 1403 |
} |
| 1404 |
return true; |
| 1405 |
} |
| 1406 |
|
| 1407 |
|
| 1408 |
|
| 1409 |
|
| 1410 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::deactivateSubsetMergeableSuccessorLinks(CIndividualSaturationProcessNode*& indiProcSatNode, CLinkedRoleSaturationSuccessorHash* linkedSuccHash, CPROCESSMAP<cint64,CSaturationSuccessorData*>* succDataMap, CRole* role, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 1411 |
bool linksDeactivated = false; |
| 1412 |
cint64 removedSuccCardCount = 0; |
| 1413 |
for (CPROCESSMAP<cint64,CSaturationSuccessorData*>::const_iterator succDataIt = succDataMap->constBegin(), succDataItEnd = succDataMap->constEnd(); succDataIt != succDataItEnd; ++succDataIt) { |
| 1414 |
cint64 indiID = succDataIt.key(); |
| 1415 |
CSaturationSuccessorData* succLinkData = succDataIt.value(); |
| 1416 |
if (succLinkData->mActiveCount > 0) { |
| 1417 |
cint64 succCard = succLinkData->mSuccCount; |
| 1418 |
|
| 1419 |
bool nodeMergeable = true; |
| 1420 |
if (succLinkData->mSuccIndiNode && (succLinkData->mSuccIndiNode->hasDataValueApplied() || succLinkData->mSuccIndiNode->hasNominalIntegrated())) { |
| 1421 |
nodeMergeable = false; |
| 1422 |
} |
| 1423 |
if (succLinkData->mVALUENominalConnection) { |
| 1424 |
nodeMergeable = false; |
| 1425 |
} |
| 1426 |
|
| 1427 |
if (nodeMergeable) { |
| 1428 |
for (CXNegLinker<CRole*>* creationRoleLinkerIt = succLinkData->mCreationRoleLinker; creationRoleLinkerIt; creationRoleLinkerIt = creationRoleLinkerIt->getNext()) { |
| 1429 |
if (!creationRoleLinkerIt->isNegated()) { |
| 1430 |
CRole* creationRole = creationRoleLinkerIt->getData(); |
| 1431 |
|
| 1432 |
bool deactivateLink = false; |
| 1433 |
for (CPROCESSMAP<cint64,CSaturationSuccessorData*>::const_iterator mergeSuccDataIt = succDataMap->constBegin(); !deactivateLink && mergeSuccDataIt != succDataItEnd; ++mergeSuccDataIt) { |
| 1434 |
cint64 mergeIndiID = mergeSuccDataIt.key(); |
| 1435 |
if (indiID != mergeIndiID) { |
| 1436 |
CSaturationSuccessorData* mergeSuccLinkData = mergeSuccDataIt.value(); |
| 1437 |
if (mergeSuccLinkData->mActiveCount > 0) { |
| 1438 |
if (isLinkedIndividualSuccessorNodeMergingSubset(indiProcSatNode,succLinkData,mergeSuccLinkData,creationRole,calcAlgContext)) { |
| 1439 |
deactivateLink = true; |
| 1440 |
} |
| 1441 |
} |
| 1442 |
} |
| 1443 |
} |
| 1444 |
if (deactivateLink) { |
| 1445 |
for (CSortedNegLinker<CRole*>* creationSuperRoleIt = creationRole->getIndirectSuperRoleList(); creationSuperRoleIt; creationSuperRoleIt = creationSuperRoleIt->getNext()) { |
| 1446 |
CRole* creationSuperRole = creationSuperRoleIt->getData(); |
| 1447 |
if (!creationSuperRoleIt->isNegated()) { |
| 1448 |
linkedSuccHash->deactivateLinkedSuccessor(creationSuperRole,succLinkData->mSuccIndiNode,creationRole); |
| 1449 |
} |
| 1450 |
} |
| 1451 |
} |
| 1452 |
} |
| 1453 |
} |
| 1454 |
} |
| 1455 |
|
| 1456 |
if (succLinkData->mActiveCount <= 0) { |
| 1457 |
removedSuccCardCount += succCard; |
| 1458 |
} |
| 1459 |
} |
| 1460 |
} |
| 1461 |
return linksDeactivated; |
| 1462 |
} |
| 1463 |
|
| 1464 |
|
| 1465 |
|
| 1466 |
|
| 1467 |
|
| 1468 |
|
| 1469 |
|
| 1470 |
|
| 1471 |
|
| 1472 |
|
| 1473 |
|
| 1474 |
|
| 1475 |
|
| 1476 |
|
| 1477 |
|
| 1478 |
|
| 1479 |
|
| 1480 |
|
| 1481 |
|
| 1482 |
|
| 1483 |
|
| 1484 |
|
| 1485 |
|
| 1486 |
|
| 1487 |
|
| 1488 |
|
| 1489 |
|
| 1490 |
|
| 1491 |
|
| 1492 |
|
| 1493 |
|
| 1494 |
|
| 1495 |
|
| 1496 |
|
| 1497 |
|
| 1498 |
|
| 1499 |
|
| 1500 |
|
| 1501 |
|
| 1502 |
|
| 1503 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::updateSuccessorRoleFUNCTIONALConceptsExtensions(CIndividualSaturationProcessNode*& indiProcSatNode, CRole* role, CLinkedRoleSaturationSuccessorData* succData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 1504 |
bool updated = false; |
| 1505 |
CLinkedRoleSaturationSuccessorHash* linkedSuccHash = indiProcSatNode->getLinkedRoleSuccessorHash(false); |
| 1506 |
CPROCESSHASH<CRole*,CLinkedRoleSaturationSuccessorData*>* succDataHash = linkedSuccHash->getLinkedRoleSuccessorHash(); |
| 1507 |
CSaturationIndividualNodeSuccessorExtensionData* indiProcSatNodeSuccExt = indiProcSatNode->getSuccessorExtensionData(); |
| 1508 |
CSaturationIndividualNodeFUNCTIONALConceptsExtensionData* indiProcSatNodeFunctionalConSuccExt = indiProcSatNodeSuccExt->getFUNCTIONALConceptsExtensionData(true); |
| 1509 |
if (succData) { |
| 1510 |
CSaturationSuccessorFUNCTIONALConceptExtensionData* roleFuncConExtData = indiProcSatNodeFunctionalConSuccExt->getSuccessorFUNCTIONALConceptsExtensionData(role,true); |
| 1511 |
CSaturationSuccessorData* lastExaminedLinkedSucc = roleFuncConExtData->getLastExaminedLinkedSuccessorData(); |
| 1512 |
CSaturationSuccessorData* lastLinkedSucc = succData->getLastSuccessorLinkData(); |
| 1513 |
if (lastLinkedSucc != lastExaminedLinkedSucc) { |
| 1514 |
|
| 1515 |
CPROCESSMAP<cint64,CSaturationSuccessorData*>* succDataMap = succData->getSuccessorNodeDataMap(false); |
| 1516 |
deactivateSubsetMergeableSuccessorLinks(indiProcSatNode,linkedSuccHash,succDataMap,role,calcAlgContext); |
| 1517 |
|
| 1518 |
cint64 succCount = 0; |
| 1519 |
cint64 maxSuccCardinality = CINT64_MIN; |
| 1520 |
for (CSaturationSuccessorData* lastLinkedSuccIt = lastLinkedSucc; lastLinkedSuccIt; lastLinkedSuccIt = lastLinkedSuccIt->mNextLink) { |
| 1521 |
if (lastLinkedSuccIt->mActiveCount >= 1 && !lastLinkedSuccIt->mVALUENominalConnection) { |
| 1522 |
succCount++; |
| 1523 |
maxSuccCardinality = qMax(maxSuccCardinality,lastLinkedSuccIt->mSuccCount); |
| 1524 |
} |
| 1525 |
} |
| 1526 |
if (succCount > 1 && maxSuccCardinality <= 1) { |
| 1527 |
|
| 1528 |
//if (getDebugIndividualConceptName(indiProcSatNode,calcAlgContext) == "http://www.owllink.org/testsuite/galen#Kussmaul-KienRespiration") { |
| 1529 |
// bool debug = true; |
| 1530 |
//} |
| 1531 |
|
| 1532 |
CIndividualSaturationProcessNode* copyIndiProcSatNode = nullptr; |
| 1533 |
CSaturationIndividualNodeExtensionResolveData* resolveData = nullptr; |
| 1534 |
|
| 1535 |
|
| 1536 |
CIndividualSaturationSuccessorLinkDataLinker* mergingSuccDataLinker = nullptr; |
| 1537 |
|
| 1538 |
CSaturationSuccessorData* maxLabelResolveIndiLinkedSuccData = nullptr; |
| 1539 |
cint64 maxLabelResolveIndiConceptCount = 0; |
| 1540 |
|
| 1541 |
// resolve new individual node |
| 1542 |
for (CPROCESSMAP<cint64,CSaturationSuccessorData*>::const_iterator it = succDataMap->constBegin(), itEnd = succDataMap->constEnd(); it != itEnd; ++it) { |
| 1543 |
cint64 succID = it.key(); |
| 1544 |
CSaturationSuccessorData* linkedSuccData = it.value(); |
| 1545 |
if (linkedSuccData->mActiveCount >= 1 && !linkedSuccData->mVALUENominalConnection) { |
| 1546 |
|
| 1547 |
cint64 succLabelConCount = linkedSuccData->mSuccIndiNode->getReapplyConceptSaturationLabelSet(false)->getConceptCount(); |
| 1548 |
if (!maxLabelResolveIndiLinkedSuccData && succLabelConCount > maxLabelResolveIndiConceptCount) { |
| 1549 |
maxLabelResolveIndiConceptCount = succLabelConCount; |
| 1550 |
maxLabelResolveIndiLinkedSuccData = linkedSuccData; |
| 1551 |
} |
| 1552 |
|
| 1553 |
CIndividualSaturationSuccessorLinkDataLinker* tmpMergingSuccDataLinker = createIndividualSaturationSuccessorLinkDataLinker(calcAlgContext); |
| 1554 |
tmpMergingSuccDataLinker->initSuccessorLinkDataLinker(linkedSuccData); |
| 1555 |
mergingSuccDataLinker = tmpMergingSuccDataLinker->append(mergingSuccDataLinker); |
| 1556 |
} |
| 1557 |
} |
| 1558 |
|
| 1559 |
|
| 1560 |
CPROCESSINGHASH<cint64,CConceptNegationPair>* conExtMap = nullptr; |
| 1561 |
|
| 1562 |
CIndividualSaturationSuccessorLinkDataLinker* mergingSuccDataLinkerIt = mergingSuccDataLinker; |
| 1563 |
CSaturationSuccessorData* resolveLinkedSuccData = maxLabelResolveIndiLinkedSuccData; |
| 1564 |
copyIndiProcSatNode = resolveLinkedSuccData->mSuccIndiNode; |
| 1565 |
|
| 1566 |
for (CIndividualSaturationSuccessorLinkDataLinker* mergingSuccDataLinkerIt = mergingSuccDataLinker; mergingSuccDataLinkerIt; mergingSuccDataLinkerIt = mergingSuccDataLinkerIt->getNext()) { |
| 1567 |
CSaturationSuccessorData* linkedSuccData = mergingSuccDataLinkerIt->getData(); |
| 1568 |
if (linkedSuccData != resolveLinkedSuccData) { |
| 1569 |
CIndividualSaturationProcessNode* succNode = linkedSuccData->mSuccIndiNode; |
| 1570 |
|
| 1571 |
collectResolveIndividualExtendableConceptMap(copyIndiProcSatNode,succNode,conExtMap,calcAlgContext); |
| 1572 |
} |
| 1573 |
} |
| 1574 |
releaseIndividualSaturationSuccessorLinkDataLinker(mergingSuccDataLinker,calcAlgContext); |
| 1575 |
|
| 1576 |
resolveData = copyIndiProcSatNode->getSuccessorExtensionData(true)->getBaseExtensionResolveData(true); |
| 1577 |
resolveData = getResolvedIndividualNodeExtension(resolveData,conExtMap,copyIndiProcSatNode,calcAlgContext); |
| 1578 |
|
| 1579 |
|
| 1580 |
|
| 1581 |
CIndividualSaturationProcessNode* resolvedIndiNode = resolveData->getProcessingIndividualNode(); |
| 1582 |
roleFuncConExtData->setLastResolvedIndividualNode(resolvedIndiNode); |
| 1583 |
|
| 1584 |
bool backwardLinkConnected = false; |
| 1585 |
bool connectionAlreadyExist = false; |
| 1586 |
// deactivate previous successor connections, activate new ones |
| 1587 |
for (CPROCESSMAP<cint64,CSaturationSuccessorData*>::const_iterator it = succDataMap->constBegin(), itEnd = succDataMap->constEnd(); it != itEnd; ++it) { |
| 1588 |
cint64 succID = it.key(); |
| 1589 |
CSaturationSuccessorData* linkedSuccData = it.value(); |
| 1590 |
if (linkedSuccData->mActiveCount >= 1 && !linkedSuccData->mVALUENominalConnection) { |
| 1591 |
cint64 linkSuccCount = linkedSuccData->mSuccCount; |
| 1592 |
CIndividualSaturationProcessNode* succNode = linkedSuccData->mSuccIndiNode; |
| 1593 |
for (CXNegLinker<CRole*>* creationRoleLinkerIt = linkedSuccData->mCreationRoleLinker; creationRoleLinkerIt; creationRoleLinkerIt = creationRoleLinkerIt->getNext()) { |
| 1594 |
if (!creationRoleLinkerIt->isNegated()) { |
| 1595 |
CRole* creationRole = creationRoleLinkerIt->getData(); |
| 1596 |
bool makeNewSuccessorConnections = true; |
| 1597 |
bool removePreviousSuccessorConnections = true; |
| 1598 |
// test whether creation role already exists for this successor connection |
| 1599 |
if (linkedSuccHash->hasActiveLinkedSuccessor(creationRole,resolvedIndiNode)) { |
| 1600 |
connectionAlreadyExist = true; |
| 1601 |
makeNewSuccessorConnections = false; |
| 1602 |
if (succNode == resolvedIndiNode) { |
| 1603 |
removePreviousSuccessorConnections = false; |
| 1604 |
} |
| 1605 |
} |
| 1606 |
for (CSortedNegLinker<CRole*>* creationSuperRoleIt = creationRole->getIndirectSuperRoleList(); creationSuperRoleIt; creationSuperRoleIt = creationSuperRoleIt->getNext()) { |
| 1607 |
CRole* creationSuperRole = creationSuperRoleIt->getData(); |
| 1608 |
if (!creationSuperRoleIt->isNegated()) { |
| 1609 |
if (removePreviousSuccessorConnections) { |
| 1610 |
linkedSuccHash->deactivateLinkedSuccessor(creationSuperRole,succNode,creationRole); |
| 1611 |
} |
| 1612 |
if (makeNewSuccessorConnections) { |
| 1613 |
linkedSuccHash->addExtensionSuccessor(creationSuperRole,resolvedIndiNode,creationRole,1); |
| 1614 |
//linkedSuccHash->setSuccessorMergedCreation(creationSuperRole,resolvedIndiNode); |
| 1615 |
} |
| 1616 |
} else { |
| 1617 |
|
| 1618 |
if (makeNewSuccessorConnections) { |
| 1619 |
backwardLinkConnected = true; |
| 1620 |
CBackwardSaturationPropagationLink* backPropLink = CObjectAllocator<CBackwardSaturationPropagationLink>::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 1621 |
backPropLink->initBackwardPropagationLink(indiProcSatNode,creationSuperRole); |
| 1622 |
|
| 1623 |
installBackwardPropagationLink(indiProcSatNode,resolvedIndiNode,creationSuperRole,backPropLink,true,true,calcAlgContext); |
| 1624 |
|
| 1625 |
} |
| 1626 |
|
| 1627 |
} |
| 1628 |
|
| 1629 |
} |
| 1630 |
|
| 1631 |
} |
| 1632 |
} |
| 1633 |
} |
| 1634 |
} |
| 1635 |
//linkedSuccHash->setSuccessorMergedCreation(role,resolvedIndiNode); |
| 1636 |
|
| 1637 |
//if (succData->mSuccCount >= 2) { |
| 1638 |
// bool debug = true; |
| 1639 |
//} |
| 1640 |
//cint64 countedSucc = 0; |
| 1641 |
//for (CSaturationSuccessorData* linkedSuccDataIt = succData->mLastLink; linkedSuccDataIt; linkedSuccDataIt = linkedSuccDataIt->mNextLink) { |
| 1642 |
// if (linkedSuccDataIt->mActiveCount >= 1) { |
| 1643 |
// countedSucc += linkedSuccDataIt->mSuccCount; |
| 1644 |
// } |
| 1645 |
//} |
| 1646 |
//if (countedSucc >= 2) { |
| 1647 |
|
| 1648 |
// mEndSaturationDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 1649 |
// QFile tmpFile("saturation-model.txt"); |
| 1650 |
// if (tmpFile.open(QIODevice::WriteOnly)) { |
| 1651 |
// tmpFile.write(mEndSaturationDebugIndiModelString.replace("<br>","").replace("<p>","\n").toLocal8Bit()); |
| 1652 |
// tmpFile.close(); |
| 1653 |
// } |
| 1654 |
// bool bug = true; |
| 1655 |
//} |
| 1656 |
|
| 1657 |
updateIndirectAddingIndividualStatusFlags(indiProcSatNode,resolvedIndiNode->getIndirectStatusFlags(),mCalcAlgContext); |
| 1658 |
updateAddingSuccessorConnectedNominal(indiProcSatNode,resolvedIndiNode->getSuccessorConnectedNominalSet(false),mCalcAlgContext); |
| 1659 |
updateMaxCardinalityCandidates(indiProcSatNode,resolvedIndiNode->getMaxAtleastCardinalityCandidate(),resolvedIndiNode->getMaxAtmostCardinalityCandidate(),mCalcAlgContext); |
| 1660 |
|
| 1661 |
if (!connectionAlreadyExist && !backwardLinkConnected) { |
| 1662 |
CXLinker<CIndividualSaturationProcessNode*>* nonInvConnectedIndiNodeLinker = CObjectAllocator< CXLinker<CIndividualSaturationProcessNode*> >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 1663 |
nonInvConnectedIndiNodeLinker->initLinker(indiProcSatNode); |
| 1664 |
resolvedIndiNode->addNonInverseConnectedIndividualNodeLinker(nonInvConnectedIndiNodeLinker); |
| 1665 |
} |
| 1666 |
|
| 1667 |
updated = true; |
| 1668 |
} |
| 1669 |
} |
| 1670 |
} |
| 1671 |
return updated; |
| 1672 |
} |
| 1673 |
|
| 1674 |
|
| 1675 |
|
| 1676 |
|
| 1677 |
|
| 1678 |
|
| 1679 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::updateSuccessorRoleQualifiedFUNCTIONALConceptsExtensions(CIndividualSaturationProcessNode*& indiProcSatNode, CRole* role, CSortedNegLinker<CConcept*>* qualifiyConLinker, CLinkedRoleSaturationSuccessorData* succData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 1680 |
bool updated = false; |
| 1681 |
CLinkedRoleSaturationSuccessorHash* linkedSuccHash = indiProcSatNode->getLinkedRoleSuccessorHash(false); |
| 1682 |
CPROCESSHASH<CRole*,CLinkedRoleSaturationSuccessorData*>* succDataHash = linkedSuccHash->getLinkedRoleSuccessorHash(); |
| 1683 |
CSaturationIndividualNodeSuccessorExtensionData* indiProcSatNodeSuccExt = indiProcSatNode->getSuccessorExtensionData(); |
| 1684 |
CSaturationIndividualNodeFUNCTIONALConceptsExtensionData* indiProcSatNodeFunctionalConSuccExt = indiProcSatNodeSuccExt->getFUNCTIONALConceptsExtensionData(true); |
| 1685 |
if (succData) { |
| 1686 |
CPROCESSMAP<cint64,CSaturationSuccessorData*>* succDataMap = succData->getSuccessorNodeDataMap(false); |
| 1687 |
|
| 1688 |
cint64 succCount = 0; |
| 1689 |
cint64 maxSuccCardinality = CINT64_MIN; |
| 1690 |
CIndividualSaturationSuccessorLinkDataLinker* mergingSuccDataLinker = nullptr; |
| 1691 |
CSaturationSuccessorData* maxLabelResolveIndiLinkedSuccData = nullptr; |
| 1692 |
cint64 maxLabelResolveIndiConceptCount = 0; |
| 1693 |
|
| 1694 |
for (CSaturationSuccessorData* lastLinkedSuccIt = succData->getLastSuccessorLinkData(); lastLinkedSuccIt; lastLinkedSuccIt = lastLinkedSuccIt->mNextLink) { |
| 1695 |
if (lastLinkedSuccIt->mActiveCount >= 1 && !lastLinkedSuccIt->mVALUENominalConnection) { |
| 1696 |
CReapplyConceptSaturationLabelSet* succConSet = lastLinkedSuccIt->mSuccIndiNode->getReapplyConceptSaturationLabelSet(false); |
| 1697 |
bool containsQualification = false; |
| 1698 |
for (CSortedNegLinker<CConcept*>* qualifiyConLinkerIt = qualifiyConLinker; !containsQualification && qualifiyConLinkerIt; qualifiyConLinkerIt = qualifiyConLinkerIt->getNext()) { |
| 1699 |
CConcept* qualCon = qualifiyConLinkerIt->getData(); |
| 1700 |
bool qualNegation = qualifiyConLinkerIt->isNegated(); |
| 1701 |
if (succConSet->containsConcept(qualCon,qualNegation)) { |
| 1702 |
containsQualification = true; |
| 1703 |
} |
| 1704 |
} |
| 1705 |
if (containsQualification) { |
| 1706 |
succCount++; |
| 1707 |
maxSuccCardinality = qMax(maxSuccCardinality,lastLinkedSuccIt->mSuccCount); |
| 1708 |
|
| 1709 |
cint64 succLabelConCount = succConSet->getConceptCount(); |
| 1710 |
if (!maxLabelResolveIndiLinkedSuccData && succLabelConCount > maxLabelResolveIndiConceptCount) { |
| 1711 |
maxLabelResolveIndiConceptCount = succLabelConCount; |
| 1712 |
maxLabelResolveIndiLinkedSuccData = lastLinkedSuccIt; |
| 1713 |
} |
| 1714 |
|
| 1715 |
CIndividualSaturationSuccessorLinkDataLinker* tmpMergingSuccDataLinker = createIndividualSaturationSuccessorLinkDataLinker(calcAlgContext); |
| 1716 |
tmpMergingSuccDataLinker->initSuccessorLinkDataLinker(lastLinkedSuccIt); |
| 1717 |
mergingSuccDataLinker = tmpMergingSuccDataLinker->append(mergingSuccDataLinker); |
| 1718 |
|
| 1719 |
} |
| 1720 |
} |
| 1721 |
} |
| 1722 |
if (succCount > 1 && maxSuccCardinality <= 1) { |
| 1723 |
|
| 1724 |
|
| 1725 |
CIndividualSaturationProcessNode* copyIndiProcSatNode = nullptr; |
| 1726 |
CSaturationIndividualNodeExtensionResolveData* resolveData = nullptr; |
| 1727 |
|
| 1728 |
|
| 1729 |
CPROCESSINGHASH<cint64,CConceptNegationPair>* conExtMap = nullptr; |
| 1730 |
|
| 1731 |
CIndividualSaturationSuccessorLinkDataLinker* mergingSuccDataLinkerIt = mergingSuccDataLinker; |
| 1732 |
CSaturationSuccessorData* resolveLinkedSuccData = maxLabelResolveIndiLinkedSuccData; |
| 1733 |
copyIndiProcSatNode = resolveLinkedSuccData->mSuccIndiNode; |
| 1734 |
|
| 1735 |
for (CIndividualSaturationSuccessorLinkDataLinker* mergingSuccDataLinkerIt = mergingSuccDataLinker; mergingSuccDataLinkerIt; mergingSuccDataLinkerIt = mergingSuccDataLinkerIt->getNext()) { |
| 1736 |
CSaturationSuccessorData* linkedSuccData = mergingSuccDataLinkerIt->getData(); |
| 1737 |
if (linkedSuccData != resolveLinkedSuccData) { |
| 1738 |
CIndividualSaturationProcessNode* succNode = linkedSuccData->mSuccIndiNode; |
| 1739 |
|
| 1740 |
collectResolveIndividualExtendableConceptMap(copyIndiProcSatNode,succNode,conExtMap,calcAlgContext); |
| 1741 |
} |
| 1742 |
} |
| 1743 |
|
| 1744 |
resolveData = copyIndiProcSatNode->getSuccessorExtensionData(true)->getBaseExtensionResolveData(true); |
| 1745 |
resolveData = getResolvedIndividualNodeExtension(resolveData,conExtMap,copyIndiProcSatNode,calcAlgContext); |
| 1746 |
|
| 1747 |
|
| 1748 |
|
| 1749 |
CIndividualSaturationProcessNode* resolvedIndiNode = resolveData->getProcessingIndividualNode(); |
| 1750 |
|
| 1751 |
bool backwardLinkConnected = false; |
| 1752 |
bool connectionAlreadyExist = false; |
| 1753 |
// deactivate previous successor connections, activate new ones |
| 1754 |
for (CPROCESSMAP<cint64,CSaturationSuccessorData*>::const_iterator it = succDataMap->constBegin(), itEnd = succDataMap->constEnd(); it != itEnd; ++it) { |
| 1755 |
cint64 succID = it.key(); |
| 1756 |
CSaturationSuccessorData* linkedSuccData = it.value(); |
| 1757 |
if (linkedSuccData->mActiveCount >= 1 && !linkedSuccData->mVALUENominalConnection) { |
| 1758 |
cint64 linkSuccCount = linkedSuccData->mSuccCount; |
| 1759 |
CIndividualSaturationProcessNode* succNode = linkedSuccData->mSuccIndiNode; |
| 1760 |
for (CXNegLinker<CRole*>* creationRoleLinkerIt = linkedSuccData->mCreationRoleLinker; creationRoleLinkerIt; creationRoleLinkerIt = creationRoleLinkerIt->getNext()) { |
| 1761 |
if (!creationRoleLinkerIt->isNegated()) { |
| 1762 |
CRole* creationRole = creationRoleLinkerIt->getData(); |
| 1763 |
bool makeNewSuccessorConnections = true; |
| 1764 |
bool removePreviousSuccessorConnections = true; |
| 1765 |
// test whether creation role already exists for this successor connection |
| 1766 |
if (linkedSuccHash->hasActiveLinkedSuccessor(creationRole,resolvedIndiNode)) { |
| 1767 |
connectionAlreadyExist = true; |
| 1768 |
makeNewSuccessorConnections = false; |
| 1769 |
if (succNode == resolvedIndiNode) { |
| 1770 |
removePreviousSuccessorConnections = false; |
| 1771 |
} |
| 1772 |
} |
| 1773 |
for (CSortedNegLinker<CRole*>* creationSuperRoleIt = creationRole->getIndirectSuperRoleList(); creationSuperRoleIt; creationSuperRoleIt = creationSuperRoleIt->getNext()) { |
| 1774 |
CRole* creationSuperRole = creationSuperRoleIt->getData(); |
| 1775 |
if (!creationSuperRoleIt->isNegated()) { |
| 1776 |
if (removePreviousSuccessorConnections) { |
| 1777 |
linkedSuccHash->deactivateLinkedSuccessor(creationSuperRole,succNode,creationRole); |
| 1778 |
} |
| 1779 |
if (makeNewSuccessorConnections) { |
| 1780 |
linkedSuccHash->addExtensionSuccessor(creationSuperRole,resolvedIndiNode,creationRole,1); |
| 1781 |
//linkedSuccHash->setSuccessorMergedCreation(creationSuperRole,resolvedIndiNode); |
| 1782 |
} |
| 1783 |
} else { |
| 1784 |
|
| 1785 |
if (makeNewSuccessorConnections) { |
| 1786 |
backwardLinkConnected = true; |
| 1787 |
CBackwardSaturationPropagationLink* backPropLink = CObjectAllocator<CBackwardSaturationPropagationLink>::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 1788 |
backPropLink->initBackwardPropagationLink(indiProcSatNode,creationSuperRole); |
| 1789 |
|
| 1790 |
installBackwardPropagationLink(indiProcSatNode,resolvedIndiNode,creationSuperRole,backPropLink,true,true,calcAlgContext); |
| 1791 |
|
| 1792 |
} |
| 1793 |
|
| 1794 |
} |
| 1795 |
|
| 1796 |
} |
| 1797 |
|
| 1798 |
} |
| 1799 |
} |
| 1800 |
} |
| 1801 |
} |
| 1802 |
|
| 1803 |
updateIndirectAddingIndividualStatusFlags(indiProcSatNode,resolvedIndiNode->getIndirectStatusFlags(),mCalcAlgContext); |
| 1804 |
updateAddingSuccessorConnectedNominal(indiProcSatNode,resolvedIndiNode->getSuccessorConnectedNominalSet(false),mCalcAlgContext); |
| 1805 |
updateMaxCardinalityCandidates(indiProcSatNode,resolvedIndiNode->getMaxAtleastCardinalityCandidate(),resolvedIndiNode->getMaxAtmostCardinalityCandidate(),mCalcAlgContext); |
| 1806 |
|
| 1807 |
|
| 1808 |
updated = true; |
| 1809 |
} |
| 1810 |
releaseIndividualSaturationSuccessorLinkDataLinker(mergingSuccDataLinker,calcAlgContext); |
| 1811 |
|
| 1812 |
} |
| 1813 |
return updated; |
| 1814 |
} |
| 1815 |
|
| 1816 |
|
| 1817 |
|
| 1818 |
|
| 1819 |
|
| 1820 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::updateSuccessorRoleALLConceptsExtensions(CIndividualSaturationProcessNode*& indiProcSatNode, CRole* role, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 1821 |
|
| 1822 |
CLinkedRoleSaturationSuccessorHash* linkedSuccHash = indiProcSatNode->getLinkedRoleSuccessorHash(false); |
| 1823 |
if (linkedSuccHash) { |
| 1824 |
CPROCESSHASH<CRole*,CLinkedRoleSaturationSuccessorData*>* succHash = linkedSuccHash->getLinkedRoleSuccessorHash(); |
| 1825 |
CLinkedRoleSaturationSuccessorData* succData = succHash->value(role,nullptr); |
| 1826 |
if (succData) { |
| 1827 |
succData->mRoleALLConceptsProcessingQueued = false; |
| 1828 |
CRoleBackwardSaturationPropagationHash* backwardPropHash = indiProcSatNode->getRoleBackwardPropagationHash(false); |
| 1829 |
if (backwardPropHash) { |
| 1830 |
CPROCESSHASH<CRole*,CRoleBackwardSaturationPropagationHashData>* backwardPropDataHash = backwardPropHash->getRoleBackwardPropagationDataHash(); |
| 1831 |
CRoleBackwardSaturationPropagationHashData* backwardPropData(backwardPropDataHash->valuePointer(role)); |
| 1832 |
if (backwardPropData && backwardPropData->mReapplyLinker) { |
| 1833 |
backwardPropData->mRoleALLConceptsProcessingQueued = false; |
| 1834 |
updateSuccessorRoleALLConceptsExtensions(indiProcSatNode,role,succData,*backwardPropData,calcAlgContext); |
| 1835 |
} |
| 1836 |
} |
| 1837 |
} |
| 1838 |
} |
| 1839 |
} |
| 1840 |
|
| 1841 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::updateSuccessorALLConceptsExtensions(CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 1842 |
bool updated = false; |
| 1843 |
|
| 1844 |
CLinkedRoleSaturationSuccessorHash* linkedSuccHash = indiProcSatNode->getLinkedRoleSuccessorHash(false); |
| 1845 |
if (linkedSuccHash) { |
| 1846 |
CSaturationIndividualNodeSuccessorExtensionData* indiProcSatNodeSuccExt = indiProcSatNode->getSuccessorExtensionData(false); |
| 1847 |
if (indiProcSatNodeSuccExt) { |
| 1848 |
CSaturationIndividualNodeALLConceptsExtensionData* indiProcSatNodeALLConSuccExt = indiProcSatNodeSuccExt->getALLConceptsExtensionData(false); |
| 1849 |
if (indiProcSatNodeALLConSuccExt) { |
| 1850 |
CPROCESSHASH<CRole*,CLinkedRoleSaturationSuccessorData*>* succHash = linkedSuccHash->getLinkedRoleSuccessorHash(); |
| 1851 |
|
| 1852 |
while (indiProcSatNodeALLConSuccExt->hasExtensionProcessData()) { |
| 1853 |
CSaturationSuccessorALLConceptExtensionData* satSucALLConExtData = indiProcSatNodeALLConSuccExt->takeNextExtensionProcessData(); |
| 1854 |
satSucALLConExtData->setExtensionProcessingQueued(false); |
| 1855 |
|
| 1856 |
CSaturationSuccessorConceptExtensionMap* satSucConExtMap = satSucALLConExtData->getSuccessorConceptExtensionMap(); |
| 1857 |
CIndividualSaturationProcessNode* indiNode = satSucALLConExtData->getIndividualNode(); |
| 1858 |
CRole* role = satSucALLConExtData->getRole(); |
| 1859 |
CIndividualSaturationProcessNode* lastResolvedIndiNode = satSucALLConExtData->getLastResolvedIndividualNode(); |
| 1860 |
if (!lastResolvedIndiNode) { |
| 1861 |
lastResolvedIndiNode = indiNode; |
| 1862 |
} |
| 1863 |
|
| 1864 |
cint64 lastSuccCard = satSucALLConExtData->getLastConnectedSuccessorCardinality(); |
| 1865 |
cint64 requiredSuccCard = satSucALLConExtData->getRequiredSuccessorCardinality(); |
| 1866 |
|
| 1867 |
|
| 1868 |
|
| 1869 |
|
| 1870 |
//CRoleBackwardSaturationPropagationHash* backwardPropHash = indiProcSatNode->getRoleBackwardPropagationHash(false); |
| 1871 |
//if (backwardPropHash) { |
| 1872 |
// CPROCESSHASH<cint64,CSaturationSuccessorConceptExtensionMapData>* extMap = satSucConExtMap->getSuccessorConceptExtensionMap(); |
| 1873 |
// CPROCESSHASH<CRole*,CRoleBackwardSaturationPropagationHashData>* backPropDataHash = backwardPropHash->getRoleBackwardPropagationDataHash(); |
| 1874 |
// if (backPropDataHash) { |
| 1875 |
// for (CSortedNegLinker<CRole*>* superRoleIt = role->getIndirectSuperRoleList(); superRoleIt; superRoleIt = superRoleIt->getNext()) { |
| 1876 |
// CRole* superRole = superRoleIt->getData(); |
| 1877 |
// if (!superRoleIt->isNegated()) { |
| 1878 |
// const CRoleBackwardSaturationPropagationHashData& backPropData = backPropDataHash->value(superRole); |
| 1879 |
// for (CBackwardSaturationPropagationReapplyDescriptor* backPropIt = backPropData.mReapplyLinker; backPropIt; backPropIt = backPropIt->getNext()) { |
| 1880 |
// CConceptSaturationDescriptor* conDes = backPropIt->getReapplyConceptSaturationDescriptor(); |
| 1881 |
// CConcept* concept = conDes->getConcept(); |
| 1882 |
// bool negation = conDes->isNegated(); |
| 1883 |
// for (CSortedNegLinker<CConcept*>* opLinkerIt = concept->getOperandList(); opLinkerIt; opLinkerIt = opLinkerIt->getNext()) { |
| 1884 |
// CConcept* opConcept = opLinkerIt->getData(); |
| 1885 |
// bool opNegation = opLinkerIt->isNegated()^negation; |
| 1886 |
// const CSaturationSuccessorConceptExtensionMapData& satSuccConExtMapData = extMap->value(opConcept->getConceptTag()); |
| 1887 |
// if (opNegation && !satSuccConExtMapData.mNegative) { |
| 1888 |
// bool bug = true; |
| 1889 |
// } |
| 1890 |
// if (!opNegation && !satSuccConExtMapData.mPositive) { |
| 1891 |
// bool bug = true; |
| 1892 |
// } |
| 1893 |
// } |
| 1894 |
// } |
| 1895 |
// } |
| 1896 |
// } |
| 1897 |
// } |
| 1898 |
//} |
| 1899 |
|
| 1900 |
|
| 1901 |
bool onlySuccessorCardinalityUpdated = true; |
| 1902 |
CIndividualSaturationProcessNode* resolvedIndiNode = lastResolvedIndiNode; |
| 1903 |
if (satSucALLConExtData->hasConceptsUpdatedFlag()) { |
| 1904 |
resolvedIndiNode = getResolvedIndividualNodeExtensionSuccessor(indiNode,satSucConExtMap,calcAlgContext); |
| 1905 |
if (lastResolvedIndiNode != resolvedIndiNode) { |
| 1906 |
onlySuccessorCardinalityUpdated = false; |
| 1907 |
} |
| 1908 |
} |
| 1909 |
if (lastResolvedIndiNode != resolvedIndiNode || lastSuccCard != requiredSuccCard) { |
| 1910 |
updated = true; |
| 1911 |
bool backwardLinkConnected = false; |
| 1912 |
if (lastResolvedIndiNode) { |
| 1913 |
for (CSortedNegLinker<CRole*>* superRoleIt = role->getIndirectSuperRoleList(); superRoleIt; superRoleIt = superRoleIt->getNext()) { |
| 1914 |
if (!superRoleIt->isNegated()) { |
| 1915 |
CRole* superRole = superRoleIt->getData(); |
| 1916 |
linkedSuccHash->deactivateLinkedSuccessor(superRole,lastResolvedIndiNode,role); |
| 1917 |
} |
| 1918 |
} |
| 1919 |
} |
| 1920 |
for (CSortedNegLinker<CRole*>* superRoleIt = role->getIndirectSuperRoleList(); superRoleIt; superRoleIt = superRoleIt->getNext()) { |
| 1921 |
CRole* superRole = superRoleIt->getData(); |
| 1922 |
if (!superRoleIt->isNegated()) { |
| 1923 |
linkedSuccHash->addExtensionSuccessor(superRole,resolvedIndiNode,role,requiredSuccCard); |
| 1924 |
addNewLinkedExtensionProcessingRole(superRole,indiProcSatNode,false,true,calcAlgContext); |
| 1925 |
|
| 1926 |
} else { |
| 1927 |
|
| 1928 |
if (!onlySuccessorCardinalityUpdated) { |
| 1929 |
backwardLinkConnected = true; |
| 1930 |
CBackwardSaturationPropagationLink* backPropLink = CObjectAllocator<CBackwardSaturationPropagationLink>::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 1931 |
backPropLink->initBackwardPropagationLink(indiProcSatNode,superRole); |
| 1932 |
|
| 1933 |
installBackwardPropagationLink(indiProcSatNode,resolvedIndiNode,superRole,backPropLink,true,true,calcAlgContext); |
| 1934 |
|
| 1935 |
} |
| 1936 |
|
| 1937 |
} |
| 1938 |
} |
| 1939 |
updateIndirectAddingIndividualStatusFlags(indiProcSatNode,resolvedIndiNode->getIndirectStatusFlags(),mCalcAlgContext); |
| 1940 |
updateAddingSuccessorConnectedNominal(indiProcSatNode,resolvedIndiNode->getSuccessorConnectedNominalSet(false),mCalcAlgContext); |
| 1941 |
updateMaxCardinalityCandidates(indiProcSatNode,resolvedIndiNode->getMaxAtleastCardinalityCandidate(),resolvedIndiNode->getMaxAtmostCardinalityCandidate(),mCalcAlgContext); |
| 1942 |
if (!onlySuccessorCardinalityUpdated && !backwardLinkConnected) { |
| 1943 |
CXLinker<CIndividualSaturationProcessNode*>* nonInvConnectedIndiNodeLinker = CObjectAllocator< CXLinker<CIndividualSaturationProcessNode*> >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 1944 |
nonInvConnectedIndiNodeLinker->initLinker(indiProcSatNode); |
| 1945 |
resolvedIndiNode->addNonInverseConnectedIndividualNodeLinker(nonInvConnectedIndiNodeLinker); |
| 1946 |
} |
| 1947 |
satSucALLConExtData->setLastResolvedIndividualNode(resolvedIndiNode); |
| 1948 |
satSucALLConExtData->setLastConnectedSuccessorCardinality(requiredSuccCard); |
| 1949 |
} |
| 1950 |
} |
| 1951 |
} |
| 1952 |
} |
| 1953 |
} |
| 1954 |
return updated; |
| 1955 |
} |
| 1956 |
|
| 1957 |
|
| 1958 |
|
| 1959 |
|
| 1960 |
|
| 1961 |
|
| 1962 |
|
| 1963 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::installBackwardPropagationLink(CIndividualSaturationProcessNode* sourceIndiProcSatNode, CIndividualSaturationProcessNode* destIndiProcSatNode, CRole* role, CBackwardSaturationPropagationLink* link, bool applyBackPropDes, bool queueFunctionalProcessing, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 1964 |
|
| 1965 |
CRoleBackwardSaturationPropagationHash* resolvedIndiBackPropHash = destIndiProcSatNode->getRoleBackwardPropagationHash(true); |
| 1966 |
CPROCESSHASH<CRole*,CRoleBackwardSaturationPropagationHashData>* backPropDataHash = resolvedIndiBackPropHash->getRoleBackwardPropagationDataHash(); |
| 1967 |
CRoleBackwardSaturationPropagationHashData& backPropData = (*backPropDataHash)[role]; |
| 1968 |
bool installLink = true; |
| 1969 |
bool linkInstalled = false; |
| 1970 |
if (backPropData.mLinkLinker) { |
| 1971 |
if (backPropData.mLinkLinker->getSourceIndividual() == link->getSourceIndividual()) { |
| 1972 |
installLink = false; |
| 1973 |
} |
| 1974 |
} |
| 1975 |
if (installLink) { |
| 1976 |
linkInstalled = true; |
| 1977 |
backPropData.mLinkLinker = link->append(backPropData.mLinkLinker); |
| 1978 |
CBackwardSaturationPropagationReapplyDescriptor* backPropReapplyDes = backPropData.mReapplyLinker; |
| 1979 |
if (backPropReapplyDes && applyBackPropDes) { |
| 1980 |
applyBackwardPropagationConcepts(sourceIndiProcSatNode,backPropReapplyDes,calcAlgContext); |
| 1981 |
} |
| 1982 |
} |
| 1983 |
if (backPropData.mRolePredecessorMergingQueuingRequired && queueFunctionalProcessing) { |
| 1984 |
if (!backPropData.mRolePredecessorMergingProcessingQueued) { |
| 1985 |
backPropData.mRolePredecessorMergingProcessingQueued = true; |
| 1986 |
|
| 1987 |
addSuccessorExtensionToProcessingQueue(destIndiProcSatNode,calcAlgContext); |
| 1988 |
CSaturationIndividualNodeSuccessorExtensionData* succExtData = destIndiProcSatNode->getSuccessorExtensionData(false); |
| 1989 |
if (succExtData) { |
| 1990 |
CSaturationIndividualNodeFUNCTIONALConceptsExtensionData* succIndiFUNCTIONALConExtData = succExtData->getFUNCTIONALConceptsExtensionData(false); |
| 1991 |
if (succIndiFUNCTIONALConExtData) { |
| 1992 |
if (succIndiFUNCTIONALConExtData->isSuccessorExtensionInitialized()) { |
| 1993 |
if (!succIndiFUNCTIONALConExtData->hasLinkedPredecessorAddedProcessLinkerForRole(role)) { |
| 1994 |
CRoleSaturationProcessLinker* roleProcessLinker = createRoleSaturationProcessLinker(calcAlgContext); |
| 1995 |
roleProcessLinker->initRoleProcessLinker(role); |
| 1996 |
succIndiFUNCTIONALConExtData->addLinkedPredecessorAddedRoleProcessLinker(roleProcessLinker); |
| 1997 |
} |
| 1998 |
} |
| 1999 |
} |
| 2000 |
} |
| 2001 |
} |
| 2002 |
} |
| 2003 |
return linkInstalled; |
| 2004 |
|
| 2005 |
} |
| 2006 |
|
| 2007 |
|
| 2008 |
|
| 2009 |
|
| 2010 |
|
| 2011 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::initializeIndividualNodeByCoping(CIndividualSaturationProcessNode* indiProcSatNode, CIndividualSaturationProcessNode* copyFromIndiProcSatNode, bool tryFlatLabelCopy, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2012 |
++mCopiedIndiNodeCount; |
| 2013 |
indiProcSatNode->initCopingIndividualSaturationProcessNode(copyFromIndiProcSatNode,tryFlatLabelCopy); |
| 2014 |
indiProcSatNode->setReferenceMode(2); |
| 2015 |
indiProcSatNode->setCopyIndividualNode(copyFromIndiProcSatNode); |
| 2016 |
indiProcSatNode->setReferenceIndividualSaturationProcessNode(copyFromIndiProcSatNode); |
| 2017 |
|
| 2018 |
updateDirectAddingIndividualStatusFlags(indiProcSatNode,copyFromIndiProcSatNode->getDirectStatusFlags(),mCalcAlgContext); |
| 2019 |
updateIndirectAddingIndividualStatusFlags(indiProcSatNode,copyFromIndiProcSatNode->getIndirectStatusFlags(),mCalcAlgContext); |
| 2020 |
updateAddingSuccessorConnectedNominal(indiProcSatNode,copyFromIndiProcSatNode->getSuccessorConnectedNominalSet(false),mCalcAlgContext); |
| 2021 |
updateMaxCardinalityCandidates(indiProcSatNode,copyFromIndiProcSatNode->getMaxAtleastCardinalityCandidate(),copyFromIndiProcSatNode->getMaxAtmostCardinalityCandidate(),mCalcAlgContext); |
| 2022 |
|
| 2023 |
|
| 2024 |
for (CConceptSaturationProcessLinker* conSatProLinkerIt = copyFromIndiProcSatNode->getConceptSaturationProcessLinker(); conSatProLinkerIt; conSatProLinkerIt = conSatProLinkerIt->getNext()) { |
| 2025 |
CConceptSaturationProcessLinker* conSatProLinker = createConceptSaturationProcessLinker(calcAlgContext); |
| 2026 |
conSatProLinker->initLinker(conSatProLinkerIt->getConceptSaturationDescriptor()); |
| 2027 |
indiProcSatNode->addConceptSaturationProcessLinker(conSatProLinker); |
| 2028 |
} |
| 2029 |
|
| 2030 |
CSaturationIndividualNodeSuccessorExtensionData* copySuccExtensionData = copyFromIndiProcSatNode->getSuccessorExtensionData(false); |
| 2031 |
if (copySuccExtensionData) { |
| 2032 |
CSaturationIndividualNodeALLConceptsExtensionData* copyALLConceptsExtension = copySuccExtensionData->getALLConceptsExtensionData(false); |
| 2033 |
if (copyALLConceptsExtension) { |
| 2034 |
if (copyALLConceptsExtension->isSuccessorExtensionInitialized()) { |
| 2035 |
addSuccessorExtensionToProcessingQueue(indiProcSatNode,calcAlgContext); |
| 2036 |
} |
| 2037 |
} |
| 2038 |
CSaturationIndividualNodeFUNCTIONALConceptsExtensionData* copyFUNCTIONALConceptsExtension = copySuccExtensionData->getFUNCTIONALConceptsExtensionData(false); |
| 2039 |
if (copyFUNCTIONALConceptsExtension) { |
| 2040 |
if (copyFUNCTIONALConceptsExtension->isSuccessorExtensionInitialized()) { |
| 2041 |
|
| 2042 |
CSaturationIndividualNodeFUNCTIONALConceptsExtensionData* functionalConceptsExtension = indiProcSatNode->getSuccessorExtensionData(true)->getFUNCTIONALConceptsExtensionData(true); |
| 2043 |
|
| 2044 |
addSuccessorExtensionToProcessingQueue(indiProcSatNode,calcAlgContext); |
| 2045 |
for (CRoleSaturationProcessLinker* roleLinkerIt = copyFUNCTIONALConceptsExtension->getCopyingInitializingRoleProcessLinker(); roleLinkerIt; roleLinkerIt = roleLinkerIt->getNext()) { |
| 2046 |
CRole* role = roleLinkerIt->getRole(); |
| 2047 |
CRoleSaturationProcessLinker* tmpRoleLinker = createRoleSaturationProcessLinker(calcAlgContext); |
| 2048 |
tmpRoleLinker->initRoleProcessLinker(role); |
| 2049 |
functionalConceptsExtension->addFunctionalityAddedRoleProcessLinker(tmpRoleLinker); |
| 2050 |
} |
| 2051 |
} |
| 2052 |
} |
| 2053 |
} |
| 2054 |
} |
| 2055 |
|
| 2056 |
|
| 2057 |
|
| 2058 |
|
| 2059 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::preprocessResolvedIndividualNode(CIndividualSaturationProcessNode* resolvedIndiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2060 |
bool processed = false; |
| 2061 |
CConceptSaturationProcessLinker* conceptSaturationProcessLinker = resolvedIndiProcSatNode->takeConceptSaturationProcessLinker(); |
| 2062 |
while (conceptSaturationProcessLinker) { |
| 2063 |
STATINC(RULEAPPLICATIONCOUNT,calcAlgContext); |
| 2064 |
KONCLUCE_TASK_ALGORITHM_SATURATION_SATURATION_MODEL_STRING_INSTRUCTION(mRuleBeginDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext)); |
| 2065 |
applyTableauSaturationRule(resolvedIndiProcSatNode,conceptSaturationProcessLinker); |
| 2066 |
KONCLUCE_TASK_ALGORITHM_SATURATION_SATURATION_MODEL_STRING_INSTRUCTION(mRuleEndDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext)); |
| 2067 |
releaseConceptSaturationProcessLinker(conceptSaturationProcessLinker,calcAlgContext); |
| 2068 |
conceptSaturationProcessLinker = resolvedIndiProcSatNode->takeConceptSaturationProcessLinker(); |
| 2069 |
processed = true; |
| 2070 |
} |
| 2071 |
return processed; |
| 2072 |
} |
| 2073 |
|
| 2074 |
|
| 2075 |
|
| 2076 |
|
| 2077 |
CIndividualSaturationProcessNode* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getResolvedIndividualNodeRepresentativeRangeAssertion(CIndividualSaturationProcessNode* indiProcSatNode, CIndividual* nominalIndi, CRole* role, bool inversedRole, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2078 |
CIndividualSaturationProcessNode* resolvedNode = nullptr; |
| 2079 |
CSaturationIndividualNodeExtensionResolveData* resolveData = indiProcSatNode->getSuccessorExtensionData(true)->getBaseExtensionResolveData(true); |
| 2080 |
CIndividualSaturationProcessNode* copyIndiProcSatNode = indiProcSatNode; |
| 2081 |
CConceptAssertionLinker* conAssLinker = nominalIndi->getAssertionConceptLinker(); |
| 2082 |
CConcept* topConcept = calcAlgContext->getProcessingDataBox()->getOntologyTopConcept(); |
| 2083 |
CConcept* nominalConcept = nominalIndi->getIndividualNominalConcept(); |
| 2084 |
// resolve individual |
| 2085 |
for (CConceptAssertionLinker* conAssLinkerIt = conAssLinker; conAssLinkerIt; conAssLinkerIt = conAssLinkerIt->getNext()) { |
| 2086 |
CConcept* concept = conAssLinkerIt->getData(); |
| 2087 |
bool negated = conAssLinkerIt->isNegated(); |
| 2088 |
|
| 2089 |
if (concept == nominalConcept) { |
| 2090 |
if (negated) { |
| 2091 |
resolveData = getResolvedIndividualNodeExtension(resolveData,topConcept,true,copyIndiProcSatNode,calcAlgContext); |
| 2092 |
} |
| 2093 |
} else { |
| 2094 |
if (concept->getOperatorCode() == CCNOMINAL) { |
| 2095 |
if (concept->getNominalIndividual() == nominalIndi) { |
| 2096 |
if (negated) { |
| 2097 |
resolveData = getResolvedIndividualNodeExtension(resolveData,topConcept,true,copyIndiProcSatNode,calcAlgContext); |
| 2098 |
} |
| 2099 |
} else if (!negated) { |
| 2100 |
resolveData = getResolvedIndividualNodeExtension(resolveData,concept,negated,copyIndiProcSatNode,calcAlgContext); |
| 2101 |
} |
| 2102 |
} else { |
| 2103 |
resolveData = getResolvedIndividualNodeExtension(resolveData,concept,negated,copyIndiProcSatNode,calcAlgContext); |
| 2104 |
} |
| 2105 |
} |
| 2106 |
} |
| 2107 |
|
| 2108 |
for (CSortedNegLinker<CRole*>* superRoleIt = role->getIndirectSuperRoleList(); superRoleIt; superRoleIt = superRoleIt->getNext()) { |
| 2109 |
CRole* superRole = superRoleIt->getData(); |
| 2110 |
CSortedNegLinker<CConcept*>* rangeConLinker = superRole->getRelativeRangeConceptList(superRoleIt->isNegated()^inversedRole); |
| 2111 |
for (CSortedNegLinker<CConcept*>* rangeConLinkerIt = rangeConLinker; rangeConLinkerIt; rangeConLinkerIt = rangeConLinkerIt->getNext()) { |
| 2112 |
CConcept* rangeConcept = rangeConLinkerIt->getData(); |
| 2113 |
bool rangeConceptNegation = rangeConLinkerIt->isNegated(); |
| 2114 |
resolveData = getResolvedIndividualNodeExtension(resolveData,rangeConcept,rangeConceptNegation,copyIndiProcSatNode,calcAlgContext); |
| 2115 |
} |
| 2116 |
} |
| 2117 |
|
| 2118 |
resolveData = getResolvedNeighbourIndividualNodeExtension(resolveData, copyIndiProcSatNode, calcAlgContext); |
| 2119 |
|
| 2120 |
|
| 2121 |
if (!resolveData->hasProcessingIndividualNode()) { |
| 2122 |
// create individual |
| 2123 |
resolvedNode = createResolvedIndividualNode(resolveData,copyIndiProcSatNode,true,calcAlgContext); |
| 2124 |
resolvedNode->setABoxIndividualRepresentationNode(true); |
| 2125 |
resolvedNode->setSeparated(indiProcSatNode->isSeparated()); |
| 2126 |
CReapplyConceptSaturationLabelSet* conSet = resolvedNode->getReapplyConceptSaturationLabelSet(true); |
| 2127 |
|
| 2128 |
|
| 2129 |
// add all concepts to individual |
| 2130 |
for (CConceptAssertionLinker* conAssLinkerIt = conAssLinker; conAssLinkerIt; conAssLinkerIt = conAssLinkerIt->getNext()) { |
| 2131 |
CConcept* concept = conAssLinkerIt->getData(); |
| 2132 |
bool negated = conAssLinkerIt->isNegated(); |
| 2133 |
if (concept == nominalConcept) { |
| 2134 |
if (negated) { |
| 2135 |
addConceptFilteredToIndividual(topConcept,true,resolvedNode,calcAlgContext); |
| 2136 |
} |
| 2137 |
} else { |
| 2138 |
if (concept->getOperatorCode() == CCNOMINAL) { |
| 2139 |
if (concept->getNominalIndividual() == nominalIndi) { |
| 2140 |
if (negated) { |
| 2141 |
addConceptFilteredToIndividual(topConcept,true,resolvedNode,calcAlgContext); |
| 2142 |
} |
| 2143 |
} else if (!negated) { |
| 2144 |
addConceptFilteredToIndividual(concept,negated,resolvedNode,calcAlgContext); |
| 2145 |
} |
| 2146 |
} else { |
| 2147 |
addConceptFilteredToIndividual(concept,negated,resolvedNode,calcAlgContext); |
| 2148 |
} |
| 2149 |
} |
| 2150 |
} |
| 2151 |
|
| 2152 |
|
| 2153 |
|
| 2154 |
for (CSortedNegLinker<CRole*>* superRoleIt = role->getIndirectSuperRoleList(); superRoleIt; superRoleIt = superRoleIt->getNext()) { |
| 2155 |
CRole* superRole = superRoleIt->getData(); |
| 2156 |
CSortedNegLinker<CConcept*>* rangeConLinker = superRole->getRelativeRangeConceptList(superRoleIt->isNegated()^inversedRole); |
| 2157 |
for (CSortedNegLinker<CConcept*>* rangeConLinkerIt = rangeConLinker; rangeConLinkerIt; rangeConLinkerIt = rangeConLinkerIt->getNext()) { |
| 2158 |
CConcept* rangeConcept = rangeConLinkerIt->getData(); |
| 2159 |
bool rangeConceptNegation = rangeConLinkerIt->isNegated(); |
| 2160 |
addConceptFilteredToIndividual(rangeConcept,rangeConceptNegation,resolvedNode,calcAlgContext); |
| 2161 |
} |
| 2162 |
} |
| 2163 |
|
| 2164 |
preprocessResolvedIndividualNode(resolvedNode,calcAlgContext); |
| 2165 |
|
| 2166 |
} |
| 2167 |
resolvedNode = resolveData->getProcessingIndividualNode(); |
| 2168 |
return resolvedNode; |
| 2169 |
} |
| 2170 |
|
| 2171 |
|
| 2172 |
|
| 2173 |
|
| 2174 |
|
| 2175 |
CIndividualSaturationProcessNode* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getResolvedIndividualNodeRepresentativeAssertion(CIndividualSaturationProcessNode* indiProcSatNode, CIndividual* nominalIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2176 |
CIndividualSaturationProcessNode* resolvedNode = nullptr; |
| 2177 |
CSaturationIndividualNodeExtensionResolveData* resolveData = indiProcSatNode->getSuccessorExtensionData(true)->getBaseExtensionResolveData(true); |
| 2178 |
CIndividualSaturationProcessNode* copyIndiProcSatNode = indiProcSatNode; |
| 2179 |
CConceptAssertionLinker* conAssLinker = nominalIndi->getAssertionConceptLinker(); |
| 2180 |
CConcept* topConcept = calcAlgContext->getProcessingDataBox()->getOntologyTopConcept(); |
| 2181 |
CConcept* nominalConcept = nominalIndi->getIndividualNominalConcept(); |
| 2182 |
// resolve individual |
| 2183 |
for (CConceptAssertionLinker* conAssLinkerIt = conAssLinker; conAssLinkerIt; conAssLinkerIt = conAssLinkerIt->getNext()) { |
| 2184 |
CConcept* concept = conAssLinkerIt->getData(); |
| 2185 |
bool negated = conAssLinkerIt->isNegated(); |
| 2186 |
|
| 2187 |
if (concept == nominalConcept) { |
| 2188 |
if (negated) { |
| 2189 |
resolveData = getResolvedIndividualNodeExtension(resolveData,topConcept,true,copyIndiProcSatNode,calcAlgContext); |
| 2190 |
} |
| 2191 |
} else { |
| 2192 |
if (concept->getOperatorCode() == CCNOMINAL) { |
| 2193 |
if (concept->getNominalIndividual() == nominalIndi) { |
| 2194 |
if (negated) { |
| 2195 |
resolveData = getResolvedIndividualNodeExtension(resolveData,topConcept,true,copyIndiProcSatNode,calcAlgContext); |
| 2196 |
} |
| 2197 |
} else { |
| 2198 |
resolveData = getResolvedIndividualNodeExtension(resolveData,concept,negated,copyIndiProcSatNode,calcAlgContext); |
| 2199 |
} |
| 2200 |
} else { |
| 2201 |
resolveData = getResolvedIndividualNodeExtension(resolveData,concept,negated,copyIndiProcSatNode,calcAlgContext); |
| 2202 |
} |
| 2203 |
} |
| 2204 |
} |
| 2205 |
|
| 2206 |
resolveData = getResolvedNeighbourIndividualNodeExtension(resolveData, copyIndiProcSatNode, calcAlgContext); |
| 2207 |
|
| 2208 |
if (!resolveData->hasProcessingIndividualNode()) { |
| 2209 |
// create individual |
| 2210 |
resolvedNode = createResolvedIndividualNode(resolveData,copyIndiProcSatNode,true,calcAlgContext); |
| 2211 |
resolvedNode->setABoxIndividualRepresentationNode(true); |
| 2212 |
resolvedNode->setSeparated(indiProcSatNode->isSeparated()); |
| 2213 |
CReapplyConceptSaturationLabelSet* conSet = resolvedNode->getReapplyConceptSaturationLabelSet(true); |
| 2214 |
|
| 2215 |
|
| 2216 |
// add all concepts to individual |
| 2217 |
for (CConceptAssertionLinker* conAssLinkerIt = conAssLinker; conAssLinkerIt; conAssLinkerIt = conAssLinkerIt->getNext()) { |
| 2218 |
CConcept* concept = conAssLinkerIt->getData(); |
| 2219 |
bool negated = conAssLinkerIt->isNegated(); |
| 2220 |
if (concept == nominalConcept) { |
| 2221 |
if (negated) { |
| 2222 |
addConceptFilteredToIndividual(topConcept,true,resolvedNode,calcAlgContext); |
| 2223 |
} |
| 2224 |
} else { |
| 2225 |
if (concept->getOperatorCode() == CCNOMINAL) { |
| 2226 |
if (concept->getNominalIndividual() == nominalIndi) { |
| 2227 |
if (negated) { |
| 2228 |
addConceptFilteredToIndividual(topConcept,true,resolvedNode,calcAlgContext); |
| 2229 |
} |
| 2230 |
} else { |
| 2231 |
addConceptFilteredToIndividual(concept,negated,resolvedNode,calcAlgContext); |
| 2232 |
} |
| 2233 |
} else { |
| 2234 |
addConceptFilteredToIndividual(concept,negated,resolvedNode,calcAlgContext); |
| 2235 |
} |
| 2236 |
} |
| 2237 |
} |
| 2238 |
|
| 2239 |
preprocessResolvedIndividualNode(resolvedNode,calcAlgContext); |
| 2240 |
} |
| 2241 |
resolvedNode = resolveData->getProcessingIndividualNode(); |
| 2242 |
return resolvedNode; |
| 2243 |
} |
| 2244 |
|
| 2245 |
|
| 2246 |
|
| 2247 |
CIndividualSaturationProcessNode* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getResolvedIndividualNodeAssertion(CIndividualSaturationProcessNode* indiProcSatNode, CIndividual* nominalIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2248 |
CIndividualSaturationProcessNode* resolvedNode = nullptr; |
| 2249 |
CSaturationIndividualNodeExtensionResolveData* resolveData = indiProcSatNode->getSuccessorExtensionData(true)->getBaseExtensionResolveData(true); |
| 2250 |
CIndividualSaturationProcessNode* copyIndiProcSatNode = indiProcSatNode; |
| 2251 |
CConceptAssertionLinker* conAssLinker = nominalIndi->getAssertionConceptLinker(); |
| 2252 |
CConcept* nominalConcept = nominalIndi->getIndividualNominalConcept(); |
| 2253 |
// resolve individual |
| 2254 |
for (CConceptAssertionLinker* conAssLinkerIt = conAssLinker; conAssLinkerIt; conAssLinkerIt = conAssLinkerIt->getNext()) { |
| 2255 |
CConcept* concept = conAssLinkerIt->getData(); |
| 2256 |
bool negated = conAssLinkerIt->isNegated(); |
| 2257 |
if (negated || concept != nominalConcept) { |
| 2258 |
resolveData = getResolvedIndividualNodeExtension(resolveData,concept,negated,copyIndiProcSatNode,calcAlgContext); |
| 2259 |
} |
| 2260 |
} |
| 2261 |
if (!resolveData->hasProcessingIndividualNode()) { |
| 2262 |
// create individual |
| 2263 |
resolvedNode = createResolvedIndividualNode(resolveData,copyIndiProcSatNode,true,calcAlgContext); |
| 2264 |
resolvedNode->setSeparated(indiProcSatNode->isSeparated()); |
| 2265 |
CReapplyConceptSaturationLabelSet* conSet = resolvedNode->getReapplyConceptSaturationLabelSet(true); |
| 2266 |
|
| 2267 |
// add all concepts to individual |
| 2268 |
for (CConceptAssertionLinker* conAssLinkerIt = conAssLinker; conAssLinkerIt; conAssLinkerIt = conAssLinkerIt->getNext()) { |
| 2269 |
CConcept* concept = conAssLinkerIt->getData(); |
| 2270 |
bool negated = conAssLinkerIt->isNegated(); |
| 2271 |
if (negated || concept != nominalConcept) { |
| 2272 |
addConceptFilteredToIndividual(concept,negated,resolvedNode,calcAlgContext); |
| 2273 |
} |
| 2274 |
} |
| 2275 |
|
| 2276 |
preprocessResolvedIndividualNode(resolvedNode,calcAlgContext); |
| 2277 |
} |
| 2278 |
resolvedNode = resolveData->getProcessingIndividualNode(); |
| 2279 |
return resolvedNode; |
| 2280 |
} |
| 2281 |
|
| 2282 |
|
| 2283 |
|
| 2284 |
|
| 2285 |
|
| 2286 |
CIndividualSaturationProcessNode* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getResolvedIndividualNodeExtensionSuccessor(CIndividualSaturationProcessNode* indiProcSatNode, CSaturationSuccessorConceptExtensionMap* succConExtMap, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2287 |
CIndividualSaturationProcessNode* resolvedNode = nullptr; |
| 2288 |
CSaturationIndividualNodeExtensionResolveData* resolveData = indiProcSatNode->getSuccessorExtensionData(true)->getBaseExtensionResolveData(true); |
| 2289 |
CPROCESSHASH<cint64,CSaturationSuccessorConceptExtensionMapData>* succConExtDataMap = succConExtMap->getSuccessorConceptExtensionMap(); |
| 2290 |
CIndividualSaturationProcessNode* copyIndiProcSatNode = indiProcSatNode; |
| 2291 |
// resolve individual |
| 2292 |
for (CPROCESSHASH<cint64,CSaturationSuccessorConceptExtensionMapData>::const_iterator it = succConExtDataMap->constBegin(), itEnd = succConExtDataMap->constEnd(); it != itEnd; ++it) { |
| 2293 |
const CSaturationSuccessorConceptExtensionMapData& conExtDat(it.value()); |
| 2294 |
CConcept* concept = conExtDat.mConcept; |
| 2295 |
bool addPositive = conExtDat.mPositive; |
| 2296 |
bool addNegative = conExtDat.mNegative; |
| 2297 |
if (addPositive) { |
| 2298 |
resolveData = getResolvedIndividualNodeExtension(resolveData,concept,false,copyIndiProcSatNode,calcAlgContext); |
| 2299 |
} |
| 2300 |
if (addNegative) { |
| 2301 |
resolveData = getResolvedIndividualNodeExtension(resolveData,concept,true,copyIndiProcSatNode,calcAlgContext); |
| 2302 |
} |
| 2303 |
} |
| 2304 |
if (!resolveData->hasProcessingIndividualNode()) { |
| 2305 |
// create individual |
| 2306 |
resolvedNode = createResolvedIndividualNode(resolveData,copyIndiProcSatNode,true,calcAlgContext); |
| 2307 |
CReapplyConceptSaturationLabelSet* conSet = resolvedNode->getReapplyConceptSaturationLabelSet(true); |
| 2308 |
|
| 2309 |
// add all concepts to individual |
| 2310 |
for (CPROCESSHASH<cint64,CSaturationSuccessorConceptExtensionMapData>::const_iterator it = succConExtDataMap->constBegin(), itEnd = succConExtDataMap->constEnd(); it != itEnd; ++it) { |
| 2311 |
const CSaturationSuccessorConceptExtensionMapData& conExtDat(it.value()); |
| 2312 |
CConcept* concept = conExtDat.mConcept; |
| 2313 |
bool addPositive = conExtDat.mPositive; |
| 2314 |
bool addNegative = conExtDat.mNegative; |
| 2315 |
if (addPositive) { |
| 2316 |
addConceptFilteredToIndividual(concept,false,resolvedNode,calcAlgContext); |
| 2317 |
} |
| 2318 |
if (addNegative) { |
| 2319 |
addConceptFilteredToIndividual(concept,true,resolvedNode,calcAlgContext); |
| 2320 |
} |
| 2321 |
} |
| 2322 |
|
| 2323 |
preprocessResolvedIndividualNode(resolvedNode,calcAlgContext); |
| 2324 |
} |
| 2325 |
resolvedNode = resolveData->getProcessingIndividualNode(); |
| 2326 |
return resolvedNode; |
| 2327 |
} |
| 2328 |
|
| 2329 |
|
| 2330 |
|
| 2331 |
CIndividualSaturationProcessNode* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::createResolvedIndividualNode(CSaturationIndividualNodeExtensionResolveData* resolveData, CIndividualSaturationProcessNode*& copyIndiProcSatNode, bool queueProcessing, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2332 |
CIndividualSaturationProcessNode* resolvedNode = nullptr; |
| 2333 |
resolvedNode = CObjectParameterizingAllocator< CIndividualSaturationProcessNode,CProcessContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedProcessTaskMemoryAllocationManager(),calcAlgContext->getUsedProcessContext()); |
| 2334 |
resolvedNode->initIndividualSaturationProcessNode(resolveData->getProcessingIndividualNodeID(),nullptr,nullptr); |
| 2335 |
initializeIndividualNodeByCoping(resolvedNode,copyIndiProcSatNode,false,calcAlgContext); |
| 2336 |
|
| 2337 |
resolveData->setProcessingIndividualNode(resolvedNode); |
| 2338 |
resolvedNode->getSuccessorExtensionData(true)->setExtensionResolveData(resolveData); |
| 2339 |
resolvedNode->setInitialized(true); |
| 2340 |
resolvedNode->setRequiredBackwardPropagation(true); |
| 2341 |
addIndividualToCompletionQueue(resolvedNode,calcAlgContext); |
| 2342 |
|
| 2343 |
CIndividualSaturationProcessNodeLinker* resolveNodeProcessLiner = CObjectAllocator<CIndividualSaturationProcessNodeLinker>::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 2344 |
resolveNodeProcessLiner->initProcessNodeLinker(resolvedNode,queueProcessing); |
| 2345 |
resolvedNode->setIndividualSaturationProcessNodeLinker(resolveNodeProcessLiner); |
| 2346 |
if (queueProcessing) { |
| 2347 |
calcAlgContext->getUsedProcessingDataBox()->addIndividualSaturationProcessNodeLinker(resolveNodeProcessLiner); |
| 2348 |
} |
| 2349 |
CIndividualSaturationProcessNodeVector* indiVec = calcAlgContext->getUsedProcessingDataBox()->getIndividualSaturationProcessNodeVector(true); |
| 2350 |
indiVec->setData(resolvedNode->getIndividualID(),resolvedNode); |
| 2351 |
return resolvedNode; |
| 2352 |
} |
| 2353 |
|
| 2354 |
|
| 2355 |
|
| 2356 |
|
| 2357 |
|
| 2358 |
|
| 2359 |
|
| 2360 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::collectResolveIndividualExtendableConceptMap(CIndividualSaturationProcessNode* baseIndiNode, CIndividualSaturationProcessNode* extensionIndiNode, CPROCESSINGHASH<cint64,CConceptNegationPair>*& conExtMap, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2361 |
CReapplyConceptSaturationLabelSet* extConSet = extensionIndiNode->getReapplyConceptSaturationLabelSet(false); |
| 2362 |
bool extensionRequired = false; |
| 2363 |
for (CConceptSaturationDescriptor* conIt = extConSet->getConceptSaturationDescriptionLinker(); conIt; conIt = conIt->getNextConceptDesciptor()) { |
| 2364 |
CConceptSaturationDescriptor* containedConDes = nullptr; |
| 2365 |
CImplicationReapplyConceptSaturationDescriptor* containedImpReaDes = nullptr; |
| 2366 |
bool insertionRequired = false; |
| 2367 |
CReapplyConceptSaturationLabelSet* baseConSet = baseIndiNode->getReapplyConceptSaturationLabelSet(false); |
| 2368 |
if (baseConSet->getConceptSaturationDescriptor(conIt->getConcept(),containedConDes,containedImpReaDes)) { |
| 2369 |
if (!containedConDes) { |
| 2370 |
insertionRequired = true; |
| 2371 |
} else if (containedConDes->isNegated() != conIt->isNegated()) { |
| 2372 |
insertionRequired = true; |
| 2373 |
} |
| 2374 |
} else { |
| 2375 |
insertionRequired = true; |
| 2376 |
} |
| 2377 |
|
| 2378 |
if (insertionRequired) { |
| 2379 |
extensionRequired = true; |
| 2380 |
if (!conExtMap) { |
| 2381 |
conExtMap = CObjectParameterizingAllocator< CPROCESSINGHASH<cint64,CConceptNegationPair>,CContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedTemporaryMemoryAllocationManager(),calcAlgContext->getTaskProcessorContext()); |
| 2382 |
} |
| 2383 |
conExtMap->insert(conIt->getConceptTag(),CConceptNegationPair(conIt->getConcept(),conIt->isNegated())); |
| 2384 |
} |
| 2385 |
} |
| 2386 |
return extensionRequired; |
| 2387 |
} |
| 2388 |
|
| 2389 |
|
| 2390 |
CSaturationIndividualNodeExtensionResolveData* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getResolvedIndividualNodeExtension(CSaturationIndividualNodeExtensionResolveData* resolveData, CPROCESSINGHASH<cint64,CConceptNegationPair>* conExtensionMap, CIndividualSaturationProcessNode*& copyIndiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2391 |
return getResolvedIndividualNodeExtension(resolveData,conExtensionMap,copyIndiProcSatNode,nullptr,calcAlgContext); |
| 2392 |
} |
| 2393 |
|
| 2394 |
CSaturationIndividualNodeExtensionResolveData* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getResolvedIndividualNodeExtension(CSaturationIndividualNodeExtensionResolveData* resolveData, CPROCESSINGHASH<cint64,CConceptNegationPair>* conExtensionMap, CIndividualSaturationProcessNode*& copyIndiProcSatNode, bool* newNodeExpansionCreated, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2395 |
if (conExtensionMap) { |
| 2396 |
|
| 2397 |
for (CPROCESSHASH<cint64,CConceptNegationPair>::const_iterator it = conExtensionMap->constBegin(), itEnd = conExtensionMap->constEnd(); it != itEnd; ++it) { |
| 2398 |
const CConceptNegationPair& conExtDat(it.value()); |
| 2399 |
CConcept* concept = conExtDat.first; |
| 2400 |
bool negation = conExtDat.second; |
| 2401 |
|
| 2402 |
resolveData = getResolvedIndividualNodeExtension(resolveData,concept,negation,copyIndiProcSatNode,calcAlgContext); |
| 2403 |
} |
| 2404 |
|
| 2405 |
if (!resolveData->getProcessingIndividualNode()) { |
| 2406 |
CIndividualSaturationProcessNode* resolvedNode = createResolvedIndividualNode(resolveData,copyIndiProcSatNode,true,calcAlgContext); |
| 2407 |
resolveData->setProcessingIndividualNode(resolvedNode); |
| 2408 |
|
| 2409 |
|
| 2410 |
for (CPROCESSHASH<cint64,CConceptNegationPair>::const_iterator it = conExtensionMap->constBegin(), itEnd = conExtensionMap->constEnd(); it != itEnd; ++it) { |
| 2411 |
const CConceptNegationPair& conExtDat(it.value()); |
| 2412 |
CConcept* concept = conExtDat.first; |
| 2413 |
bool negation = conExtDat.second; |
| 2414 |
addConceptFilteredToIndividual(concept,negation,resolvedNode,calcAlgContext); |
| 2415 |
} |
| 2416 |
preprocessResolvedIndividualNode(resolvedNode,calcAlgContext); |
| 2417 |
|
| 2418 |
if (newNodeExpansionCreated) { |
| 2419 |
*newNodeExpansionCreated = true; |
| 2420 |
} |
| 2421 |
} |
| 2422 |
|
| 2423 |
copyIndiProcSatNode = resolveData->getProcessingIndividualNode(); |
| 2424 |
} |
| 2425 |
|
| 2426 |
return resolveData; |
| 2427 |
} |
| 2428 |
|
| 2429 |
|
| 2430 |
|
| 2431 |
|
| 2432 |
CSaturationIndividualNodeExtensionResolveData* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getResolvedIndividualNodeExtension(CSaturationIndividualNodeExtensionResolveData* resolveData, CIndividualSaturationProcessNode* extensionNode, CIndividualSaturationProcessNode*& copyIndiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2433 |
return getResolvedIndividualNodeExtension(resolveData,extensionNode,copyIndiProcSatNode,nullptr,calcAlgContext); |
| 2434 |
} |
| 2435 |
|
| 2436 |
|
| 2437 |
|
| 2438 |
CSaturationIndividualNodeExtensionResolveData* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getResolvedIndividualNodeExtension(CSaturationIndividualNodeExtensionResolveData* resolveData, CIndividualSaturationProcessNode* extensionNode, CIndividualSaturationProcessNode*& copyIndiProcSatNode, bool* newNodeExpansionCreated, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2439 |
CSaturationIndividualNodeExtensionResolveHashData& resolveHashData = resolveData->getIndividualNodeExtensionResolveHash(true)->getResolvedIndividualNodeExtensionData(extensionNode); |
| 2440 |
if (!resolveHashData.mResolveData) { |
| 2441 |
CReapplyConceptSaturationLabelSet* extConSet = extensionNode->getReapplyConceptSaturationLabelSet(false); |
| 2442 |
|
| 2443 |
CPROCESSINGHASH<cint64,CConceptNegationPair>* conExtensionMap = nullptr; |
| 2444 |
|
| 2445 |
for (CConceptSaturationDescriptor* conIt = extConSet->getConceptSaturationDescriptionLinker(); conIt; conIt = conIt->getNextConceptDesciptor()) { |
| 2446 |
CConceptSaturationDescriptor* containedConDes = nullptr; |
| 2447 |
CImplicationReapplyConceptSaturationDescriptor* containedImpReaDes = nullptr; |
| 2448 |
bool insertionRequired = false; |
| 2449 |
CReapplyConceptSaturationLabelSet* baseConSet = copyIndiProcSatNode->getReapplyConceptSaturationLabelSet(false); |
| 2450 |
if (baseConSet->getConceptSaturationDescriptor(conIt->getConcept(),containedConDes,containedImpReaDes)) { |
| 2451 |
if (!containedConDes) { |
| 2452 |
insertionRequired = true; |
| 2453 |
} else if (containedConDes->isNegated() != conIt->isNegated()) { |
| 2454 |
insertionRequired = true; |
| 2455 |
} |
| 2456 |
} else { |
| 2457 |
insertionRequired = true; |
| 2458 |
} |
| 2459 |
|
| 2460 |
if (insertionRequired) { |
| 2461 |
if (!conExtensionMap) { |
| 2462 |
conExtensionMap = CObjectParameterizingAllocator< CPROCESSINGHASH<cint64,CConceptNegationPair>,CContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedTemporaryMemoryAllocationManager(),calcAlgContext->getTaskProcessorContext()); |
| 2463 |
} |
| 2464 |
conExtensionMap->insert(conIt->getConceptTag(),CConceptNegationPair(conIt->getConcept(),conIt->isNegated())); |
| 2465 |
} |
| 2466 |
} |
| 2467 |
|
| 2468 |
|
| 2469 |
resolveData = getResolvedIndividualNodeExtension(resolveData,conExtensionMap,copyIndiProcSatNode,newNodeExpansionCreated,calcAlgContext); |
| 2470 |
|
| 2471 |
|
| 2472 |
resolveHashData.mResolveData = resolveData; |
| 2473 |
|
| 2474 |
} |
| 2475 |
return resolveHashData.mResolveData; |
| 2476 |
} |
| 2477 |
|
| 2478 |
|
| 2479 |
|
| 2480 |
|
| 2481 |
|
| 2482 |
|
| 2483 |
|
| 2484 |
|
| 2485 |
|
| 2486 |
CSaturationIndividualNodeExtensionResolveData* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getResolvedNeighbourIndividualNodeExtension(CSaturationIndividualNodeExtensionResolveData* resolveData, CIndividualSaturationProcessNode*& copyIndiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2487 |
CSaturationIndividualNodeExtensionResolveHashData& resolveHashData = resolveData->getIndividualNodeExtensionResolveHash(true)->getResolvedNeighbourIndividualNodeExtensionData(); |
| 2488 |
if (!resolveHashData.mResolveData) { |
| 2489 |
resolveHashData.mResolveData = CObjectParameterizingAllocator< CSaturationIndividualNodeExtensionResolveData, CProcessContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedProcessTaskMemoryAllocationManager(), calcAlgContext->getUsedProcessContext()); |
| 2490 |
cint64 nextResolveIndiID = calcAlgContext->getUsedProcessingDataBox()->getNextSaturationResolvedSuccessorExtensionIndividualNodeID(); |
| 2491 |
resolveHashData.mResolveData->initExtensionResolveData(nextResolveIndiID); |
| 2492 |
} |
| 2493 |
if (resolveHashData.mResolveData->hasProcessingIndividualNode()) { |
| 2494 |
copyIndiProcSatNode = resolveHashData.mResolveData->getProcessingIndividualNode(); |
| 2495 |
} |
| 2496 |
return resolveHashData.mResolveData; |
| 2497 |
} |
| 2498 |
|
| 2499 |
|
| 2500 |
|
| 2501 |
CSaturationIndividualNodeExtensionResolveData* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getResolvedIndividualNodeExtension(CSaturationIndividualNodeExtensionResolveData* resolveData, CConcept* concept, bool negation, CIndividualSaturationProcessNode*& copyIndiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2502 |
CReapplyConceptSaturationLabelSet* conSet = copyIndiProcSatNode->getReapplyConceptSaturationLabelSet(false); |
| 2503 |
if (conSet && conSet->containsConcept(concept, negation)) { |
| 2504 |
return resolveData; |
| 2505 |
} |
| 2506 |
|
| 2507 |
CSaturationIndividualNodeExtensionResolveHashData& resolveHashData = resolveData->getIndividualNodeExtensionResolveHash(true)->getResolvedIndividualNodeExtensionData(concept,negation); |
| 2508 |
if (!resolveHashData.mResolveData) { |
| 2509 |
resolveHashData.mResolveData = CObjectParameterizingAllocator< CSaturationIndividualNodeExtensionResolveData, CProcessContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedProcessTaskMemoryAllocationManager(), calcAlgContext->getUsedProcessContext()); |
| 2510 |
cint64 nextResolveIndiID = calcAlgContext->getUsedProcessingDataBox()->getNextSaturationResolvedSuccessorExtensionIndividualNodeID(); |
| 2511 |
resolveHashData.mResolveData->initExtensionResolveData(nextResolveIndiID); |
| 2512 |
} |
| 2513 |
if (resolveHashData.mResolveData->hasProcessingIndividualNode()) { |
| 2514 |
copyIndiProcSatNode = resolveHashData.mResolveData->getProcessingIndividualNode(); |
| 2515 |
} |
| 2516 |
return resolveHashData.mResolveData; |
| 2517 |
} |
| 2518 |
|
| 2519 |
|
| 2520 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addSuccessorExtensionsALLConcept(CIndividualSaturationProcessNode*& indiProcSatNode, CConcept* concept, bool conceptNegation, CSaturationSuccessorALLConceptExtensionData* allConSuccExtData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2521 |
bool newConceptAdded = false; |
| 2522 |
bool addOperandConcepts = false; |
| 2523 |
bool useNegatedOperandConcepts = false; |
| 2524 |
CConceptOperator* conOp = concept->getConceptOperator(); |
| 2525 |
if (!conceptNegation && conOp->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_ALL_AQALL_TYPE)) { |
| 2526 |
addOperandConcepts = true; |
| 2527 |
useNegatedOperandConcepts = false; |
| 2528 |
} |
| 2529 |
if (conceptNegation && conOp->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_SOME_TYPE)) { |
| 2530 |
addOperandConcepts = true; |
| 2531 |
useNegatedOperandConcepts = true; |
| 2532 |
} |
| 2533 |
if (addOperandConcepts) { |
| 2534 |
for (CSortedNegLinker<CConcept*>* opLinkerIt = concept->getOperandList(); opLinkerIt; opLinkerIt = opLinkerIt->getNext()) { |
| 2535 |
CConcept* opConcept = opLinkerIt->getData(); |
| 2536 |
bool opConceptNegation = opLinkerIt->isNegated()^useNegatedOperandConcepts; |
| 2537 |
newConceptAdded |= allConSuccExtData->addExtensionConcept(opConcept,opConceptNegation); |
| 2538 |
} |
| 2539 |
} |
| 2540 |
return newConceptAdded; |
| 2541 |
} |
| 2542 |
|
| 2543 |
|
| 2544 |
|
| 2545 |
|
| 2546 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::processSuccessorFUNCTIONALConceptsExtensions(CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2547 |
CSaturationIndividualNodeSuccessorExtensionData* succExtensionData = indiProcSatNode->getSuccessorExtensionData(); |
| 2548 |
CSaturationIndividualNodeFUNCTIONALConceptsExtensionData* functionalConceptsExtension = succExtensionData->getFUNCTIONALConceptsExtensionData(); |
| 2549 |
|
| 2550 |
bool updated = false; |
| 2551 |
bool initialized = false; |
| 2552 |
|
| 2553 |
collectLinkedSuccessorNodes(indiProcSatNode,calcAlgContext); |
| 2554 |
|
| 2555 |
if (!functionalConceptsExtension->isSuccessorExtensionInitialized()) { |
| 2556 |
functionalConceptsExtension->setSuccessorExtensionInitialized(true); |
| 2557 |
} |
| 2558 |
|
| 2559 |
|
| 2560 |
CRoleSaturationProcessLinker* functionalityRoleSatProcLinker = functionalConceptsExtension->takeFunctionalityAddedRoleProcessLinker(); |
| 2561 |
while (functionalityRoleSatProcLinker) { |
| 2562 |
CRole* role = functionalityRoleSatProcLinker->getRole(); |
| 2563 |
CRoleSaturationProcessLinker* tmpRoleSatProcLinker = functionalityRoleSatProcLinker; |
| 2564 |
functionalityRoleSatProcLinker = functionalityRoleSatProcLinker->getNext(); |
| 2565 |
tmpRoleSatProcLinker->clearNext(); |
| 2566 |
if (installSuccessorPredecessorRoleFunctionalityConceptsExtension(indiProcSatNode,role,calcAlgContext)) { |
| 2567 |
functionalConceptsExtension->addLinkedSuccessorAddedRoleProcessLinker(tmpRoleSatProcLinker); |
| 2568 |
addFUNCTIONALProcessRoleExtensionFunctionalityAddedToDependentIndividuals(indiProcSatNode,role,calcAlgContext); |
| 2569 |
|
| 2570 |
CRoleSaturationProcessLinker* predFuncRoleProcLinker = createRoleSaturationProcessLinker(calcAlgContext); |
| 2571 |
predFuncRoleProcLinker->initRoleProcessLinker(role); |
| 2572 |
functionalConceptsExtension->addLinkedPredecessorAddedRoleProcessLinker(predFuncRoleProcLinker); |
| 2573 |
|
| 2574 |
CRoleSaturationProcessLinker* copyInitRoleLinker = createRoleSaturationProcessLinker(calcAlgContext); |
| 2575 |
copyInitRoleLinker->initRoleProcessLinker(role); |
| 2576 |
functionalConceptsExtension->addCopyingInitializingRoleProcessLinker(copyInitRoleLinker); |
| 2577 |
} |
| 2578 |
} |
| 2579 |
|
| 2580 |
|
| 2581 |
if (!updated) { |
| 2582 |
CRoleSaturationProcessLinker* succLinkedAddedRoleSatProcLinker = functionalConceptsExtension->takeLinkedSuccessorAddedRoleProcessLinker(); |
| 2583 |
while (succLinkedAddedRoleSatProcLinker) { |
| 2584 |
CRole* role = succLinkedAddedRoleSatProcLinker->getRole(); |
| 2585 |
CRoleSaturationProcessLinker* tmpRoleSatProcLinker = succLinkedAddedRoleSatProcLinker; |
| 2586 |
succLinkedAddedRoleSatProcLinker = succLinkedAddedRoleSatProcLinker->getNext(); |
| 2587 |
tmpRoleSatProcLinker->clearNext(); |
| 2588 |
updated |= updateSuccessorRoleFUNCTIONALConceptsExtensions(indiProcSatNode,role,calcAlgContext); |
| 2589 |
releaseRoleSaturationProcessLinker(tmpRoleSatProcLinker,calcAlgContext); |
| 2590 |
//addFUNCTIONALProcessRoleExtensionLinkedSuccessorAddedToDependentIndividuals(indiProcSatNode,role,calcAlgContext); |
| 2591 |
} |
| 2592 |
} |
| 2593 |
|
| 2594 |
|
| 2595 |
if (!updated) { |
| 2596 |
CRoleSaturationProcessLinker* predLinkedAddedRoleSatProcLinker = functionalConceptsExtension->takeLinkedPredecessorAddedRoleProcessLinker(); |
| 2597 |
while (predLinkedAddedRoleSatProcLinker) { |
| 2598 |
CRole* role = predLinkedAddedRoleSatProcLinker->getRole(); |
| 2599 |
CRoleSaturationProcessLinker* tmpRoleSatProcLinker = predLinkedAddedRoleSatProcLinker; |
| 2600 |
predLinkedAddedRoleSatProcLinker = predLinkedAddedRoleSatProcLinker->getNext(); |
| 2601 |
tmpRoleSatProcLinker->clearNext(); |
| 2602 |
updated |= updatePredecessorRoleFUNCTIONALConceptsExtensions(indiProcSatNode,role,calcAlgContext); |
| 2603 |
releaseRoleSaturationProcessLinker(tmpRoleSatProcLinker,calcAlgContext); |
| 2604 |
//addFUNCTIONALProcessRoleExtensionLinkedPredecessorAddedToDependentIndividuals(indiProcSatNode,role,calcAlgContext); |
| 2605 |
} |
| 2606 |
} |
| 2607 |
|
| 2608 |
|
| 2609 |
|
| 2610 |
if (!updated) { |
| 2611 |
CConceptSaturationProcessLinker* funcQualAtmostConSatProcLinker = functionalConceptsExtension->takeQualifiedFunctionalAtmostConceptProcessLinker(); |
| 2612 |
while (funcQualAtmostConSatProcLinker) { |
| 2613 |
CConceptSaturationDescriptor* conDes = funcQualAtmostConSatProcLinker->getConceptSaturationDescriptor(); |
| 2614 |
CConceptSaturationProcessLinker* tmpConDesSatProcLinker = funcQualAtmostConSatProcLinker; |
| 2615 |
funcQualAtmostConSatProcLinker = funcQualAtmostConSatProcLinker->getNext(); |
| 2616 |
tmpConDesSatProcLinker->clearNext(); |
| 2617 |
CConcept* funcQualAtleastConcept = conDes->getConcept(); |
| 2618 |
updated |= updateSuccessorRoleQualifiedFUNCTIONALConceptsExtensions(indiProcSatNode,funcQualAtleastConcept->getRole(),funcQualAtleastConcept->getOperandList(),calcAlgContext); |
| 2619 |
releaseConceptSaturationProcessLinker(tmpConDesSatProcLinker,calcAlgContext); |
| 2620 |
addFUNCTIONALQualifiedProcessAtmostConceptExtensionToDependentIndividuals(indiProcSatNode,conDes,calcAlgContext); |
| 2621 |
} |
| 2622 |
} |
| 2623 |
|
| 2624 |
if (succExtensionData->isExtensionProcessingQueued()) { |
| 2625 |
succExtensionData->setExtensionProcessingQueued(false); |
| 2626 |
} |
| 2627 |
|
| 2628 |
|
| 2629 |
return updated; |
| 2630 |
} |
| 2631 |
|
| 2632 |
|
| 2633 |
|
| 2634 |
|
| 2635 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::processNextSuccessorExtensions(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2636 |
bool extensionProcessed = false; |
| 2637 |
CIndividualSaturationProcessNode* indiProcSatNode = nullptr; |
| 2638 |
CSaturationSuccessorExtensionIndividualNodeProcessingQueue* extProIndiQueue = mProcessingDataBox->getSaturationSucessorExtensionIndividualNodeProcessingQueue(false); |
| 2639 |
while (!extensionProcessed && extProIndiQueue && !extProIndiQueue->isEmpty()) { |
| 2640 |
indiProcSatNode = extProIndiQueue->takeNextToCurrentProcessIndividual(); |
| 2641 |
if (indiProcSatNode && !indiProcSatNode->isSeparated()) { |
| 2642 |
if (!extensionProcessed && mConfALLConceptsExtensionProcessing) { |
| 2643 |
extensionProcessed |= processSuccessorALLConceptsExtensions(indiProcSatNode,calcAlgContext); |
| 2644 |
} |
| 2645 |
if (!extensionProcessed && mConfFUNCTIONALConceptsExtensionProcessing) { |
| 2646 |
extensionProcessed |= processSuccessorFUNCTIONALConceptsExtensions(indiProcSatNode,calcAlgContext); |
| 2647 |
} |
| 2648 |
} |
| 2649 |
if (!extensionProcessed) { |
| 2650 |
extProIndiQueue->clearCurrentProcessIndividual(); |
| 2651 |
} |
| 2652 |
} |
| 2653 |
return extensionProcessed; |
| 2654 |
} |
| 2655 |
|
| 2656 |
|
| 2657 |
|
| 2658 |
|
| 2659 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::processSuccessorALLConceptsExtensions(CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2660 |
CSaturationIndividualNodeSuccessorExtensionData* succExtensionData = indiProcSatNode->getSuccessorExtensionData(); |
| 2661 |
CSaturationIndividualNodeALLConceptsExtensionData* allConceptsExtension = succExtensionData->getALLConceptsExtensionData(); |
| 2662 |
|
| 2663 |
bool updated = false; |
| 2664 |
bool initialized = false; |
| 2665 |
|
| 2666 |
collectLinkedSuccessorNodes(indiProcSatNode,calcAlgContext); |
| 2667 |
|
| 2668 |
|
| 2669 |
//QString indiDebugNameString = getDebugIndividualConceptName(indiProcSatNode,calcAlgContext); |
| 2670 |
//if (indiDebugNameString == "http://www.co-ode.org/ontologies/galen#Atlas") { |
| 2671 |
// bool debug = true; |
| 2672 |
//} |
| 2673 |
|
| 2674 |
if (!allConceptsExtension->isSuccessorExtensionInitialized()) { |
| 2675 |
allConceptsExtension->setSuccessorExtensionInitialized(true); |
| 2676 |
initializeSuccessorALLConceptsExtensions(indiProcSatNode,calcAlgContext); |
| 2677 |
addProcessExtensionToDependentIndividuals(indiProcSatNode,calcAlgContext); |
| 2678 |
initialized = true; |
| 2679 |
mALLSuccExtInitializedCount++; |
| 2680 |
} |
| 2681 |
|
| 2682 |
CRoleSaturationProcessLinker* roleSatProcLinker = allConceptsExtension->takeRoleProcessLinker(); |
| 2683 |
while (roleSatProcLinker) { |
| 2684 |
CRole* role = roleSatProcLinker->getRole(); |
| 2685 |
CRoleSaturationProcessLinker* tmpRoleSatProcLinker = roleSatProcLinker; |
| 2686 |
roleSatProcLinker = roleSatProcLinker->getNext(); |
| 2687 |
tmpRoleSatProcLinker->clearNext(); |
| 2688 |
updateSuccessorRoleALLConceptsExtensions(indiProcSatNode,role,calcAlgContext); |
| 2689 |
releaseRoleSaturationProcessLinker(tmpRoleSatProcLinker,calcAlgContext); |
| 2690 |
//addALLProcessRoleExtensionToDependentIndividuals(indiProcSatNode,role,calcAlgContext); |
| 2691 |
} |
| 2692 |
if (allConceptsExtension->isExtensionProcessingQueued()) { |
| 2693 |
allConceptsExtension->setExtensionProcessingQueued(false); |
| 2694 |
} |
| 2695 |
if (succExtensionData->isExtensionProcessingQueued()) { |
| 2696 |
succExtensionData->setExtensionProcessingQueued(false); |
| 2697 |
} |
| 2698 |
updated = updateSuccessorALLConceptsExtensions(indiProcSatNode,calcAlgContext); |
| 2699 |
//testInsufficientALLConcepts(indiProcSatNode,calcAlgContext); |
| 2700 |
return updated; |
| 2701 |
|
| 2702 |
} |
| 2703 |
|
| 2704 |
|
| 2705 |
|
| 2706 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addSuccessorExtensionToProcessingQueue(CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2707 |
CSaturationIndividualNodeSuccessorExtensionData* succExtData = indiProcSatNode->getSuccessorExtensionData(true); |
| 2708 |
CSaturationIndividualNodeALLConceptsExtensionData* succIndiALLConExtData = succExtData->getALLConceptsExtensionData(true); |
| 2709 |
if (!succExtData->isExtensionProcessingQueued()) { |
| 2710 |
succExtData->setExtensionProcessingQueued(true); |
| 2711 |
calcAlgContext->getUsedProcessingDataBox()->getSaturationSucessorExtensionIndividualNodeProcessingQueue(true)->insertProcessIndiviudal(indiProcSatNode); |
| 2712 |
return true; |
| 2713 |
} |
| 2714 |
return false; |
| 2715 |
} |
| 2716 |
|
| 2717 |
|
| 2718 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addProcessExtensionToDependentIndividuals(CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2719 |
for (CXNegLinker<CIndividualSaturationProcessNode*>* depIndiLinkerIt = indiProcSatNode->getCopyDependingIndividualNodeLinker(); depIndiLinkerIt; depIndiLinkerIt = depIndiLinkerIt->getNext()) { |
| 2720 |
CIndividualSaturationProcessNode* depIndi = depIndiLinkerIt->getData(); |
| 2721 |
if (depIndi) { |
| 2722 |
addSuccessorExtensionToProcessingQueue(depIndi,calcAlgContext); |
| 2723 |
} |
| 2724 |
} |
| 2725 |
} |
| 2726 |
|
| 2727 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addALLProcessRoleExtensionToDependentIndividuals(CIndividualSaturationProcessNode*& indiProcSatNode, CRole* role, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2728 |
for (CXNegLinker<CIndividualSaturationProcessNode*>* depIndiLinkerIt = indiProcSatNode->getCopyDependingIndividualNodeLinker(); depIndiLinkerIt; depIndiLinkerIt = depIndiLinkerIt->getNext()) { |
| 2729 |
CIndividualSaturationProcessNode* depIndi = depIndiLinkerIt->getData(); |
| 2730 |
if (depIndi) { |
| 2731 |
CSaturationIndividualNodeSuccessorExtensionData* succExtData = depIndi->getSuccessorExtensionData(true); |
| 2732 |
CSaturationIndividualNodeALLConceptsExtensionData* succIndiALLConExtData = succExtData->getALLConceptsExtensionData(true); |
| 2733 |
addSuccessorExtensionToProcessingQueue(depIndi,calcAlgContext); |
| 2734 |
if (succIndiALLConExtData->isSuccessorExtensionInitialized()) { |
| 2735 |
if (!succIndiALLConExtData->hasProcessLinkerForRole(role)) { |
| 2736 |
CRoleSaturationProcessLinker* roleProcLinker = createRoleSaturationProcessLinker(calcAlgContext); |
| 2737 |
roleProcLinker->initRoleProcessLinker(role); |
| 2738 |
succIndiALLConExtData->addRoleProcessLinker(roleProcLinker); |
| 2739 |
} |
| 2740 |
} |
| 2741 |
} |
| 2742 |
} |
| 2743 |
} |
| 2744 |
|
| 2745 |
|
| 2746 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addFUNCTIONALProcessRoleExtensionLinkedSuccessorAddedToDependentIndividuals(CIndividualSaturationProcessNode*& indiProcSatNode, CRole* role, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2747 |
for (CXNegLinker<CIndividualSaturationProcessNode*>* depIndiLinkerIt = indiProcSatNode->getCopyDependingIndividualNodeLinker(); depIndiLinkerIt; depIndiLinkerIt = depIndiLinkerIt->getNext()) { |
| 2748 |
CIndividualSaturationProcessNode* depIndi = depIndiLinkerIt->getData(); |
| 2749 |
if (depIndi) { |
| 2750 |
CSaturationIndividualNodeSuccessorExtensionData* succExtData = depIndi->getSuccessorExtensionData(true); |
| 2751 |
CSaturationIndividualNodeFUNCTIONALConceptsExtensionData* succIndiFunctionalConExtData = succExtData->getFUNCTIONALConceptsExtensionData(true); |
| 2752 |
addSuccessorExtensionToProcessingQueue(depIndi,calcAlgContext); |
| 2753 |
if (succIndiFunctionalConExtData->isSuccessorExtensionInitialized()) { |
| 2754 |
if (!succIndiFunctionalConExtData->hasLinkedSuccessorAddedProcessLinkerForRole(role)) { |
| 2755 |
CRoleSaturationProcessLinker* roleProcLinker = createRoleSaturationProcessLinker(calcAlgContext); |
| 2756 |
roleProcLinker->initRoleProcessLinker(role); |
| 2757 |
succIndiFunctionalConExtData->addLinkedSuccessorAddedRoleProcessLinker(roleProcLinker); |
| 2758 |
} |
| 2759 |
} |
| 2760 |
} |
| 2761 |
} |
| 2762 |
} |
| 2763 |
|
| 2764 |
|
| 2765 |
|
| 2766 |
|
| 2767 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addFUNCTIONALQualifiedProcessAtmostConceptExtensionToDependentIndividuals(CIndividualSaturationProcessNode*& indiProcSatNode, CConceptSaturationDescriptor* conDes, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2768 |
for (CXNegLinker<CIndividualSaturationProcessNode*>* depIndiLinkerIt = indiProcSatNode->getCopyDependingIndividualNodeLinker(); depIndiLinkerIt; depIndiLinkerIt = depIndiLinkerIt->getNext()) { |
| 2769 |
CIndividualSaturationProcessNode* depIndi = depIndiLinkerIt->getData(); |
| 2770 |
if (depIndi) { |
| 2771 |
addQualifiedFUNCTIONALAtmostConceptExtensionProcessing(conDes,depIndi,calcAlgContext); |
| 2772 |
} |
| 2773 |
} |
| 2774 |
} |
| 2775 |
|
| 2776 |
|
| 2777 |
|
| 2778 |
|
| 2779 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addFUNCTIONALProcessRoleExtensionLinkedPredecessorAddedToDependentIndividuals(CIndividualSaturationProcessNode*& indiProcSatNode, CRole* role, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2780 |
for (CXNegLinker<CIndividualSaturationProcessNode*>* depIndiLinkerIt = indiProcSatNode->getCopyDependingIndividualNodeLinker(); depIndiLinkerIt; depIndiLinkerIt = depIndiLinkerIt->getNext()) { |
| 2781 |
CIndividualSaturationProcessNode* depIndi = depIndiLinkerIt->getData(); |
| 2782 |
if (depIndi) { |
| 2783 |
CSaturationIndividualNodeSuccessorExtensionData* succExtData = depIndi->getSuccessorExtensionData(true); |
| 2784 |
CSaturationIndividualNodeFUNCTIONALConceptsExtensionData* succIndiFunctionalConExtData = succExtData->getFUNCTIONALConceptsExtensionData(true); |
| 2785 |
if (succIndiFunctionalConExtData->isSuccessorExtensionInitialized()) { |
| 2786 |
addSuccessorExtensionToProcessingQueue(depIndi,calcAlgContext); |
| 2787 |
if (!succIndiFunctionalConExtData->hasLinkedPredecessorAddedProcessLinkerForRole(role)) { |
| 2788 |
CRoleSaturationProcessLinker* roleProcLinker = createRoleSaturationProcessLinker(calcAlgContext); |
| 2789 |
roleProcLinker->initRoleProcessLinker(role); |
| 2790 |
succIndiFunctionalConExtData->addLinkedPredecessorAddedRoleProcessLinker(roleProcLinker); |
| 2791 |
} |
| 2792 |
} |
| 2793 |
} |
| 2794 |
} |
| 2795 |
} |
| 2796 |
|
| 2797 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addFUNCTIONALProcessRoleExtensionFunctionalityAddedToDependentIndividuals(CIndividualSaturationProcessNode*& indiProcSatNode, CRole* role, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2798 |
for (CXNegLinker<CIndividualSaturationProcessNode*>* depIndiLinkerIt = indiProcSatNode->getCopyDependingIndividualNodeLinker(); depIndiLinkerIt; depIndiLinkerIt = depIndiLinkerIt->getNext()) { |
| 2799 |
CIndividualSaturationProcessNode* depIndi = depIndiLinkerIt->getData(); |
| 2800 |
if (depIndi) { |
| 2801 |
CSaturationIndividualNodeSuccessorExtensionData* succExtData = depIndi->getSuccessorExtensionData(true); |
| 2802 |
CSaturationIndividualNodeFUNCTIONALConceptsExtensionData* succIndiFunctionalConExtData = succExtData->getFUNCTIONALConceptsExtensionData(true); |
| 2803 |
addSuccessorExtensionToProcessingQueue(depIndi,calcAlgContext); |
| 2804 |
if (!succIndiFunctionalConExtData->hasFunctionalityAddedProcessLinkerForRole(role)) { |
| 2805 |
CRoleSaturationProcessLinker* roleProcLinker = createRoleSaturationProcessLinker(calcAlgContext); |
| 2806 |
roleProcLinker->initRoleProcessLinker(role); |
| 2807 |
succIndiFunctionalConExtData->addFunctionalityAddedRoleProcessLinker(roleProcLinker); |
| 2808 |
} |
| 2809 |
} |
| 2810 |
} |
| 2811 |
} |
| 2812 |
|
| 2813 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::markNominalATMOSTRestrictedAncestorsAsInsufficient(CConceptSaturationDescriptor* conDes, CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2814 |
bool ancestorsRestricted = false; |
| 2815 |
CRoleBackwardSaturationPropagationHash* backwardPropHash = indiProcSatNode->getRoleBackwardPropagationHash(false); |
| 2816 |
CConcept* concept = conDes->getConcept(); |
| 2817 |
bool conceptNegation = conDes->isNegated(); |
| 2818 |
CRole* role = concept->getRole(); |
| 2819 |
if (backwardPropHash && !indiProcSatNode->isABoxIndividualRepresentationNode()) { |
| 2820 |
CPROCESSHASH<CRole*,CRoleBackwardSaturationPropagationHashData>* backPropDataHash = backwardPropHash->getRoleBackwardPropagationDataHash(); |
| 2821 |
if (backPropDataHash) { |
| 2822 |
for (CPROCESSHASH<CRole*,CRoleBackwardSaturationPropagationHashData>::const_iterator it = backPropDataHash->constFind(role), itEnd = backPropDataHash->constEnd(); it != itEnd && it.key() == role; ++it) { |
| 2823 |
const CRoleBackwardSaturationPropagationHashData& backPropData = it.value(); |
| 2824 |
for (CBackwardSaturationPropagationLink* backPropLinkIt = backPropData.mLinkLinker; backPropLinkIt; backPropLinkIt = backPropLinkIt->getNext()) { |
| 2825 |
CBackwardSaturationPropagationLink* backPropLink = backPropLinkIt; |
| 2826 |
CIndividualSaturationProcessNode* sourceIndi = backPropLink->getSourceIndividual(); |
| 2827 |
updateDirectAddingIndividualStatusFlags(sourceIndi,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,calcAlgContext); |
| 2828 |
setInsufficientNodeOccured(mCalcAlgContext); |
| 2829 |
ancestorsRestricted = true; |
| 2830 |
} |
| 2831 |
} |
| 2832 |
} |
| 2833 |
} |
| 2834 |
CCriticalPredecessorRoleCardinalityHash* critPredRolCardHash = indiProcSatNode->getCriticalPredecessorRoleCardinalityHash(true); |
| 2835 |
critPredRolCardHash->addCriticalPredecessorRoleCardinality(role,concept,!conceptNegation); |
| 2836 |
return ancestorsRestricted; |
| 2837 |
} |
| 2838 |
|
| 2839 |
|
| 2840 |
|
| 2841 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::markATMOSTRestrictedAncestorsAsInsufficient(CConceptSaturationDescriptor* conDes, CIndividualSaturationProcessNode* functionallyRestrictedSuccessorNode, CXNegLinker<CRole*>* functionallyRestrictedSuccessorCreationRoleLinker, CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2842 |
bool ancestorsRestricted = false; |
| 2843 |
CRoleBackwardSaturationPropagationHash* backwardPropHash = indiProcSatNode->getRoleBackwardPropagationHash(false); |
| 2844 |
CConcept* concept = conDes->getConcept(); |
| 2845 |
bool conceptNegation = conDes->isNegated(); |
| 2846 |
CRole* role = concept->getRole(); |
| 2847 |
if (backwardPropHash && !indiProcSatNode->isABoxIndividualRepresentationNode()) { |
| 2848 |
CPROCESSHASH<CRole*,CRoleBackwardSaturationPropagationHashData>* backPropDataHash = backwardPropHash->getRoleBackwardPropagationDataHash(); |
| 2849 |
if (backPropDataHash) { |
| 2850 |
for (CPROCESSHASH<CRole*,CRoleBackwardSaturationPropagationHashData>::const_iterator it = backPropDataHash->constFind(role), itEnd = backPropDataHash->constEnd(); it != itEnd && it.key() == role; ++it) { |
| 2851 |
const CRoleBackwardSaturationPropagationHashData& backPropData = it.value(); |
| 2852 |
for (CBackwardSaturationPropagationLink* backPropLinkIt = backPropData.mLinkLinker; backPropLinkIt; backPropLinkIt = backPropLinkIt->getNext()) { |
| 2853 |
CBackwardSaturationPropagationLink* backPropLink = backPropLinkIt; |
| 2854 |
CIndividualSaturationProcessNode* sourceIndi = backPropLink->getSourceIndividual(); |
| 2855 |
bool ancestorInsufficient = true; |
| 2856 |
cint64 allowedCardinality = concept->getParameter() - 1*conceptNegation; |
| 2857 |
|
| 2858 |
if (!sourceIndi->getIndirectStatusFlags()->hasInsufficientFlag()) { |
| 2859 |
if (allowedCardinality == 1 && !concept->getOperandList()) { |
| 2860 |
if (sourceIndi == functionallyRestrictedSuccessorNode) { |
| 2861 |
ancestorInsufficient = false; |
| 2862 |
} else { |
| 2863 |
collectLinkedSuccessorNodes(sourceIndi,calcAlgContext); |
| 2864 |
CLinkedRoleSaturationSuccessorHash* linkedSuccHash = sourceIndi->getLinkedRoleSuccessorHash(false); |
| 2865 |
if (linkedSuccHash) { |
| 2866 |
CPROCESSHASH<CRole*,CLinkedRoleSaturationSuccessorData*>* succHash = linkedSuccHash->getLinkedRoleSuccessorHash(); |
| 2867 |
CRole* inverseRole = getInverseRole(role,calcAlgContext); |
| 2868 |
CLinkedRoleSaturationSuccessorData* succData = succHash->value(inverseRole); |
| 2869 |
if (succData) { |
| 2870 |
CSaturationSuccessorData* succRoleData = succData->mSuccNodeDataMap.value(indiProcSatNode->getIndividualID()); |
| 2871 |
if (succRoleData) { |
| 2872 |
if (succRoleData->mActiveCount <= 0) { |
| 2873 |
ancestorInsufficient = false; |
| 2874 |
} else { |
| 2875 |
|
| 2876 |
|
| 2877 |
bool funcSuccAllRolePredMerged = false; |
| 2878 |
CSaturationIndividualNodeSuccessorExtensionData* succExtData = functionallyRestrictedSuccessorNode->getSuccessorExtensionData(false); |
| 2879 |
if (succExtData) { |
| 2880 |
CSaturationIndividualNodeFUNCTIONALConceptsExtensionData* funcConExtData = succExtData->getFUNCTIONALConceptsExtensionData(false); |
| 2881 |
if (funcConExtData) { |
| 2882 |
funcSuccAllRolePredMerged = true; |
| 2883 |
for (CXNegLinker<CRole*>* functionallyRestrictedSuccessorCreationRoleIt = functionallyRestrictedSuccessorCreationRoleLinker; funcSuccAllRolePredMerged && functionallyRestrictedSuccessorCreationRoleIt; functionallyRestrictedSuccessorCreationRoleIt = functionallyRestrictedSuccessorCreationRoleIt->getNext()) { |
| 2884 |
if (!functionallyRestrictedSuccessorCreationRoleIt->isNegated()) { |
| 2885 |
if (!funcConExtData->hasIndividualNodeForwardingPredecessorMerged(sourceIndi,functionallyRestrictedSuccessorCreationRoleIt->getData())) { |
| 2886 |
funcSuccAllRolePredMerged = false; |
| 2887 |
} |
| 2888 |
} |
| 2889 |
} |
| 2890 |
} |
| 2891 |
} |
| 2892 |
|
| 2893 |
|
| 2894 |
if (funcSuccAllRolePredMerged || isIndividualNodeLabelMergingSubset(functionallyRestrictedSuccessorNode,sourceIndi,true,calcAlgContext)) { |
| 2895 |
if (funcSuccAllRolePredMerged || isSuccessorCreationRoleMergingSubset(functionallyRestrictedSuccessorCreationRoleLinker,succRoleData->mCreationRoleLinker,calcAlgContext)) { |
| 2896 |
ancestorInsufficient = false; |
| 2897 |
} |
| 2898 |
} |
| 2899 |
} |
| 2900 |
} |
| 2901 |
} |
| 2902 |
} |
| 2903 |
} |
| 2904 |
} |
| 2905 |
} |
| 2906 |
|
| 2907 |
if (ancestorInsufficient) { |
| 2908 |
updateDirectAddingIndividualStatusFlags(sourceIndi,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,calcAlgContext); |
| 2909 |
setInsufficientNodeOccured(mCalcAlgContext); |
| 2910 |
ancestorsRestricted = true; |
| 2911 |
} |
| 2912 |
} |
| 2913 |
} |
| 2914 |
} |
| 2915 |
} |
| 2916 |
CCriticalPredecessorRoleCardinalityHash* critPredRolCardHash = indiProcSatNode->getCriticalPredecessorRoleCardinalityHash(true); |
| 2917 |
critPredRolCardHash->addCriticalPredecessorRoleCardinality(role,concept,!conceptNegation); |
| 2918 |
return ancestorsRestricted; |
| 2919 |
} |
| 2920 |
|
| 2921 |
|
| 2922 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addCriticalORConceptTestedForDependentNodes(CConceptSaturationDescriptor* conDes, CCriticalSaturationConceptTypeQueues::CRITICALSATURATIONCONCEPTQUEUETYPE conceptType, CIndividualSaturationProcessNode*& indiProcSatNode, CCriticalIndividualNodeConceptTestSet* criticalIndiNodeConTestSet, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2923 |
|
| 2924 |
cint64 updatedNodes = 0; |
| 2925 |
cint64 currentUpdateLinkerCount = 1; |
| 2926 |
|
| 2927 |
CIndividualSaturationProcessNodeStatusUpdateLinker* directUpdateLinker = createIndividualSaturationUpdateLinker(calcAlgContext); |
| 2928 |
directUpdateLinker->initUpdateNodeLinker(indiProcSatNode); |
| 2929 |
|
| 2930 |
while (directUpdateLinker) { |
| 2931 |
CIndividualSaturationProcessNodeStatusUpdateLinker* nextUpdateLinker = directUpdateLinker; |
| 2932 |
directUpdateLinker = directUpdateLinker->getNext(); |
| 2933 |
CIndividualSaturationProcessNode* updateIndiNode = nextUpdateLinker->getData(); |
| 2934 |
nextUpdateLinker->clearNext(); |
| 2935 |
releaseIndividualSaturationUpdateLinker(nextUpdateLinker,calcAlgContext); |
| 2936 |
|
| 2937 |
--currentUpdateLinkerCount; |
| 2938 |
++updatedNodes; |
| 2939 |
|
| 2940 |
for (CXNegLinker<CIndividualSaturationProcessNode*>* depIndiIt = updateIndiNode->getCopyDependingIndividualNodeLinker(); depIndiIt; depIndiIt = depIndiIt->getNext()) { |
| 2941 |
if (depIndiIt->isNegated()) { |
| 2942 |
CIndividualSaturationProcessNode* dependingIndiNode = depIndiIt->getData(); |
| 2943 |
CIndividualSaturationProcessNodeStatusFlags* statusFlag = dependingIndiNode->getDirectStatusFlags(); |
| 2944 |
bool continueDepending = false; |
| 2945 |
if (!statusFlag->hasFlags(CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,false)) { |
| 2946 |
|
| 2947 |
if (!criticalIndiNodeConTestSet->isConceptTestedForIndividual(conDes,dependingIndiNode)) { |
| 2948 |
criticalIndiNodeConTestSet->insertConceptTestedForIndividual(conDes,dependingIndiNode); |
| 2949 |
STATINC(SATURATIONCRITICALTESTCOUNT,calcAlgContext); |
| 2950 |
if (isCriticalORConceptDescriptorInsufficient(conDes,dependingIndiNode,calcAlgContext)) { |
| 2951 |
updateDirectNotDependentAddingIndividualStatusFlags(dependingIndiNode,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,calcAlgContext); |
| 2952 |
setInsufficientNodeOccured(calcAlgContext); |
| 2953 |
continueDepending = true; |
| 2954 |
} |
| 2955 |
} |
| 2956 |
} else { |
| 2957 |
continueDepending = true; |
| 2958 |
} |
| 2959 |
|
| 2960 |
if (continueDepending) { |
| 2961 |
CIndividualSaturationProcessNodeStatusUpdateLinker* nextUpdateLinker = createIndividualSaturationUpdateLinker(calcAlgContext); |
| 2962 |
nextUpdateLinker->initUpdateNodeLinker(dependingIndiNode); |
| 2963 |
directUpdateLinker = nextUpdateLinker->append(directUpdateLinker); |
| 2964 |
|
| 2965 |
++currentUpdateLinkerCount; |
| 2966 |
} |
| 2967 |
} |
| 2968 |
} |
| 2969 |
} |
| 2970 |
} |
| 2971 |
|
| 2972 |
|
| 2973 |
|
| 2974 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addCriticalConceptForDependentNodes(CConceptSaturationDescriptor* conDes, CCriticalSaturationConceptTypeQueues::CRITICALSATURATIONCONCEPTQUEUETYPE conceptType, CIndividualSaturationProcessNode*& indiProcSatNode, bool directFlagsCheck, cint64 checkFlags, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2975 |
for (CXNegLinker<CIndividualSaturationProcessNode*>* depIndiIt = indiProcSatNode->getCopyDependingIndividualNodeLinker(); depIndiIt; depIndiIt = depIndiIt->getNext()) { |
| 2976 |
CIndividualSaturationProcessNode* dependingIndiNode = depIndiIt->getData(); |
| 2977 |
CIndividualSaturationProcessNodeStatusFlags* statusFlag = nullptr; |
| 2978 |
if (directFlagsCheck) { |
| 2979 |
statusFlag = dependingIndiNode->getDirectStatusFlags(); |
| 2980 |
} else { |
| 2981 |
statusFlag = dependingIndiNode->getIndirectStatusFlags(); |
| 2982 |
} |
| 2983 |
if (checkFlags == 0 || !statusFlag->hasFlags(checkFlags,false)) { |
| 2984 |
addCriticalConceptDescriptor(conDes,conceptType,dependingIndiNode,calcAlgContext); |
| 2985 |
} |
| 2986 |
} |
| 2987 |
} |
| 2988 |
|
| 2989 |
|
| 2990 |
|
| 2991 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::checkCriticalConceptsForNode(CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 2992 |
CCriticalSaturationConceptTypeQueues* criticalConceptQueues = indiProcSatNode->getCriticalConceptTypeQueues(false); |
| 2993 |
CIndividualSaturationProcessNodeStatusFlags* indirectFlags = indiProcSatNode->getIndirectStatusFlags(); |
| 2994 |
CIndividualSaturationProcessNodeStatusFlags* directFlags = indiProcSatNode->getDirectStatusFlags(); |
| 2995 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 2996 |
CCriticalIndividualNodeConceptTestSet* criticalIndiNodeConTestSet = processingDataBox->getSaturationCriticalIndividualNodeConceptTestSet(true); |
| 2997 |
|
| 2998 |
criticalConceptQueues->setProcessNodeQueued(false); |
| 2999 |
if (!indirectFlags->hasInsufficientFlag() && !indirectFlags->hasClashedFlag()) { |
| 3000 |
CCriticalSaturationConceptTypeQueues::CRITICALSATURATIONCONCEPTQUEUETYPE conceptType = CCriticalSaturationConceptTypeQueues::CCT_FORALL; |
| 3001 |
CCriticalSaturationConceptQueue* criticalConTypeQueue = criticalConceptQueues->getCriticalSaturationConceptQueue(conceptType,false); |
| 3002 |
if (criticalConTypeQueue) { |
| 3003 |
while (criticalConTypeQueue->hasCriticalConceptDescriptorLinker() && !indirectFlags->hasInsufficientFlag()) { |
| 3004 |
CConceptSaturationProcessLinker* criticalConProcDes = criticalConTypeQueue->takeNextCriticalConceptDescriptor(); |
| 3005 |
CConceptSaturationDescriptor* criticalConDes = criticalConProcDes->getConceptSaturationDescriptor(); |
| 3006 |
|
| 3007 |
if (!criticalIndiNodeConTestSet->isConceptTestedForIndividual(criticalConDes,indiProcSatNode)) { |
| 3008 |
criticalIndiNodeConTestSet->insertConceptTestedForIndividual(criticalConDes,indiProcSatNode); |
| 3009 |
STATINC(SATURATIONCRITICALTESTCOUNT,calcAlgContext); |
| 3010 |
if (isCriticalALLConceptDescriptorInsufficient(criticalConDes,indiProcSatNode,calcAlgContext)) { |
| 3011 |
updateDirectAddingIndividualStatusFlags(indiProcSatNode,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,calcAlgContext); |
| 3012 |
if (indiProcSatNode->isABoxIndividualRepresentationNode()) { |
| 3013 |
updateDirectAddingIndividualStatusFlags(indiProcSatNode, CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGPROPAGATIONINCOMPLETE, calcAlgContext); |
| 3014 |
} |
| 3015 |
setInsufficientNodeOccured(calcAlgContext); |
| 3016 |
++mInsufficientALLCount; |
| 3017 |
} else { |
| 3018 |
addCriticalConceptForDependentNodes(criticalConDes,conceptType,indiProcSatNode,false,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,calcAlgContext); |
| 3019 |
} |
| 3020 |
} |
| 3021 |
|
| 3022 |
releaseConceptSaturationProcessLinker(criticalConProcDes,calcAlgContext); |
| 3023 |
} |
| 3024 |
} |
| 3025 |
} |
| 3026 |
|
| 3027 |
if (!indirectFlags->hasInsufficientFlag() && !indirectFlags->hasClashedFlag()) { |
| 3028 |
CCriticalSaturationConceptTypeQueues::CRITICALSATURATIONCONCEPTQUEUETYPE conceptType = CCriticalSaturationConceptTypeQueues::CCT_ATMOST; |
| 3029 |
CCriticalSaturationConceptQueue* criticalConTypeQueue = criticalConceptQueues->getCriticalSaturationConceptQueue(conceptType,false); |
| 3030 |
if (criticalConTypeQueue) { |
| 3031 |
while (criticalConTypeQueue->hasCriticalConceptDescriptorLinker() && !indirectFlags->hasInsufficientFlag()) { |
| 3032 |
CConceptSaturationProcessLinker* criticalConProcDes = criticalConTypeQueue->takeNextCriticalConceptDescriptor(); |
| 3033 |
CConceptSaturationDescriptor* criticalConDes = criticalConProcDes->getConceptSaturationDescriptor(); |
| 3034 |
|
| 3035 |
if (!criticalIndiNodeConTestSet->isConceptTestedForIndividual(criticalConDes,indiProcSatNode)) { |
| 3036 |
criticalIndiNodeConTestSet->insertConceptTestedForIndividual(criticalConDes,indiProcSatNode); |
| 3037 |
bool ancestorPossiblyInsufficient = false; |
| 3038 |
CIndividualSaturationProcessNode* functionallyRestrictedSuccessorNode = nullptr; |
| 3039 |
CXNegLinker<CRole*>* functionallyRestrictedSuccessorCreationRoleLinker = nullptr; |
| 3040 |
STATINC(SATURATIONCRITICALTESTCOUNT,calcAlgContext); |
| 3041 |
if (isCriticalATMOSTConceptDescriptorInsufficient(criticalConDes,ancestorPossiblyInsufficient,functionallyRestrictedSuccessorNode,functionallyRestrictedSuccessorCreationRoleLinker,indiProcSatNode,calcAlgContext)) { |
| 3042 |
if (mConfDelayedMergingCriticalATMOSTConcepts && indiProcSatNode->getMaxAtleastCardinalityCandidate() > mConfDelayedMergingCriticalATMOSTConceptsCardinalitySize) { |
| 3043 |
if (!indirectFlags->hasInsufficientFlag() && !indirectFlags->hasClashedFlag()) { |
| 3044 |
CSaturationATMOSTSuccessorMergingData* atmostSuccMergData = indiProcSatNode->getATMOSTSuccessorMergingData(true); |
| 3045 |
if (!atmostSuccMergData->isMergingProcessingQueued()) { |
| 3046 |
processingDataBox->addSaturationATMOSTMergingProcessLinker(atmostSuccMergData->getMergingIndividualProcessLinker()->setProcessingQueued(true)); |
| 3047 |
} |
| 3048 |
CSaturationATMOSTSuccessorMergingHashData& atmostSuccConHashData = atmostSuccMergData->getATMOSTConceptMergingDataHash()->getATMOSTConceptMergingData(criticalConDes); |
| 3049 |
if (!atmostSuccConHashData.mQueued) { |
| 3050 |
atmostSuccConHashData.mQueued = true; |
| 3051 |
atmostSuccMergData->addMergingProcessingConcept(criticalConDes); |
| 3052 |
} |
| 3053 |
} |
| 3054 |
} else { |
| 3055 |
++mInsufficientATMOSTCount; |
| 3056 |
//bool bug = false; |
| 3057 |
//while (bug) { |
| 3058 |
// isCriticalATMOSTConceptDescriptorInsufficient(criticalConDes,ancestorPossiblyInsufficient,functionallyRestrictedSuccessorNode,functionallyRestrictedSuccessorCreationRoleLinker,indiProcSatNode,calcAlgContext); |
| 3059 |
//} |
| 3060 |
updateDirectAddingIndividualStatusFlags(indiProcSatNode,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,calcAlgContext); |
| 3061 |
setInsufficientNodeOccured(calcAlgContext); |
| 3062 |
} |
| 3063 |
} else { |
| 3064 |
addCriticalConceptForDependentNodes(criticalConDes,conceptType,indiProcSatNode,false,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,calcAlgContext); |
| 3065 |
} |
| 3066 |
if (indiProcSatNode->hasNominalIntegrated()) { |
| 3067 |
markNominalATMOSTRestrictedAncestorsAsInsufficient(criticalConDes,indiProcSatNode,calcAlgContext); |
| 3068 |
} |
| 3069 |
if (ancestorPossiblyInsufficient) { |
| 3070 |
markATMOSTRestrictedAncestorsAsInsufficient(criticalConDes,functionallyRestrictedSuccessorNode,functionallyRestrictedSuccessorCreationRoleLinker,indiProcSatNode,calcAlgContext); |
| 3071 |
updateDirectAddingIndividualStatusFlags(indiProcSatNode,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGCARDINALITYPROPLEMATIC,calcAlgContext); |
| 3072 |
} |
| 3073 |
} |
| 3074 |
|
| 3075 |
releaseConceptSaturationProcessLinker(criticalConProcDes,calcAlgContext); |
| 3076 |
} |
| 3077 |
} |
| 3078 |
} |
| 3079 |
|
| 3080 |
|
| 3081 |
|
| 3082 |
|
| 3083 |
if (!indirectFlags->hasInsufficientFlag() && !indirectFlags->hasClashedFlag()) { |
| 3084 |
CCriticalSaturationConceptTypeQueues::CRITICALSATURATIONCONCEPTQUEUETYPE conceptType = CCriticalSaturationConceptTypeQueues::CCT_VALUE; |
| 3085 |
CCriticalSaturationConceptQueue* criticalConTypeQueue = criticalConceptQueues->getCriticalSaturationConceptQueue(conceptType,false); |
| 3086 |
if (criticalConTypeQueue) { |
| 3087 |
while (criticalConTypeQueue->hasCriticalConceptDescriptorLinker() && !indirectFlags->hasInsufficientFlag()) { |
| 3088 |
CConceptSaturationProcessLinker* criticalConProcDes = criticalConTypeQueue->takeNextCriticalConceptDescriptor(); |
| 3089 |
CConceptSaturationDescriptor* criticalConDes = criticalConProcDes->getConceptSaturationDescriptor(); |
| 3090 |
|
| 3091 |
if (!criticalIndiNodeConTestSet->isConceptTestedForIndividual(criticalConDes,indiProcSatNode)) { |
| 3092 |
criticalIndiNodeConTestSet->insertConceptTestedForIndividual(criticalConDes,indiProcSatNode); |
| 3093 |
STATINC(SATURATIONCRITICALTESTCOUNT,calcAlgContext); |
| 3094 |
if (isCriticalVALUEConceptDescriptorInsufficient(criticalConDes,indiProcSatNode,calcAlgContext)) { |
| 3095 |
updateDirectAddingIndividualStatusFlags(indiProcSatNode,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,calcAlgContext); |
| 3096 |
setInsufficientNodeOccured(calcAlgContext); |
| 3097 |
} else { |
| 3098 |
addCriticalConceptForDependentNodes(criticalConDes,conceptType,indiProcSatNode,false,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,calcAlgContext); |
| 3099 |
} |
| 3100 |
} |
| 3101 |
|
| 3102 |
releaseConceptSaturationProcessLinker(criticalConProcDes,calcAlgContext); |
| 3103 |
} |
| 3104 |
} |
| 3105 |
} |
| 3106 |
|
| 3107 |
|
| 3108 |
if (!indirectFlags->hasInsufficientFlag() && !indirectFlags->hasClashedFlag()) { |
| 3109 |
CCriticalSaturationConceptTypeQueues::CRITICALSATURATIONCONCEPTQUEUETYPE conceptType = CCriticalSaturationConceptTypeQueues::CCT_NOMINAL; |
| 3110 |
CCriticalSaturationConceptQueue* criticalConTypeQueue = criticalConceptQueues->getCriticalSaturationConceptQueue(conceptType,false); |
| 3111 |
if (criticalConTypeQueue) { |
| 3112 |
while (criticalConTypeQueue->hasCriticalConceptDescriptorLinker() && !indirectFlags->hasInsufficientFlag()) { |
| 3113 |
CConceptSaturationProcessLinker* criticalConProcDes = criticalConTypeQueue->takeNextCriticalConceptDescriptor(); |
| 3114 |
CConceptSaturationDescriptor* criticalConDes = criticalConProcDes->getConceptSaturationDescriptor(); |
| 3115 |
|
| 3116 |
if (!criticalIndiNodeConTestSet->isConceptTestedForIndividual(criticalConDes,indiProcSatNode)) { |
| 3117 |
criticalIndiNodeConTestSet->insertConceptTestedForIndividual(criticalConDes,indiProcSatNode); |
| 3118 |
STATINC(SATURATIONCRITICALTESTCOUNT,calcAlgContext); |
| 3119 |
if (isCriticalNOMINALConceptDescriptorInsufficient(criticalConDes,indiProcSatNode,calcAlgContext)) { |
| 3120 |
updateDirectAddingIndividualStatusFlags(indiProcSatNode,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,calcAlgContext); |
| 3121 |
setInsufficientNodeOccured(calcAlgContext); |
| 3122 |
} else { |
| 3123 |
addCriticalConceptForDependentNodes(criticalConDes,conceptType,indiProcSatNode,false,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,calcAlgContext); |
| 3124 |
} |
| 3125 |
} |
| 3126 |
|
| 3127 |
releaseConceptSaturationProcessLinker(criticalConProcDes,calcAlgContext); |
| 3128 |
} |
| 3129 |
} |
| 3130 |
} |
| 3131 |
|
| 3132 |
|
| 3133 |
|
| 3134 |
|
| 3135 |
if (!indirectFlags->hasClashedFlag()) { |
| 3136 |
CCriticalSaturationConceptTypeQueues::CRITICALSATURATIONCONCEPTQUEUETYPE conceptType = CCriticalSaturationConceptTypeQueues::CCT_DISJUNCTION; |
| 3137 |
CCriticalSaturationConceptQueue* criticalConTypeQueue = criticalConceptQueues->getCriticalSaturationConceptQueue(conceptType,false); |
| 3138 |
if (criticalConTypeQueue) { |
| 3139 |
while (criticalConTypeQueue->hasCriticalConceptDescriptorLinker()) { |
| 3140 |
CConceptSaturationProcessLinker* criticalConProcDes = criticalConTypeQueue->takeNextCriticalConceptDescriptor(); |
| 3141 |
CConceptSaturationDescriptor* criticalConDes = criticalConProcDes->getConceptSaturationDescriptor(); |
| 3142 |
|
| 3143 |
if (!criticalIndiNodeConTestSet->isConceptTestedForIndividual(criticalConDes,indiProcSatNode)) { |
| 3144 |
criticalIndiNodeConTestSet->insertConceptTestedForIndividual(criticalConDes,indiProcSatNode); |
| 3145 |
STATINC(SATURATIONCRITICALTESTCOUNT,calcAlgContext); |
| 3146 |
if (isCriticalORConceptDescriptorInsufficient(criticalConDes,indiProcSatNode,calcAlgContext)) { |
| 3147 |
updateDirectNotDependentAddingIndividualStatusFlags(indiProcSatNode,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,calcAlgContext); |
| 3148 |
setInsufficientNodeOccured(calcAlgContext); |
| 3149 |
addCriticalORConceptTestedForDependentNodes(criticalConDes,conceptType,indiProcSatNode,criticalIndiNodeConTestSet,calcAlgContext); |
| 3150 |
} |
| 3151 |
} |
| 3152 |
releaseConceptSaturationProcessLinker(criticalConProcDes,calcAlgContext); |
| 3153 |
} |
| 3154 |
} |
| 3155 |
} |
| 3156 |
|
| 3157 |
|
| 3158 |
if (!indirectFlags->hasClashedFlag()) { |
| 3159 |
CCriticalSaturationConceptTypeQueues::CRITICALSATURATIONCONCEPTQUEUETYPE conceptType = CCriticalSaturationConceptTypeQueues::CCT_EQCANDIDATE; |
| 3160 |
CCriticalSaturationConceptQueue* criticalConTypeQueue = criticalConceptQueues->getCriticalSaturationConceptQueue(conceptType,false); |
| 3161 |
if (criticalConTypeQueue) { |
| 3162 |
while (criticalConTypeQueue->hasCriticalConceptDescriptorLinker()) { |
| 3163 |
CConceptSaturationProcessLinker* criticalConProcDes = criticalConTypeQueue->takeNextCriticalConceptDescriptor(); |
| 3164 |
CConceptSaturationDescriptor* criticalConDes = criticalConProcDes->getConceptSaturationDescriptor(); |
| 3165 |
|
| 3166 |
if (!criticalIndiNodeConTestSet->isConceptTestedForIndividual(criticalConDes,indiProcSatNode)) { |
| 3167 |
criticalIndiNodeConTestSet->insertConceptTestedForIndividual(criticalConDes,indiProcSatNode); |
| 3168 |
if (isCriticalEQCANDConceptDescriptorProblematic(criticalConDes,indiProcSatNode,calcAlgContext)) { |
| 3169 |
updateDirectNotDependentAddingIndividualStatusFlags(indiProcSatNode,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGEQCANDPROPLEMATIC,calcAlgContext); |
| 3170 |
setProblematicEQCandidateOccured(calcAlgContext); |
| 3171 |
addCriticalConceptForDependentNodes(criticalConDes,conceptType,indiProcSatNode,true,0,calcAlgContext); |
| 3172 |
} |
| 3173 |
} |
| 3174 |
releaseConceptSaturationProcessLinker(criticalConProcDes,calcAlgContext); |
| 3175 |
} |
| 3176 |
} |
| 3177 |
} |
| 3178 |
} |
| 3179 |
|
| 3180 |
|
| 3181 |
|
| 3182 |
|
| 3183 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::collectLinkedSuccessorNodes(CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext, CLinkedRoleSaturationSuccessorHash* linkedRoleSuccHash) { |
| 3184 |
if (!linkedRoleSuccHash) { |
| 3185 |
linkedRoleSuccHash = indiProcSatNode->getLinkedRoleSuccessorHash(true); |
| 3186 |
} |
| 3187 |
CConceptSaturationDescriptor* lastExaminedConDes = linkedRoleSuccHash->getLastExaminedConceptDescriptor(); |
| 3188 |
CReapplyConceptSaturationLabelSet* conSet = indiProcSatNode->getReapplyConceptSaturationLabelSet(true); |
| 3189 |
CConceptSaturationDescriptor* conDesLinker = conSet->getConceptSaturationDescriptionLinker(); |
| 3190 |
for (CConceptSaturationDescriptor* conDesIt = conDesLinker; conDesIt && conDesIt != lastExaminedConDes; conDesIt = conDesIt->getNext()) { |
| 3191 |
CConceptSaturationDescriptor* conDes = conDesIt; |
| 3192 |
CConcept* concept = conDes->getConcept(); |
| 3193 |
bool conNegation = conDes->isNegated(); |
| 3194 |
|
| 3195 |
cint64 conCode = concept->getOperatorCode(); |
| 3196 |
if (!conNegation && (conCode == CCSOME || conCode == CCAQSOME) || conNegation && (conCode == CCALL)) { |
| 3197 |
addLinkedSuccessorNodeForConcept(conDes,linkedRoleSuccHash,indiProcSatNode,calcAlgContext); |
| 3198 |
} |
| 3199 |
if (!conNegation && conCode == CCATLEAST || conNegation && conCode == CCATMOST) { |
| 3200 |
addLinkedSuccessorNodeForConcept(conDes,linkedRoleSuccHash,indiProcSatNode,calcAlgContext); |
| 3201 |
} |
| 3202 |
if (!conNegation && conCode == CCVALUE) { |
| 3203 |
addLinkedSuccessorNodeForConcept(conDes,linkedRoleSuccHash,indiProcSatNode,calcAlgContext); |
| 3204 |
} |
| 3205 |
} |
| 3206 |
CSaturationSuccessorRoleAssertionLinker* lastSatSuccRoleAssLinker = linkedRoleSuccHash->getLastExaminedRoleAssertionLinker(); |
| 3207 |
CSaturationSuccessorRoleAssertionLinker* satSuccRoleAssLinker = indiProcSatNode->getRoleAssertionLinker(); |
| 3208 |
for (CSaturationSuccessorRoleAssertionLinker* satSuccRoleAssLinkerIt = satSuccRoleAssLinker; satSuccRoleAssLinkerIt && satSuccRoleAssLinkerIt != lastSatSuccRoleAssLinker; satSuccRoleAssLinkerIt = satSuccRoleAssLinkerIt->getNext()) { |
| 3209 |
CRole* role = satSuccRoleAssLinkerIt->getAssertionRole(); |
| 3210 |
bool roleNegation = satSuccRoleAssLinkerIt->getAssertionRoleNegation(); |
| 3211 |
CIndividualSaturationProcessNode* destNode = satSuccRoleAssLinkerIt->getAssertionDestinationNode(); |
| 3212 |
addLinkedSuccessorNodeForRoleAssertion(destNode,role,roleNegation,linkedRoleSuccHash,indiProcSatNode,calcAlgContext); |
| 3213 |
} |
| 3214 |
linkedRoleSuccHash->setLastExaminedRoleAssertionLinker(satSuccRoleAssLinker); |
| 3215 |
linkedRoleSuccHash->setLastExaminedConceptDescriptor(conDesLinker); |
| 3216 |
} |
| 3217 |
|
| 3218 |
|
| 3219 |
|
| 3220 |
|
| 3221 |
|
| 3222 |
|
| 3223 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addLinkedSuccessorNodeForRoleAssertion(CIndividualSaturationProcessNode* destNode, CRole* role, bool roleInversion, CLinkedRoleSaturationSuccessorHash* linkedRoleSuccHash, CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 3224 |
CSortedNegLinker<CRole*>* superRoleIt = role->getIndirectSuperRoleList(); |
| 3225 |
while (superRoleIt) { |
| 3226 |
CRole* superRole = superRoleIt->getData(); |
| 3227 |
if (!superRoleIt->isNegated() ^ roleInversion) { |
| 3228 |
linkedRoleSuccHash->addLinkedSuccessor(superRole,destNode,role,1,true); |
| 3229 |
} |
| 3230 |
superRoleIt = superRoleIt->getNext(); |
| 3231 |
} |
| 3232 |
} |
| 3233 |
|
| 3234 |
|
| 3235 |
|
| 3236 |
|
| 3237 |
|
| 3238 |
|
| 3239 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addLinkedSuccessorNodeForConcept(CConceptSaturationDescriptor* conDes, CLinkedRoleSaturationSuccessorHash* linkedRoleSuccHash, CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 3240 |
CConcept* concept = conDes->getConcept(); |
| 3241 |
bool conNegation = conDes->isNegated(); |
| 3242 |
CRole* role = concept->getRole(); |
| 3243 |
cint64 param = concept->getParameter(); |
| 3244 |
cint64 cardinality = param + 1*conNegation; |
| 3245 |
|
| 3246 |
cint64 conCode = concept->getOperatorCode(); |
| 3247 |
|
| 3248 |
bool addSuccessor = false; |
| 3249 |
bool nominalSuccessor = false; |
| 3250 |
cint64 successorCount = 0; |
| 3251 |
cint64 nominalID = 0; |
| 3252 |
if (!conNegation && (conCode == CCVALUE)) { |
| 3253 |
addSuccessor = true; |
| 3254 |
successorCount = 1; |
| 3255 |
nominalSuccessor = true; |
| 3256 |
CIndividual* nominalIndividual = concept->getNominalIndividual(); |
| 3257 |
nominalID = nominalIndividual->getIndividualID(); |
| 3258 |
} |
| 3259 |
if (!conNegation && (conCode == CCSOME || conCode == CCAQSOME) || conNegation && (conCode == CCALL)) { |
| 3260 |
addSuccessor = true; |
| 3261 |
successorCount = 1; |
| 3262 |
nominalSuccessor = false; |
| 3263 |
} |
| 3264 |
if (cardinality >= 1 && (!conNegation && conCode == CCATLEAST || conNegation && conCode == CCATMOST)) { |
| 3265 |
addSuccessor = true; |
| 3266 |
successorCount = cardinality; |
| 3267 |
nominalSuccessor = false; |
| 3268 |
} |
| 3269 |
|
| 3270 |
if (addSuccessor) { |
| 3271 |
bool foundSpecialIndiNode = false; |
| 3272 |
bool foundOperandIndiNode = false; |
| 3273 |
CConceptData* conceptData = concept->getConceptData(); |
| 3274 |
if (conceptData) { |
| 3275 |
CConceptProcessData* conProcData = (CConceptProcessData*)conceptData; |
| 3276 |
CConceptReferenceLinking* conRefLinking = conProcData->getConceptReferenceLinking(); |
| 3277 |
if (conRefLinking) { |
| 3278 |
CConceptSaturationReferenceLinkingData* confSatRefLinkingData = (CConceptSaturationReferenceLinkingData*)conRefLinking; |
| 3279 |
CSaturationConceptReferenceLinking* extSatCalcRefLinkData = confSatRefLinkingData->getExistentialSuccessorConceptSaturationReferenceLinkingData(); |
| 3280 |
if (extSatCalcRefLinkData) { |
| 3281 |
CIndividualSaturationProcessNode* existIndiNode = (CIndividualSaturationProcessNode*)extSatCalcRefLinkData->getIndividualProcessNodeForConcept(); |
| 3282 |
if (existIndiNode) { |
| 3283 |
foundSpecialIndiNode = true; |
| 3284 |
CSortedNegLinker<CRole*>* superRoleIt = role->getIndirectSuperRoleList(); |
| 3285 |
while (superRoleIt) { |
| 3286 |
CRole* superRole = superRoleIt->getData(); |
| 3287 |
if (!superRoleIt->isNegated()) { |
| 3288 |
if (nominalSuccessor) { |
| 3289 |
linkedRoleSuccHash->addLinkedVALUESuccessor(superRole,nominalID,role); |
| 3290 |
} else { |
| 3291 |
linkedRoleSuccHash->addLinkedSuccessor(superRole,existIndiNode,role,successorCount,false); |
| 3292 |
} |
| 3293 |
} |
| 3294 |
superRoleIt = superRoleIt->getNext(); |
| 3295 |
} |
| 3296 |
} |
| 3297 |
} |
| 3298 |
} |
| 3299 |
} |
| 3300 |
if (!foundSpecialIndiNode) { |
| 3301 |
CSortedNegLinker<CConcept*>* conceptOpLinkerIt = concept->getOperandList(); |
| 3302 |
while (conceptOpLinkerIt) { |
| 3303 |
foundOperandIndiNode = true; |
| 3304 |
CConcept* opConcept = conceptOpLinkerIt->getData(); |
| 3305 |
bool opConNegation = conceptOpLinkerIt->isNegated()^conNegation; |
| 3306 |
CConceptData* opConceptData = opConcept->getConceptData(); |
| 3307 |
if (opConceptData) { |
| 3308 |
CConceptProcessData* conProcData = (CConceptProcessData*)opConceptData; |
| 3309 |
CConceptReferenceLinking* conRefLinking = conProcData->getConceptReferenceLinking(); |
| 3310 |
if (conRefLinking) { |
| 3311 |
CConceptSaturationReferenceLinkingData* confSatRefLinkingData = (CConceptSaturationReferenceLinkingData*)conRefLinking; |
| 3312 |
CSaturationConceptReferenceLinking* satCalcRefLinkData = confSatRefLinkingData->getConceptSaturationReferenceLinkingData(opConNegation); |
| 3313 |
if (satCalcRefLinkData) { |
| 3314 |
CIndividualSaturationProcessNode* existIndiNode = (CIndividualSaturationProcessNode*)satCalcRefLinkData->getIndividualProcessNodeForConcept(); |
| 3315 |
if (existIndiNode) { |
| 3316 |
CSortedNegLinker<CRole*>* superRoleIt = role->getIndirectSuperRoleList(); |
| 3317 |
while (superRoleIt) { |
| 3318 |
CRole* superRole = superRoleIt->getData(); |
| 3319 |
if (!superRoleIt->isNegated()) { |
| 3320 |
if (nominalSuccessor) { |
| 3321 |
linkedRoleSuccHash->addLinkedVALUESuccessor(superRole,nominalID,role); |
| 3322 |
} else { |
| 3323 |
linkedRoleSuccHash->addLinkedSuccessor(superRole,existIndiNode,role,successorCount,false); |
| 3324 |
} |
| 3325 |
} |
| 3326 |
superRoleIt = superRoleIt->getNext(); |
| 3327 |
} |
| 3328 |
} |
| 3329 |
} |
| 3330 |
} |
| 3331 |
} |
| 3332 |
conceptOpLinkerIt = conceptOpLinkerIt->getNext(); |
| 3333 |
} |
| 3334 |
} |
| 3335 |
if (!foundSpecialIndiNode && !foundOperandIndiNode) { |
| 3336 |
CConcept* baseTopConcept = nullptr; |
| 3337 |
if (!role->isDataRole()) { |
| 3338 |
baseTopConcept = calcAlgContext->getUsedProcessingDataBox()->getOntologyTopConcept(); |
| 3339 |
} else { |
| 3340 |
baseTopConcept = calcAlgContext->getUsedProcessingDataBox()->getOntologyTopDataRangeConcept(); |
| 3341 |
} |
| 3342 |
CConcept* opConcept = baseTopConcept; |
| 3343 |
bool opConNegation = false; |
| 3344 |
CConceptData* opConceptData = opConcept->getConceptData(); |
| 3345 |
if (opConceptData) { |
| 3346 |
CConceptProcessData* conProcData = (CConceptProcessData*)opConceptData; |
| 3347 |
CConceptReferenceLinking* conRefLinking = conProcData->getConceptReferenceLinking(); |
| 3348 |
if (conRefLinking) { |
| 3349 |
CConceptSaturationReferenceLinkingData* confSatRefLinkingData = (CConceptSaturationReferenceLinkingData*)conRefLinking; |
| 3350 |
CSaturationConceptReferenceLinking* satCalcRefLinkData = confSatRefLinkingData->getConceptSaturationReferenceLinkingData(opConNegation); |
| 3351 |
if (satCalcRefLinkData) { |
| 3352 |
CIndividualSaturationProcessNode* existIndiNode = (CIndividualSaturationProcessNode*)satCalcRefLinkData->getIndividualProcessNodeForConcept(); |
| 3353 |
if (existIndiNode) { |
| 3354 |
CSortedNegLinker<CRole*>* superRoleIt = role->getIndirectSuperRoleList(); |
| 3355 |
while (superRoleIt) { |
| 3356 |
CRole* superRole = superRoleIt->getData(); |
| 3357 |
if (!superRoleIt->isNegated()) { |
| 3358 |
if (nominalSuccessor) { |
| 3359 |
linkedRoleSuccHash->addLinkedVALUESuccessor(superRole,nominalID,role); |
| 3360 |
} else { |
| 3361 |
linkedRoleSuccHash->addLinkedSuccessor(superRole,existIndiNode,role,successorCount,false); |
| 3362 |
} |
| 3363 |
} |
| 3364 |
superRoleIt = superRoleIt->getNext(); |
| 3365 |
} |
| 3366 |
} |
| 3367 |
} |
| 3368 |
} |
| 3369 |
} |
| 3370 |
} |
| 3371 |
} |
| 3372 |
} |
| 3373 |
|
| 3374 |
|
| 3375 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addCriticalConceptDescriptor(CConceptSaturationDescriptor* conDes, CCriticalSaturationConceptTypeQueues::CRITICALSATURATIONCONCEPTQUEUETYPE conceptType, CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 3376 |
if (mConfAddCriticalConceptsToQueues) { |
| 3377 |
STATINC(SATURATIONCRITICALADDCOUNT,calcAlgContext); |
| 3378 |
CConceptSaturationProcessLinker* conDesProLinker = createConceptSaturationProcessLinker(calcAlgContext); |
| 3379 |
conDesProLinker->initConceptSaturationProcessLinker(conDes); |
| 3380 |
CCriticalSaturationConceptTypeQueues* queues = indiProcSatNode->getCriticalConceptTypeQueues(true); |
| 3381 |
CCriticalSaturationConceptQueue* criticalConceptQueue = queues->getCriticalSaturationConceptQueue(conceptType,true); |
| 3382 |
criticalConceptQueue->addCriticalConceptDescriptorLinker(conDesProLinker); |
| 3383 |
if (!queues->isProcessNodeQueued()) { |
| 3384 |
// TODO: insert into a queue |
| 3385 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 3386 |
CCriticalIndividualNodeProcessingQueue* criticalIndNodProcQueue = processingDataBox->getSaturationCriticalIndividualNodeProcessingQueue(true); |
| 3387 |
criticalIndNodProcQueue->insertProcessIndiviudal(indiProcSatNode); |
| 3388 |
queues->setProcessNodeQueued(true); |
| 3389 |
} |
| 3390 |
} |
| 3391 |
if (mConfDirectlyCriticalToInsufficient) { |
| 3392 |
updateDirectAddingIndividualStatusFlags(indiProcSatNode,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,mCalcAlgContext); |
| 3393 |
setInsufficientNodeOccured(mCalcAlgContext); |
| 3394 |
} |
| 3395 |
} |
| 3396 |
|
| 3397 |
|
| 3398 |
|
| 3399 |
|
| 3400 |
|
| 3401 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::testInsufficientALLConcepts(CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 3402 |
collectLinkedSuccessorNodes(indiProcSatNode,calcAlgContext); |
| 3403 |
CLinkedRoleSaturationSuccessorHash* linkedSuccHash = indiProcSatNode->getLinkedRoleSuccessorHash(false); |
| 3404 |
CRoleBackwardSaturationPropagationHash* backwardPropHash = indiProcSatNode->getRoleBackwardPropagationHash(false); |
| 3405 |
if (backwardPropHash && linkedSuccHash) { |
| 3406 |
CSaturationIndividualNodeSuccessorExtensionData* succExtData = indiProcSatNode->getSuccessorExtensionData(false); |
| 3407 |
if (succExtData && !succExtData->isExtensionProcessingQueued()) { |
| 3408 |
CPROCESSHASH<CRole*,CRoleBackwardSaturationPropagationHashData>* backPropDataHash = backwardPropHash->getRoleBackwardPropagationDataHash(); |
| 3409 |
if (backPropDataHash) { |
| 3410 |
CPROCESSHASH<CRole*,CLinkedRoleSaturationSuccessorData*>* succHash = linkedSuccHash->getLinkedRoleSuccessorHash(); |
| 3411 |
for (CPROCESSHASH<CRole*,CLinkedRoleSaturationSuccessorData*>::const_iterator itSucc = succHash->constBegin(), itSuccEnd = succHash->constEnd(); itSucc != itSuccEnd; ++itSucc) { |
| 3412 |
CRole* role(itSucc.key()); |
| 3413 |
CLinkedRoleSaturationSuccessorData* succData(itSucc.value()); |
| 3414 |
for (CPROCESSMAP<cint64,CSaturationSuccessorData*>::const_iterator itSuccIndi = succData->mSuccNodeDataMap.constBegin(), itSuccIndiEnd = succData->mSuccNodeDataMap.constEnd(); itSuccIndi != itSuccIndiEnd; ++itSuccIndi) { |
| 3415 |
CSaturationSuccessorData* succDataIndi(itSuccIndi.value()); |
| 3416 |
if (succDataIndi->mActiveCount >= 1) { |
| 3417 |
if (succDataIndi->mVALUENominalConnection) { |
| 3418 |
} else { |
| 3419 |
CIndividualSaturationProcessNode* succIndi = succDataIndi->mSuccIndiNode; |
| 3420 |
CReapplyConceptSaturationLabelSet* succConSet = succIndi->getReapplyConceptSaturationLabelSet(false); |
| 3421 |
const CRoleBackwardSaturationPropagationHashData& backPropData = backPropDataHash->value(role); |
| 3422 |
for (CBackwardSaturationPropagationReapplyDescriptor* backPropIt = backPropData.mReapplyLinker; backPropIt; backPropIt = backPropIt->getNext()) { |
| 3423 |
CConceptSaturationDescriptor* conDes = backPropIt->getReapplyConceptSaturationDescriptor(); |
| 3424 |
CConcept* concept = conDes->getConcept(); |
| 3425 |
bool negation = conDes->isNegated(); |
| 3426 |
for (CSortedNegLinker<CConcept*>* opLinkerIt = concept->getOperandList(); opLinkerIt; opLinkerIt = opLinkerIt->getNext()) { |
| 3427 |
CConcept* opConcept = opLinkerIt->getData(); |
| 3428 |
bool opNegation = opLinkerIt->isNegated()^negation; |
| 3429 |
if (!succConSet || !succConSet->containsConcept(opConcept,opNegation)) { |
| 3430 |
mEndSaturationDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 3431 |
QFile tmpFile("saturation-model.txt"); |
| 3432 |
if (tmpFile.open(QIODevice::WriteOnly)) { |
| 3433 |
tmpFile.write(mEndSaturationDebugIndiModelString.replace("<br>","").replace("<p>","\n").toLocal8Bit()); |
| 3434 |
tmpFile.close(); |
| 3435 |
} |
| 3436 |
bool bug = true; |
| 3437 |
} |
| 3438 |
} |
| 3439 |
} |
| 3440 |
} |
| 3441 |
} |
| 3442 |
} |
| 3443 |
} |
| 3444 |
} |
| 3445 |
} |
| 3446 |
} |
| 3447 |
} |
| 3448 |
|
| 3449 |
|
| 3450 |
|
| 3451 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::isCriticalALLConceptDescriptorInsufficient(CConceptSaturationDescriptor* conDes, CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 3452 |
STATINC(SATURATIONCRITICALALLCOUNT,calcAlgContext); |
| 3453 |
if (!indiProcSatNode->hasSubstituteIndividualNode()) { |
| 3454 |
CConcept* concept = conDes->getConcept(); |
| 3455 |
bool conceptNegation = conDes->isNegated(); |
| 3456 |
CRole* role = concept->getRole(); |
| 3457 |
|
| 3458 |
if (role->isDataRole() && indiProcSatNode->getIndividualExtensionData(false)) { |
| 3459 |
CLinkedDataValueAssertionSaturationData* linkedDataValueAssertionData = indiProcSatNode->getIndividualExtensionData(false)->getLinkedDataValueAssertionData(false); |
| 3460 |
if (linkedDataValueAssertionData) { |
| 3461 |
for (CXLinker<CRole*>* dataRoleLinkerIt = linkedDataValueAssertionData->getDataValueRoleAssertionLinker(); dataRoleLinkerIt; dataRoleLinkerIt = dataRoleLinkerIt->getNext()) { |
| 3462 |
CRole* assertedDataRole = dataRoleLinkerIt->getData(); |
| 3463 |
for (CSortedNegLinker<CRole*>* superAssertedDataRoleIt = assertedDataRole->getIndirectSuperRoleList(); superAssertedDataRoleIt; superAssertedDataRoleIt = superAssertedDataRoleIt->getNext()) { |
| 3464 |
if (!superAssertedDataRoleIt->isNegated()) { |
| 3465 |
CRole* superAssertedDataRole = superAssertedDataRoleIt->getData(); |
| 3466 |
if (role == superAssertedDataRole) { |
| 3467 |
return true; |
| 3468 |
} |
| 3469 |
} |
| 3470 |
} |
| 3471 |
} |
| 3472 |
} |
| 3473 |
} |
| 3474 |
|
| 3475 |
|
| 3476 |
collectLinkedSuccessorNodes(indiProcSatNode,calcAlgContext); |
| 3477 |
CLinkedRoleSaturationSuccessorHash* linkedSuccHash = indiProcSatNode->getLinkedRoleSuccessorHash(false); |
| 3478 |
if (linkedSuccHash) { |
| 3479 |
CPROCESSHASH<CRole*,CLinkedRoleSaturationSuccessorData*>* succHash = linkedSuccHash->getLinkedRoleSuccessorHash(); |
| 3480 |
CLinkedRoleSaturationSuccessorData* succData = succHash->value(role); |
| 3481 |
if (succData) { |
| 3482 |
for (CPROCESSMAP<cint64,CSaturationSuccessorData*>::const_iterator itSucc = succData->mSuccNodeDataMap.constBegin(), itSuccEnd = succData->mSuccNodeDataMap.constEnd(); itSucc != itSuccEnd; ++itSucc) { |
| 3483 |
CSaturationSuccessorData* indiSuccData(itSucc.value()); |
| 3484 |
if (indiSuccData->mActiveCount >= 1) { |
| 3485 |
if (indiSuccData->mVALUENominalConnection) { |
| 3486 |
if (isConsistenceDataAvailable(calcAlgContext)) { |
| 3487 |
CIndividualProcessNode* indiProcNode = getCorrectedNode(indiSuccData->mVALUENominalID,mDetCachedCGIndiVector,mCalcAlgContext); |
| 3488 |
if (indiProcNode) { |
| 3489 |
CReapplyConceptLabelSet* reapplyConSet = indiProcNode->getReapplyConceptLabelSet(false); |
| 3490 |
bool operantsContained = true; |
| 3491 |
if (reapplyConSet) { |
| 3492 |
for (CSortedNegLinker<CConcept*>* opLinkerIt = concept->getOperandList(); opLinkerIt && operantsContained; opLinkerIt = opLinkerIt->getNext()) { |
| 3493 |
CConcept* opConcept = opLinkerIt->getData(); |
| 3494 |
bool opConceptNegation = opLinkerIt->isNegated()^conceptNegation; |
| 3495 |
if (!reapplyConSet->containsConcept(opConcept,opConceptNegation)) { |
| 3496 |
operantsContained = false; |
| 3497 |
} |
| 3498 |
} |
| 3499 |
} else { |
| 3500 |
operantsContained = false; |
| 3501 |
} |
| 3502 |
if (!operantsContained) { |
| 3503 |
return true; |
| 3504 |
} |
| 3505 |
} else { |
| 3506 |
return true; |
| 3507 |
} |
| 3508 |
} |
| 3509 |
} else { |
| 3510 |
CIndividualSaturationProcessNode* succNode = indiSuccData->mSuccIndiNode; |
| 3511 |
CReapplyConceptSaturationLabelSet* succConSet = succNode->getReapplyConceptSaturationLabelSet(false); |
| 3512 |
bool operantsContained = true; |
| 3513 |
if (succConSet) { |
| 3514 |
for (CSortedNegLinker<CConcept*>* opLinkerIt = concept->getOperandList(); opLinkerIt && operantsContained; opLinkerIt = opLinkerIt->getNext()) { |
| 3515 |
CConcept* opConcept = opLinkerIt->getData(); |
| 3516 |
bool opConceptNegation = opLinkerIt->isNegated()^conceptNegation; |
| 3517 |
if (!succConSet->containsConcept(opConcept,opConceptNegation)) { |
| 3518 |
operantsContained = false; |
| 3519 |
} |
| 3520 |
} |
| 3521 |
} else { |
| 3522 |
operantsContained = false; |
| 3523 |
} |
| 3524 |
if (!operantsContained) { |
| 3525 |
|
| 3526 |
//mEndSaturationDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 3527 |
//QFile tmpFile("saturation-model.txt"); |
| 3528 |
//if (tmpFile.open(QIODevice::WriteOnly)) { |
| 3529 |
// tmpFile.write(mEndSaturationDebugIndiModelString.replace("<br>","").replace("<p>","\n").toLocal8Bit()); |
| 3530 |
// tmpFile.close(); |
| 3531 |
//} |
| 3532 |
//bool bug = true; |
| 3533 |
|
| 3534 |
|
| 3535 |
//CRoleBackwardSaturationPropagationHashData* backwardPropData = nullptr; |
| 3536 |
//CRoleBackwardSaturationPropagationHash* backwardPropHash = indiProcSatNode->getRoleBackwardPropagationHash(false); |
| 3537 |
//if (backwardPropHash) { |
| 3538 |
// CPROCESSHASH<CRole*,CRoleBackwardSaturationPropagationHashData>* backwardPropDataHash = backwardPropHash->getRoleBackwardPropagationDataHash(); |
| 3539 |
|
| 3540 |
// backwardPropData = backwardPropDataHash->valuePointer(role); |
| 3541 |
//} |
| 3542 |
|
| 3543 |
//CSaturationSuccessorALLConceptExtensionData* satSucALLConExtData = nullptr; |
| 3544 |
//CSaturationLinkedSuccessorIndividualALLConceptsExtensionData* satSucALLConExtRoleData = nullptr; |
| 3545 |
//CSaturationIndividualNodeSuccessorExtensionData* indiProcSatNodeSuccExt = indiProcSatNode->getSuccessorExtensionData(false); |
| 3546 |
//if (indiProcSatNodeSuccExt) { |
| 3547 |
// CSaturationIndividualNodeALLConceptsExtensionData* indiProcSatNodeALLConSuccExt = indiProcSatNodeSuccExt->getALLConceptsExtensionData(false); |
| 3548 |
// if (indiProcSatNodeALLConSuccExt) { |
| 3549 |
|
| 3550 |
// satSucALLConExtRoleData = indiProcSatNodeALLConSuccExt->getALLConceptsExtensionData(succNode,false); |
| 3551 |
// if (satSucALLConExtRoleData) { |
| 3552 |
// satSucALLConExtData = satSucALLConExtRoleData->getRoleSuccessorALLConceptExtensionData(role,false); |
| 3553 |
// } |
| 3554 |
// } |
| 3555 |
//} |
| 3556 |
|
| 3557 |
|
| 3558 |
return true; |
| 3559 |
} |
| 3560 |
} |
| 3561 |
} |
| 3562 |
} |
| 3563 |
} |
| 3564 |
} |
| 3565 |
} |
| 3566 |
return false; |
| 3567 |
} |
| 3568 |
|
| 3569 |
|
| 3570 |
|
| 3571 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::isCriticalORConceptDescriptorInsufficient(CConceptSaturationDescriptor* conDes, CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 3572 |
|
| 3573 |
STATINC(SATURATIONCRITICALORCOUNT,calcAlgContext); |
| 3574 |
CConcept* concept = conDes->getConcept(); |
| 3575 |
bool conceptNegation = conDes->isNegated(); |
| 3576 |
CReapplyConceptSaturationLabelSet* conSet = indiProcSatNode->getReapplyConceptSaturationLabelSet(false); |
| 3577 |
if (conSet) { |
| 3578 |
for (CSortedNegLinker<CConcept*>* opLinkerIt = concept->getOperandList(); opLinkerIt; opLinkerIt = opLinkerIt->getNext()) { |
| 3579 |
CConcept* opConcept = opLinkerIt->getData(); |
| 3580 |
bool opConceptNegation = opLinkerIt->isNegated()^conceptNegation; |
| 3581 |
|
| 3582 |
bool checkingNegation = opConceptNegation; |
| 3583 |
CConcept* opCheckingConcept = getDisjunctCheckingConcept(opConcept, opConceptNegation, &checkingNegation, calcAlgContext); |
| 3584 |
|
| 3585 |
if (conSet->containsConcept(opCheckingConcept, checkingNegation)) { |
| 3586 |
return false; |
| 3587 |
} |
| 3588 |
} |
| 3589 |
} |
| 3590 |
return true; |
| 3591 |
} |
| 3592 |
|
| 3593 |
|
| 3594 |
|
| 3595 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::isCriticalEQCANDConceptDescriptorProblematic(CConceptSaturationDescriptor* conDes, CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 3596 |
|
| 3597 |
STATINC(SATURATIONCRITICALORCOUNT,calcAlgContext); |
| 3598 |
CConcept* concept = conDes->getConcept(); |
| 3599 |
bool conceptNegation = conDes->isNegated(); |
| 3600 |
CReapplyConceptSaturationLabelSet* conSet = indiProcSatNode->getReapplyConceptSaturationLabelSet(false); |
| 3601 |
if (conSet) { |
| 3602 |
for (CSortedNegLinker<CConcept*>* opLinkerIt = concept->getOperandList(); opLinkerIt; opLinkerIt = opLinkerIt->getNext()) { |
| 3603 |
CConcept* opConcept = opLinkerIt->getData(); |
| 3604 |
bool opConceptNegation = opLinkerIt->isNegated()^conceptNegation; |
| 3605 |
if (conSet->containsConcept(opConcept,opConceptNegation)) { |
| 3606 |
return false; |
| 3607 |
} |
| 3608 |
} |
| 3609 |
} |
| 3610 |
return true; |
| 3611 |
} |
| 3612 |
|
| 3613 |
|
| 3614 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::isCriticalATMOSTConceptDescriptorInsufficient(CConceptSaturationDescriptor* conDes, bool& ancestorPossiblyCriticalFlag, CIndividualSaturationProcessNode*& functionallyRestrictedSuccessorNode, CXNegLinker<CRole*>*& functionallyRestrictedSuccessorCreationRoleLinker, CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 3615 |
STATINC(SATURATIONCRITICALATMOSTCOUNT,calcAlgContext); |
| 3616 |
CConcept* concept = conDes->getConcept(); |
| 3617 |
bool conceptNegation = conDes->isNegated(); |
| 3618 |
CRole* role = concept->getRole(); |
| 3619 |
cint64 allowedCardinality = concept->getParameter() - 1*conceptNegation; |
| 3620 |
if (allowedCardinality < 0) { |
| 3621 |
return true; |
| 3622 |
} |
| 3623 |
|
| 3624 |
|
| 3625 |
cint64 foundCardinality = 0; |
| 3626 |
if (!indiProcSatNode->hasSubstituteIndividualNode()) { |
| 3627 |
|
| 3628 |
if (role->isDataRole() && indiProcSatNode->getIndividualExtensionData(false)) { |
| 3629 |
CLinkedDataValueAssertionSaturationData* linkedDataValueAssertionData = indiProcSatNode->getIndividualExtensionData(false)->getLinkedDataValueAssertionData(false); |
| 3630 |
if (linkedDataValueAssertionData) { |
| 3631 |
for (CXLinker<CRole*>* dataRoleLinkerIt = linkedDataValueAssertionData->getDataValueRoleAssertionLinker(); dataRoleLinkerIt; dataRoleLinkerIt = dataRoleLinkerIt->getNext()) { |
| 3632 |
CRole* assertedDataRole = dataRoleLinkerIt->getData(); |
| 3633 |
for (CSortedNegLinker<CRole*>* superAssertedDataRoleIt = assertedDataRole->getIndirectSuperRoleList(); superAssertedDataRoleIt; superAssertedDataRoleIt = superAssertedDataRoleIt->getNext()) { |
| 3634 |
if (!superAssertedDataRoleIt->isNegated()) { |
| 3635 |
CRole* superAssertedDataRole = superAssertedDataRoleIt->getData(); |
| 3636 |
if (role == superAssertedDataRole) { |
| 3637 |
++foundCardinality; |
| 3638 |
} |
| 3639 |
} |
| 3640 |
} |
| 3641 |
|
| 3642 |
if (foundCardinality > allowedCardinality) { |
| 3643 |
return true; |
| 3644 |
} |
| 3645 |
} |
| 3646 |
} |
| 3647 |
} |
| 3648 |
|
| 3649 |
|
| 3650 |
//if (getDebugIndividualConceptName(indiProcSatNode,calcAlgContext) == "http://www.projecthalo.com/aura#Hydrogenated-Margarine") { |
| 3651 |
// bool debug = true; |
| 3652 |
//} |
| 3653 |
|
| 3654 |
collectLinkedSuccessorNodes(indiProcSatNode,calcAlgContext); |
| 3655 |
CLinkedRoleSaturationSuccessorHash* linkedSuccHash = indiProcSatNode->getLinkedRoleSuccessorHash(false); |
| 3656 |
if (linkedSuccHash) { |
| 3657 |
|
| 3658 |
cint64 minCardinality = 0; |
| 3659 |
CIndividualSaturationSuccessorLinkDataLinker* mergingSuccDataLinker = nullptr; |
| 3660 |
|
| 3661 |
CPROCESSHASH<CRole*,CLinkedRoleSaturationSuccessorData*>* succHash = linkedSuccHash->getLinkedRoleSuccessorHash(); |
| 3662 |
CLinkedRoleSaturationSuccessorData* succData = succHash->value(role); |
| 3663 |
if (succData) { |
| 3664 |
if (succData->mSuccCount >= allowedCardinality) { |
| 3665 |
|
| 3666 |
CIndividualSaturationProcessNode* lastSuccessorNode = nullptr; |
| 3667 |
CXNegLinker<CRole*>* lastSuccessorCreationRoleLinker = nullptr; |
| 3668 |
|
| 3669 |
foundCardinality += collectATMOSTConceptRelevantSuccessors(conDes,indiProcSatNode,succData,mergingSuccDataLinker,lastSuccessorNode,lastSuccessorCreationRoleLinker,minCardinality,calcAlgContext); |
| 3670 |
|
| 3671 |
|
| 3672 |
cint64 mergeableCardinality = 0; |
| 3673 |
if (foundCardinality >= allowedCardinality && foundCardinality > 1) { |
| 3674 |
|
| 3675 |
// check whether some trivial merging is possible |
| 3676 |
CPROCESSHASH<CSaturationSuccessorData*,cint64>* remainMergeableCardHash = CObjectParameterizingAllocator< CPROCESSHASH<CSaturationSuccessorData*,cint64>,CContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedTemporaryMemoryAllocationManager(),calcAlgContext->getTaskProcessorContext()); |
| 3677 |
|
| 3678 |
CPROCESSHASH<CSaturationSuccessorData*,CSaturationSuccessorData*>* mergeDistintHash = CObjectParameterizingAllocator< CPROCESSHASH<CSaturationSuccessorData*,CSaturationSuccessorData*>,CContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedTemporaryMemoryAllocationManager(),calcAlgContext->getTaskProcessorContext()); |
| 3679 |
CPROCESSSET< QPair<CSaturationSuccessorData*,CSaturationSuccessorData*> >* mergeDistintSet = CObjectParameterizingAllocator< CPROCESSSET< QPair<CSaturationSuccessorData*,CSaturationSuccessorData*> >,CContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedTemporaryMemoryAllocationManager(),calcAlgContext->getTaskProcessorContext()); |
| 3680 |
|
| 3681 |
if (mergingSuccDataLinker) { |
| 3682 |
|
| 3683 |
if (mConfSimpleMergingTestForATMOSTCriticalTesting) { |
| 3684 |
for (CIndividualSaturationSuccessorLinkDataLinker* mergingSuccDataLinkerIt = mergingSuccDataLinker; mergingSuccDataLinkerIt && foundCardinality-mergeableCardinality >= allowedCardinality; mergingSuccDataLinkerIt = mergingSuccDataLinkerIt->getNext()) { |
| 3685 |
CSaturationSuccessorData* succLinkData = mergingSuccDataLinkerIt->getData(); |
| 3686 |
if (succLinkData->mSuccCount >= 1) { |
| 3687 |
cint64 maxRequiredMergingCardinality = foundCardinality-mergeableCardinality-(allowedCardinality-1); |
| 3688 |
cint64 mergingCardinality = getSuccessorLinkSimplyMergeableCardinalityCount(indiProcSatNode,succLinkData,mergingSuccDataLinker,remainMergeableCardHash,role,maxRequiredMergingCardinality,mergeDistintHash,mergeDistintSet,calcAlgContext); |
| 3689 |
cint64 remainingCardinality = succLinkData->mSuccCount-mergingCardinality; |
| 3690 |
remainMergeableCardHash->insert(succLinkData,remainingCardinality); |
| 3691 |
mergeableCardinality += mergingCardinality; |
| 3692 |
} |
| 3693 |
} |
| 3694 |
} |
| 3695 |
|
| 3696 |
|
| 3697 |
|
| 3698 |
if (mConfDetailedMergingTestForATMOSTCriticalTesting && foundCardinality-mergeableCardinality >= allowedCardinality && foundCardinality-mergeableCardinality <= allowedCardinality*2) { |
| 3699 |
for (CIndividualSaturationSuccessorLinkDataLinker* mergingSuccDataLinkerIt = mergingSuccDataLinker; mergingSuccDataLinkerIt && foundCardinality-mergeableCardinality >= allowedCardinality; mergingSuccDataLinkerIt = mergingSuccDataLinkerIt->getNext()) { |
| 3700 |
CSaturationSuccessorData* succLinkData = mergingSuccDataLinkerIt->getData(); |
| 3701 |
if (succLinkData->mSuccCount >= 1) { |
| 3702 |
cint64 succRemainingCardinality = remainMergeableCardHash->value(succLinkData,succLinkData->mSuccCount); |
| 3703 |
if (succRemainingCardinality > 0) { |
| 3704 |
cint64 maxRequiredMergingCardinality = foundCardinality-mergeableCardinality-(allowedCardinality-1); |
| 3705 |
|
| 3706 |
//for (CIndividualSaturationSuccessorLinkDataLinker* otherSuccDataLinkerIt = mergingSuccDataLinker; otherSuccDataLinkerIt && foundCardinality-mergeableCardinality >= allowedCardinality; otherSuccDataLinkerIt = otherSuccDataLinkerIt->getNext()) { |
| 3707 |
// if (otherSuccDataLinkerIt != mergingSuccDataLinkerIt) { |
| 3708 |
// CSaturationSuccessorData* otherSuccLinkData = otherSuccDataLinkerIt->getData(); |
| 3709 |
// if (otherSuccLinkData->mSuccCount >= 1) { |
| 3710 |
// cint64 otherSuccRemainingCardinality = remainMergeableCardHash->value(otherSuccLinkData,otherSuccLinkData->mSuccCount); |
| 3711 |
// if (otherSuccRemainingCardinality > 0) { |
| 3712 |
|
| 3713 |
|
| 3714 |
|
| 3715 |
cint64 mergingCardinality = getSuccessorLinkExtendedMergeableCardinalityCount(indiProcSatNode,succLinkData,nullptr,mergingSuccDataLinkerIt->getNext(),remainMergeableCardHash,role,maxRequiredMergingCardinality,mergeDistintHash,mergeDistintSet,calcAlgContext); |
| 3716 |
if (mergingCardinality > 0) { |
| 3717 |
cint64 newSuccCard = qMax(succRemainingCardinality,mergingCardinality); |
| 3718 |
remainMergeableCardHash->insert(succLinkData,newSuccCard); |
| 3719 |
cint64 removedSuccCard = qMin(succRemainingCardinality,mergingCardinality); |
| 3720 |
mergeableCardinality += removedSuccCard; |
| 3721 |
} |
| 3722 |
} |
| 3723 |
} |
| 3724 |
} |
| 3725 |
} |
| 3726 |
|
| 3727 |
} |
| 3728 |
if (mergingSuccDataLinker) { |
| 3729 |
releaseIndividualSaturationSuccessorLinkDataLinker(mergingSuccDataLinker,calcAlgContext); |
| 3730 |
} |
| 3731 |
} |
| 3732 |
|
| 3733 |
|
| 3734 |
if (foundCardinality-mergeableCardinality == allowedCardinality || minCardinality >= allowedCardinality) { |
| 3735 |
ancestorPossiblyCriticalFlag = true; |
| 3736 |
if (allowedCardinality == 1) { |
| 3737 |
functionallyRestrictedSuccessorNode = lastSuccessorNode; |
| 3738 |
functionallyRestrictedSuccessorCreationRoleLinker = lastSuccessorCreationRoleLinker; |
| 3739 |
} |
| 3740 |
} |
| 3741 |
if (foundCardinality-mergeableCardinality > allowedCardinality) { |
| 3742 |
|
| 3743 |
//mEndSaturationDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 3744 |
//QFile tmpFile("saturation-model.txt"); |
| 3745 |
//if (tmpFile.open(QIODevice::WriteOnly)) { |
| 3746 |
// tmpFile.write(mEndSaturationDebugIndiModelString.replace("<br>","").replace("<p>","\n").toLocal8Bit()); |
| 3747 |
// tmpFile.close(); |
| 3748 |
//} |
| 3749 |
//bool bug = true; |
| 3750 |
|
| 3751 |
return true; |
| 3752 |
} |
| 3753 |
|
| 3754 |
} |
| 3755 |
} |
| 3756 |
} |
| 3757 |
} |
| 3758 |
return false; |
| 3759 |
} |
| 3760 |
|
| 3761 |
|
| 3762 |
|
| 3763 |
|
| 3764 |
|
| 3765 |
|
| 3766 |
|
| 3767 |
|
| 3768 |
cint64 CCalculationTableauApproximationSaturationTaskHandleAlgorithm::collectATMOSTConceptRelevantSuccessors(CConceptSaturationDescriptor* conDes, CIndividualSaturationProcessNode*& indiProcSatNode, CLinkedRoleSaturationSuccessorData* succData, CIndividualSaturationSuccessorLinkDataLinker*& mergingSuccDataLinker, CIndividualSaturationProcessNode*& lastSuccessorNode, CXNegLinker<CRole*>*& lastSuccessorCreationRoleLinker, cint64& minCardinality, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 3769 |
|
| 3770 |
CConcept* concept = conDes->getConcept(); |
| 3771 |
bool conceptNegation = conDes->isNegated(); |
| 3772 |
CRole* role = concept->getRole(); |
| 3773 |
cint64 allowedCardinality = concept->getParameter() - 1*conceptNegation; |
| 3774 |
|
| 3775 |
cint64 foundCardinality = 0; |
| 3776 |
minCardinality = 0; |
| 3777 |
|
| 3778 |
bool trivialQualification = true; |
| 3779 |
CConceptRoleBranchingTrigger* chooseTriggerLinker = nullptr; |
| 3780 |
for (CSortedNegLinker<CConcept*>* opLinkerIt = concept->getOperandList(); trivialQualification && opLinkerIt; opLinkerIt = opLinkerIt->getNext()) { |
| 3781 |
CConcept* opConcept = opLinkerIt->getData(); |
| 3782 |
bool opConceptNegation = opLinkerIt->isNegated(); |
| 3783 |
cint64 opCode = opConcept->getOperatorCode(); |
| 3784 |
if (opConceptNegation || (opCode != CCATOM && opCode != CCSUB)) { |
| 3785 |
trivialQualification = false; |
| 3786 |
} |
| 3787 |
} |
| 3788 |
if (!trivialQualification) { |
| 3789 |
CConceptProcessData* conProData = (CConceptProcessData*)concept->getConceptData(); |
| 3790 |
if (conProData) { |
| 3791 |
chooseTriggerLinker = conProData->getConceptRoleBranchTrigger(); |
| 3792 |
} |
| 3793 |
} |
| 3794 |
|
| 3795 |
for (CPROCESSMAP<cint64,CSaturationSuccessorData*>::const_iterator itSucc = succData->mSuccNodeDataMap.constBegin(), itSuccEnd = succData->mSuccNodeDataMap.constEnd(); itSucc != itSuccEnd; ++itSucc) { |
| 3796 |
CSaturationSuccessorData* succRoleData = itSucc.value(); |
| 3797 |
if (succRoleData->mActiveCount >= 1) { |
| 3798 |
cint64 succCardinality(succRoleData->mSuccCount); |
| 3799 |
bool operantsContainedNegative = true; |
| 3800 |
bool operantsContainedPositive = true; |
| 3801 |
bool operantsContained = true; |
| 3802 |
bool qualificationRepresentitiveSuccessorIndi = false; |
| 3803 |
if (succRoleData->mVALUENominalConnection) { |
| 3804 |
lastSuccessorNode = nullptr; |
| 3805 |
lastSuccessorCreationRoleLinker = nullptr; |
| 3806 |
CIndividualProcessNode* indiProcNode = getCorrectedNode(succRoleData->mVALUENominalID,mDetCachedCGIndiVector,mCalcAlgContext); |
| 3807 |
if (indiProcNode) { |
| 3808 |
CReapplyConceptLabelSet* reapplyConSet = indiProcNode->getReapplyConceptLabelSet(false); |
| 3809 |
if (reapplyConSet) { |
| 3810 |
if (concept->getOperandList()) { |
| 3811 |
for (CSortedNegLinker<CConcept*>* opLinkerIt = concept->getOperandList(); opLinkerIt; opLinkerIt = opLinkerIt->getNext()) { |
| 3812 |
CConcept* opConcept = opLinkerIt->getData(); |
| 3813 |
bool opConceptNegation = opLinkerIt->isNegated(); |
| 3814 |
bool containedNegation = false; |
| 3815 |
if (reapplyConSet->containsConcept(opConcept,&containedNegation)) { |
| 3816 |
if (containedNegation == opConceptNegation) { |
| 3817 |
operantsContainedNegative = false; |
| 3818 |
} else { |
| 3819 |
operantsContainedPositive = false; |
| 3820 |
} |
| 3821 |
} else { |
| 3822 |
if (trivialQualification) { |
| 3823 |
operantsContainedPositive = false; |
| 3824 |
} else { |
| 3825 |
bool isChooseTriggered = false; |
| 3826 |
for (CConceptRoleBranchingTrigger* chooseTriggerIt = chooseTriggerLinker; isChooseTriggered && chooseTriggerIt; chooseTriggerIt = chooseTriggerIt->getNext()) { |
| 3827 |
if (chooseTriggerIt->isConceptTrigger()) { |
| 3828 |
if (reapplyConSet->containsConcept(chooseTriggerIt->getTriggerConcept(),&containedNegation)) { |
| 3829 |
if (chooseTriggerIt->getTriggerNegation() == containedNegation) { |
| 3830 |
isChooseTriggered = true; |
| 3831 |
} |
| 3832 |
} |
| 3833 |
} else { |
| 3834 |
isChooseTriggered = true; |
| 3835 |
} |
| 3836 |
} |
| 3837 |
if (!chooseTriggerLinker || isChooseTriggered) { |
| 3838 |
operantsContained = false; |
| 3839 |
} |
| 3840 |
} |
| 3841 |
} |
| 3842 |
} |
| 3843 |
} else { |
| 3844 |
operantsContainedNegative = false; |
| 3845 |
} |
| 3846 |
} else { |
| 3847 |
if (trivialQualification) { |
| 3848 |
operantsContainedPositive = false; |
| 3849 |
} else { |
| 3850 |
operantsContained = false; |
| 3851 |
} |
| 3852 |
} |
| 3853 |
} |
| 3854 |
|
| 3855 |
} else { |
| 3856 |
CIndividualSaturationProcessNode* succNode(succRoleData->mSuccIndiNode); |
| 3857 |
lastSuccessorNode = succNode; |
| 3858 |
lastSuccessorCreationRoleLinker = succRoleData->mCreationRoleLinker; |
| 3859 |
CReapplyConceptSaturationLabelSet* succConSet = succNode->getReapplyConceptSaturationLabelSet(false); |
| 3860 |
CSaturationConceptDataItem* conceptSatItem = (CSaturationConceptDataItem*)succNode->getSaturationConceptReferenceLinking(); |
| 3861 |
if (succConSet) { |
| 3862 |
if (concept->getOperandList()) { |
| 3863 |
for (CSortedNegLinker<CConcept*>* opLinkerIt = concept->getOperandList(); opLinkerIt; opLinkerIt = opLinkerIt->getNext()) { |
| 3864 |
CConcept* opConcept = opLinkerIt->getData(); |
| 3865 |
bool opConceptNegation = opLinkerIt->isNegated(); |
| 3866 |
bool containedNegation = false; |
| 3867 |
|
| 3868 |
if (conceptSatItem) { |
| 3869 |
CConcept* indiConcept = conceptSatItem->getSaturationConcept(); |
| 3870 |
bool indiConNegation = conceptSatItem->getSaturationNegation(); |
| 3871 |
CRole* indiRole = conceptSatItem->getSaturationRoleRanges(); |
| 3872 |
if (opConcept == indiConcept && opConceptNegation == indiConNegation && (indiRole == nullptr || indiRole == role)) { |
| 3873 |
qualificationRepresentitiveSuccessorIndi = true; |
| 3874 |
operantsContainedNegative = false; |
| 3875 |
} |
| 3876 |
} |
| 3877 |
|
| 3878 |
if (!qualificationRepresentitiveSuccessorIndi) { |
| 3879 |
if (succConSet->containsConcept(opConcept,&containedNegation)) { |
| 3880 |
if (containedNegation == opConceptNegation) { |
| 3881 |
operantsContainedNegative = false; |
| 3882 |
} else { |
| 3883 |
operantsContainedPositive = false; |
| 3884 |
} |
| 3885 |
} else { |
| 3886 |
if (trivialQualification) { |
| 3887 |
operantsContainedPositive = false; |
| 3888 |
} else { |
| 3889 |
bool isChooseTriggered = false; |
| 3890 |
for (CConceptRoleBranchingTrigger* chooseTriggerIt = chooseTriggerLinker; isChooseTriggered && chooseTriggerIt; chooseTriggerIt = chooseTriggerIt->getNext()) { |
| 3891 |
if (chooseTriggerIt->isConceptTrigger()) { |
| 3892 |
if (succConSet->containsConcept(chooseTriggerIt->getTriggerConcept(),&containedNegation)) { |
| 3893 |
if (chooseTriggerIt->getTriggerNegation() == containedNegation) { |
| 3894 |
isChooseTriggered = true; |
| 3895 |
} |
| 3896 |
} |
| 3897 |
} else { |
| 3898 |
isChooseTriggered = true; |
| 3899 |
} |
| 3900 |
} |
| 3901 |
if (!chooseTriggerLinker || isChooseTriggered) { |
| 3902 |
operantsContained = false; |
| 3903 |
} |
| 3904 |
} |
| 3905 |
} |
| 3906 |
} |
| 3907 |
} |
| 3908 |
} else { |
| 3909 |
|
| 3910 |
if (conceptSatItem) { |
| 3911 |
CConcept* indiConcept = conceptSatItem->getSaturationConcept(); |
| 3912 |
bool indiConNegation = conceptSatItem->getSaturationNegation(); |
| 3913 |
CRole* indiRole = conceptSatItem->getSaturationRoleRanges(); |
| 3914 |
CConcept* topConcept = calcAlgContext->getUsedProcessingDataBox()->getOntologyTopConcept(); |
| 3915 |
if (topConcept == indiConcept && !indiConNegation && (indiRole == nullptr || indiRole == role)) { |
| 3916 |
qualificationRepresentitiveSuccessorIndi = true; |
| 3917 |
} |
| 3918 |
} |
| 3919 |
operantsContainedNegative = false; |
| 3920 |
|
| 3921 |
} |
| 3922 |
} else { |
| 3923 |
if (trivialQualification) { |
| 3924 |
operantsContainedPositive = false; |
| 3925 |
} else { |
| 3926 |
operantsContained = false; |
| 3927 |
} |
| 3928 |
} |
| 3929 |
} |
| 3930 |
if (operantsContainedPositive || !operantsContained) { |
| 3931 |
|
| 3932 |
minCardinality = qMax(minCardinality,succCardinality); |
| 3933 |
if (operantsContained && operantsContainedPositive && !indiProcSatNode->getNominalIndividual() && succCardinality > allowedCardinality) { |
| 3934 |
updateDirectAddingIndividualStatusFlags(indiProcSatNode,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGCLASHED,calcAlgContext); |
| 3935 |
} |
| 3936 |
|
| 3937 |
if (!qualificationRepresentitiveSuccessorIndi) { |
| 3938 |
foundCardinality += succCardinality; |
| 3939 |
CIndividualSaturationSuccessorLinkDataLinker* newMergingSuccDataLinker = createIndividualSaturationSuccessorLinkDataLinker(calcAlgContext); |
| 3940 |
newMergingSuccDataLinker->initSuccessorLinkDataLinker(succRoleData); |
| 3941 |
mergingSuccDataLinker = newMergingSuccDataLinker->append(mergingSuccDataLinker); |
| 3942 |
} |
| 3943 |
} |
| 3944 |
|
| 3945 |
|
| 3946 |
} |
| 3947 |
} |
| 3948 |
|
| 3949 |
return foundCardinality; |
| 3950 |
} |
| 3951 |
|
| 3952 |
|
| 3953 |
|
| 3954 |
|
| 3955 |
|
| 3956 |
|
| 3957 |
|
| 3958 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::tryATMOSTConceptSuccessorMerging(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 3959 |
bool nodeSaturation = false; |
| 3960 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 3961 |
while (!nodeSaturation && processingDataBox->hasSaturationATMOSTMergingProcessLinker()) { |
| 3962 |
CIndividualSaturationProcessNodeLinker* mergingProcessLinker = processingDataBox->getSaturationATMOSTMergingProcessLinker(); |
| 3963 |
CIndividualSaturationProcessNode* indiProcSatNode = mergingProcessLinker->getData(); |
| 3964 |
|
| 3965 |
CIndividualSaturationProcessNodeStatusFlags* indirectFlags = indiProcSatNode->getIndirectStatusFlags(); |
| 3966 |
|
| 3967 |
if (!indirectFlags->hasInsufficientFlag() && !indirectFlags->hasClashedFlag()) { |
| 3968 |
|
| 3969 |
CSaturationATMOSTSuccessorMergingData* atmostSuccMergingData = indiProcSatNode->getATMOSTSuccessorMergingData(false); |
| 3970 |
if (atmostSuccMergingData) { |
| 3971 |
CConceptSaturationProcessLinker* conProcLinker = atmostSuccMergingData->getMergingConceptLinker(); |
| 3972 |
while (!nodeSaturation && conProcLinker) { |
| 3973 |
CConceptSaturationDescriptor* conDes = conProcLinker->getConceptSaturationDescriptor(); |
| 3974 |
|
| 3975 |
|
| 3976 |
CSaturationATMOSTSuccessorMergingHashData& mergingSuccData = atmostSuccMergingData->getATMOSTConceptMergingData(conDes); |
| 3977 |
|
| 3978 |
bool nodeInsufficient = false; |
| 3979 |
bool ancestorPossiblyInsufficient = false; |
| 3980 |
CIndividualSaturationProcessNode* functionallyRestrictedSuccessorNode = nullptr; |
| 3981 |
CXNegLinker<CRole*>* functionallyRestrictedSuccessorCreationRoleLinker = nullptr; |
| 3982 |
STATINC(SATURATIONCRITICALTESTCOUNT,calcAlgContext); |
| 3983 |
nodeSaturation = tryIndividiualATMOSTConceptSuccessorMerging(conDes,&mergingSuccData,nodeInsufficient,ancestorPossiblyInsufficient,functionallyRestrictedSuccessorNode,functionallyRestrictedSuccessorCreationRoleLinker,indiProcSatNode,calcAlgContext); |
| 3984 |
if (!nodeSaturation) { |
| 3985 |
if (nodeInsufficient) { |
| 3986 |
++mInsufficientATMOSTCount; |
| 3987 |
updateDirectAddingIndividualStatusFlags(indiProcSatNode,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,calcAlgContext); |
| 3988 |
setInsufficientNodeOccured(calcAlgContext); |
| 3989 |
} else { |
| 3990 |
addCriticalConceptForDependentNodes(conDes,CCriticalSaturationConceptTypeQueues::CCT_ATMOST,indiProcSatNode,false,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,calcAlgContext); |
| 3991 |
} |
| 3992 |
if (indiProcSatNode->hasNominalIntegrated()) { |
| 3993 |
markNominalATMOSTRestrictedAncestorsAsInsufficient(conDes,indiProcSatNode,calcAlgContext); |
| 3994 |
} |
| 3995 |
if (ancestorPossiblyInsufficient) { |
| 3996 |
markATMOSTRestrictedAncestorsAsInsufficient(conDes,functionallyRestrictedSuccessorNode,functionallyRestrictedSuccessorCreationRoleLinker,indiProcSatNode,calcAlgContext); |
| 3997 |
updateDirectAddingIndividualStatusFlags(indiProcSatNode,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGCARDINALITYPROPLEMATIC,calcAlgContext); |
| 3998 |
} |
| 3999 |
} |
| 4000 |
|
| 4001 |
|
| 4002 |
if (!nodeSaturation) { |
| 4003 |
conProcLinker = atmostSuccMergingData->takeNextMergingConceptLinker(); |
| 4004 |
} |
| 4005 |
} |
| 4006 |
} |
| 4007 |
} |
| 4008 |
|
| 4009 |
if (!nodeSaturation) { |
| 4010 |
mergingProcessLinker = processingDataBox->takeSaturationATMOSTMergingProcessLinker(); |
| 4011 |
mergingProcessLinker->setProcessingQueued(false); |
| 4012 |
} |
| 4013 |
|
| 4014 |
} |
| 4015 |
return nodeSaturation; |
| 4016 |
} |
| 4017 |
|
| 4018 |
|
| 4019 |
|
| 4020 |
|
| 4021 |
|
| 4022 |
|
| 4023 |
CIndividualSaturationSuccessorLinkDataLinker* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::reconnectMergedLinkedSuccessors(CSaturationSuccessorData* succLinkData, CSaturationSuccessorData* mergedSuccLinkData, cint64 newSuccCard, cint64 incrSuccCard, CLinkedRoleSaturationSuccessorHash* linkedSuccHash, CLinkedRoleSaturationSuccessorData* succData, CPROCESSHASH<CSaturationSuccessorData*,CSaturationSuccessorData*>* mergeDistintHash, CPROCESSSET< QPair<CSaturationSuccessorData*,CSaturationSuccessorData*> >* mergeDistintSet, CPROCESSHASH<CSaturationSuccessorData*,cint64>* remainMergeableCardHash, CIndividualSaturationProcessNode*& indiProcSatNode, CIndividualSaturationProcessNode* resolvedIndiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4024 |
|
| 4025 |
CIndividualSaturationSuccessorLinkDataLinker* mergingSuccDataLinker = nullptr; |
| 4026 |
|
| 4027 |
CSaturationSuccessorData* resolvedSuccLinkData = nullptr; |
| 4028 |
if (resolvedIndiProcSatNode != succLinkData->mSuccIndiNode) { |
| 4029 |
for (CXNegLinker<CRole*>* creationRoleIt = succLinkData->mCreationRoleLinker; creationRoleIt; creationRoleIt = creationRoleIt->getNext()) { |
| 4030 |
if (!creationRoleIt->isNegated()) { |
| 4031 |
CRole* creationRole = creationRoleIt->getData(); |
| 4032 |
for (CSortedNegLinker<CRole*>* superRoleIt = creationRole->getIndirectSuperRoleList(); superRoleIt; superRoleIt = superRoleIt->getNext()) { |
| 4033 |
if (!superRoleIt->isNegated()) { |
| 4034 |
CRole* superRole = superRoleIt->getData(); |
| 4035 |
linkedSuccHash->deactivateLinkedSuccessor(superRole,succLinkData->mSuccIndiNode,creationRole); |
| 4036 |
} |
| 4037 |
} |
| 4038 |
if (!linkedSuccHash->hasActiveLinkedSuccessor(creationRole,resolvedIndiProcSatNode,creationRole,newSuccCard)) { |
| 4039 |
for (CSortedNegLinker<CRole*>* superRoleIt = creationRole->getIndirectSuperRoleList(); superRoleIt; superRoleIt = superRoleIt->getNext()) { |
| 4040 |
if (!superRoleIt->isNegated()) { |
| 4041 |
CRole* superRole = superRoleIt->getData(); |
| 4042 |
linkedSuccHash->addExtensionSuccessor(superRole,resolvedIndiProcSatNode,creationRole,newSuccCard); |
| 4043 |
} |
| 4044 |
} |
| 4045 |
} |
| 4046 |
} |
| 4047 |
} |
| 4048 |
resolvedSuccLinkData = succData->getSuccessorNodeDataMap()->value(resolvedIndiProcSatNode->getIndividualID()); |
| 4049 |
for (CPROCESSHASH<CSaturationSuccessorData*,CSaturationSuccessorData*>::const_iterator mDIt = mergeDistintHash->constFind(succLinkData), mDItEnd = mergeDistintHash->constEnd(); mDIt != mDItEnd && mDIt.key() == succLinkData; ++mDIt) { |
| 4050 |
CSaturationSuccessorData* distSuccData = mDIt.value(); |
| 4051 |
mergeDistintHash->insertMulti(distSuccData,resolvedSuccLinkData); |
| 4052 |
mergeDistintHash->insertMulti(resolvedSuccLinkData,distSuccData); |
| 4053 |
mergeDistintSet->insert(QPair<CSaturationSuccessorData*,CSaturationSuccessorData*>(qMin(resolvedSuccLinkData,distSuccData),qMax(resolvedSuccLinkData,distSuccData))); |
| 4054 |
} |
| 4055 |
} |
| 4056 |
if (resolvedIndiProcSatNode != mergedSuccLinkData->mSuccIndiNode) { |
| 4057 |
for (CXNegLinker<CRole*>* creationRoleIt = mergedSuccLinkData->mCreationRoleLinker; creationRoleIt; creationRoleIt = creationRoleIt->getNext()) { |
| 4058 |
if (!creationRoleIt->isNegated()) { |
| 4059 |
CRole* creationRole = creationRoleIt->getData(); |
| 4060 |
for (CSortedNegLinker<CRole*>* superRoleIt = creationRole->getIndirectSuperRoleList(); superRoleIt; superRoleIt = superRoleIt->getNext()) { |
| 4061 |
if (!superRoleIt->isNegated()) { |
| 4062 |
CRole* superRole = superRoleIt->getData(); |
| 4063 |
linkedSuccHash->deactivateLinkedSuccessor(superRole,mergedSuccLinkData->mSuccIndiNode,creationRole); |
| 4064 |
} |
| 4065 |
} |
| 4066 |
if (!linkedSuccHash->hasActiveLinkedSuccessor(creationRole,resolvedIndiProcSatNode,creationRole,newSuccCard)) { |
| 4067 |
for (CSortedNegLinker<CRole*>* superRoleIt = creationRole->getIndirectSuperRoleList(); superRoleIt; superRoleIt = superRoleIt->getNext()) { |
| 4068 |
if (!superRoleIt->isNegated()) { |
| 4069 |
CRole* superRole = superRoleIt->getData(); |
| 4070 |
linkedSuccHash->addExtensionSuccessor(superRole,resolvedIndiProcSatNode,creationRole,newSuccCard); |
| 4071 |
} |
| 4072 |
} |
| 4073 |
} |
| 4074 |
} |
| 4075 |
} |
| 4076 |
resolvedSuccLinkData = succData->getSuccessorNodeDataMap()->value(resolvedIndiProcSatNode->getIndividualID()); |
| 4077 |
for (CPROCESSHASH<CSaturationSuccessorData*,CSaturationSuccessorData*>::const_iterator mDIt = mergeDistintHash->constFind(mergedSuccLinkData), mDItEnd = mergeDistintHash->constEnd(); mDIt != mDItEnd && mDIt.key() == mergedSuccLinkData; ++mDIt) { |
| 4078 |
CSaturationSuccessorData* distSuccData = mDIt.value(); |
| 4079 |
mergeDistintHash->insertMulti(distSuccData,resolvedSuccLinkData); |
| 4080 |
mergeDistintHash->insertMulti(resolvedSuccLinkData,distSuccData); |
| 4081 |
mergeDistintSet->insert(QPair<CSaturationSuccessorData*,CSaturationSuccessorData*>(qMin(resolvedSuccLinkData,distSuccData),qMax(resolvedSuccLinkData,distSuccData))); |
| 4082 |
} |
| 4083 |
} |
| 4084 |
|
| 4085 |
if (resolvedIndiProcSatNode == succLinkData->mSuccIndiNode || resolvedIndiProcSatNode == mergedSuccLinkData->mSuccIndiNode) { |
| 4086 |
CSaturationSuccessorData* sameSuccLinkData = succLinkData; |
| 4087 |
CSaturationSuccessorData* otherSuccLinkData = mergedSuccLinkData; |
| 4088 |
if (resolvedIndiProcSatNode != mergedSuccLinkData->mSuccIndiNode) { |
| 4089 |
sameSuccLinkData = mergedSuccLinkData; |
| 4090 |
otherSuccLinkData = succLinkData; |
| 4091 |
} |
| 4092 |
if (incrSuccCard > 0) { |
| 4093 |
for (CXNegLinker<CRole*>* creationRoleIt = sameSuccLinkData->mCreationRoleLinker; creationRoleIt; creationRoleIt = creationRoleIt->getNext()) { |
| 4094 |
if (!creationRoleIt->isNegated()) { |
| 4095 |
CRole* creationRole = creationRoleIt->getData(); |
| 4096 |
for (CSortedNegLinker<CRole*>* superRoleIt = creationRole->getIndirectSuperRoleList(); superRoleIt; superRoleIt = superRoleIt->getNext()) { |
| 4097 |
if (!superRoleIt->isNegated()) { |
| 4098 |
CRole* superRole = superRoleIt->getData(); |
| 4099 |
linkedSuccHash->increaseLinkedSuccessorCount(superRole,sameSuccLinkData->mSuccIndiNode,creationRole,incrSuccCard); |
| 4100 |
} |
| 4101 |
} |
| 4102 |
} |
| 4103 |
} |
| 4104 |
} |
| 4105 |
for (CPROCESSHASH<CSaturationSuccessorData*,CSaturationSuccessorData*>::const_iterator mDIt = mergeDistintHash->constFind(otherSuccLinkData), mDItEnd = mergeDistintHash->constEnd(); mDIt != mDItEnd && mDIt.key() == otherSuccLinkData; ++mDIt) { |
| 4106 |
CSaturationSuccessorData* distSuccData = mDIt.value(); |
| 4107 |
mergeDistintHash->insertMulti(distSuccData,sameSuccLinkData); |
| 4108 |
mergeDistintHash->insertMulti(sameSuccLinkData,distSuccData); |
| 4109 |
mergeDistintSet->insert(QPair<CSaturationSuccessorData*,CSaturationSuccessorData*>(qMin(sameSuccLinkData,distSuccData),qMax(sameSuccLinkData,distSuccData))); |
| 4110 |
} |
| 4111 |
remainMergeableCardHash->insert(sameSuccLinkData,newSuccCard); |
| 4112 |
} else { |
| 4113 |
|
| 4114 |
CIndividualSaturationSuccessorLinkDataLinker* newMergingSuccDataLinker = createIndividualSaturationSuccessorLinkDataLinker(calcAlgContext); |
| 4115 |
newMergingSuccDataLinker->initSuccessorLinkDataLinker(resolvedSuccLinkData); |
| 4116 |
mergingSuccDataLinker = newMergingSuccDataLinker->append(mergingSuccDataLinker); |
| 4117 |
remainMergeableCardHash->insert(resolvedSuccLinkData,newSuccCard); |
| 4118 |
} |
| 4119 |
return mergingSuccDataLinker; |
| 4120 |
} |
| 4121 |
|
| 4122 |
|
| 4123 |
|
| 4124 |
|
| 4125 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::testMergedSuccessorLinkingProblematic(CConceptSaturationDescriptor* conDes, CSaturationSuccessorData* succLinkData, CSaturationSuccessorData* mergedSuccLinkData, CIndividualSaturationProcessNode* resolvedIndiProcSatNode, CLinkedRoleSaturationSuccessorData* succData, CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4126 |
CSaturationSuccessorData* resolvedSuccLinkData = succData->getSuccessorNodeDataMap()->value(resolvedIndiProcSatNode->getIndividualID()); |
| 4127 |
CRoleBackwardSaturationPropagationHash* propTestBackwardPropHash = resolvedIndiProcSatNode->getRoleBackwardPropagationHash(false); |
| 4128 |
if (propTestBackwardPropHash) { |
| 4129 |
CReapplyConceptSaturationLabelSet* indiConSet = indiProcSatNode->getReapplyConceptSaturationLabelSet(false); |
| 4130 |
CPROCESSHASH<CRole*,CRoleBackwardSaturationPropagationHashData>* backwardPropDataHash = propTestBackwardPropHash->getRoleBackwardPropagationDataHash(); |
| 4131 |
for (CXNegLinker<CRole*>* creationRoleIt = succLinkData->mCreationRoleLinker; creationRoleIt; creationRoleIt = creationRoleIt->getNext()) { |
| 4132 |
if (!creationRoleIt->isNegated()) { |
| 4133 |
CRole* creationRole = creationRoleIt->getData(); |
| 4134 |
for (CSortedNegLinker<CRole*>* superRoleIt = creationRole->getIndirectSuperRoleList(); superRoleIt; superRoleIt = superRoleIt->getNext()) { |
| 4135 |
if (!superRoleIt->isNegated()) { |
| 4136 |
CRole* superRole = superRoleIt->getData(); |
| 4137 |
CRoleBackwardSaturationPropagationHashData* backwardPropData = backwardPropDataHash->valuePointer(superRole); |
| 4138 |
if (backwardPropData && backwardPropData->mReapplyLinker) { |
| 4139 |
for (CBackwardSaturationPropagationReapplyDescriptor* backPropIt = backwardPropData->mReapplyLinker; backPropIt; backPropIt = backPropIt->getNext()) { |
| 4140 |
CConceptSaturationDescriptor* backConDes = backPropIt->getReapplyConceptSaturationDescriptor(); |
| 4141 |
CConcept* concept = backConDes->getConcept(); |
| 4142 |
bool negation = backConDes->isNegated(); |
| 4143 |
for (CSortedNegLinker<CConcept*>* opLinkerIt = concept->getOperandList(); opLinkerIt; opLinkerIt = opLinkerIt->getNext()) { |
| 4144 |
CConcept* opConcept = opLinkerIt->getData(); |
| 4145 |
bool opNegation = opLinkerIt->isNegated()^negation; |
| 4146 |
if (!indiConSet->containsConcept(opConcept,opNegation)) { |
| 4147 |
return true; |
| 4148 |
} |
| 4149 |
} |
| 4150 |
} |
| 4151 |
} |
| 4152 |
} |
| 4153 |
} |
| 4154 |
} |
| 4155 |
} |
| 4156 |
for (CXNegLinker<CRole*>* creationRoleIt = mergedSuccLinkData->mCreationRoleLinker; creationRoleIt; creationRoleIt = creationRoleIt->getNext()) { |
| 4157 |
if (!creationRoleIt->isNegated()) { |
| 4158 |
CRole* creationRole = creationRoleIt->getData(); |
| 4159 |
for (CSortedNegLinker<CRole*>* superRoleIt = creationRole->getIndirectSuperRoleList(); superRoleIt; superRoleIt = superRoleIt->getNext()) { |
| 4160 |
if (!superRoleIt->isNegated()) { |
| 4161 |
CRole* superRole = superRoleIt->getData(); |
| 4162 |
CRoleBackwardSaturationPropagationHashData* backwardPropData = backwardPropDataHash->valuePointer(superRole); |
| 4163 |
if (backwardPropData && backwardPropData->mReapplyLinker) { |
| 4164 |
for (CBackwardSaturationPropagationReapplyDescriptor* backPropIt = backwardPropData->mReapplyLinker; backPropIt; backPropIt = backPropIt->getNext()) { |
| 4165 |
CConceptSaturationDescriptor* backConDes = backPropIt->getReapplyConceptSaturationDescriptor(); |
| 4166 |
CConcept* concept = backConDes->getConcept(); |
| 4167 |
bool negation = backConDes->isNegated(); |
| 4168 |
for (CSortedNegLinker<CConcept*>* opLinkerIt = concept->getOperandList(); opLinkerIt; opLinkerIt = opLinkerIt->getNext()) { |
| 4169 |
CConcept* opConcept = opLinkerIt->getData(); |
| 4170 |
bool opNegation = opLinkerIt->isNegated()^negation; |
| 4171 |
if (!indiConSet->containsConcept(opConcept,opNegation)) { |
| 4172 |
return true; |
| 4173 |
} |
| 4174 |
} |
| 4175 |
} |
| 4176 |
} |
| 4177 |
} |
| 4178 |
} |
| 4179 |
} |
| 4180 |
} |
| 4181 |
} |
| 4182 |
|
| 4183 |
|
| 4184 |
CConceptSaturationDescriptor* lastConDesIt1 = succLinkData->mSuccIndiNode->getReapplyConceptSaturationLabelSet(false)->getConceptSaturationDescriptionLinker(); |
| 4185 |
CConceptSaturationDescriptor* lastConDesIt2 = mergedSuccLinkData->mSuccIndiNode->getReapplyConceptSaturationLabelSet(false)->getConceptSaturationDescriptionLinker(); |
| 4186 |
for (CConceptSaturationDescriptor* conDesIt = resolvedIndiProcSatNode->getReapplyConceptSaturationLabelSet(false)->getConceptSaturationDescriptionLinker(); conDesIt && conDesIt != lastConDesIt1 && conDesIt != lastConDesIt2; conDesIt = conDesIt->getNextConceptDesciptor()) { |
| 4187 |
CConcept* concept = conDesIt->getConcept(); |
| 4188 |
|
| 4189 |
for (CConceptSaturationDescriptor* predConDesIt = indiProcSatNode->getReapplyConceptSaturationLabelSet(false)->getConceptSaturationDescriptionLinker(); predConDesIt; predConDesIt = predConDesIt->getNextConceptDesciptor()) { |
| 4190 |
CConcept* predConcept = predConDesIt->getConcept(); |
| 4191 |
bool predConNegation = predConDesIt->isNegated(); |
| 4192 |
cint64 predConOpCode = predConcept->getOperatorCode(); |
| 4193 |
if (predConNegation && predConOpCode == CCATLEAST || !predConNegation && predConOpCode == CCATMOST) { |
| 4194 |
CConcept* predOpCon = nullptr; |
| 4195 |
if (predConcept->getOperandList()) { |
| 4196 |
predOpCon = predConcept = predConcept->getOperandList()->getData(); |
| 4197 |
} |
| 4198 |
if (!predOpCon || predOpCon == concept) { |
| 4199 |
for (CXNegLinker<CRole*>* creationRoleLinkerIt = succLinkData->mCreationRoleLinker; creationRoleLinkerIt; creationRoleLinkerIt = creationRoleLinkerIt->getNext()) { |
| 4200 |
if (!creationRoleLinkerIt->isNegated()) { |
| 4201 |
CRole* creationRole = creationRoleLinkerIt->getData(); |
| 4202 |
for (CSortedNegLinker<CRole*>* creationSuperRoleIt = creationRole->getIndirectSuperRoleList(); creationSuperRoleIt; creationSuperRoleIt = creationSuperRoleIt->getNext()) { |
| 4203 |
if (!creationSuperRoleIt->isNegated()) { |
| 4204 |
CRole* creationSuperRole = creationSuperRoleIt->getData(); |
| 4205 |
if (creationSuperRole == predConcept->getRole()) { |
| 4206 |
cint64 allowedCardinality = predConcept->getParameter() - 1*predConNegation; |
| 4207 |
if (getIndividualNodeQualifiedSuccessorCount(indiProcSatNode,creationSuperRole,predConcept->getOperandList(),calcAlgContext) > allowedCardinality) { |
| 4208 |
return true; |
| 4209 |
} |
| 4210 |
} |
| 4211 |
} |
| 4212 |
} |
| 4213 |
} |
| 4214 |
} |
| 4215 |
for (CXNegLinker<CRole*>* creationRoleLinkerIt = mergedSuccLinkData->mCreationRoleLinker; creationRoleLinkerIt; creationRoleLinkerIt = creationRoleLinkerIt->getNext()) { |
| 4216 |
if (!creationRoleLinkerIt->isNegated()) { |
| 4217 |
CRole* creationRole = creationRoleLinkerIt->getData(); |
| 4218 |
for (CSortedNegLinker<CRole*>* creationSuperRoleIt = creationRole->getIndirectSuperRoleList(); creationSuperRoleIt; creationSuperRoleIt = creationSuperRoleIt->getNext()) { |
| 4219 |
if (!creationSuperRoleIt->isNegated()) { |
| 4220 |
CRole* creationSuperRole = creationSuperRoleIt->getData(); |
| 4221 |
if (creationSuperRole == predConcept->getRole()) { |
| 4222 |
cint64 allowedCardinality = predConcept->getParameter() - 1*predConNegation; |
| 4223 |
if (getIndividualNodeQualifiedSuccessorCount(indiProcSatNode,creationSuperRole,predConcept->getOperandList(),calcAlgContext) > allowedCardinality) { |
| 4224 |
return true; |
| 4225 |
} |
| 4226 |
} |
| 4227 |
} |
| 4228 |
} |
| 4229 |
} |
| 4230 |
} |
| 4231 |
} |
| 4232 |
} |
| 4233 |
} |
| 4234 |
} |
| 4235 |
return false; |
| 4236 |
} |
| 4237 |
|
| 4238 |
|
| 4239 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::tryIndividiualATMOSTConceptSuccessorMerging(CConceptSaturationDescriptor* conDes, CSaturationATMOSTSuccessorMergingHashData* mergingSuccData, bool& nodeInsufficient, bool& ancestorPossiblyCriticalFlag, CIndividualSaturationProcessNode*& functionallyRestrictedSuccessorNode, CXNegLinker<CRole*>*& functionallyRestrictedSuccessorCreationRoleLinker, CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4240 |
STATINC(SATURATIONCRITICALATMOSTCOUNT,calcAlgContext); |
| 4241 |
CConcept* concept = conDes->getConcept(); |
| 4242 |
bool conceptNegation = conDes->isNegated(); |
| 4243 |
CRole* role = concept->getRole(); |
| 4244 |
cint64 allowedCardinality = concept->getParameter() - 1*conceptNegation; |
| 4245 |
if (allowedCardinality < 0) { |
| 4246 |
nodeInsufficient = true; |
| 4247 |
return false; |
| 4248 |
} |
| 4249 |
if (!indiProcSatNode->hasSubstituteIndividualNode()) { |
| 4250 |
|
| 4251 |
|
| 4252 |
CSaturationATMOSTSuccessorMergingData* atmostSuccMergingData = indiProcSatNode->getATMOSTSuccessorMergingData(); |
| 4253 |
CLinkedRoleSaturationSuccessorHash* linkedSuccHash = atmostSuccMergingData->getMergedLinkedRoleSaturationSuccessorHash(); |
| 4254 |
collectLinkedSuccessorNodes(indiProcSatNode,calcAlgContext,linkedSuccHash); |
| 4255 |
if (linkedSuccHash) { |
| 4256 |
|
| 4257 |
cint64& foundCardinality = mergingSuccData->mFoundCardinality; |
| 4258 |
cint64& mergeableCardinality = mergingSuccData->mMergeableCardinality; |
| 4259 |
cint64& minCardinality = mergingSuccData->mMinCardinality; |
| 4260 |
|
| 4261 |
CPROCESSHASH<CRole*,CLinkedRoleSaturationSuccessorData*>* succHash = linkedSuccHash->getLinkedRoleSuccessorHash(); |
| 4262 |
CLinkedRoleSaturationSuccessorData* succData = succHash->value(role); |
| 4263 |
if (succData) { |
| 4264 |
if (succData->mSuccCount >= allowedCardinality) { |
| 4265 |
|
| 4266 |
CIndividualSaturationSuccessorLinkDataLinker*& mergingSuccDataLinker = mergingSuccData->mSuccessorLinkMergingLinker; |
| 4267 |
|
| 4268 |
|
| 4269 |
CIndividualSaturationProcessNode*& lastSuccessorNode = mergingSuccData->mLastSuccessorNode; |
| 4270 |
CXNegLinker<CRole*>*& lastSuccessorCreationRoleLinker = mergingSuccData->mLastSuccessorCreationRoleLinker; |
| 4271 |
|
| 4272 |
CPROCESSHASH<CSaturationSuccessorData*,cint64>* remainMergeableCardHash = atmostSuccMergingData->getRemainingMergeableCardinalityHash(); |
| 4273 |
|
| 4274 |
CPROCESSHASH<CSaturationSuccessorData*,CSaturationSuccessorData*>* mergeDistintHash = atmostSuccMergingData->getMergingDistintHash(); |
| 4275 |
CPROCESSSET< QPair<CSaturationSuccessorData*,CSaturationSuccessorData*> >* mergeDistintSet = atmostSuccMergingData->getMergingDistintSet(); |
| 4276 |
|
| 4277 |
if (!mergingSuccData->mInitialized) { |
| 4278 |
mergingSuccData->mInitialized = true; |
| 4279 |
|
| 4280 |
|
| 4281 |
foundCardinality = collectATMOSTConceptRelevantSuccessors(conDes,indiProcSatNode,succData,mergingSuccDataLinker,lastSuccessorNode,lastSuccessorCreationRoleLinker,minCardinality,calcAlgContext); |
| 4282 |
|
| 4283 |
if (foundCardinality >= allowedCardinality && foundCardinality > 1) { |
| 4284 |
|
| 4285 |
// check whether some trivial merging is possible |
| 4286 |
|
| 4287 |
if (mergingSuccDataLinker) { |
| 4288 |
|
| 4289 |
if (mConfSimpleMergingTestForATMOSTCriticalTesting) { |
| 4290 |
for (CIndividualSaturationSuccessorLinkDataLinker* mergingSuccDataLinkerIt = mergingSuccDataLinker; mergingSuccDataLinkerIt && foundCardinality-mergeableCardinality >= allowedCardinality; mergingSuccDataLinkerIt = mergingSuccDataLinkerIt->getNext()) { |
| 4291 |
CSaturationSuccessorData* succLinkData = mergingSuccDataLinkerIt->getData(); |
| 4292 |
cint64 succCount = succLinkData->mSuccCount; |
| 4293 |
if (succCount >= 1) { |
| 4294 |
cint64 maxRequiredMergingCardinality = foundCardinality-mergeableCardinality-(allowedCardinality-1); |
| 4295 |
cint64 mergingCardinality = getSuccessorLinkSimplyMergeableCardinalityCount(indiProcSatNode,succLinkData,mergingSuccDataLinker,remainMergeableCardHash,role,maxRequiredMergingCardinality,mergeDistintHash,mergeDistintSet,calcAlgContext); |
| 4296 |
cint64 remainingCardinality = succLinkData->mSuccCount-mergingCardinality; |
| 4297 |
remainMergeableCardHash->insert(succLinkData,remainingCardinality); |
| 4298 |
if (remainingCardinality <= 0) { |
| 4299 |
for (CXNegLinker<CRole*>* creationRoleIt = succLinkData->mCreationRoleLinker; creationRoleIt; creationRoleIt = creationRoleIt->getNext()) { |
| 4300 |
if (!creationRoleIt->isNegated()) { |
| 4301 |
CRole* creationRole = creationRoleIt->getData(); |
| 4302 |
for (CSortedNegLinker<CRole*>* superRoleIt = creationRole->getIndirectSuperRoleList(); superRoleIt; superRoleIt = superRoleIt->getNext()) { |
| 4303 |
if (!superRoleIt->isNegated()) { |
| 4304 |
CRole* superRole = superRoleIt->getData(); |
| 4305 |
linkedSuccHash->deactivateLinkedSuccessor(superRole,succLinkData->mSuccIndiNode,creationRole); |
| 4306 |
} |
| 4307 |
} |
| 4308 |
} |
| 4309 |
} |
| 4310 |
} |
| 4311 |
mergeableCardinality += mergingCardinality; |
| 4312 |
} |
| 4313 |
} |
| 4314 |
} |
| 4315 |
|
| 4316 |
|
| 4317 |
|
| 4318 |
if (mConfDetailedMergingTestForATMOSTCriticalTesting && foundCardinality-mergeableCardinality >= allowedCardinality && foundCardinality-mergeableCardinality <= allowedCardinality*2) { |
| 4319 |
for (CIndividualSaturationSuccessorLinkDataLinker* mergingSuccDataLinkerIt = mergingSuccDataLinker; mergingSuccDataLinkerIt && foundCardinality-mergeableCardinality >= allowedCardinality; mergingSuccDataLinkerIt = mergingSuccDataLinkerIt->getNext()) { |
| 4320 |
CSaturationSuccessorData* succLinkData = mergingSuccDataLinkerIt->getData(); |
| 4321 |
CSaturationSuccessorData* mergedSuccLinkData = nullptr; |
| 4322 |
if (succLinkData->mSuccCount >= 1) { |
| 4323 |
cint64 succRemainingCardinality = remainMergeableCardHash->value(succLinkData,succLinkData->mSuccCount); |
| 4324 |
if (succRemainingCardinality > 0) { |
| 4325 |
cint64 maxRequiredMergingCardinality = foundCardinality-mergeableCardinality-(allowedCardinality-1); |
| 4326 |
|
| 4327 |
cint64 mergingCardinality = getSuccessorLinkExtendedMergeableCardinalityCount(indiProcSatNode,succLinkData,&mergedSuccLinkData,mergingSuccDataLinkerIt->getNext(),remainMergeableCardHash,role,maxRequiredMergingCardinality,mergeDistintHash,mergeDistintSet,calcAlgContext); |
| 4328 |
if (mergingCardinality > 0) { |
| 4329 |
cint64 newSuccCard = qMax(succRemainingCardinality,mergingCardinality); |
| 4330 |
|
| 4331 |
CIndividualSaturationProcessNode* copyIndiProcSatNode = succLinkData->mSuccIndiNode; |
| 4332 |
CSaturationIndividualNodeExtensionResolveData* resolveData = copyIndiProcSatNode->getSuccessorExtensionData(true)->getBaseExtensionResolveData(true); |
| 4333 |
resolveData = getResolvedIndividualNodeExtension(resolveData,mergedSuccLinkData->mSuccIndiNode,copyIndiProcSatNode,calcAlgContext); |
| 4334 |
|
| 4335 |
|
| 4336 |
CIndividualSaturationProcessNode* resolvedIndiProcSatNode = resolveData->getProcessingIndividualNode(); |
| 4337 |
cint64 incrSuccCard = qMax(mergingCardinality,succRemainingCardinality)-qMin(mergingCardinality,succRemainingCardinality); |
| 4338 |
CIndividualSaturationSuccessorLinkDataLinker* newMergingSuccDataLinker = reconnectMergedLinkedSuccessors(succLinkData,mergedSuccLinkData,newSuccCard,incrSuccCard,linkedSuccHash,succData,mergeDistintHash,mergeDistintSet,remainMergeableCardHash,indiProcSatNode,resolvedIndiProcSatNode,calcAlgContext); |
| 4339 |
|
| 4340 |
|
| 4341 |
if (newMergingSuccDataLinker) { |
| 4342 |
mergingSuccDataLinker = newMergingSuccDataLinker->append(mergingSuccDataLinker); |
| 4343 |
} |
| 4344 |
|
| 4345 |
|
| 4346 |
|
| 4347 |
|
| 4348 |
|
| 4349 |
cint64 removedSuccCard = qMin(succRemainingCardinality,mergingCardinality); |
| 4350 |
mergeableCardinality += removedSuccCard; |
| 4351 |
} |
| 4352 |
} |
| 4353 |
} |
| 4354 |
} |
| 4355 |
} |
| 4356 |
} |
| 4357 |
} |
| 4358 |
} |
| 4359 |
|
| 4360 |
|
| 4361 |
|
| 4362 |
bool nodeExpansionRequired = false; |
| 4363 |
while (mergingSuccDataLinker && foundCardinality-mergeableCardinality >= allowedCardinality && !nodeExpansionRequired) { |
| 4364 |
|
| 4365 |
CSaturationSuccessorData* succLinkData = mergingSuccDataLinker->getData(); |
| 4366 |
if (succLinkData->mSuccCount >= 1) { |
| 4367 |
cint64 succRemainingCardinality = remainMergeableCardHash->value(succLinkData,succLinkData->mSuccCount); |
| 4368 |
if (succRemainingCardinality > 0) { |
| 4369 |
|
| 4370 |
for (CIndividualSaturationSuccessorLinkDataLinker* mergingSuccDataLinkerIt = mergingSuccDataLinker->getNext(); mergingSuccDataLinkerIt && foundCardinality-mergeableCardinality >= allowedCardinality && foundCardinality-mergeableCardinality > minCardinality; mergingSuccDataLinkerIt = mergingSuccDataLinkerIt->getNext()) { |
| 4371 |
CSaturationSuccessorData* mergeSuccLinkData = mergingSuccDataLinkerIt->getData(); |
| 4372 |
|
| 4373 |
if (mergeSuccLinkData->mSuccCount >= 1) { |
| 4374 |
if (!mergeDistintSet->contains(QPair<CSaturationSuccessorData*,CSaturationSuccessorData*>(qMin(mergeSuccLinkData,succLinkData),qMax(mergeSuccLinkData,succLinkData)))) { |
| 4375 |
|
| 4376 |
cint64 mergingCardinality = remainMergeableCardHash->value(mergeSuccLinkData,mergeSuccLinkData->mSuccCount); |
| 4377 |
if (mergingCardinality > 0) { |
| 4378 |
|
| 4379 |
|
| 4380 |
bool newNodeExpansionCreated = false; |
| 4381 |
CIndividualSaturationProcessNode* copyIndiProcSatNode = succLinkData->mSuccIndiNode; |
| 4382 |
CSaturationIndividualNodeExtensionResolveData* resolveData = copyIndiProcSatNode->getSuccessorExtensionData(true)->getBaseExtensionResolveData(true); |
| 4383 |
resolveData = getResolvedIndividualNodeExtension(resolveData,mergeSuccLinkData->mSuccIndiNode,copyIndiProcSatNode,&newNodeExpansionCreated,calcAlgContext); |
| 4384 |
|
| 4385 |
if (newNodeExpansionCreated) { |
| 4386 |
nodeExpansionRequired = true; |
| 4387 |
} else { |
| 4388 |
|
| 4389 |
CIndividualSaturationProcessNode* resolvedIndiProcSatNode = resolveData->getProcessingIndividualNode(); |
| 4390 |
|
| 4391 |
CIndividualSaturationProcessNodeStatusFlags* resolvedNodesFlags = resolvedIndiProcSatNode->getIndirectStatusFlags(); |
| 4392 |
if (!resolvedNodesFlags->hasClashedFlag() && !resolvedNodesFlags->hasInsufficientFlag()) { |
| 4393 |
|
| 4394 |
CIndividualSaturationProcessNode* resolvedIndiProcSatNode = resolveData->getProcessingIndividualNode(); |
| 4395 |
if (!testMergedSuccessorLinkingProblematic(conDes,succLinkData,mergeSuccLinkData,resolvedIndiProcSatNode,succData,indiProcSatNode,calcAlgContext)) { |
| 4396 |
// use new merged successor node instead of the previous ones |
| 4397 |
|
| 4398 |
cint64 newSuccCard = qMax(mergingCardinality,succRemainingCardinality); |
| 4399 |
cint64 incrSuccCard = qMax(mergingCardinality,succRemainingCardinality)-qMin(mergingCardinality,succRemainingCardinality); |
| 4400 |
CIndividualSaturationSuccessorLinkDataLinker* newMergingSuccDataLinker = reconnectMergedLinkedSuccessors(succLinkData,mergeSuccLinkData,newSuccCard,incrSuccCard,linkedSuccHash,succData,mergeDistintHash,mergeDistintSet,remainMergeableCardHash,indiProcSatNode,resolvedIndiProcSatNode,calcAlgContext); |
| 4401 |
|
| 4402 |
if (newMergingSuccDataLinker) { |
| 4403 |
mergingSuccDataLinker = newMergingSuccDataLinker->append(mergingSuccDataLinker); |
| 4404 |
} |
| 4405 |
cint64 removedSuccCard = qMin(succRemainingCardinality,mergingCardinality); |
| 4406 |
mergeableCardinality += removedSuccCard; |
| 4407 |
} |
| 4408 |
} |
| 4409 |
} |
| 4410 |
} |
| 4411 |
} |
| 4412 |
|
| 4413 |
} |
| 4414 |
} |
| 4415 |
} |
| 4416 |
} |
| 4417 |
|
| 4418 |
|
| 4419 |
} |
| 4420 |
|
| 4421 |
|
| 4422 |
|
| 4423 |
|
| 4424 |
if (foundCardinality-mergeableCardinality == allowedCardinality || minCardinality >= allowedCardinality) { |
| 4425 |
ancestorPossiblyCriticalFlag = true; |
| 4426 |
if (allowedCardinality == 1) { |
| 4427 |
functionallyRestrictedSuccessorNode = lastSuccessorNode; |
| 4428 |
functionallyRestrictedSuccessorCreationRoleLinker = lastSuccessorCreationRoleLinker; |
| 4429 |
} |
| 4430 |
} |
| 4431 |
if (foundCardinality-mergeableCardinality > allowedCardinality) { |
| 4432 |
nodeInsufficient = true; |
| 4433 |
} |
| 4434 |
|
| 4435 |
return nodeExpansionRequired; |
| 4436 |
|
| 4437 |
} |
| 4438 |
} |
| 4439 |
} |
| 4440 |
} |
| 4441 |
return false; |
| 4442 |
} |
| 4443 |
|
| 4444 |
|
| 4445 |
|
| 4446 |
|
| 4447 |
|
| 4448 |
|
| 4449 |
|
| 4450 |
|
| 4451 |
|
| 4452 |
|
| 4453 |
|
| 4454 |
|
| 4455 |
|
| 4456 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::isIndividualSuccessorLinkCardinalityMergeable(CSaturationSuccessorData* subsetIndiSuccData, CSaturationSuccessorData* superIndiSuccData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4457 |
CIndividualSaturationProcessNode* subsetIndiSuccNode = subsetIndiSuccData->mSuccIndiNode; |
| 4458 |
CIndividualSaturationProcessNode* superIndiSuccNode = superIndiSuccData->mSuccIndiNode; |
| 4459 |
return isIndividualSuccessorLinkCardinalityMergeable(subsetIndiSuccNode,subsetIndiSuccData,superIndiSuccNode,superIndiSuccData,calcAlgContext); |
| 4460 |
} |
| 4461 |
|
| 4462 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::isIndividualSuccessorLinkCardinalityMergeable(CIndividualSaturationProcessNode* subsetIndiSuccNode, CSaturationSuccessorData* subsetIndiSuccData, CIndividualSaturationProcessNode* superIndiSuccNode, CSaturationSuccessorData* superIndiSuccData, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4463 |
if (subsetIndiSuccData->mVALUENominalConnection || superIndiSuccData->mVALUENominalConnection) { |
| 4464 |
return false; |
| 4465 |
} |
| 4466 |
if (subsetIndiSuccNode->hasNominalIntegrated() || superIndiSuccNode->hasNominalIntegrated()) { |
| 4467 |
return false; |
| 4468 |
} |
| 4469 |
if (subsetIndiSuccNode->isABoxIndividualRepresentationNode() || superIndiSuccNode->isABoxIndividualRepresentationNode()) { |
| 4470 |
return false; |
| 4471 |
} |
| 4472 |
if (subsetIndiSuccNode->hasDataValueApplied() || superIndiSuccNode->hasDataValueApplied()) { |
| 4473 |
return false; |
| 4474 |
} |
| 4475 |
if (!isSuccessorCreationRoleMergingSubset(subsetIndiSuccData->mCreationRoleLinker,superIndiSuccData->mCreationRoleLinker,calcAlgContext)) { |
| 4476 |
return false; |
| 4477 |
} |
| 4478 |
if (!isIndividualNodeLabelMergingSubset(subsetIndiSuccNode,superIndiSuccNode,true,calcAlgContext)) { |
| 4479 |
return false; |
| 4480 |
} |
| 4481 |
return true; |
| 4482 |
} |
| 4483 |
|
| 4484 |
|
| 4485 |
|
| 4486 |
|
| 4487 |
cint64 CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getSuccessorLinkSimplyMergeableCardinalityCount(CIndividualSaturationProcessNode*& indiProcSatNode, CSaturationSuccessorData* succLinkData, CIndividualSaturationSuccessorLinkDataLinker* mergingSuccDataLinker, CPROCESSHASH<CSaturationSuccessorData*,cint64>* remainMergeableCardHash, CRole* role, cint64 maxRequiredMergingCardinality, CPROCESSHASH<CSaturationSuccessorData*,CSaturationSuccessorData*>* mergeDistintHash, CPROCESSSET< QPair<CSaturationSuccessorData*,CSaturationSuccessorData*> >* mergeDistintSet, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4488 |
cint64 remainingCardinality = succLinkData->mSuccCount; |
| 4489 |
|
| 4490 |
bool intoAllMergeable = false; |
| 4491 |
bool intoAllMergeableChecked = false; |
| 4492 |
|
| 4493 |
for (CIndividualSaturationSuccessorLinkDataLinker* mergingSuccDataLinkerIt = mergingSuccDataLinker; mergingSuccDataLinkerIt; mergingSuccDataLinkerIt = mergingSuccDataLinkerIt->getNext()) { |
| 4494 |
CSaturationSuccessorData* mergeSuccLinkData = mergingSuccDataLinkerIt->getData(); |
| 4495 |
if (mergeSuccLinkData != succLinkData) { |
| 4496 |
cint64 mergeableCardinality = remainMergeableCardHash->value(mergeSuccLinkData,mergeSuccLinkData->mSuccCount); |
| 4497 |
if (mergeableCardinality >= succLinkData->mSuccCount) { |
| 4498 |
if (!mergeDistintSet->contains(QPair<CSaturationSuccessorData*,CSaturationSuccessorData*>(qMin(mergeSuccLinkData,succLinkData),qMax(mergeSuccLinkData,succLinkData)))) { |
| 4499 |
if (isIndividualSuccessorLinkCardinalityMergeable(succLinkData,mergeSuccLinkData,calcAlgContext)) { |
| 4500 |
return remainingCardinality; |
| 4501 |
} else { |
| 4502 |
intoAllMergeableChecked = true; |
| 4503 |
} |
| 4504 |
} else { |
| 4505 |
intoAllMergeableChecked = true; |
| 4506 |
} |
| 4507 |
} |
| 4508 |
} |
| 4509 |
} |
| 4510 |
|
| 4511 |
|
| 4512 |
|
| 4513 |
cint64 mergedCardinality = 0; |
| 4514 |
for (CIndividualSaturationSuccessorLinkDataLinker* mergingSuccDataLinkerIt = mergingSuccDataLinker; mergingSuccDataLinkerIt && remainingCardinality > 0 && mergedCardinality < maxRequiredMergingCardinality; mergingSuccDataLinkerIt = mergingSuccDataLinkerIt->getNext()) { |
| 4515 |
CSaturationSuccessorData* mergeSuccLinkData = mergingSuccDataLinkerIt->getData(); |
| 4516 |
if (mergeSuccLinkData != succLinkData) { |
| 4517 |
cint64 mergeableCardinality = remainMergeableCardHash->value(mergeSuccLinkData,mergeSuccLinkData->mSuccCount); |
| 4518 |
if (mergeableCardinality > 0 && mergeableCardinality < succLinkData->mSuccCount) { |
| 4519 |
|
| 4520 |
if (!mergeDistintSet->contains(QPair<CSaturationSuccessorData*,CSaturationSuccessorData*>(qMin(mergeSuccLinkData,succLinkData),qMax(mergeSuccLinkData,succLinkData)))) { |
| 4521 |
|
| 4522 |
if (intoAllMergeable || isIndividualSuccessorLinkCardinalityMergeable(succLinkData,mergeSuccLinkData,calcAlgContext)) { |
| 4523 |
|
| 4524 |
if (!intoAllMergeableChecked) { |
| 4525 |
intoAllMergeable = true; |
| 4526 |
for (CIndividualSaturationSuccessorLinkDataLinker* remTestSuccDataLinkerIt = mergingSuccDataLinkerIt->getNext(); remTestSuccDataLinkerIt; remTestSuccDataLinkerIt = remTestSuccDataLinkerIt->getNext()) { |
| 4527 |
CSaturationSuccessorData* remTestSuccLinkData = remTestSuccDataLinkerIt->getData(); |
| 4528 |
if (remTestSuccLinkData != succLinkData && remTestSuccLinkData != mergeSuccLinkData) { |
| 4529 |
cint64 mergeableCardinality = remainMergeableCardHash->value(remTestSuccLinkData,remTestSuccLinkData->mSuccCount); |
| 4530 |
if (mergeableCardinality > 0 && mergeableCardinality < succLinkData->mSuccCount) { |
| 4531 |
|
| 4532 |
if (!mergeDistintSet->contains(QPair<CSaturationSuccessorData*,CSaturationSuccessorData*>(qMin(remTestSuccLinkData,succLinkData),qMax(remTestSuccLinkData,succLinkData)))) { |
| 4533 |
|
| 4534 |
if (!isIndividualSuccessorLinkCardinalityMergeable(succLinkData,mergeSuccLinkData,calcAlgContext)) { |
| 4535 |
intoAllMergeable = false; |
| 4536 |
} |
| 4537 |
} |
| 4538 |
} |
| 4539 |
} |
| 4540 |
} |
| 4541 |
intoAllMergeableChecked = true; |
| 4542 |
} |
| 4543 |
|
| 4544 |
if (!intoAllMergeable && succLinkData->mSuccCount > 1) { |
| 4545 |
mergeDistintSet->insert(QPair<CSaturationSuccessorData*,CSaturationSuccessorData*>(qMin(mergeSuccLinkData,succLinkData),qMax(mergeSuccLinkData,succLinkData))); |
| 4546 |
for (CPROCESSHASH<CSaturationSuccessorData*,CSaturationSuccessorData*>::const_iterator mDIt = mergeDistintHash->constFind(succLinkData), mDItEnd = mergeDistintHash->constEnd(); mDIt != mDItEnd && mDIt.key() == succLinkData; ++mDIt) { |
| 4547 |
CSaturationSuccessorData* distSuccData = mDIt.value(); |
| 4548 |
mergeDistintHash->insertMulti(distSuccData,mergeSuccLinkData); |
| 4549 |
mergeDistintHash->insertMulti(mergeSuccLinkData,distSuccData); |
| 4550 |
mergeDistintSet->insert(QPair<CSaturationSuccessorData*,CSaturationSuccessorData*>(qMin(mergeSuccLinkData,distSuccData),qMax(mergeSuccLinkData,distSuccData))); |
| 4551 |
} |
| 4552 |
mergeDistintHash->insertMulti(succLinkData,mergeSuccLinkData); |
| 4553 |
mergeDistintHash->insertMulti(mergeSuccLinkData,succLinkData); |
| 4554 |
} |
| 4555 |
|
| 4556 |
cint64 mergingCardinality = qMin(remainingCardinality,mergeableCardinality); |
| 4557 |
remainingCardinality -= mergingCardinality; |
| 4558 |
mergedCardinality += mergingCardinality; |
| 4559 |
} else { |
| 4560 |
intoAllMergeableChecked = true; |
| 4561 |
} |
| 4562 |
} else { |
| 4563 |
intoAllMergeableChecked = true; |
| 4564 |
} |
| 4565 |
} |
| 4566 |
} |
| 4567 |
} |
| 4568 |
return mergedCardinality; |
| 4569 |
} |
| 4570 |
|
| 4571 |
|
| 4572 |
|
| 4573 |
|
| 4574 |
|
| 4575 |
|
| 4576 |
|
| 4577 |
|
| 4578 |
|
| 4579 |
|
| 4580 |
|
| 4581 |
|
| 4582 |
|
| 4583 |
|
| 4584 |
|
| 4585 |
|
| 4586 |
|
| 4587 |
|
| 4588 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::isIndividualSuccessorLinkCardinalityExtendedMergeable(CIndividualSaturationProcessNode*& indiProcSatNode, CSaturationSuccessorData* indiSuccData1, CSaturationSuccessorData* indiSuccData2, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4589 |
CIndividualSaturationProcessNode* indiSuccNode1 = indiSuccData1->mSuccIndiNode; |
| 4590 |
CIndividualSaturationProcessNode* indiSuccNode2 = indiSuccData2->mSuccIndiNode; |
| 4591 |
return isIndividualSuccessorLinkCardinalityExtendedMergeable(indiProcSatNode,indiSuccNode1,indiSuccData1,indiSuccNode2,indiSuccData2,calcAlgContext); |
| 4592 |
} |
| 4593 |
|
| 4594 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::isIndividualSuccessorLinkCardinalityExtendedMergeable(CIndividualSaturationProcessNode*& indiProcSatNode, CIndividualSaturationProcessNode* indiSuccNode1, CSaturationSuccessorData* indiSuccData1, CIndividualSaturationProcessNode* indiSuccNode2, CSaturationSuccessorData* indiSuccData2, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4595 |
if (indiSuccData1->mVALUENominalConnection || indiSuccData2->mVALUENominalConnection) { |
| 4596 |
return false; |
| 4597 |
} |
| 4598 |
if (indiSuccNode1->hasNominalIntegrated() || indiSuccNode2->hasNominalIntegrated()) { |
| 4599 |
return false; |
| 4600 |
} |
| 4601 |
if (indiSuccNode1->hasDataValueApplied() || indiSuccNode2->hasDataValueApplied()) { |
| 4602 |
return false; |
| 4603 |
} |
| 4604 |
if (indiSuccNode1->isABoxIndividualRepresentationNode() || indiSuccNode2->isABoxIndividualRepresentationNode()) { |
| 4605 |
return false; |
| 4606 |
} |
| 4607 |
if (!isSuccessorCreationRoleMergingSubset(indiSuccData1->mCreationRoleLinker,indiSuccData2->mCreationRoleLinker,calcAlgContext)) { |
| 4608 |
return false; |
| 4609 |
} |
| 4610 |
if (!isSuccessorCreationRoleMergingSubset(indiSuccData2->mCreationRoleLinker,indiSuccData1->mCreationRoleLinker,calcAlgContext)) { |
| 4611 |
return false; |
| 4612 |
} |
| 4613 |
|
| 4614 |
|
| 4615 |
|
| 4616 |
|
| 4617 |
if (isIndividualNodeLabelMergingProblematic(indiProcSatNode,indiSuccNode1,indiSuccNode2,indiSuccData1->mCreationRoleLinker,calcAlgContext)) { |
| 4618 |
return false; |
| 4619 |
} |
| 4620 |
if (isIndividualNodeLabelMergingProblematic(indiProcSatNode,indiSuccNode2,indiSuccNode1,indiSuccData2->mCreationRoleLinker,calcAlgContext)) { |
| 4621 |
return false; |
| 4622 |
} |
| 4623 |
return true; |
| 4624 |
} |
| 4625 |
|
| 4626 |
cint64 CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getIndividualNodeQualifiedSuccessorCount(CIndividualSaturationProcessNode*& indiProcSatNode, CRole* role, CSortedNegLinker<CConcept*>* conQualificationLinker, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4627 |
|
| 4628 |
cint64 matchingSuccCount = 0; |
| 4629 |
CLinkedRoleSaturationSuccessorHash* linkedSuccHash = indiProcSatNode->getLinkedRoleSuccessorHash(false); |
| 4630 |
if (linkedSuccHash) { |
| 4631 |
|
| 4632 |
CPROCESSHASH<CRole*,CLinkedRoleSaturationSuccessorData*>* succHash = linkedSuccHash->getLinkedRoleSuccessorHash(); |
| 4633 |
CLinkedRoleSaturationSuccessorData* predSuccData = succHash->value(role); |
| 4634 |
if (predSuccData) { |
| 4635 |
|
| 4636 |
bool trivialQualification = true; |
| 4637 |
for (CSortedNegLinker<CConcept*>* opLinkerIt = conQualificationLinker; trivialQualification && opLinkerIt; opLinkerIt = opLinkerIt->getNext()) { |
| 4638 |
CConcept* opConcept = opLinkerIt->getData(); |
| 4639 |
bool opConceptNegation = opLinkerIt->isNegated(); |
| 4640 |
cint64 opCode = opConcept->getOperatorCode(); |
| 4641 |
if (opConceptNegation || (opCode != CCATOM && opCode != CCSUB)) { |
| 4642 |
trivialQualification = false; |
| 4643 |
} |
| 4644 |
} |
| 4645 |
|
| 4646 |
CIndividualSaturationProcessNode* lastSuccessorNode = nullptr; |
| 4647 |
CXNegLinker<CRole*>* lastSuccessorCreationRoleLinker = nullptr; |
| 4648 |
for (CPROCESSMAP<cint64,CSaturationSuccessorData*>::const_iterator itSucc = predSuccData->mSuccNodeDataMap.constBegin(), itSuccEnd = predSuccData->mSuccNodeDataMap.constEnd(); itSucc != itSuccEnd; ++itSucc) { |
| 4649 |
CSaturationSuccessorData* succRoleData = itSucc.value(); |
| 4650 |
if (succRoleData->mActiveCount >= 1) { |
| 4651 |
cint64 succCardinality(succRoleData->mSuccCount); |
| 4652 |
bool operantsContainedNegative = true; |
| 4653 |
bool operantsContainedPositive = true; |
| 4654 |
bool operantsContained = true; |
| 4655 |
if (succRoleData->mVALUENominalConnection) { |
| 4656 |
operantsContainedPositive = true; |
| 4657 |
} else { |
| 4658 |
CIndividualSaturationProcessNode* succNode(succRoleData->mSuccIndiNode); |
| 4659 |
lastSuccessorNode = succNode; |
| 4660 |
lastSuccessorCreationRoleLinker = succRoleData->mCreationRoleLinker; |
| 4661 |
CReapplyConceptSaturationLabelSet* succConSet = succNode->getReapplyConceptSaturationLabelSet(false); |
| 4662 |
if (succConSet) { |
| 4663 |
if (conQualificationLinker) { |
| 4664 |
for (CSortedNegLinker<CConcept*>* opLinkerIt = conQualificationLinker; opLinkerIt; opLinkerIt = opLinkerIt->getNext()) { |
| 4665 |
CConcept* opConcept = opLinkerIt->getData(); |
| 4666 |
bool opConceptNegation = opLinkerIt->isNegated(); |
| 4667 |
bool containedNegation = false; |
| 4668 |
if (succConSet->containsConcept(opConcept,&containedNegation)) { |
| 4669 |
if (containedNegation == opConceptNegation) { |
| 4670 |
operantsContainedNegative = false; |
| 4671 |
} else { |
| 4672 |
operantsContainedPositive = false; |
| 4673 |
} |
| 4674 |
} else { |
| 4675 |
if (trivialQualification) { |
| 4676 |
operantsContainedPositive = false; |
| 4677 |
} else { |
| 4678 |
operantsContained = false; |
| 4679 |
} |
| 4680 |
} |
| 4681 |
} |
| 4682 |
} else { |
| 4683 |
operantsContainedNegative = false; |
| 4684 |
|
| 4685 |
} |
| 4686 |
} else { |
| 4687 |
if (trivialQualification) { |
| 4688 |
operantsContainedPositive = false; |
| 4689 |
} else { |
| 4690 |
operantsContained = false; |
| 4691 |
} |
| 4692 |
} |
| 4693 |
} |
| 4694 |
if (operantsContainedPositive || !operantsContained) { |
| 4695 |
matchingSuccCount += succCardinality; |
| 4696 |
} |
| 4697 |
} |
| 4698 |
} |
| 4699 |
} |
| 4700 |
} |
| 4701 |
return matchingSuccCount; |
| 4702 |
} |
| 4703 |
|
| 4704 |
|
| 4705 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::isIndividualNodeLabelMergingProblematic(CIndividualSaturationProcessNode*& indiProcSatNode, CIndividualSaturationProcessNode* mergingSuccNode, CIndividualSaturationProcessNode* probTestingSuccNode, CXNegLinker<CRole*>* creationRoleLinker, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4706 |
CReapplyConceptSaturationLabelSet* mergingConSet = mergingSuccNode->getReapplyConceptSaturationLabelSet(false); |
| 4707 |
CReapplyConceptSaturationLabelSet* propTestConSet = probTestingSuccNode->getReapplyConceptSaturationLabelSet(false); |
| 4708 |
for (CConceptSaturationDescriptor* conDesIt = mergingConSet->getConceptSaturationDescriptionLinker(); conDesIt; conDesIt = conDesIt->getNextConceptDesciptor()) { |
| 4709 |
CConcept* concept = conDesIt->getConcept(); |
| 4710 |
bool negation = conDesIt->isNegated(); |
| 4711 |
CConceptSaturationDescriptor* propTestConDes = nullptr; |
| 4712 |
CImplicationReapplyConceptSaturationDescriptor* propTestImpReapDes = nullptr; |
| 4713 |
if (propTestConSet->getConceptDescriptorAndReapplyQueue(concept,propTestConDes,propTestImpReapDes)) { |
| 4714 |
if (propTestConDes) { |
| 4715 |
if (propTestConDes->isNegated() != negation) { |
| 4716 |
return true; |
| 4717 |
} |
| 4718 |
} else if (!negation && propTestImpReapDes) { |
| 4719 |
CConcept* propTestImpCon = propTestImpReapDes->getImplicationConcept(); |
| 4720 |
if (!propTestConSet->containsConcept(propTestImpCon->getOperandList()->getData()) && !mergingConSet->containsConcept(propTestImpCon->getOperandList()->getData())) { |
| 4721 |
return true; |
| 4722 |
} |
| 4723 |
} |
| 4724 |
} else { |
| 4725 |
// test whether concept is critical |
| 4726 |
|
| 4727 |
for (CConceptSaturationDescriptor* predConDesIt = indiProcSatNode->getReapplyConceptSaturationLabelSet(false)->getConceptSaturationDescriptionLinker(); predConDesIt; predConDesIt = predConDesIt->getNextConceptDesciptor()) { |
| 4728 |
CConcept* predConcept = predConDesIt->getConcept(); |
| 4729 |
bool predConNegation = predConDesIt->isNegated(); |
| 4730 |
cint64 predConOpCode = predConcept->getOperatorCode(); |
| 4731 |
if (predConNegation && predConOpCode == CCATLEAST || !predConNegation && predConOpCode == CCATMOST) { |
| 4732 |
CConcept* predOpCon = nullptr; |
| 4733 |
if (predConcept->getOperandList()) { |
| 4734 |
predOpCon = predConcept = predConcept->getOperandList()->getData(); |
| 4735 |
} |
| 4736 |
if (!predOpCon || predOpCon == concept) { |
| 4737 |
for (CXNegLinker<CRole*>* creationRoleLinkerIt = creationRoleLinker; creationRoleLinkerIt; creationRoleLinkerIt = creationRoleLinkerIt->getNext()) { |
| 4738 |
if (!creationRoleLinkerIt->isNegated()) { |
| 4739 |
CRole* creationRole = creationRoleLinkerIt->getData(); |
| 4740 |
for (CSortedNegLinker<CRole*>* creationSuperRoleIt = creationRole->getIndirectSuperRoleList(); creationSuperRoleIt; creationSuperRoleIt = creationSuperRoleIt->getNext()) { |
| 4741 |
if (!creationSuperRoleIt->isNegated()) { |
| 4742 |
CRole* creationSuperRole = creationSuperRoleIt->getData(); |
| 4743 |
if (creationSuperRole == predConcept->getRole()) { |
| 4744 |
cint64 allowedCardinality = predConcept->getParameter() - 1*predConNegation; |
| 4745 |
if (getIndividualNodeQualifiedSuccessorCount(indiProcSatNode,creationSuperRole,predConcept->getOperandList(),calcAlgContext) > allowedCardinality) { |
| 4746 |
return true; |
| 4747 |
} |
| 4748 |
} |
| 4749 |
} |
| 4750 |
} |
| 4751 |
} |
| 4752 |
} |
| 4753 |
} |
| 4754 |
} |
| 4755 |
} |
| 4756 |
|
| 4757 |
|
| 4758 |
cint64 opCode = concept->getOperatorCode(); |
| 4759 |
CConceptOperator* conOp = concept->getConceptOperator(); |
| 4760 |
|
| 4761 |
if (!negation && conOp->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_AQALL_TYPE) || negation && conOp->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_SOME_TYPE) || !negation && opCode == CCATMOST || negation && opCode == CCATLEAST) { |
| 4762 |
collectLinkedSuccessorNodes(probTestingSuccNode,calcAlgContext); |
| 4763 |
CLinkedRoleSaturationSuccessorHash* propTestLinkedSuccHash = probTestingSuccNode->getLinkedRoleSuccessorHash(false); |
| 4764 |
if (propTestLinkedSuccHash) { |
| 4765 |
CRole* role = concept->getRole(); |
| 4766 |
if (propTestLinkedSuccHash->hasLinkedRoleSuccessorData(role)) { |
| 4767 |
return true; |
| 4768 |
} |
| 4769 |
} |
| 4770 |
} |
| 4771 |
|
| 4772 |
|
| 4773 |
if (!negation && conOp->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_SOME_TYPE | CConceptOperator::CCF_SELF | CConceptOperator::CCF_ATLEAST) || negation && conOp->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_AQALL_TYPE | CConceptOperator::CCF_ATMOST)) { |
| 4774 |
CRoleBackwardSaturationPropagationHash* propTestBackwardPropHash = probTestingSuccNode->getRoleBackwardPropagationHash(false); |
| 4775 |
if (propTestBackwardPropHash) { |
| 4776 |
CRole* role = concept->getRole(); |
| 4777 |
CPROCESSHASH<CRole*,CRoleBackwardSaturationPropagationHashData>* backwardPropDataHash = propTestBackwardPropHash->getRoleBackwardPropagationDataHash(); |
| 4778 |
for (CSortedNegLinker<CRole*>* superRoleIt = role->getIndirectSuperRoleList(); superRoleIt; superRoleIt = superRoleIt->getNext()) { |
| 4779 |
if (!superRoleIt->isNegated()) { |
| 4780 |
CRole* superRole = superRoleIt->getData(); |
| 4781 |
CRoleBackwardSaturationPropagationHashData* backwardPropData = backwardPropDataHash->valuePointer(superRole); |
| 4782 |
if (backwardPropData && backwardPropData->mReapplyLinker) { |
| 4783 |
return true; |
| 4784 |
} |
| 4785 |
} |
| 4786 |
} |
| 4787 |
} |
| 4788 |
} |
| 4789 |
} |
| 4790 |
} |
| 4791 |
return false; |
| 4792 |
} |
| 4793 |
|
| 4794 |
|
| 4795 |
|
| 4796 |
|
| 4797 |
cint64 CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getSuccessorLinkExtendedMergeableCardinalityCount(CIndividualSaturationProcessNode*& indiProcSatNode, CSaturationSuccessorData* succLinkData, CSaturationSuccessorData** mergedSuccLinkData, CIndividualSaturationSuccessorLinkDataLinker* mergingSuccDataLinker, CPROCESSHASH<CSaturationSuccessorData*,cint64>* remainMergeableCardHash, CRole* role, cint64 maxRequiredMergingCardinality, CPROCESSHASH<CSaturationSuccessorData*,CSaturationSuccessorData*>* mergeDistintHash, CPROCESSSET< QPair<CSaturationSuccessorData*,CSaturationSuccessorData*> >* mergeDistintSet, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4798 |
for (CIndividualSaturationSuccessorLinkDataLinker* mergingSuccDataLinkerIt = mergingSuccDataLinker; mergingSuccDataLinkerIt; mergingSuccDataLinkerIt = mergingSuccDataLinkerIt->getNext()) { |
| 4799 |
CSaturationSuccessorData* mergeSuccLinkData = mergingSuccDataLinkerIt->getData(); |
| 4800 |
cint64 mergeableCardinality = remainMergeableCardHash->value(mergeSuccLinkData,mergeSuccLinkData->mSuccCount); |
| 4801 |
if (mergeableCardinality > 0) { |
| 4802 |
if (!mergeDistintSet->contains(QPair<CSaturationSuccessorData*,CSaturationSuccessorData*>(qMin(mergeSuccLinkData,succLinkData),qMax(mergeSuccLinkData,succLinkData)))) { |
| 4803 |
if (isIndividualSuccessorLinkCardinalityExtendedMergeable(indiProcSatNode,succLinkData,mergeSuccLinkData,calcAlgContext)) { |
| 4804 |
remainMergeableCardHash->insert(mergeSuccLinkData,0); |
| 4805 |
for (CPROCESSHASH<CSaturationSuccessorData*,CSaturationSuccessorData*>::const_iterator mDIt = mergeDistintHash->constFind(succLinkData), mDItEnd = mergeDistintHash->constEnd(); mDIt != mDItEnd && mDIt.key() == succLinkData; ++mDIt) { |
| 4806 |
CSaturationSuccessorData* distSuccData = mDIt.value(); |
| 4807 |
mergeDistintHash->insertMulti(distSuccData,mergeSuccLinkData); |
| 4808 |
mergeDistintHash->insertMulti(mergeSuccLinkData,distSuccData); |
| 4809 |
mergeDistintSet->insert(QPair<CSaturationSuccessorData*,CSaturationSuccessorData*>(qMin(mergeSuccLinkData,distSuccData),qMax(mergeSuccLinkData,distSuccData))); |
| 4810 |
} |
| 4811 |
if (mergedSuccLinkData) { |
| 4812 |
*mergedSuccLinkData = mergeSuccLinkData; |
| 4813 |
} |
| 4814 |
return mergeableCardinality; |
| 4815 |
} |
| 4816 |
} |
| 4817 |
} |
| 4818 |
} |
| 4819 |
return 0; |
| 4820 |
} |
| 4821 |
|
| 4822 |
|
| 4823 |
|
| 4824 |
|
| 4825 |
|
| 4826 |
|
| 4827 |
|
| 4828 |
|
| 4829 |
|
| 4830 |
|
| 4831 |
|
| 4832 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::isCriticalNOMINALConceptDescriptorInsufficient(CConceptSaturationDescriptor* conDes, CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4833 |
CConcept* concept = conDes->getConcept(); |
| 4834 |
CRole* role = concept->getRole(); |
| 4835 |
CIndividual* nominal = concept->getNominalIndividual(); |
| 4836 |
cint64 nominalID = nominal->getIndividualID(); |
| 4837 |
|
| 4838 |
if (isConsistenceDataAvailable(calcAlgContext)) { |
| 4839 |
CIndividualProcessNode* detNominalProcessNode = getCorrectedNode(nominalID,mDetCachedCGIndiVector,mCalcAlgContext); |
| 4840 |
if (detNominalProcessNode) { |
| 4841 |
CIndividualProcessNode* nonDetNominalProcessNode = getCorrectedNode(nominalID,mNonDetCachedCGIndiVector,mCalcAlgContext); |
| 4842 |
CReapplyConceptLabelSet* detNominalReapplyConSet = detNominalProcessNode->getReapplyConceptLabelSet(false); |
| 4843 |
CReapplyConceptLabelSet* nonDetNominalReapplyConSet = nonDetNominalProcessNode->getReapplyConceptLabelSet(false); |
| 4844 |
|
| 4845 |
CReapplyConceptSaturationLabelSet* satIndiNodeConSet = indiProcSatNode->getReapplyConceptSaturationLabelSet(false); |
| 4846 |
|
| 4847 |
CConceptDescriptor* lastDetConDesIt = detNominalReapplyConSet->getAddingSortedConceptDescriptionLinker(); |
| 4848 |
for (CConceptDescriptor* conDesIt = nonDetNominalReapplyConSet->getAddingSortedConceptDescriptionLinker(); conDesIt && conDesIt != lastDetConDesIt; conDesIt = conDesIt->getNext()) { |
| 4849 |
CConcept* nominalConcept = conDesIt->getConcept(); |
| 4850 |
bool nominalConceptNegation = conDesIt->isNegated(); |
| 4851 |
if (!satIndiNodeConSet->containsConcept(nominalConcept,nominalConceptNegation)) { |
| 4852 |
return true; |
| 4853 |
} |
| 4854 |
} |
| 4855 |
return false; |
| 4856 |
} else { |
| 4857 |
return true; |
| 4858 |
} |
| 4859 |
} else { |
| 4860 |
return true; |
| 4861 |
} |
| 4862 |
} |
| 4863 |
|
| 4864 |
|
| 4865 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::isCriticalVALUEConceptDescriptorInsufficient(CConceptSaturationDescriptor* conDes, CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4866 |
|
| 4867 |
CConcept* concept = conDes->getConcept(); |
| 4868 |
CRole* role = concept->getRole(); |
| 4869 |
CIndividual* nominal = concept->getNominalIndividual(); |
| 4870 |
cint64 nominalID = nominal->getIndividualID(); |
| 4871 |
|
| 4872 |
if (isConsistenceDataAvailable(calcAlgContext)) { |
| 4873 |
CIndividualProcessNode* detNominalProcessNode = getCorrectedNode(nominalID,mDetCachedCGIndiVector,mCalcAlgContext); |
| 4874 |
if (detNominalProcessNode) { |
| 4875 |
CIndividualProcessNode* nonDetNominalProcessNode = getCorrectedNode(nominalID,mNonDetCachedCGIndiVector,mCalcAlgContext); |
| 4876 |
CReapplyConceptLabelSet* detNominalReapplyConSet = detNominalProcessNode->getReapplyConceptLabelSet(false); |
| 4877 |
CReapplyRoleSuccessorHash* nonDetNominalReapplyRoleSuccHash = nonDetNominalProcessNode->getReapplyRoleSuccessorHash(false); |
| 4878 |
|
| 4879 |
CReapplyConceptSaturationLabelSet* satIndiNodeConSet = indiProcSatNode->getReapplyConceptSaturationLabelSet(false); |
| 4880 |
|
| 4881 |
if (nonDetNominalReapplyRoleSuccHash) { |
| 4882 |
for (CSortedNegLinker<CRole*>* superRoleIt = role->getIndirectSuperRoleList(); superRoleIt; superRoleIt = superRoleIt->getNext()) { |
| 4883 |
CRole* superRole = superRoleIt->getData(); |
| 4884 |
bool inversedSuperRole = superRoleIt->isNegated(); |
| 4885 |
if (!inversedSuperRole) { |
| 4886 |
CReapplyQueueIterator reapplyRoleIt(nonDetNominalReapplyRoleSuccHash->getRoleReapplyIterator(superRole)); |
| 4887 |
while (reapplyRoleIt.hasNext()) { |
| 4888 |
CReapplyConceptDescriptor* reapplyDes = reapplyRoleIt.next(); |
| 4889 |
CConceptDescriptor* reapplyConDes = reapplyDes->getConceptDescriptor(); |
| 4890 |
CConcept* reapplyConcept = reapplyConDes->getConcept(); |
| 4891 |
bool reapplyConceptNegation = reapplyConDes->isNegated(); |
| 4892 |
if (!reapplyConceptNegation && detNominalReapplyConSet->containsConcept(reapplyConcept,reapplyConceptNegation)) { |
| 4893 |
|
| 4894 |
cint64 reapplyConceptCode = reapplyConcept->getOperatorCode(); |
| 4895 |
CConceptOperator* reapplyConceptOperator = reapplyConcept->getConceptOperator(); |
| 4896 |
if (!reapplyConceptNegation && reapplyConceptOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_PROPAGATION_ALL_TYPE)) { |
| 4897 |
return true; |
| 4898 |
} else if (!reapplyConceptNegation && reapplyConceptOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_ALL_AQALL_TYPE) || reapplyConceptNegation && reapplyConceptCode == CCSOME) { |
| 4899 |
for (CSortedNegLinker<CConcept*>* reapplyConceptOpLinkerIt = reapplyConcept->getOperandList(); reapplyConceptOpLinkerIt; reapplyConceptOpLinkerIt = reapplyConceptOpLinkerIt->getNext()) { |
| 4900 |
CConcept* reapplyOperandConcept = reapplyConceptOpLinkerIt->getData(); |
| 4901 |
bool reapplyOperandConceptNegation = reapplyConceptOpLinkerIt->isNegated()^reapplyConceptNegation; |
| 4902 |
if (!satIndiNodeConSet->containsConcept(reapplyOperandConcept,reapplyOperandConceptNegation)) { |
| 4903 |
return true; |
| 4904 |
} |
| 4905 |
} |
| 4906 |
} else if (!reapplyConceptNegation && reapplyConceptOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_AQAND_TYPE)) { |
| 4907 |
testAutomateTransitionOperandsAddable(indiProcSatNode,reapplyConcept,role,mCalcAlgContext); |
| 4908 |
} else { |
| 4909 |
return true; |
| 4910 |
} |
| 4911 |
return false; |
| 4912 |
} |
| 4913 |
} |
| 4914 |
} |
| 4915 |
} |
| 4916 |
} |
| 4917 |
} |
| 4918 |
return false; |
| 4919 |
} else { |
| 4920 |
return true; |
| 4921 |
} |
| 4922 |
} |
| 4923 |
|
| 4924 |
|
| 4925 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::updateExtractDisjunctCommonConcept(CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4926 |
CSaturationConceptDataItem* conceptSatItem = (CSaturationConceptDataItem*)indiProcSatNode->getSaturationConceptReferenceLinking();; |
| 4927 |
CConcept* disjunctionConcept = conceptSatItem->getSaturationConcept(); |
| 4928 |
bool disjunctionNegation = conceptSatItem->getSaturationNegation(); |
| 4929 |
CSortedNegLinker<CConcept*>* disjunctConceptLinker = disjunctionConcept->getOperandList(); |
| 4930 |
CSaturationDisjunctCommonConceptExtractionData* extractionData = indiProcSatNode->getDisjunctCommonConceptExtractionData(false); |
| 4931 |
|
| 4932 |
if (extractionData) { |
| 4933 |
CReapplyConceptSaturationLabelSet* disjunctionConSet = indiProcSatNode->getReapplyConceptSaturationLabelSet(true); |
| 4934 |
CSaturationDisjunctCommonConceptCountHash* commonConceptCountHash = extractionData->getSaturationDisjunctCommonConceptCountHash(); |
| 4935 |
|
| 4936 |
for (CSaturationDisjunctExtractionLinker* satDisjExtLinkerIt = extractionData->getDisjunctIndividualNodeExtractionLinker(); satDisjExtLinkerIt; satDisjExtLinkerIt = satDisjExtLinkerIt->getNext()) { |
| 4937 |
CIndividualSaturationProcessNode* disjConIndiNode = satDisjExtLinkerIt->getDisjunctIndividualSaturationProcessNode(); |
| 4938 |
|
| 4939 |
CConceptSaturationDescriptor* lastExaminedDisjConSatDes = satDisjExtLinkerIt->getLastExaminedConceptSaturationDescriptor(); |
| 4940 |
CReapplyConceptSaturationLabelSet* disjConConSet = disjConIndiNode->getReapplyConceptSaturationLabelSet(false); |
| 4941 |
if (disjConConSet) { |
| 4942 |
CConceptSaturationDescriptor* newLastExaminedDisjConSatDes = disjConConSet->getConceptSaturationDescriptionLinker(); |
| 4943 |
satDisjExtLinkerIt->setLastExaminedConceptSaturationDescriptor(newLastExaminedDisjConSatDes); |
| 4944 |
for (CConceptSaturationDescriptor* disjConSatDesIt = newLastExaminedDisjConSatDes; disjConSatDesIt != lastExaminedDisjConSatDes; disjConSatDesIt = disjConSatDesIt->getNext()) { |
| 4945 |
CConcept* disjConcept = disjConSatDesIt->getConcept(); |
| 4946 |
bool disjNegation = disjConSatDesIt->isNegated(); |
| 4947 |
if (commonConceptCountHash->incCommonConceptCountReturnMaxReached(disjConSatDesIt)) { |
| 4948 |
addConceptFilteredToIndividual(disjConcept,disjNegation,indiProcSatNode,disjunctionConSet,true,calcAlgContext); |
| 4949 |
} |
| 4950 |
} |
| 4951 |
} |
| 4952 |
} |
| 4953 |
} |
| 4954 |
} |
| 4955 |
|
| 4956 |
|
| 4957 |
|
| 4958 |
|
| 4959 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::initializeExtractDisjunctCommonConcept(CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4960 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 4961 |
CSaturationDisjunctCommonConceptExtractionData* extractionData = indiProcSatNode->getDisjunctCommonConceptExtractionData(true); |
| 4962 |
CSaturationConceptDataItem* conceptSatItem = (CSaturationConceptDataItem*)indiProcSatNode->getSaturationConceptReferenceLinking(); |
| 4963 |
CConcept* disjunctionConcept = conceptSatItem->getSaturationConcept(); |
| 4964 |
bool disjunctionNegation = conceptSatItem->getSaturationNegation(); |
| 4965 |
|
| 4966 |
CSortedNegLinker<CConcept*>* disjunctConceptLinker = disjunctionConcept->getOperandList(); |
| 4967 |
cint64 disjCount = 0; |
| 4968 |
for (CSortedNegLinker<CConcept*>* disjunctConceptLinkerIt = disjunctConceptLinker; disjunctConceptLinkerIt; disjunctConceptLinkerIt = disjunctConceptLinkerIt->getNext()) { |
| 4969 |
++disjCount; |
| 4970 |
CConcept* disjunctConcept = disjunctConceptLinkerIt->getData(); |
| 4971 |
bool disjunctNegation = disjunctConceptLinkerIt->isNegated()^disjunctionNegation; |
| 4972 |
|
| 4973 |
bool checkingNegation = disjunctNegation; |
| 4974 |
CConcept* disjunctHandling = getDisjunctCheckingConcept(disjunctConcept, disjunctNegation, &checkingNegation, calcAlgContext); |
| 4975 |
|
| 4976 |
CConceptProcessData* conProData = (CConceptProcessData*)disjunctHandling->getConceptData(); |
| 4977 |
CConceptSaturationReferenceLinkingData* confSatRefLinkingData = (CConceptSaturationReferenceLinkingData*)conProData->getConceptReferenceLinking(); |
| 4978 |
CSaturationConceptReferenceLinking* disjunctConceptRefLinkData = confSatRefLinkingData->getConceptSaturationReferenceLinkingData(checkingNegation); |
| 4979 |
CIndividualSaturationProcessNode* disConIndiNode = (CIndividualSaturationProcessNode*)disjunctConceptRefLinkData->getIndividualProcessNodeForConcept(); |
| 4980 |
addUninitializedIndividualToProcessingQueue(disConIndiNode,calcAlgContext); |
| 4981 |
|
| 4982 |
CSaturationDisjunctExtractionLinker* disNodeExtLinker = CObjectAllocator<CSaturationDisjunctExtractionLinker>::allocateAndConstruct(taskMemMan); |
| 4983 |
disNodeExtLinker->initSaturationDisjunctExtractionLinker(disConIndiNode,nullptr); |
| 4984 |
extractionData->addDisjunctIndividualNodeExtractionLinker(disNodeExtLinker); |
| 4985 |
|
| 4986 |
CSaturationModifiedProcessUpdateLinker* modProcUpdLinker = createModifiedProcessUpdateLinker(calcAlgContext); |
| 4987 |
modProcUpdLinker->initProcessUpdateLinker(indiProcSatNode,CSaturationModifiedProcessUpdateLinker::UPDATEPDISJUNCTCOMMONCONCEPTSEXTRACTION); |
| 4988 |
disConIndiNode->getReapplyConceptSaturationLabelSet(true)->addModifiedUpdateLinker(modProcUpdLinker); |
| 4989 |
|
| 4990 |
} |
| 4991 |
extractionData->getSaturationDisjunctCommonConceptCountHash()->setDisjunctCount(disjCount); |
| 4992 |
|
| 4993 |
updateExtractDisjunctCommonConcept(indiProcSatNode,calcAlgContext); |
| 4994 |
} |
| 4995 |
|
| 4996 |
|
| 4997 |
|
| 4998 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addDisjunctCommonConceptExtractionToProcessingQueue(CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 4999 |
CSaturationDisjunctCommonConceptExtractionData* extractionData = indiProcSatNode->getDisjunctCommonConceptExtractionData(false); |
| 5000 |
if (extractionData) { |
| 5001 |
CIndividualSaturationProcessNodeLinker* processNodeLinker = extractionData->getExtractionContinueProcessLinker(); |
| 5002 |
if (!processNodeLinker->isProcessingQueued()) { |
| 5003 |
processNodeLinker->setProcessingQueued(); |
| 5004 |
calcAlgContext->getUsedProcessingDataBox()->addIndividualDisjunctCommonConceptExtractProcessLinker(processNodeLinker); |
| 5005 |
} |
| 5006 |
} |
| 5007 |
} |
| 5008 |
|
| 5009 |
|
| 5010 |
|
| 5011 |
|
| 5012 |
|
| 5013 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::createRoleAssertionLink(CIndividualSaturationProcessNode*& sourceNode, CIndividualSaturationProcessNode*& destinationNode, CRole* role, bool roleInversed, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5014 |
// status propagation not required since it is tracked for each abox individual separately |
| 5015 |
//updateIndirectAddingIndividualStatusFlags(sourceNode,destinationNode->getIndirectStatusFlags(),mCalcAlgContext); |
| 5016 |
|
| 5017 |
CMemoryAllocationManager* taskMemMan = mCalcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 5018 |
bool existIndiInitialized = destinationNode->isInitialized() || destinationNode == sourceNode; |
| 5019 |
CReapplyConceptSaturationLabelSet* conSet = nullptr; |
| 5020 |
CSortedNegLinker<CRole*>* superRoleIt = role->getIndirectSuperRoleList(); |
| 5021 |
bool connected = false; |
| 5022 |
while (superRoleIt) { |
| 5023 |
CRole* superRole = superRoleIt->getData(); |
| 5024 |
if (superRole->getDisjointRoleList() != nullptr) { |
| 5025 |
updateDirectAddingIndividualStatusFlags(sourceNode,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,mCalcAlgContext); |
| 5026 |
setInsufficientNodeOccured(mCalcAlgContext); |
| 5027 |
} |
| 5028 |
CSortedNegLinker<CConcept*>* domainConLinker = superRole->getDomainRangeConceptList(superRoleIt->isNegated()^roleInversed); |
| 5029 |
for (CSortedNegLinker<CConcept*>* domainConLinkerIt = domainConLinker; domainConLinkerIt; domainConLinkerIt = domainConLinkerIt->getNext()) { |
| 5030 |
CConcept* domainConcept = domainConLinkerIt->getData(); |
| 5031 |
bool domainConceptNegation = domainConLinkerIt->isNegated(); |
| 5032 |
if (!conSet) { |
| 5033 |
conSet = sourceNode->getReapplyConceptSaturationLabelSet(true); |
| 5034 |
} |
| 5035 |
addConceptFilteredToIndividual(domainConcept,domainConceptNegation,sourceNode,conSet,false,mCalcAlgContext); |
| 5036 |
} |
| 5037 |
|
| 5038 |
|
| 5039 |
if (superRoleIt->isNegated()^roleInversed) { |
| 5040 |
connected = true; |
| 5041 |
CBackwardSaturationPropagationLink* backPropLink = CObjectAllocator<CBackwardSaturationPropagationLink>::allocateAndConstruct(taskMemMan); |
| 5042 |
backPropLink->initBackwardPropagationLink(sourceNode,superRole); |
| 5043 |
if (!existIndiInitialized) { |
| 5044 |
destinationNode->addInitializingBackwardPropagationLinks(backPropLink); |
| 5045 |
} else { |
| 5046 |
installBackwardPropagationLink(sourceNode,destinationNode,superRole,backPropLink,true,true,calcAlgContext); |
| 5047 |
} |
| 5048 |
} else { |
| 5049 |
addNewLinkedExtensionProcessingRole(superRole,sourceNode,true,true,mCalcAlgContext); |
| 5050 |
|
| 5051 |
CRoleProcessData* roleProData = (CRoleProcessData*)superRole->getRoleData(); |
| 5052 |
if (!roleProData || roleProData->hasPropagationAndCreationConceptsFlag()) { |
| 5053 |
updateDirectAddingIndividualStatusFlags(sourceNode, CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGUNMARKEDROLEASSERTION, mCalcAlgContext); |
| 5054 |
} |
| 5055 |
|
| 5056 |
|
| 5057 |
} |
| 5058 |
superRoleIt = superRoleIt->getNext(); |
| 5059 |
} |
| 5060 |
if (!connected) { |
| 5061 |
CXLinker<CIndividualSaturationProcessNode*>* nonInvConnectedIndiNodeLinker = CObjectAllocator< CXLinker<CIndividualSaturationProcessNode*> >::allocateAndConstruct(taskMemMan); |
| 5062 |
nonInvConnectedIndiNodeLinker->initLinker(sourceNode); |
| 5063 |
destinationNode->addNonInverseConnectedIndividualNodeLinker(nonInvConnectedIndiNodeLinker); |
| 5064 |
} |
| 5065 |
} |
| 5066 |
|
| 5067 |
|
| 5068 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::initializeRoleAssertions(CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5069 |
|
| 5070 |
CIndividual* nominalIndi = indiProcSatNode->getNominalIndividual(); |
| 5071 |
if (nominalIndi) { |
| 5072 |
|
| 5073 |
cint64 saturationID = getSaturationIDForIndividualNode(nominalIndi,calcAlgContext); |
| 5074 |
|
| 5075 |
//if (CIRIName::getRecentIRIName(nominalIndi->getIndividualNameLinker()) == "http://www.biopax.org/release/biopax-level2.owl#protein1189") { |
| 5076 |
// bool bug = true; |
| 5077 |
//} |
| 5078 |
|
| 5079 |
CIndividualSaturationProcessNode* resolveNode = nullptr; |
| 5080 |
if (indiProcSatNode->isSeparated()) { |
| 5081 |
resolveNode = getSeparatedSaturationConceptAssertionResolveNode(calcAlgContext); |
| 5082 |
} else { |
| 5083 |
CConcept* topConcept = calcAlgContext->getUsedProcessingDataBox()->getOntologyTopConcept(); |
| 5084 |
resolveNode = getIndividualNodeForConcept(topConcept,false,calcAlgContext); |
| 5085 |
} |
| 5086 |
|
| 5087 |
CIndividualSaturationProcessNodeExtensionData* extensionData = indiProcSatNode->getIndividualExtensionData(true); |
| 5088 |
CLinkedNeighbourRoleAssertionSaturationHash* neighbourRoleAssertionHash = extensionData->getLinkedNeighbourRoleAssertionHash(true); |
| 5089 |
|
| 5090 |
for (CRoleAssertionLinker* assRoleLinkerIt = nominalIndi->getAssertionRoleLinker(); assRoleLinkerIt; assRoleLinkerIt = assRoleLinkerIt->getNext()) { |
| 5091 |
CRole* role = assRoleLinkerIt->getRole(); |
| 5092 |
CIndividual* othIndi = assRoleLinkerIt->getIndividual(); |
| 5093 |
|
| 5094 |
|
| 5095 |
CIndividualSaturationProcessNode* othIndiNode = getIndividualNodeForIndividual(indiProcSatNode,othIndi,saturationID,calcAlgContext); |
| 5096 |
if (othIndiNode && (othIndiNode->isInitialized() || othIndiNode == indiProcSatNode)) { |
| 5097 |
createRoleAssertionLink(indiProcSatNode,othIndiNode,role,false,calcAlgContext); |
| 5098 |
indiProcSatNode->addRoleAssertion(othIndiNode,role,false); |
| 5099 |
createRoleAssertionLink(othIndiNode,indiProcSatNode,role,true,calcAlgContext); |
| 5100 |
othIndiNode->addRoleAssertion(indiProcSatNode,role,true); |
| 5101 |
} else if (!othIndiNode) { |
| 5102 |
othIndiNode = getResolvedIndividualNodeRepresentativeRangeAssertion(resolveNode,othIndi,role,false,calcAlgContext); |
| 5103 |
createRoleAssertionLink(indiProcSatNode, othIndiNode,role,false,calcAlgContext); |
| 5104 |
indiProcSatNode->addRoleAssertion(othIndiNode,role,false); |
| 5105 |
} |
| 5106 |
neighbourRoleAssertionHash->addNeighbourRoleAssertion(nominalIndi->getIndividualID(), othIndi->getIndividualID(), role, false, othIndiNode); |
| 5107 |
} |
| 5108 |
|
| 5109 |
for (CReverseRoleAssertionLinker* reverseAssRoleLinkerIt = nominalIndi->getReverseAssertionRoleLinker(); reverseAssRoleLinkerIt; reverseAssRoleLinkerIt = reverseAssRoleLinkerIt->getNext()) { |
| 5110 |
CRole* role = reverseAssRoleLinkerIt->getRole(); |
| 5111 |
CIndividual* othIndi = reverseAssRoleLinkerIt->getIndividual(); |
| 5112 |
|
| 5113 |
|
| 5114 |
CIndividualSaturationProcessNode* othIndiNode = getIndividualNodeForIndividual(indiProcSatNode,othIndi,saturationID,calcAlgContext); |
| 5115 |
if (othIndiNode && othIndiNode->isInitialized()) { |
| 5116 |
createRoleAssertionLink(othIndiNode,indiProcSatNode,role,false,calcAlgContext); |
| 5117 |
othIndiNode->addRoleAssertion(indiProcSatNode,role,false); |
| 5118 |
createRoleAssertionLink(indiProcSatNode,othIndiNode,role,true,calcAlgContext); |
| 5119 |
indiProcSatNode->addRoleAssertion(othIndiNode,role,true); |
| 5120 |
} else if (!othIndiNode) { |
| 5121 |
othIndiNode = getResolvedIndividualNodeRepresentativeRangeAssertion(resolveNode,othIndi,role,true,calcAlgContext); |
| 5122 |
createRoleAssertionLink(indiProcSatNode, othIndiNode,role,true,calcAlgContext); |
| 5123 |
indiProcSatNode->addRoleAssertion(othIndiNode,role,true); |
| 5124 |
} |
| 5125 |
neighbourRoleAssertionHash->addNeighbourRoleAssertion(nominalIndi->getIndividualID(), othIndi->getIndividualID(), role, true, othIndiNode); |
| 5126 |
|
| 5127 |
} |
| 5128 |
} |
| 5129 |
} |
| 5130 |
|
| 5131 |
|
| 5132 |
|
| 5133 |
|
| 5134 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::initializeDataAssertions(CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5135 |
|
| 5136 |
CIndividual* nominalIndi = indiProcSatNode->getNominalIndividual(); |
| 5137 |
if (nominalIndi) { |
| 5138 |
|
| 5139 |
cint64 saturationID = getSaturationIDForIndividualNode(nominalIndi, calcAlgContext); |
| 5140 |
|
| 5141 |
CIndividualSaturationProcessNode* resolveNode = nullptr; |
| 5142 |
if (indiProcSatNode->isSeparated()) { |
| 5143 |
resolveNode = getSeparatedSaturationConceptAssertionResolveNode(calcAlgContext); |
| 5144 |
} else { |
| 5145 |
CConcept* topConcept = calcAlgContext->getUsedProcessingDataBox()->getOntologyTopConcept(); |
| 5146 |
resolveNode = getIndividualNodeForConcept(topConcept, false, calcAlgContext); |
| 5147 |
} |
| 5148 |
|
| 5149 |
for (CDataAssertionLinker* assDataLinkerIt = nominalIndi->getAssertionDataLinker(); assDataLinkerIt; assDataLinkerIt = assDataLinkerIt->getNext()) { |
| 5150 |
CRole* role = assDataLinkerIt->getRole(); |
| 5151 |
CDataLiteral* dataLiteral = assDataLinkerIt->getDataLiteral(); |
| 5152 |
|
| 5153 |
createSuccessorForDataLiteral(indiProcSatNode, role, dataLiteral, calcAlgContext); |
| 5154 |
} |
| 5155 |
} |
| 5156 |
} |
| 5157 |
|
| 5158 |
|
| 5159 |
|
| 5160 |
|
| 5161 |
|
| 5162 |
|
| 5163 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::createSuccessorForDataLiteral(CIndividualSaturationProcessNode*& processIndi, CRole* role, CDataLiteral* dataLiteral, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5164 |
|
| 5165 |
|
| 5166 |
cint64 nextResolveIndiID = calcAlgContext->getUsedProcessingDataBox()->getNextSaturationResolvedSuccessorExtensionIndividualNodeID(); |
| 5167 |
|
| 5168 |
CLinkedDataValueAssertionSaturationData* linkedDataValueAssertionData = processIndi->getIndividualExtensionData(true)->getLinkedDataValueAssertionData(true); |
| 5169 |
linkedDataValueAssertionData->addDataValueAssertion(role, dataLiteral); |
| 5170 |
|
| 5171 |
CIndividualSaturationProcessNode* dataValueIndiNode = CObjectParameterizingAllocator< CIndividualSaturationProcessNode, CProcessContext* >::allocateAndConstructAndParameterize(calcAlgContext->getUsedProcessTaskMemoryAllocationManager(), calcAlgContext->getUsedProcessContext()); |
| 5172 |
dataValueIndiNode->initIndividualSaturationProcessNode(nextResolveIndiID, nullptr, nullptr); |
| 5173 |
dataValueIndiNode->initRootIndividualSaturationProcessNode(); |
| 5174 |
dataValueIndiNode->setReferenceMode(4); |
| 5175 |
|
| 5176 |
CIndividualSaturationProcessNodeLinker* dataNodeProcessLiner = CObjectAllocator<CIndividualSaturationProcessNodeLinker>::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 5177 |
bool queueProcessing = true; |
| 5178 |
dataNodeProcessLiner->initProcessNodeLinker(dataValueIndiNode, queueProcessing); |
| 5179 |
dataValueIndiNode->setIndividualSaturationProcessNodeLinker(dataNodeProcessLiner); |
| 5180 |
if (queueProcessing) { |
| 5181 |
calcAlgContext->getUsedProcessingDataBox()->addIndividualSaturationProcessNodeLinker(dataNodeProcessLiner); |
| 5182 |
} |
| 5183 |
|
| 5184 |
|
| 5185 |
CConcept* baseTopConcept = calcAlgContext->getUsedProcessingDataBox()->getOntologyTopDataRangeConcept(); |
| 5186 |
if (baseTopConcept) { |
| 5187 |
addConceptFilteredToIndividual(baseTopConcept, false, dataValueIndiNode, false, calcAlgContext); |
| 5188 |
} |
| 5189 |
if (dataLiteral->getDatatype() && dataLiteral->getDatatype()->getDatatypeConcept()) { |
| 5190 |
addConceptFilteredToIndividual(dataLiteral->getDatatype()->getDatatypeConcept(), false, dataValueIndiNode, false, calcAlgContext); |
| 5191 |
} |
| 5192 |
dataValueIndiNode->setInitialized(true); |
| 5193 |
dataValueIndiNode->setRequiredBackwardPropagation(true); |
| 5194 |
addIndividualToCompletionQueue(dataValueIndiNode, calcAlgContext); |
| 5195 |
|
| 5196 |
CIndividualSaturationProcessNodeVector* indiVec = calcAlgContext->getUsedProcessingDataBox()->getIndividualSaturationProcessNodeVector(true); |
| 5197 |
indiVec->setData(dataValueIndiNode->getIndividualID(), dataValueIndiNode); |
| 5198 |
|
| 5199 |
dataValueIndiNode->setSeparated(processIndi->isSeparated()); |
| 5200 |
preprocessResolvedIndividualNode(dataValueIndiNode, calcAlgContext); |
| 5201 |
associateDataLiteralWithNode(dataValueIndiNode, dataLiteral, dataLiteral->getDatatype(), calcAlgContext); |
| 5202 |
|
| 5203 |
|
| 5204 |
updateIndirectAddingIndividualStatusFlags(processIndi, dataValueIndiNode->getIndirectStatusFlags(), mCalcAlgContext); |
| 5205 |
updateAddingSuccessorConnectedNominal(processIndi, dataValueIndiNode->getSuccessorConnectedNominalSet(false), mCalcAlgContext); |
| 5206 |
updateMaxCardinalityCandidates(processIndi, dataValueIndiNode->getMaxAtleastCardinalityCandidate(), dataValueIndiNode->getMaxAtmostCardinalityCandidate(), mCalcAlgContext); |
| 5207 |
|
| 5208 |
CRoleBackwardSaturationPropagationHash* backPropHash = nullptr; |
| 5209 |
CReapplyConceptSaturationLabelSet* processIndiConSet = nullptr; |
| 5210 |
CReapplyConceptSaturationLabelSet* rangeIndiConSet = nullptr; |
| 5211 |
CSortedNegLinker<CRole*>* superRoleIt = role->getIndirectSuperRoleList(); |
| 5212 |
bool connected = false; |
| 5213 |
while (superRoleIt) { |
| 5214 |
CRole* superRole = superRoleIt->getData(); |
| 5215 |
if (superRole->getDisjointRoleList() != nullptr) { |
| 5216 |
updateDirectAddingIndividualStatusFlags(processIndi, CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT, mCalcAlgContext); |
| 5217 |
setInsufficientNodeOccured(mCalcAlgContext); |
| 5218 |
} |
| 5219 |
CSortedNegLinker<CConcept*>* domainConLinker = superRole->getDomainRangeConceptList(superRoleIt->isNegated()); |
| 5220 |
for (CSortedNegLinker<CConcept*>* domainConLinkerIt = domainConLinker; domainConLinkerIt; domainConLinkerIt = domainConLinkerIt->getNext()) { |
| 5221 |
CConcept* domainConcept = domainConLinkerIt->getData(); |
| 5222 |
bool domainConceptNegation = domainConLinkerIt->isNegated(); |
| 5223 |
if (!processIndiConSet) { |
| 5224 |
processIndiConSet = processIndi->getReapplyConceptSaturationLabelSet(true); |
| 5225 |
} |
| 5226 |
addConceptFilteredToIndividual(domainConcept, domainConceptNegation, processIndi, processIndiConSet, false, mCalcAlgContext); |
| 5227 |
} |
| 5228 |
CSortedNegLinker<CConcept*>* rangeConLinker = superRole->getDomainRangeConceptList(!superRoleIt->isNegated()); |
| 5229 |
for (CSortedNegLinker<CConcept*>* rangeConLinkerIt = rangeConLinker; rangeConLinkerIt; rangeConLinkerIt = rangeConLinkerIt->getNext()) { |
| 5230 |
CConcept* rangeConcept = rangeConLinkerIt->getData(); |
| 5231 |
bool rangeConceptNegation = rangeConLinkerIt->isNegated(); |
| 5232 |
if (!rangeIndiConSet) { |
| 5233 |
rangeIndiConSet = dataValueIndiNode->getReapplyConceptSaturationLabelSet(true); |
| 5234 |
} |
| 5235 |
addConceptFilteredToIndividual(rangeConcept, rangeConceptNegation, dataValueIndiNode, rangeIndiConSet, false, mCalcAlgContext); |
| 5236 |
} |
| 5237 |
|
| 5238 |
if (superRoleIt->isNegated()) { |
| 5239 |
connected = true; |
| 5240 |
CBackwardSaturationPropagationLink* backPropLink = nullptr; |
| 5241 |
backPropLink = CObjectAllocator<CBackwardSaturationPropagationLink>::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 5242 |
backPropLink->initBackwardPropagationLink(processIndi, superRole); |
| 5243 |
installBackwardPropagationLink(processIndi, dataValueIndiNode, superRole, backPropLink, true, true, calcAlgContext); |
| 5244 |
} else { |
| 5245 |
addNewLinkedExtensionProcessingRole(superRole, processIndi, true, true, mCalcAlgContext); |
| 5246 |
} |
| 5247 |
superRoleIt = superRoleIt->getNext(); |
| 5248 |
} |
| 5249 |
if (!connected) { |
| 5250 |
CXLinker<CIndividualSaturationProcessNode*>* nonInvConnectedIndiNodeLinker = CObjectAllocator< CXLinker<CIndividualSaturationProcessNode*> >::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 5251 |
nonInvConnectedIndiNodeLinker->initLinker(processIndi); |
| 5252 |
dataValueIndiNode->addNonInverseConnectedIndividualNodeLinker(nonInvConnectedIndiNodeLinker); |
| 5253 |
} |
| 5254 |
} |
| 5255 |
|
| 5256 |
|
| 5257 |
|
| 5258 |
|
| 5259 |
CIndividualSaturationProcessNode* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getSeparatedSaturationConceptAssertionResolveNode(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5260 |
CProcessingDataBox* procDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 5261 |
CConcept* topConcept = procDataBox->getOntologyTopConcept(); |
| 5262 |
CIndividualSaturationProcessNode* resolveNode = procDataBox->getSeparatedSaturationConceptAssertionResolveNode(); |
| 5263 |
if (!resolveNode) { |
| 5264 |
resolveNode = CObjectParameterizingAllocator<CIndividualSaturationProcessNode,CProcessContext*>::allocateAndConstructAndParameterize(calcAlgContext->getUsedProcessTaskMemoryAllocationManager(),calcAlgContext->getUsedProcessContext()); |
| 5265 |
cint64 nextResolveIndiID = calcAlgContext->getUsedProcessingDataBox()->getNextSaturationResolvedSuccessorExtensionIndividualNodeID(); |
| 5266 |
|
| 5267 |
resolveNode->initIndividualSaturationProcessNode(nextResolveIndiID,nullptr,nullptr); |
| 5268 |
resolveNode->setInitialized(true); |
| 5269 |
resolveNode->setSeparated(true); |
| 5270 |
resolveNode->setRequiredBackwardPropagation(true); |
| 5271 |
|
| 5272 |
addIndividualToCompletionQueue(resolveNode,calcAlgContext); |
| 5273 |
|
| 5274 |
CIndividualSaturationProcessNodeLinker* resolveNodeProcessLiner = CObjectAllocator<CIndividualSaturationProcessNodeLinker>::allocateAndConstruct(calcAlgContext->getUsedProcessTaskMemoryAllocationManager()); |
| 5275 |
resolveNodeProcessLiner->initProcessNodeLinker(resolveNode,true); |
| 5276 |
resolveNode->setIndividualSaturationProcessNodeLinker(resolveNodeProcessLiner); |
| 5277 |
calcAlgContext->getUsedProcessingDataBox()->addIndividualSaturationProcessNodeLinker(resolveNodeProcessLiner); |
| 5278 |
CIndividualSaturationProcessNodeVector* indiVec = calcAlgContext->getUsedProcessingDataBox()->getIndividualSaturationProcessNodeVector(true); |
| 5279 |
indiVec->setData(resolveNode->getIndividualID(),resolveNode); |
| 5280 |
|
| 5281 |
CReapplyConceptSaturationLabelSet* resolveConSet = resolveNode->getReapplyConceptSaturationLabelSet(true); |
| 5282 |
addConceptFilteredToIndividual(topConcept,false,resolveNode,resolveConSet,false,calcAlgContext); |
| 5283 |
|
| 5284 |
procDataBox->setSeparatedSaturationConceptAssertionResolveNode(resolveNode); |
| 5285 |
} |
| 5286 |
return resolveNode; |
| 5287 |
} |
| 5288 |
|
| 5289 |
|
| 5290 |
CIndividualSaturationProcessNode* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getIndividualNodeForConcept(CConcept* concept, bool negated, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5291 |
CIndividualSaturationProcessNode* node = nullptr; |
| 5292 |
CConceptData* conceptData = concept->getConceptData(); |
| 5293 |
if (conceptData) { |
| 5294 |
CConceptProcessData* conProcData = (CConceptProcessData*)conceptData; |
| 5295 |
CConceptReferenceLinking* conRefLinking = conProcData->getConceptReferenceLinking(); |
| 5296 |
if (conRefLinking) { |
| 5297 |
CConceptSaturationReferenceLinkingData* confSatRefLinkingData = (CConceptSaturationReferenceLinkingData*)conRefLinking; |
| 5298 |
CSaturationConceptReferenceLinking* satCalcRefLinkData = confSatRefLinkingData->getConceptSaturationReferenceLinkingData(negated); |
| 5299 |
if (satCalcRefLinkData) { |
| 5300 |
node = (CIndividualSaturationProcessNode*)satCalcRefLinkData->getIndividualProcessNodeForConcept(); |
| 5301 |
} |
| 5302 |
} |
| 5303 |
} |
| 5304 |
return node; |
| 5305 |
} |
| 5306 |
|
| 5307 |
|
| 5308 |
cint64 CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getSaturationIDForIndividualNode(CIndividual* individual, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5309 |
CIndividualProcessData* indiProcData = (CIndividualProcessData*)individual->getIndividualData(); |
| 5310 |
bool hasRefLinking = false; |
| 5311 |
if (indiProcData) { |
| 5312 |
CConceptReferenceLinking* refLinking = indiProcData->getSaturationReferenceLinkingData(); |
| 5313 |
if (refLinking) { |
| 5314 |
CIndividualSaturationReferenceLinkingData* satCalcRefLinkData = (CIndividualSaturationReferenceLinkingData*)refLinking; |
| 5315 |
if (satCalcRefLinkData) { |
| 5316 |
hasRefLinking = true; |
| 5317 |
return satCalcRefLinkData->getSaturationID(); |
| 5318 |
} |
| 5319 |
} |
| 5320 |
} |
| 5321 |
return -1; |
| 5322 |
} |
| 5323 |
|
| 5324 |
|
| 5325 |
CIndividualSaturationProcessNode* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getIndividualNodeForIndividual(CIndividualSaturationProcessNode* indiProcSatNode, CIndividual* individual, cint64 saturationID, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5326 |
|
| 5327 |
CIndividualSaturationProcessNode* node = nullptr; |
| 5328 |
if (indiProcSatNode->getNominalIndividual() == individual) { |
| 5329 |
node = indiProcSatNode; |
| 5330 |
} else { |
| 5331 |
CIndividualProcessData* indiProcData = (CIndividualProcessData*)individual->getIndividualData(); |
| 5332 |
bool hasRefLinking = false; |
| 5333 |
if (indiProcData) { |
| 5334 |
CConceptReferenceLinking* refLinking = indiProcData->getSaturationReferenceLinkingData(); |
| 5335 |
if (refLinking) { |
| 5336 |
CIndividualSaturationReferenceLinkingData* satCalcRefLinkData = (CIndividualSaturationReferenceLinkingData*)refLinking; |
| 5337 |
if (satCalcRefLinkData) { |
| 5338 |
hasRefLinking = true; |
| 5339 |
if (satCalcRefLinkData->getSaturationID() == saturationID) { |
| 5340 |
node = (CIndividualSaturationProcessNode*)satCalcRefLinkData->getIndividualProcessNodeForConcept(); |
| 5341 |
if (node->getNominalIndividual() != individual) { |
| 5342 |
node = nullptr; |
| 5343 |
} |
| 5344 |
} |
| 5345 |
} |
| 5346 |
} |
| 5347 |
} |
| 5348 |
} |
| 5349 |
//if (!hasRefLinking) { |
| 5350 |
// CIndividualSaturationProcessNodeVector* indiNodeVec = calcAlgContext->getProcessingDataBox()->getIndividualSaturationProcessNodeVector(false); |
| 5351 |
// node = indiNodeVec->getData(individual->getIndividualID()); |
| 5352 |
//} |
| 5353 |
return node; |
| 5354 |
} |
| 5355 |
|
| 5356 |
|
| 5357 |
|
| 5358 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::countConceptsOfReferredNodes(CConcept* concept, bool negation, cint64 depth, cint64& manyConceptRefIndiNodeCount, cint64& totalRefConceptCount, cint64& unprocessedRefCount, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5359 |
if (depth <= 0) { |
| 5360 |
return false; |
| 5361 |
} |
| 5362 |
if (concept) { |
| 5363 |
cint64 initConCode = concept->getOperatorCode(); |
| 5364 |
if (!negation && (initConCode == CCSUB || initConCode == CCEQ || initConCode == CCAND) || negation && (initConCode == CCEQ || initConCode == CCOR)) { |
| 5365 |
for (CSortedNegLinker<CConcept*>* opConLinkerIt = concept->getOperandList(); opConLinkerIt; opConLinkerIt = opConLinkerIt->getNext()) { |
| 5366 |
CConcept* opConcept = opConLinkerIt->getData(); |
| 5367 |
bool opNegation = opConLinkerIt->isNegated()^negation; |
| 5368 |
|
| 5369 |
CIndividualSaturationProcessNode* opIndiNode = getIndividualNodeForConcept(opConcept,opNegation,calcAlgContext); |
| 5370 |
if (opIndiNode && opIndiNode->isInitialized()) { |
| 5371 |
if (opIndiNode->getDirectStatusFlags()->hasUnprocessedFlag()) { |
| 5372 |
++unprocessedRefCount; |
| 5373 |
} |
| 5374 |
CReapplyConceptSaturationLabelSet* opConSet = opIndiNode->getReapplyConceptSaturationLabelSet(false); |
| 5375 |
if (opConSet) { |
| 5376 |
cint64 opConCount = opConSet->getConceptCount(); |
| 5377 |
totalRefConceptCount += opConCount; |
| 5378 |
if (opConCount >= mConfReferredNodeManyConceptCount) { |
| 5379 |
++manyConceptRefIndiNodeCount; |
| 5380 |
} |
| 5381 |
} |
| 5382 |
} else { |
| 5383 |
countConceptsOfReferredNodes(opConcept,opNegation,depth-1,manyConceptRefIndiNodeCount,totalRefConceptCount,unprocessedRefCount,calcAlgContext); |
| 5384 |
} |
| 5385 |
} |
| 5386 |
} |
| 5387 |
} |
| 5388 |
return false; |
| 5389 |
} |
| 5390 |
|
| 5391 |
|
| 5392 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::isProcessingCritical(CIndividualSaturationProcessNode* indiProcSatNode, CSaturationConceptDataItem* conceptSatItem, CIndividualSaturationProcessNode* specRefIndiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5393 |
if (mConfForceManyConceptSaturation && specRefIndiProcSatNode && conceptSatItem) { |
| 5394 |
CConcept* initConcept = conceptSatItem->getSaturationConcept(); |
| 5395 |
bool initNegated = conceptSatItem->getSaturationNegation(); |
| 5396 |
|
| 5397 |
|
| 5398 |
cint64 manyRefIndiConCount = 0; |
| 5399 |
cint64 totalRefConCount = 0; |
| 5400 |
cint64 unprocessedRefCount = 0; |
| 5401 |
|
| 5402 |
countConceptsOfReferredNodes(initConcept,initNegated,mConfReferredNodeCheckingDepth,manyRefIndiConCount,totalRefConCount,unprocessedRefCount,calcAlgContext); |
| 5403 |
|
| 5404 |
if (manyRefIndiConCount >= mConfManyConceptReferredNodeCountProcessLimit || totalRefConCount >= mConfReferredNodeConceptCountProcessLimit || unprocessedRefCount >= mConfReferredNodeUnprocessedCountProcessLimit) { |
| 5405 |
return true; |
| 5406 |
} |
| 5407 |
} |
| 5408 |
return false; |
| 5409 |
} |
| 5410 |
|
| 5411 |
|
| 5412 |
|
| 5413 |
CIndividualSaturationProcessNode* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::resolveSpecialInitializationIndividualNode(CIndividualSaturationProcessNode* indiProcSatNode, CSaturationConceptDataItem* conceptSatItem, CIndividualSaturationProcessNode* specRefIndiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5414 |
if (specRefIndiProcSatNode && conceptSatItem) { |
| 5415 |
CConcept* initConcept = conceptSatItem->getSaturationConcept(); |
| 5416 |
bool initNegated = conceptSatItem->getSaturationNegation(); |
| 5417 |
|
| 5418 |
|
| 5419 |
CIndividualSaturationProcessNode* maxConCountSpecRefIndiNode = nullptr; |
| 5420 |
cint64 maxConCount = 0; |
| 5421 |
|
| 5422 |
if (initConcept) { |
| 5423 |
cint64 initConCode = initConcept->getOperatorCode(); |
| 5424 |
if (!initNegated && (initConCode == CCSUB || initConCode == CCEQ || initConCode == CCAND) || initNegated && (initConCode == CCEQ || initConCode == CCOR)) { |
| 5425 |
for (CSortedNegLinker<CConcept*>* opConLinkerIt = initConcept->getOperandList(); opConLinkerIt; opConLinkerIt = opConLinkerIt->getNext()) { |
| 5426 |
CConcept* opConcept = opConLinkerIt->getData(); |
| 5427 |
bool opNegation = opConLinkerIt->isNegated()^initNegated; |
| 5428 |
|
| 5429 |
CIndividualSaturationProcessNode* opIndiNode = getIndividualNodeForConcept(opConcept,opNegation,calcAlgContext); |
| 5430 |
if (opIndiNode && opIndiNode->isInitialized()) { |
| 5431 |
CReapplyConceptSaturationLabelSet* opConSet = opIndiNode->getReapplyConceptSaturationLabelSet(false); |
| 5432 |
if (opConSet) { |
| 5433 |
cint64 opConCount = opConSet->getConceptCount(); |
| 5434 |
if (!maxConCountSpecRefIndiNode || opConCount > maxConCount) { |
| 5435 |
maxConCount = opConCount; |
| 5436 |
maxConCountSpecRefIndiNode = opIndiNode; |
| 5437 |
} |
| 5438 |
} |
| 5439 |
} |
| 5440 |
} |
| 5441 |
} |
| 5442 |
} |
| 5443 |
|
| 5444 |
if (maxConCountSpecRefIndiNode) { |
| 5445 |
specRefIndiProcSatNode = maxConCountSpecRefIndiNode; |
| 5446 |
} |
| 5447 |
} |
| 5448 |
return specRefIndiProcSatNode; |
| 5449 |
} |
| 5450 |
|
| 5451 |
|
| 5452 |
|
| 5453 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::initializeInitializationConcepts(CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5454 |
|
| 5455 |
bool requiredBackProp = true; |
| 5456 |
|
| 5457 |
CIndividualSaturationProcessNode* specialIndiNode = nullptr; |
| 5458 |
CSaturationConceptReferenceLinking* confSatRefLinkingData = nullptr; |
| 5459 |
CSaturationConceptDataItem* conceptSatItem = nullptr; |
| 5460 |
|
| 5461 |
bool copyIndividualNode = false; |
| 5462 |
bool substituiteIndividualNode = false; |
| 5463 |
|
| 5464 |
confSatRefLinkingData = (CSaturationConceptReferenceLinking*)indiProcSatNode->getSaturationConceptReferenceLinking(); |
| 5465 |
conceptSatItem = (CSaturationConceptDataItem*)confSatRefLinkingData; |
| 5466 |
|
| 5467 |
CConcept* initConcept = nullptr; |
| 5468 |
bool initNegated = false; |
| 5469 |
bool dataRangeConcept = false; |
| 5470 |
CRole* initRole = nullptr; |
| 5471 |
|
| 5472 |
if (conceptSatItem) { |
| 5473 |
initConcept = conceptSatItem->getSaturationConcept(); |
| 5474 |
initNegated = conceptSatItem->getSaturationNegation(); |
| 5475 |
initRole = conceptSatItem->getSaturationRoleRanges(); |
| 5476 |
|
| 5477 |
if (!mConfForceAllConceptInsertion) { |
| 5478 |
requiredBackProp = conceptSatItem->isPotentiallyExistInitializationConcept(); |
| 5479 |
} |
| 5480 |
dataRangeConcept = conceptSatItem->isDataRangeConcept(); |
| 5481 |
} |
| 5482 |
|
| 5483 |
if (conceptSatItem) { |
| 5484 |
CSaturationConceptDataItem* specialRefItem = conceptSatItem->getSpecialItemReference(); |
| 5485 |
if (specialRefItem) { |
| 5486 |
specialIndiNode = (CIndividualSaturationProcessNode*)specialRefItem->getIndividualProcessNodeForConcept(); |
| 5487 |
} |
| 5488 |
} |
| 5489 |
|
| 5490 |
if (conceptSatItem) { |
| 5491 |
CSaturationConceptDataItem::SATURATIONITEMREFERENCESPECIALMODE mode = conceptSatItem->getSpecialReferenceMode(); |
| 5492 |
if (mode == CSaturationConceptDataItem::SATURATIONCOPYMODE) { |
| 5493 |
//specialIndiNode = resolveSpecialInitializationIndividualNode(indiProcSatNode,conceptSatItem,specialIndiNode,calcAlgContext); |
| 5494 |
copyIndividualNode = true; |
| 5495 |
} else if (mode == CSaturationConceptDataItem::SATURATIONSUBSTITUTEMODE) { |
| 5496 |
substituiteIndividualNode = true; |
| 5497 |
} |
| 5498 |
} |
| 5499 |
|
| 5500 |
bool addInitializationConcepts = true; |
| 5501 |
bool initialized = false; |
| 5502 |
if (specialIndiNode && !specialIndiNode->isInitialized()) { |
| 5503 |
specialIndiNode = nullptr; |
| 5504 |
} |
| 5505 |
if (specialIndiNode) { |
| 5506 |
indiProcSatNode->setReferenceIndividualSaturationProcessNode(specialIndiNode); |
| 5507 |
} |
| 5508 |
if (specialIndiNode && substituiteIndividualNode && (mConfForceAllCopyInsteadOfSubstituition || initRole)) { |
| 5509 |
substituiteIndividualNode = false; |
| 5510 |
copyIndividualNode = true; |
| 5511 |
} |
| 5512 |
if (specialIndiNode && substituiteIndividualNode) { |
| 5513 |
CIndividualSaturationProcessNode* blockedIndiNode = specialIndiNode; |
| 5514 |
while (blockedIndiNode->hasSubstituteIndividualNode()) { |
| 5515 |
blockedIndiNode = blockedIndiNode->getSubstituteIndividualNode(); |
| 5516 |
} |
| 5517 |
CReapplyConceptSaturationLabelSet* blockConSet = blockedIndiNode->getReapplyConceptSaturationLabelSet(false); |
| 5518 |
CConceptSaturationDescriptor* conceptSaturationDescriptor = nullptr; |
| 5519 |
CImplicationReapplyConceptSaturationDescriptor* impReapplyConSatDes = nullptr; |
| 5520 |
bool contained = false; |
| 5521 |
if (blockConSet && blockConSet->getConceptDescriptorAndReapplyQueue(initConcept,conceptSaturationDescriptor,impReapplyConSatDes)) { |
| 5522 |
contained = true; |
| 5523 |
} |
| 5524 |
if (!contained) { |
| 5525 |
++mSubstituitedIndiNodeCount; |
| 5526 |
indiProcSatNode->initSubstituitingIndividualSaturationProcessNode(blockedIndiNode); |
| 5527 |
indiProcSatNode->setSubstituteIndividualNode(specialIndiNode); |
| 5528 |
indiProcSatNode->setReferenceMode(1); |
| 5529 |
indiProcSatNode->clearConceptSaturationProcessLinker(); |
| 5530 |
addInitializationConcepts = false; |
| 5531 |
initialized = true; |
| 5532 |
|
| 5533 |
updateDirectAddingIndividualStatusFlags(indiProcSatNode,blockedIndiNode->getDirectStatusFlags(),mCalcAlgContext); |
| 5534 |
updateIndirectAddingIndividualStatusFlags(indiProcSatNode,blockedIndiNode->getIndirectStatusFlags(),mCalcAlgContext); |
| 5535 |
updateAddingSuccessorConnectedNominal(indiProcSatNode,blockedIndiNode->getSuccessorConnectedNominalSet(false),mCalcAlgContext); |
| 5536 |
|
| 5537 |
} else { |
| 5538 |
copyIndividualNode = true; |
| 5539 |
} |
| 5540 |
} |
| 5541 |
|
| 5542 |
bool tryFlatLabelCopy = false; |
| 5543 |
indiProcSatNode->setRequiredBackwardPropagation(requiredBackProp); |
| 5544 |
|
| 5545 |
if (!specialIndiNode) { |
| 5546 |
CIndividual* nominalIndi = indiProcSatNode->getNominalIndividual(); |
| 5547 |
if (nominalIndi) { |
| 5548 |
indiProcSatNode->setABoxIndividualRepresentationNode(true); |
| 5549 |
|
| 5550 |
if (nominalIndi->hasIndividualName()) { |
| 5551 |
CIndividualSaturationProcessNodeVector* indiNodeVec = calcAlgContext->getProcessingDataBox()->getIndividualSaturationProcessNodeVector(false); |
| 5552 |
CIndividualSaturationProcessNode* resolveNode = nullptr; |
| 5553 |
if (indiProcSatNode->isSeparated()) { |
| 5554 |
resolveNode = getSeparatedSaturationConceptAssertionResolveNode(calcAlgContext); |
| 5555 |
} else { |
| 5556 |
CConcept* topConcept = calcAlgContext->getUsedProcessingDataBox()->getOntologyTopConcept(); |
| 5557 |
resolveNode = getIndividualNodeForConcept(topConcept,false,calcAlgContext); |
| 5558 |
} |
| 5559 |
|
| 5560 |
CIndividualSaturationProcessNode* assertionResolvedNode = getResolvedIndividualNodeRepresentativeAssertion(resolveNode,nominalIndi,calcAlgContext); |
| 5561 |
specialIndiNode = assertionResolvedNode; |
| 5562 |
copyIndividualNode = true; |
| 5563 |
tryFlatLabelCopy = true; |
| 5564 |
} else { |
| 5565 |
specialIndiNode = nullptr; |
| 5566 |
copyIndividualNode = false; |
| 5567 |
|
| 5568 |
for (CConceptAssertionLinker* conAssLinkerIt = nominalIndi->getAssertionConceptLinker(); conAssLinkerIt; conAssLinkerIt = conAssLinkerIt->getNext()) { |
| 5569 |
CConcept* assConcept = conAssLinkerIt->getData(); |
| 5570 |
bool assNegation = conAssLinkerIt->isNegated(); |
| 5571 |
addConceptFilteredToIndividual(assConcept,assNegation,indiProcSatNode,indiProcSatNode->getReapplyConceptSaturationLabelSet(true),false,calcAlgContext); |
| 5572 |
} |
| 5573 |
} |
| 5574 |
} |
| 5575 |
} |
| 5576 |
|
| 5577 |
|
| 5578 |
if (!specialIndiNode && !dataRangeConcept && mConfCopyNodeFromTopIndividualForManyConcepts) { |
| 5579 |
CConcept* topConcept = calcAlgContext->getUsedProcessingDataBox()->getOntologyTopConcept(); |
| 5580 |
|
| 5581 |
CConceptData* topConceptData = topConcept->getConceptData(); |
| 5582 |
if (topConceptData) { |
| 5583 |
CConceptProcessData* conProcData = (CConceptProcessData*)topConceptData; |
| 5584 |
CConceptReferenceLinking* conRefLinking = conProcData->getConceptReferenceLinking(); |
| 5585 |
if (conRefLinking) { |
| 5586 |
CConceptSaturationReferenceLinkingData* confSatRefLinkingData = (CConceptSaturationReferenceLinkingData*)conRefLinking; |
| 5587 |
CSaturationConceptReferenceLinking* satCalcRefLinkData = confSatRefLinkingData->getConceptSaturationReferenceLinkingData(false); |
| 5588 |
if (satCalcRefLinkData) { |
| 5589 |
specialIndiNode = (CIndividualSaturationProcessNode*)satCalcRefLinkData->getIndividualProcessNodeForConcept(); |
| 5590 |
} |
| 5591 |
} |
| 5592 |
} |
| 5593 |
if (specialIndiNode && specialIndiNode->isInitialized()) { |
| 5594 |
CReapplyConceptSaturationLabelSet* topConSet = specialIndiNode->getReapplyConceptSaturationLabelSet(false); |
| 5595 |
if (topConSet) { |
| 5596 |
if (topConSet->getConceptCount() > 10) { |
| 5597 |
copyIndividualNode = true; |
| 5598 |
} |
| 5599 |
} |
| 5600 |
} else { |
| 5601 |
specialIndiNode = nullptr; |
| 5602 |
} |
| 5603 |
|
| 5604 |
} |
| 5605 |
|
| 5606 |
if (specialIndiNode && copyIndividualNode) { |
| 5607 |
|
| 5608 |
if (isProcessingCritical(indiProcSatNode,conceptSatItem,specialIndiNode,calcAlgContext)) { |
| 5609 |
updateDirectAddingIndividualStatusFlags(indiProcSatNode,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGUNPROCESSED | CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,calcAlgContext); |
| 5610 |
setInsufficientNodeOccured(calcAlgContext); |
| 5611 |
addInitializationConcepts = false; |
| 5612 |
indiProcSatNode->clearConceptSaturationProcessLinker(); |
| 5613 |
} else { |
| 5614 |
CIndividualSaturationProcessNode* blockedIndiNode = specialIndiNode; |
| 5615 |
while (blockedIndiNode->hasSubstituteIndividualNode()) { |
| 5616 |
blockedIndiNode = blockedIndiNode->getSubstituteIndividualNode(); |
| 5617 |
} |
| 5618 |
initializeIndividualNodeByCoping(indiProcSatNode,blockedIndiNode,tryFlatLabelCopy,mCalcAlgContext); |
| 5619 |
} |
| 5620 |
initialized = true; |
| 5621 |
} |
| 5622 |
if (!initialized) { |
| 5623 |
specialIndiNode = nullptr; |
| 5624 |
indiProcSatNode->initRootIndividualSaturationProcessNode(); |
| 5625 |
indiProcSatNode->setReferenceMode(4); |
| 5626 |
CConcept* baseTopConcept = nullptr; |
| 5627 |
if (!dataRangeConcept) { |
| 5628 |
baseTopConcept = calcAlgContext->getUsedProcessingDataBox()->getOntologyTopConcept(); |
| 5629 |
} else { |
| 5630 |
baseTopConcept = calcAlgContext->getUsedProcessingDataBox()->getOntologyTopDataRangeConcept(); |
| 5631 |
} |
| 5632 |
if (baseTopConcept) { |
| 5633 |
addConceptFilteredToIndividual(baseTopConcept,false,indiProcSatNode,false,calcAlgContext); |
| 5634 |
} |
| 5635 |
CConcept* univConnNomValueConcept = calcAlgContext->getProcessingDataBox()->getOntology()->getTBox()->getUniversalConnectionNominalValueConcept(); |
| 5636 |
if (univConnNomValueConcept && !dataRangeConcept) { |
| 5637 |
addConceptFilteredToIndividual(univConnNomValueConcept,false,indiProcSatNode,false,calcAlgContext); |
| 5638 |
} |
| 5639 |
initialized = true; |
| 5640 |
} |
| 5641 |
|
| 5642 |
addIndividualToCompletionQueue(indiProcSatNode,calcAlgContext); |
| 5643 |
|
| 5644 |
|
| 5645 |
|
| 5646 |
|
| 5647 |
if (addInitializationConcepts) { |
| 5648 |
if (initConcept) { |
| 5649 |
addConceptFilteredToIndividual(initConcept,initNegated,indiProcSatNode,indiProcSatNode->getReapplyConceptSaturationLabelSet(true),false,calcAlgContext); |
| 5650 |
if (specialIndiNode) { |
| 5651 |
bool initConceptDisjunction = false; |
| 5652 |
cint64 initConOpCode = initConcept->getOperatorCode(); |
| 5653 |
if (initNegated && (initConOpCode == CCAND || initConOpCode == CCEQ) || !initNegated && (initConOpCode == CCOR)) { |
| 5654 |
initConceptDisjunction = true; |
| 5655 |
} |
| 5656 |
if (initConceptDisjunction) { |
| 5657 |
CReapplyConceptSaturationLabelSet* specConSet = specialIndiNode->getReapplyConceptSaturationLabelSet(false); |
| 5658 |
CConceptSaturationDescriptor* initConSatDes = nullptr; |
| 5659 |
CImplicationReapplyConceptSaturationDescriptor* initConImpDes = nullptr; |
| 5660 |
if (specConSet->getConceptSaturationDescriptor(initConcept,initConSatDes,initConImpDes)) { |
| 5661 |
if (initConSatDes->isNegated() == initNegated) { |
| 5662 |
CConceptSaturationProcessLinker* conceptSaturationProcessLinker = createConceptSaturationProcessLinker(calcAlgContext); |
| 5663 |
conceptSaturationProcessLinker->initConceptSaturationProcessLinker(initConSatDes); |
| 5664 |
indiProcSatNode->addConceptSaturationProcessLinker(conceptSaturationProcessLinker); |
| 5665 |
} |
| 5666 |
} |
| 5667 |
} |
| 5668 |
} |
| 5669 |
} |
| 5670 |
if (initRole) { |
| 5671 |
for (CSortedNegLinker<CRole*>* superRoleIt = initRole->getIndirectSuperRoleList(); superRoleIt; superRoleIt = superRoleIt->getNext()) { |
| 5672 |
CRole* superRole = superRoleIt->getData(); |
| 5673 |
bool roleInversed = superRoleIt->isNegated(); |
| 5674 |
for (CSortedNegLinker<CConcept*>* rangeConceptIt = superRole->getDomainRangeConceptList(!roleInversed); rangeConceptIt; rangeConceptIt = rangeConceptIt->getNext()) { |
| 5675 |
CConcept* rangeConcept = rangeConceptIt->getData(); |
| 5676 |
bool rangeConceptNegation = rangeConceptIt->isNegated(); |
| 5677 |
addConceptFilteredToIndividual(rangeConcept,rangeConceptNegation,indiProcSatNode,calcAlgContext); |
| 5678 |
} |
| 5679 |
} |
| 5680 |
} |
| 5681 |
} |
| 5682 |
CBackwardSaturationPropagationLink* backSatPropLinkIt = indiProcSatNode->getInitializingBackwardPropagationLinks(); |
| 5683 |
if (backSatPropLinkIt) { |
| 5684 |
while (backSatPropLinkIt) { |
| 5685 |
CBackwardSaturationPropagationLink* backPropLink = backSatPropLinkIt; |
| 5686 |
backSatPropLinkIt = backSatPropLinkIt->getNext(); |
| 5687 |
backPropLink->clearNext(); |
| 5688 |
|
| 5689 |
installBackwardPropagationLink(backPropLink->getSourceIndividual(),indiProcSatNode,backPropLink->getLinkRole(),backPropLink,true,true,calcAlgContext); |
| 5690 |
|
| 5691 |
updateIndirectAddingIndividualStatusFlags(backPropLink->getSourceIndividual(),indiProcSatNode->getIndirectStatusFlags(),mCalcAlgContext); |
| 5692 |
updateAddingSuccessorConnectedNominal(backPropLink->getSourceIndividual(),indiProcSatNode->getSuccessorConnectedNominalSet(false),mCalcAlgContext); |
| 5693 |
} |
| 5694 |
} |
| 5695 |
} |
| 5696 |
|
| 5697 |
|
| 5698 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::individualNodeConclusion(CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5699 |
CConceptSaturationProcessLinker* conSatProLinker = indiProcSatNode->getConceptSaturationProcessLinker(); |
| 5700 |
if (conSatProLinker) { |
| 5701 |
addIndividualToProcessingQueue(indiProcSatNode,calcAlgContext); |
| 5702 |
} |
| 5703 |
} |
| 5704 |
|
| 5705 |
|
| 5706 |
|
| 5707 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyTableauSaturationRule(CIndividualSaturationProcessNode*& processIndi, CConceptSaturationProcessLinker* conSatProLinker) { |
| 5708 |
CConceptSaturationDescriptor* conDes = conSatProLinker->getConceptSaturationDescriptor(); |
| 5709 |
bool conNeg = conDes->getNegation(); |
| 5710 |
CConcept* concept = conDes->getConcept(); |
| 5711 |
cint64 conOpCode = concept->getOperatorCode(); |
| 5712 |
|
| 5713 |
TableauRuleFunction func = nullptr; |
| 5714 |
if (!conNeg) { |
| 5715 |
func = mPosJumpFuncVec[conOpCode]; |
| 5716 |
if (func) { |
| 5717 |
(this->*func)(processIndi,conSatProLinker); |
| 5718 |
} else { |
| 5719 |
applyELSERule(processIndi,conSatProLinker); |
| 5720 |
} |
| 5721 |
} else { |
| 5722 |
func = mNegJumpFuncVec[conOpCode]; |
| 5723 |
if (func) { |
| 5724 |
(this->*func)(processIndi,conSatProLinker); |
| 5725 |
} else { |
| 5726 |
applyELSERule(processIndi,conSatProLinker); |
| 5727 |
} |
| 5728 |
} |
| 5729 |
} |
| 5730 |
|
| 5731 |
|
| 5732 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyAutomatChooseRule(CIndividualSaturationProcessNode*& processIndi, CConceptSaturationProcessLinker* conSatProLinker) { |
| 5733 |
STATINC(AUTOMATEINITCOUNT,mCalcAlgContext); |
| 5734 |
CConceptSaturationDescriptor* conDes = conSatProLinker->getConceptSaturationDescriptor(); |
| 5735 |
bool conNegation = conDes->getNegation(); |
| 5736 |
CConcept* concept = conDes->getConcept(); |
| 5737 |
CSortedNegLinker<CConcept*>* conceptOpLinkerIt = concept->getOperandList(); |
| 5738 |
while (conceptOpLinkerIt) { |
| 5739 |
CConcept* opConcept = conceptOpLinkerIt->getData(); |
| 5740 |
bool opNegation = conceptOpLinkerIt->isNegated(); |
| 5741 |
if (opNegation == conNegation) { |
| 5742 |
addConceptFilteredToIndividual(opConcept,false,processIndi,false,mCalcAlgContext); |
| 5743 |
} |
| 5744 |
conceptOpLinkerIt = conceptOpLinkerIt->getNext(); |
| 5745 |
} |
| 5746 |
} |
| 5747 |
|
| 5748 |
|
| 5749 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyDATATYPERule(CIndividualSaturationProcessNode*& processIndi, CConceptSaturationProcessLinker* conProLinker) { |
| 5750 |
|
| 5751 |
CConceptSaturationDescriptor* conDes = conProLinker->getConceptSaturationDescriptor(); |
| 5752 |
CConcept* concept = conDes->getConcept(); |
| 5753 |
CDatatype* datatype = concept->getDatatype(); |
| 5754 |
|
| 5755 |
if (datatype && datatype->getDatatypeTag() != 1) { |
| 5756 |
|
| 5757 |
CSaturationIndividualNodeDatatypeData* appliedDatatypeData = processIndi->getAppliedDatatypeData(true); |
| 5758 |
if (!appliedDatatypeData->getAppliedDatatype()) { |
| 5759 |
processIndi->setDataValueApplied(true); |
| 5760 |
|
| 5761 |
bool dataValueTriviallySat = true; |
| 5762 |
bool dataValueTriviallyUnsat = false; |
| 5763 |
|
| 5764 |
if (dataValueTriviallySat && !dataValueTriviallyUnsat) { |
| 5765 |
handleDatatypeValueSpaceTriggers(processIndi, datatype, dataValueTriviallySat, dataValueTriviallyUnsat, mCalcAlgContext); |
| 5766 |
} |
| 5767 |
|
| 5768 |
|
| 5769 |
if (dataValueTriviallyUnsat) { |
| 5770 |
updateDirectAddingIndividualStatusFlags(processIndi, CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGCLASHED, mCalcAlgContext); |
| 5771 |
} else if (!dataValueTriviallySat) { |
| 5772 |
updateDirectAddingIndividualStatusFlags(processIndi, CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT, mCalcAlgContext); |
| 5773 |
setInsufficientNodeOccured(mCalcAlgContext); |
| 5774 |
} |
| 5775 |
|
| 5776 |
appliedDatatypeData->setAppliedDatatype(datatype); |
| 5777 |
} else if (datatype != appliedDatatypeData->getAppliedDatatype()) { |
| 5778 |
updateDirectAddingIndividualStatusFlags(processIndi, CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT, mCalcAlgContext); |
| 5779 |
setInsufficientNodeOccured(mCalcAlgContext); |
| 5780 |
} |
| 5781 |
} |
| 5782 |
} |
| 5783 |
|
| 5784 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyDATALITERALRule(CIndividualSaturationProcessNode*& processIndi, CConceptSaturationProcessLinker* conProLinker) { |
| 5785 |
CConceptSaturationDescriptor* conDes = conProLinker->getConceptSaturationDescriptor(); |
| 5786 |
bool conNegation = conDes->getNegation(); |
| 5787 |
CConcept* concept = conDes->getConcept(); |
| 5788 |
CDataLiteral* dataLiteral = concept->getDataLiteral(); |
| 5789 |
CDatatype* datatype = concept->getDatatype(); |
| 5790 |
|
| 5791 |
associateDataLiteralWithNode(processIndi, dataLiteral, datatype, mCalcAlgContext); |
| 5792 |
} |
| 5793 |
|
| 5794 |
|
| 5795 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::handleDatatypeValueSpaceTriggers(CIndividualSaturationProcessNode*& processIndi, CDatatype* datatype, bool &dataValueTriviallySat, bool &dataValueTriviallyUnsat, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5796 |
CDatatypeValueSpacesTriggers* valueSpaceTriggers = mCalcAlgContext->getUsedProcessingDataBox()->getOntology()->getDataBoxes()->getMBox()->getValueSpacesTriggers(false); |
| 5797 |
if (valueSpaceTriggers) { |
| 5798 |
CDatatypeValueSpaceTriggers* datatypeValueSpaceTrigger = valueSpaceTriggers->getValueSpaceTriggers(datatype->getValueSpaceType()); |
| 5799 |
if (datatypeValueSpaceTrigger) { |
| 5800 |
if (datatypeValueSpaceTrigger->getConceptTriggerCount() > 0) { |
| 5801 |
|
| 5802 |
bool triggersHandled = tryHandleDatatypeValueSpaceTriggers(processIndi, datatypeValueSpaceTrigger, valueSpaceTriggers, datatype, mCalcAlgContext); |
| 5803 |
|
| 5804 |
if (!triggersHandled) { |
| 5805 |
dataValueTriviallySat = false; |
| 5806 |
} |
| 5807 |
|
| 5808 |
} |
| 5809 |
} |
| 5810 |
} |
| 5811 |
|
| 5812 |
} |
| 5813 |
|
| 5814 |
|
| 5815 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::tryHandleDatatypeValueSpaceTriggers(CIndividualSaturationProcessNode*& processIndi, CDatatypeValueSpaceTriggers* datatypeValueSpaceTrigger, CDatatypeValueSpacesTriggers* valueSpaceTriggers, CDatatype* datatype, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5816 |
bool triggersHandled = false; |
| 5817 |
|
| 5818 |
if (datatype->getValueSpaceType()->getValueSpaceType() == CDatatypeValueSpaceType::VALUESPACESTRINGTYPE) { |
| 5819 |
CDatatypeValueSpaceStringTriggers* stringDatatypeValueSpaceTrigger = valueSpaceTriggers->getStringValueSpaceTriggers(); |
| 5820 |
if (!stringDatatypeValueSpaceTrigger->getNonLanguageTagConceptTriggeringData() || !stringDatatypeValueSpaceTrigger->getNonLanguageTagConceptTriggeringData()->hasPartialConceptTriggers()) { |
| 5821 |
if (!stringDatatypeValueSpaceTrigger->getValueSpaceTriggeringMap() || stringDatatypeValueSpaceTrigger->getValueSpaceTriggeringMap()->isEmpty()) { |
| 5822 |
|
| 5823 |
for (CDatatypeValueSpaceConceptTriggerLinker* triggerLinkerIt = datatypeValueSpaceTrigger->getValueSpaceConceptTriggeringData()->getPartialConceptTriggerLinker(); triggerLinkerIt; triggerLinkerIt = triggerLinkerIt->getNext()) { |
| 5824 |
addConceptFilteredToIndividual(triggerLinkerIt->getTriggerConcept(), false, processIndi, calcAlgContext); |
| 5825 |
} |
| 5826 |
triggersHandled = true; |
| 5827 |
|
| 5828 |
} |
| 5829 |
} |
| 5830 |
|
| 5831 |
|
| 5832 |
} |
| 5833 |
|
| 5834 |
return triggersHandled; |
| 5835 |
} |
| 5836 |
|
| 5837 |
|
| 5838 |
|
| 5839 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::associateDataLiteralWithNode(CIndividualSaturationProcessNode*& processIndi, CDataLiteral* dataLiteral, CDatatype* datatype, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5840 |
|
| 5841 |
CSaturationIndividualNodeDatatypeData* appliedDatatypeData = processIndi->getAppliedDatatypeData(true); |
| 5842 |
if (!datatype) { |
| 5843 |
datatype = dataLiteral->getDatatype(); |
| 5844 |
} else if (datatype != dataLiteral->getDatatype()) { |
| 5845 |
updateDirectAddingIndividualStatusFlags(processIndi,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,mCalcAlgContext); |
| 5846 |
setInsufficientNodeOccured(mCalcAlgContext); |
| 5847 |
} |
| 5848 |
|
| 5849 |
if (!appliedDatatypeData->getAppliedDatatype()) { |
| 5850 |
processIndi->setDataValueApplied(true); |
| 5851 |
appliedDatatypeData->setAppliedDatatype(datatype); |
| 5852 |
} else if (datatype != appliedDatatypeData->getAppliedDatatype()) { |
| 5853 |
updateDirectAddingIndividualStatusFlags(processIndi,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,mCalcAlgContext); |
| 5854 |
setInsufficientNodeOccured(mCalcAlgContext); |
| 5855 |
} |
| 5856 |
|
| 5857 |
if (!appliedDatatypeData->getAppliedDataLiteral()) { |
| 5858 |
processIndi->setDataValueApplied(true); |
| 5859 |
appliedDatatypeData->setAppliedDataLiteral(dataLiteral); |
| 5860 |
|
| 5861 |
CDataLiteralValue* dataLitValue = dataLiteral->getDataLiteralValue(); |
| 5862 |
|
| 5863 |
|
| 5864 |
bool dataValueTriviallySat = true; |
| 5865 |
bool dataValueTriviallyUnsat = false; |
| 5866 |
|
| 5867 |
if (!dataLitValue && datatype) { |
| 5868 |
dataValueTriviallySat = false; |
| 5869 |
} |
| 5870 |
|
| 5871 |
if (dataValueTriviallySat && !dataValueTriviallyUnsat && datatype) { |
| 5872 |
handleDatatypeValueSpaceTriggers(processIndi, datatype, dataValueTriviallySat, dataValueTriviallyUnsat, calcAlgContext); |
| 5873 |
} |
| 5874 |
|
| 5875 |
|
| 5876 |
|
| 5877 |
|
| 5878 |
if (dataValueTriviallySat && !dataValueTriviallyUnsat && datatype) { |
| 5879 |
bool valueValid = false; |
| 5880 |
CDatatype::DATATYPE_TYPE datatypeType = datatype->getDatatypeType(); |
| 5881 |
if (datatypeType == CDatatype::DT_BOOLEAN) { |
| 5882 |
CDataLiteralBooleanValue* booleanDataLitValue = dynamic_cast<CDataLiteralBooleanValue*>(dataLitValue); |
| 5883 |
if (booleanDataLitValue) { |
| 5884 |
valueValid = true; |
| 5885 |
} |
| 5886 |
} else if (datatypeType == CDatatype::DT_FLOAT) { |
| 5887 |
CDataLiteralFloatValue* floatDataLitValue = dynamic_cast<CDataLiteralFloatValue*>(dataLitValue); |
| 5888 |
if (floatDataLitValue) { |
| 5889 |
valueValid = true; |
| 5890 |
} |
| 5891 |
} else if (datatypeType == CDatatype::DT_DOUBLE) { |
| 5892 |
CDataLiteralDoubleValue* doubleDataLitValue = dynamic_cast<CDataLiteralDoubleValue*>(dataLitValue); |
| 5893 |
if (doubleDataLitValue) { |
| 5894 |
valueValid = true; |
| 5895 |
} |
| 5896 |
} else if (datatypeType == CDatatype::DT_PLAINLITERAL) { |
| 5897 |
CDataLiteralStringValue* stringDataLitValue = dynamic_cast<CDataLiteralStringValue*>(dataLitValue); |
| 5898 |
if (stringDataLitValue) { |
| 5899 |
valueValid = true; |
| 5900 |
} |
| 5901 |
} else if (datatypeType == CDatatype::DT_STRING) { |
| 5902 |
CDataLiteralStringValue* stringDataLitValue = dynamic_cast<CDataLiteralStringValue*>(dataLitValue); |
| 5903 |
if (stringDataLitValue) { |
| 5904 |
if (stringDataLitValue->hasLanguageTag()) { |
| 5905 |
dataValueTriviallyUnsat = true; |
| 5906 |
} else { |
| 5907 |
valueValid = true; |
| 5908 |
} |
| 5909 |
} |
| 5910 |
} else if (datatypeType == CDatatype::DT_RATIONAL) { |
| 5911 |
CDataLiteralRealValue* realDataLitValue = dynamic_cast<CDataLiteralRealValue*>(dataLitValue); |
| 5912 |
if (realDataLitValue) { |
| 5913 |
if (realDataLitValue->hasFlag(CDataLiteralRealValue::DLRV_RATIONAL_FLAG)) { |
| 5914 |
valueValid = true; |
| 5915 |
} else { |
| 5916 |
dataValueTriviallyUnsat = true; |
| 5917 |
} |
| 5918 |
} |
| 5919 |
} else if (datatypeType == CDatatype::DT_DECIMAL) { |
| 5920 |
CDataLiteralRealValue* realDataLitValue = dynamic_cast<CDataLiteralRealValue*>(dataLitValue); |
| 5921 |
if (realDataLitValue) { |
| 5922 |
if (realDataLitValue->hasFlag(CDataLiteralRealValue::DLRV_DECIMAL_FLAG)) { |
| 5923 |
valueValid = true; |
| 5924 |
} else { |
| 5925 |
dataValueTriviallyUnsat = true; |
| 5926 |
} |
| 5927 |
} |
| 5928 |
} else if (datatypeType == CDatatype::DT_INTEGER) { |
| 5929 |
CDataLiteralRealValue* realDataLitValue = dynamic_cast<CDataLiteralRealValue*>(dataLitValue); |
| 5930 |
if (realDataLitValue) { |
| 5931 |
if (realDataLitValue->hasFlag(CDataLiteralRealValue::DLRV_INTEGER_FLAG)) { |
| 5932 |
valueValid = true; |
| 5933 |
} else { |
| 5934 |
dataValueTriviallyUnsat = true; |
| 5935 |
} |
| 5936 |
} |
| 5937 |
} |
| 5938 |
|
| 5939 |
if (!valueValid) { |
| 5940 |
dataValueTriviallySat = false; |
| 5941 |
} |
| 5942 |
} |
| 5943 |
|
| 5944 |
|
| 5945 |
if (dataValueTriviallyUnsat) { |
| 5946 |
updateDirectAddingIndividualStatusFlags(processIndi,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGCLASHED,mCalcAlgContext); |
| 5947 |
} else if (!dataValueTriviallySat) { |
| 5948 |
updateDirectAddingIndividualStatusFlags(processIndi, CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT, mCalcAlgContext); |
| 5949 |
setInsufficientNodeOccured(mCalcAlgContext); |
| 5950 |
} |
| 5951 |
|
| 5952 |
} else if (dataLiteral != appliedDatatypeData->getAppliedDataLiteral()) { |
| 5953 |
updateDirectAddingIndividualStatusFlags(processIndi,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,mCalcAlgContext); |
| 5954 |
setInsufficientNodeOccured(mCalcAlgContext); |
| 5955 |
} |
| 5956 |
|
| 5957 |
|
| 5958 |
|
| 5959 |
} |
| 5960 |
|
| 5961 |
|
| 5962 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyANDRule(CIndividualSaturationProcessNode*& processIndi, CConceptSaturationProcessLinker* conSatProLinker) { |
| 5963 |
STATINC(ANDRULEAPPLICATIONCOUNT,mCalcAlgContext); |
| 5964 |
CConceptSaturationDescriptor* conDes = conSatProLinker->getConceptSaturationDescriptor(); |
| 5965 |
bool conNegation = conDes->getNegation(); |
| 5966 |
CConcept* concept = conDes->getConcept(); |
| 5967 |
CSortedNegLinker<CConcept*>* conceptOpLinkerIt = concept->getOperandList(); |
| 5968 |
addConceptsFilteredToIndividual(conceptOpLinkerIt,conNegation,processIndi,false,mCalcAlgContext); |
| 5969 |
} |
| 5970 |
|
| 5971 |
|
| 5972 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyNONERule(CIndividualSaturationProcessNode*& processIndi, CConceptSaturationProcessLinker* conSatProLinker) { |
| 5973 |
} |
| 5974 |
|
| 5975 |
|
| 5976 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyIMPLICATIONRule(CIndividualSaturationProcessNode*& processIndi, CConceptSaturationProcessLinker* conSatProLinker) { |
| 5977 |
STATINC(ANDRULEAPPLICATIONCOUNT,mCalcAlgContext); |
| 5978 |
CConceptSaturationDescriptor* conDes = conSatProLinker->getConceptSaturationDescriptor(); |
| 5979 |
CImplicationReapplyConceptSaturationDescriptor tmpNewReapplyImpReapplyConSatDes; |
| 5980 |
CConcept* implConcept = conDes->getConcept(); |
| 5981 |
CSortedNegLinker<CConcept*>* nextTriggerConcept = implConcept->getOperandList(); |
| 5982 |
tmpNewReapplyImpReapplyConSatDes.initImplicationReapllyConceptSaturationDescriptor(implConcept,nextTriggerConcept); |
| 5983 |
updateImplicationReapplyConceptSaturationDescriptor(&tmpNewReapplyImpReapplyConSatDes,processIndi,processIndi->getReapplyConceptSaturationLabelSet(true),mCalcAlgContext); |
| 5984 |
} |
| 5985 |
|
| 5986 |
|
| 5987 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyNotDATATYPERule(CIndividualSaturationProcessNode*& processIndi, CConceptSaturationProcessLinker* conProLinker) { |
| 5988 |
updateDirectAddingIndividualStatusFlags(processIndi,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,mCalcAlgContext); |
| 5989 |
setInsufficientNodeOccured(mCalcAlgContext); |
| 5990 |
applyORRule(processIndi,conProLinker); |
| 5991 |
} |
| 5992 |
|
| 5993 |
|
| 5994 |
|
| 5995 |
CConcept* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getDisjunctCheckingConcept(CConcept* opConcept, bool opConNegation, bool* checkingNegation, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 5996 |
if (opConcept->getOperatorCode() == CCAQCHOOCE) { |
| 5997 |
cint64 replaceCount = 0; |
| 5998 |
CConcept* replaceCheckingConcept = nullptr; |
| 5999 |
CSortedNegLinker<CConcept*>* opConceptOpLinkerIt = opConcept->getOperandList(); |
| 6000 |
while (opConceptOpLinkerIt) { |
| 6001 |
CConcept* opOpConcept = opConceptOpLinkerIt->getData(); |
| 6002 |
bool opOpNegation = opConceptOpLinkerIt->isNegated(); |
| 6003 |
if (opOpNegation == opConNegation) { |
| 6004 |
replaceCheckingConcept = opOpConcept; |
| 6005 |
replaceCount++; |
| 6006 |
} |
| 6007 |
opConceptOpLinkerIt = opConceptOpLinkerIt->getNext(); |
| 6008 |
} |
| 6009 |
|
| 6010 |
if (replaceCount == 1 && replaceCheckingConcept) { |
| 6011 |
if (checkingNegation) { |
| 6012 |
*checkingNegation = false; |
| 6013 |
} |
| 6014 |
return replaceCheckingConcept; |
| 6015 |
} |
| 6016 |
} |
| 6017 |
return opConcept; |
| 6018 |
} |
| 6019 |
|
| 6020 |
|
| 6021 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyORRule(CIndividualSaturationProcessNode*& processIndi, CConceptSaturationProcessLinker* conSatProLinker) { |
| 6022 |
CConceptSaturationDescriptor* conDes = conSatProLinker->getConceptSaturationDescriptor(); |
| 6023 |
bool conNegation = conDes->getNegation(); |
| 6024 |
CConcept* concept = conDes->getConcept(); |
| 6025 |
if (concept->getOperandCount() == 0) { |
| 6026 |
updateDirectAddingIndividualStatusFlags(processIndi,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGCLASHED,mCalcAlgContext); |
| 6027 |
} else if (concept->getOperandCount() == 1) { |
| 6028 |
STATINC(ANDRULEAPPLICATIONCOUNT,mCalcAlgContext); |
| 6029 |
CSortedNegLinker<CConcept*>* conceptOpLinkerIt = concept->getOperandList(); |
| 6030 |
addConceptsFilteredToIndividual(conceptOpLinkerIt,conNegation,processIndi,false,mCalcAlgContext); |
| 6031 |
} else { |
| 6032 |
updateDirectAddingIndividualStatusFlags(processIndi,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGCRITICAL,mCalcAlgContext); |
| 6033 |
addCriticalConceptDescriptor(conDes,CCriticalSaturationConceptTypeQueues::CCT_DISJUNCTION,processIndi,mCalcAlgContext); |
| 6034 |
CSaturationConceptDataItem* conceptSatItem = (CSaturationConceptDataItem*)processIndi->getSaturationConceptReferenceLinking(); |
| 6035 |
if (conceptSatItem) { |
| 6036 |
CConcept* indiConcept = conceptSatItem->getSaturationConcept(); |
| 6037 |
bool indiConNegation = conceptSatItem->getSaturationNegation(); |
| 6038 |
|
| 6039 |
if (concept == indiConcept && conNegation == indiConNegation) { |
| 6040 |
initializeExtractDisjunctCommonConcept(processIndi,mCalcAlgContext); |
| 6041 |
} else { |
| 6042 |
if (indiConcept) { |
| 6043 |
CConceptProcessData* disjunctionConProData = (CConceptProcessData*)concept->getConceptData(); |
| 6044 |
CConceptSaturationReferenceLinkingData* disjConRefLinking = (CConceptSaturationReferenceLinkingData*)disjunctionConProData->getConceptReferenceLinking(); |
| 6045 |
if (disjConRefLinking) { |
| 6046 |
CSaturationConceptDataItem* disjConceptSatItem = (CSaturationConceptDataItem*)disjConRefLinking->getConceptSaturationReferenceLinkingData(conNegation); |
| 6047 |
if (disjConceptSatItem) { |
| 6048 |
CIndividualSaturationProcessNode* disjunctionIndiNode = (CIndividualSaturationProcessNode*)disjConceptSatItem->getIndividualProcessNodeForConcept(); |
| 6049 |
|
| 6050 |
bool separatedMode = processIndi->isSeparated() && !disjunctionIndiNode->isSeparated(); |
| 6051 |
if (!separatedMode) { |
| 6052 |
addUninitializedIndividualToProcessingQueue(disjunctionIndiNode,mCalcAlgContext); |
| 6053 |
} |
| 6054 |
|
| 6055 |
CMemoryAllocationManager* taskMemMan = mCalcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 6056 |
bool requiresDisjunctionProcessing = true; |
| 6057 |
CIndividualSaturationProcessNode* copiedIndividualNode = processIndi->getCopyIndividualNode(); |
| 6058 |
if (copiedIndividualNode) { |
| 6059 |
CReapplyConceptSaturationLabelSet* copiedNodeConSet = copiedIndividualNode->getReapplyConceptSaturationLabelSet(false); |
| 6060 |
if (copiedNodeConSet->containsConcept(concept,conNegation)) { |
| 6061 |
requiresDisjunctionProcessing = false; |
| 6062 |
++mDisjunctionInitializedSkippedCount; |
| 6063 |
} |
| 6064 |
} |
| 6065 |
|
| 6066 |
if (requiresDisjunctionProcessing) { |
| 6067 |
if (!separatedMode) { |
| 6068 |
CXNegLinker<CIndividualSaturationProcessNode*>* depCopyLinker = CObjectAllocator< CXNegLinker<CIndividualSaturationProcessNode*> >::allocateAndConstruct(taskMemMan); |
| 6069 |
depCopyLinker->initNegLinker(processIndi,false); |
| 6070 |
disjunctionIndiNode->addCopyDependingIndividualNodeLinker(depCopyLinker); |
| 6071 |
} |
| 6072 |
|
| 6073 |
// add already extracted common disjunct concepts |
| 6074 |
CReapplyConceptSaturationLabelSet* disjConSet = disjunctionIndiNode->getReapplyConceptSaturationLabelSet(false); |
| 6075 |
if (disjConSet) { |
| 6076 |
CReapplyConceptSaturationLabelSet* conSet = processIndi->getReapplyConceptSaturationLabelSet(true); |
| 6077 |
for (CConceptSaturationDescriptor* disjConDesIt = disjConSet->getConceptSaturationDescriptionLinker(); disjConDesIt; disjConDesIt = disjConDesIt->getNextConceptDesciptor()) { |
| 6078 |
addConceptToIndividual(disjConDesIt->getConcept(),disjConDesIt->isNegated(),processIndi,conSet,true,mCalcAlgContext); |
| 6079 |
} |
| 6080 |
} |
| 6081 |
} |
| 6082 |
} |
| 6083 |
} |
| 6084 |
} |
| 6085 |
} |
| 6086 |
} |
| 6087 |
} |
| 6088 |
} |
| 6089 |
|
| 6090 |
|
| 6091 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyELSERule(CIndividualSaturationProcessNode*& processIndi, CConceptSaturationProcessLinker* conSatProLinker) { |
| 6092 |
updateDirectAddingIndividualStatusFlags(processIndi,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,mCalcAlgContext); |
| 6093 |
setInsufficientNodeOccured(mCalcAlgContext); |
| 6094 |
} |
| 6095 |
|
| 6096 |
|
| 6097 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyATMOSTRule(CIndividualSaturationProcessNode*& processIndi, CConceptSaturationProcessLinker* conSatProLinker) { |
| 6098 |
STATINC(ATMOSTRULEAPPLICATIONCOUNT,mCalcAlgContext); |
| 6099 |
CConceptSaturationDescriptor* conDes = conSatProLinker->getConceptSaturationDescriptor(); |
| 6100 |
bool conNegation = conDes->getNegation(); |
| 6101 |
CConcept* concept = conDes->getConcept(); |
| 6102 |
CRole* role = concept->getRole(); |
| 6103 |
cint64 cardinality = concept->getParameter() - 1*conNegation; |
| 6104 |
if (cardinality < 0) { |
| 6105 |
updateDirectAddingIndividualStatusFlags(processIndi,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGCLASHED,mCalcAlgContext); |
| 6106 |
} else { |
| 6107 |
updateMaxCardinalityCandidates(processIndi,0,cardinality,mCalcAlgContext); |
| 6108 |
updateDirectAddingIndividualStatusFlags(processIndi,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGCARDINALITYRESTRICTED,mCalcAlgContext); |
| 6109 |
if (cardinality == 1) { |
| 6110 |
if (!concept->getOperandList()) { |
| 6111 |
addFUNCTIONALConceptExtensionProcessingRole(role,processIndi,mCalcAlgContext); |
| 6112 |
} else { |
| 6113 |
addQualifiedFUNCTIONALAtmostConceptExtensionProcessing(conDes,processIndi,mCalcAlgContext); |
| 6114 |
} |
| 6115 |
} |
| 6116 |
addCriticalConceptDescriptor(conDes,CCriticalSaturationConceptTypeQueues::CCT_ATMOST,processIndi,mCalcAlgContext); |
| 6117 |
} |
| 6118 |
} |
| 6119 |
|
| 6120 |
|
| 6121 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyATLEASTRule(CIndividualSaturationProcessNode*& processIndi, CConceptSaturationProcessLinker* conSatProLinker) { |
| 6122 |
STATINC(ATLEASTRULEAPPLICATIONCOUNT,mCalcAlgContext); |
| 6123 |
CConceptSaturationDescriptor* conDes = conSatProLinker->getConceptSaturationDescriptor(); |
| 6124 |
bool conNegation = conDes->getNegation(); |
| 6125 |
CConcept* concept = conDes->getConcept(); |
| 6126 |
CRole* role = concept->getRole(); |
| 6127 |
cint64 cardinality = concept->getParameter() + 1*conNegation; |
| 6128 |
if (cardinality > 0) { |
| 6129 |
updateMaxCardinalityCandidates(processIndi,cardinality,0,mCalcAlgContext); |
| 6130 |
createSuccessorForConcept(processIndi,conSatProLinker,cardinality,mCalcAlgContext); |
| 6131 |
} |
| 6132 |
} |
| 6133 |
|
| 6134 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyEQCANDRule(CIndividualSaturationProcessNode*& processIndi, CConceptSaturationProcessLinker* conSatProLinker) { |
| 6135 |
CConceptSaturationDescriptor* conDes = conSatProLinker->getConceptSaturationDescriptor(); |
| 6136 |
addCriticalConceptDescriptor(conDes,CCriticalSaturationConceptTypeQueues::CCT_EQCANDIDATE,processIndi,mCalcAlgContext); |
| 6137 |
} |
| 6138 |
|
| 6139 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyBOTTOMRule(CIndividualSaturationProcessNode*& processIndi, CConceptSaturationProcessLinker* conProLinker) { |
| 6140 |
updateDirectAddingIndividualStatusFlags(processIndi,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGCLASHED,mCalcAlgContext); |
| 6141 |
} |
| 6142 |
|
| 6143 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyALLRule(CIndividualSaturationProcessNode*& processIndi, CConceptSaturationProcessLinker* conSatProLinker) { |
| 6144 |
STATINC(ALLRULEAPPLICATIONCOUNT,mCalcAlgContext); |
| 6145 |
CConceptSaturationDescriptor* conDes = conSatProLinker->getConceptSaturationDescriptor(); |
| 6146 |
bool conNegation = conDes->getNegation(); |
| 6147 |
CConcept* concept = conDes->getConcept(); |
| 6148 |
CRole* role = concept->getRole(); |
| 6149 |
|
| 6150 |
CMemoryAllocationManager* taskMemMan = mCalcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 6151 |
CRoleBackwardSaturationPropagationHash* backPropHash = processIndi->getRoleBackwardPropagationHash(true); |
| 6152 |
CBackwardSaturationPropagationReapplyDescriptor* backPropReapplyDes = CObjectAllocator<CBackwardSaturationPropagationReapplyDescriptor>::allocateAndConstruct(taskMemMan); |
| 6153 |
backPropReapplyDes->initBackwardPropagationReapplyDescriptor(conDes); |
| 6154 |
CRoleBackwardSaturationPropagationHashData& backPropHashData = backPropHash->addBackwardPropagationConceptDescriptor(role,backPropReapplyDes); |
| 6155 |
CBackwardSaturationPropagationLink* backPropLinkIt = backPropHashData.mLinkLinker; |
| 6156 |
|
| 6157 |
|
| 6158 |
if (backPropLinkIt) { |
| 6159 |
while (backPropLinkIt) { |
| 6160 |
CIndividualSaturationProcessNode* backPropIndiNode = backPropLinkIt->getSourceIndividual(); |
| 6161 |
|
| 6162 |
CSortedNegLinker<CConcept*>* conceptOpLinkerIt = concept->getOperandList(); |
| 6163 |
while (conceptOpLinkerIt) { |
| 6164 |
CConcept* opConcept = conceptOpLinkerIt->getData(); |
| 6165 |
bool opConNegation = conceptOpLinkerIt->isNegated()^conNegation; |
| 6166 |
STATINC(ALLROLERESTRICTIONCOUNT,mCalcAlgContext); |
| 6167 |
addConceptFilteredToIndividual(opConcept,opConNegation,backPropIndiNode,true,mCalcAlgContext); |
| 6168 |
conceptOpLinkerIt = conceptOpLinkerIt->getNext(); |
| 6169 |
} |
| 6170 |
backPropLinkIt = backPropLinkIt->getNext(); |
| 6171 |
} |
| 6172 |
} |
| 6173 |
|
| 6174 |
CConceptProcessData* conProData = (CConceptProcessData*)concept->getConceptData(); |
| 6175 |
if (role->isDataRole() || conProData) { |
| 6176 |
if (role->isDataRole() || conProData->hasPropagationIntoCreationDirection()) { |
| 6177 |
addALLConceptExtensionProcessingRole(role, backPropHashData, processIndi, mCalcAlgContext); |
| 6178 |
updateDirectAddingIndividualStatusFlags(processIndi, CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGCRITICAL, mCalcAlgContext); |
| 6179 |
addCriticalConceptDescriptor(conDes, CCriticalSaturationConceptTypeQueues::CCT_FORALL, processIndi, mCalcAlgContext); |
| 6180 |
} else { |
| 6181 |
// if node has unregistered propagation, then mark node for checking all propagations in the end |
| 6182 |
CRoleProcessData* roleProData = (CRoleProcessData*)role->getRoleData(); |
| 6183 |
if (!roleProData || roleProData->hasPropagationAndCreationConceptsFlag()) { |
| 6184 |
updateDirectAddingIndividualStatusFlags(processIndi, CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGUNREGISTEREDPROPAGATION, mCalcAlgContext); |
| 6185 |
} |
| 6186 |
} |
| 6187 |
} |
| 6188 |
|
| 6189 |
|
| 6190 |
|
| 6191 |
} |
| 6192 |
|
| 6193 |
|
| 6194 |
|
| 6195 |
|
| 6196 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addALLConceptExtensionProcessingRole(CRole* role, CRoleBackwardSaturationPropagationHashData& backPropHashData, CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6197 |
if (mConfALLConceptsExtensionProcessing) { |
| 6198 |
if (!backPropHashData.mRoleALLConceptsProcessingQueued) { |
| 6199 |
backPropHashData.mRoleALLConceptsProcessingQueued = true; |
| 6200 |
CSaturationIndividualNodeSuccessorExtensionData* succExtData = indiProcSatNode->getSuccessorExtensionData(true); |
| 6201 |
CSaturationIndividualNodeALLConceptsExtensionData* succIndiALLConExtData = succExtData->getALLConceptsExtensionData(true); |
| 6202 |
addSuccessorExtensionToProcessingQueue(indiProcSatNode,calcAlgContext); |
| 6203 |
|
| 6204 |
|
| 6205 |
if (succIndiALLConExtData->isSuccessorExtensionInitialized()) { |
| 6206 |
if (!succIndiALLConExtData->hasProcessLinkerForRole(role)) { |
| 6207 |
|
| 6208 |
//QString indiDebugNameString = getDebugIndividualConceptName(indiProcSatNode,calcAlgContext); |
| 6209 |
//if (indiDebugNameString == "http://www.co-ode.org/ontologies/galen#Atlas" || indiDebugNameString == "http://www.co-ode.org/ontologies/galen#CervicalSpine") { |
| 6210 |
// bool debug = true; |
| 6211 |
//} |
| 6212 |
|
| 6213 |
CRoleSaturationProcessLinker* roleProcessLinker = createRoleSaturationProcessLinker(calcAlgContext); |
| 6214 |
roleProcessLinker->initRoleProcessLinker(role); |
| 6215 |
succIndiALLConExtData->addRoleProcessLinker(roleProcessLinker); |
| 6216 |
} |
| 6217 |
} |
| 6218 |
} |
| 6219 |
} |
| 6220 |
} |
| 6221 |
|
| 6222 |
|
| 6223 |
|
| 6224 |
|
| 6225 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addFUNCTIONALConceptExtensionProcessingRole(CRole* role, CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6226 |
if (mConfFUNCTIONALConceptsExtensionProcessing) { |
| 6227 |
CSaturationIndividualNodeSuccessorExtensionData* succExtData = indiProcSatNode->getSuccessorExtensionData(true); |
| 6228 |
CSaturationIndividualNodeFUNCTIONALConceptsExtensionData* succIndiFUNCTIONALConExtData = succExtData->getFUNCTIONALConceptsExtensionData(true); |
| 6229 |
addSuccessorExtensionToProcessingQueue(indiProcSatNode,calcAlgContext); |
| 6230 |
|
| 6231 |
if (!succIndiFUNCTIONALConExtData->hasFunctionalityAddedProcessLinkerForRole(role)) { |
| 6232 |
CRoleSaturationProcessLinker* roleProcessLinker = createRoleSaturationProcessLinker(calcAlgContext); |
| 6233 |
roleProcessLinker->initRoleProcessLinker(role); |
| 6234 |
succIndiFUNCTIONALConExtData->addFunctionalityAddedRoleProcessLinker(roleProcessLinker); |
| 6235 |
} |
| 6236 |
} |
| 6237 |
} |
| 6238 |
|
| 6239 |
|
| 6240 |
|
| 6241 |
|
| 6242 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addQualifiedFUNCTIONALAtmostConceptExtensionProcessing(CConceptSaturationDescriptor* conDes, CIndividualSaturationProcessNode*& indiProcSatNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6243 |
if (mConfFUNCTIONALConceptsExtensionProcessing) { |
| 6244 |
CSaturationIndividualNodeSuccessorExtensionData* succExtData = indiProcSatNode->getSuccessorExtensionData(true); |
| 6245 |
CSaturationIndividualNodeFUNCTIONALConceptsExtensionData* succIndiFUNCTIONALConExtData = succExtData->getFUNCTIONALConceptsExtensionData(true); |
| 6246 |
addSuccessorExtensionToProcessingQueue(indiProcSatNode,calcAlgContext); |
| 6247 |
|
| 6248 |
if (!succIndiFUNCTIONALConExtData->hasQualifiedFunctionalAtmostConceptProcessLinkerForConcept(conDes)) { |
| 6249 |
CConceptSaturationProcessLinker* conProcessLinker = createConceptSaturationProcessLinker(calcAlgContext); |
| 6250 |
conProcessLinker->initConceptSaturationProcessLinker(conDes); |
| 6251 |
succIndiFUNCTIONALConExtData->addQualifiedFunctionalAtmostConceptProcessLinker(conProcessLinker); |
| 6252 |
} |
| 6253 |
} |
| 6254 |
} |
| 6255 |
|
| 6256 |
|
| 6257 |
|
| 6258 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addNewLinkedExtensionProcessingRole(CRole* role, CIndividualSaturationProcessNode*& indiProcSatNode, bool queueALLExtension, bool queueFUNCTIONALExtension, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6259 |
|
| 6260 |
if (mConfConceptsExtensionProcessing) { |
| 6261 |
CSaturationIndividualNodeSuccessorExtensionData* succExtData = indiProcSatNode->getSuccessorExtensionData(false); |
| 6262 |
if (succExtData) { |
| 6263 |
CSaturationIndividualNodeALLConceptsExtensionData* succIndiALLConExtData = succExtData->getALLConceptsExtensionData(false); |
| 6264 |
CSaturationIndividualNodeFUNCTIONALConceptsExtensionData* succIndiFUNCTIONALConExtData = succExtData->getFUNCTIONALConceptsExtensionData(false); |
| 6265 |
bool succExtensionInitialized = false; |
| 6266 |
bool succALLExtensionInitialized = false; |
| 6267 |
bool succFUNCTIONALExtensionInitialized = false; |
| 6268 |
if (succIndiALLConExtData) { |
| 6269 |
if (succIndiALLConExtData->isSuccessorExtensionInitialized()) { |
| 6270 |
succExtensionInitialized = true; |
| 6271 |
succALLExtensionInitialized = true; |
| 6272 |
} |
| 6273 |
} |
| 6274 |
if (succIndiFUNCTIONALConExtData) { |
| 6275 |
if (succIndiFUNCTIONALConExtData->isSuccessorExtensionInitialized()) { |
| 6276 |
succExtensionInitialized = true; |
| 6277 |
succFUNCTIONALExtensionInitialized = true; |
| 6278 |
} |
| 6279 |
} |
| 6280 |
|
| 6281 |
if (succExtensionInitialized) { |
| 6282 |
|
| 6283 |
CLinkedRoleSaturationSuccessorHash* linkedSuccHash = indiProcSatNode->getLinkedRoleSuccessorHash(false); |
| 6284 |
if (linkedSuccHash) { |
| 6285 |
CLinkedRoleSaturationSuccessorData*& succData = linkedSuccHash->getLinkedRoleSuccessorData(role,true); |
| 6286 |
if (succData) { |
| 6287 |
bool queueProcessing = false; |
| 6288 |
if (succALLExtensionInitialized && !succData->mRoleALLConceptsProcessingQueued && queueALLExtension) { |
| 6289 |
|
| 6290 |
bool allQueueingRequired = succData->mRoleALLConceptsQueuingRequired; |
| 6291 |
if (!allQueueingRequired) { |
| 6292 |
CRoleBackwardSaturationPropagationHash* backwardPropHash = indiProcSatNode->getRoleBackwardPropagationHash(false); |
| 6293 |
if (backwardPropHash) { |
| 6294 |
CPROCESSHASH<CRole*,CRoleBackwardSaturationPropagationHashData>* backwardPropDataHash = backwardPropHash->getRoleBackwardPropagationDataHash(); |
| 6295 |
CRoleBackwardSaturationPropagationHashData* backwardPropData(backwardPropDataHash->valuePointer(role)); |
| 6296 |
if (backwardPropData && backwardPropData->mReapplyLinker) { |
| 6297 |
allQueueingRequired = true; |
| 6298 |
succData->mRoleALLConceptsQueuingRequired = true; |
| 6299 |
} |
| 6300 |
} |
| 6301 |
} |
| 6302 |
|
| 6303 |
if (allQueueingRequired) { |
| 6304 |
succData->mRoleALLConceptsProcessingQueued = true; |
| 6305 |
queueProcessing = true; |
| 6306 |
|
| 6307 |
if (succIndiALLConExtData->isSuccessorExtensionInitialized()) { |
| 6308 |
if (!succIndiALLConExtData->hasProcessLinkerForRole(role)) { |
| 6309 |
CRoleSaturationProcessLinker* roleProcessLinker = createRoleSaturationProcessLinker(calcAlgContext); |
| 6310 |
roleProcessLinker->initRoleProcessLinker(role); |
| 6311 |
succIndiALLConExtData->addRoleProcessLinker(roleProcessLinker); |
| 6312 |
} |
| 6313 |
} |
| 6314 |
} |
| 6315 |
} |
| 6316 |
|
| 6317 |
if (succFUNCTIONALExtensionInitialized && !succData->mRoleFUNCTIONALConceptsProcessingQueued && succData->mRoleFUNCTIONALConceptsQueuingRequired /*&& succData->mSuccCount > 1 */&& queueFUNCTIONALExtension) { |
| 6318 |
succData->mRoleFUNCTIONALConceptsProcessingQueued = true; |
| 6319 |
queueProcessing = true; |
| 6320 |
|
| 6321 |
if (succIndiFUNCTIONALConExtData->isSuccessorExtensionInitialized()) { |
| 6322 |
if (!succIndiFUNCTIONALConExtData->hasLinkedSuccessorAddedProcessLinkerForRole(role)) { |
| 6323 |
CRoleSaturationProcessLinker* roleProcessLinker = createRoleSaturationProcessLinker(calcAlgContext); |
| 6324 |
roleProcessLinker->initRoleProcessLinker(role); |
| 6325 |
succIndiFUNCTIONALConExtData->addLinkedSuccessorAddedRoleProcessLinker(roleProcessLinker); |
| 6326 |
} |
| 6327 |
if (!succIndiFUNCTIONALConExtData->hasLinkedPredecessorAddedProcessLinkerForRole(role)) { |
| 6328 |
CRoleSaturationProcessLinker* roleProcessLinker = createRoleSaturationProcessLinker(calcAlgContext); |
| 6329 |
roleProcessLinker->initRoleProcessLinker(role); |
| 6330 |
succIndiFUNCTIONALConExtData->addLinkedPredecessorAddedRoleProcessLinker(roleProcessLinker); |
| 6331 |
} |
| 6332 |
} |
| 6333 |
} |
| 6334 |
|
| 6335 |
|
| 6336 |
if (queueProcessing) { |
| 6337 |
addSuccessorExtensionToProcessingQueue(indiProcSatNode,calcAlgContext); |
| 6338 |
} |
| 6339 |
} |
| 6340 |
} |
| 6341 |
} |
| 6342 |
} |
| 6343 |
} |
| 6344 |
} |
| 6345 |
|
| 6346 |
|
| 6347 |
|
| 6348 |
|
| 6349 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::loadConsistenceModelData(CCalculationAlgorithmContext* calcAlgContext) { |
| 6350 |
bool consCompGraphAvailable = false; |
| 6351 |
if (!mCachedCompletionGraphLoaded) { |
| 6352 |
CProcessingDataBox* processingDataBox = calcAlgContext->getProcessingDataBox(); |
| 6353 |
CConcreteOntology* ontology = processingDataBox->getOntology(); |
| 6354 |
CConsistence* consistence = ontology->getConsistence(); |
| 6355 |
if (consistence) { |
| 6356 |
CConsistenceData* consData = consistence->getConsistenceModelData(); |
| 6357 |
if (consData) { |
| 6358 |
CConsistenceTaskData* consTaskData = dynamic_cast<CConsistenceTaskData*>(consData); |
| 6359 |
if (consTaskData) { |
| 6360 |
CSatisfiableCalculationTask* detSatCalcTask = consTaskData->getDeterministicSatisfiableTask(); |
| 6361 |
CSatisfiableCalculationTask* compGraphCachedCalcTask = consTaskData->getCompletionGraphCachedSatisfiableTask(); |
| 6362 |
if (detSatCalcTask) { |
| 6363 |
mDetCachedCGIndiVector = detSatCalcTask->getProcessingDataBox()->getIndividualProcessNodeVector(); |
| 6364 |
mDetConsistencyCG = true; |
| 6365 |
} else { |
| 6366 |
mDetConsistencyCG = false; |
| 6367 |
} |
| 6368 |
if (compGraphCachedCalcTask && compGraphCachedCalcTask != detSatCalcTask) { |
| 6369 |
mNonDetCachedCGIndiVector = compGraphCachedCalcTask->getProcessingDataBox()->getIndividualProcessNodeVector(); |
| 6370 |
mNonDetConsistencyCG = true; |
| 6371 |
} else { |
| 6372 |
mNonDetConsistencyCG = false; |
| 6373 |
} |
| 6374 |
} |
| 6375 |
} |
| 6376 |
} |
| 6377 |
mCachedCompletionGraphLoaded = true; |
| 6378 |
} |
| 6379 |
if (mDetConsistencyCG) { |
| 6380 |
consCompGraphAvailable = true; |
| 6381 |
} else { |
| 6382 |
mCachedCompletionGraphMissing = true; |
| 6383 |
} |
| 6384 |
return consCompGraphAvailable; |
| 6385 |
} |
| 6386 |
|
| 6387 |
|
| 6388 |
|
| 6389 |
|
| 6390 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::loadConsistenceRepresentativeData(CCalculationAlgorithmContext* calcAlgContext) { |
| 6391 |
bool consRepDataAvailable = false; |
| 6392 |
if (!mRepresentativeDataLoaded) { |
| 6393 |
mRepresentativeDataAvailable = false; |
| 6394 |
CProcessingDataBox* processingDataBox = calcAlgContext->getProcessingDataBox(); |
| 6395 |
CConcreteOntology* ontology = processingDataBox->getOntology(); |
| 6396 |
CConsistence* consistence = ontology->getConsistence(); |
| 6397 |
if (consistence) { |
| 6398 |
mRepresentativeDataAvailable = consistence->areIndividualsRepresentativelyStored(); |
| 6399 |
} |
| 6400 |
mRepresentativeDataLoaded = true; |
| 6401 |
} |
| 6402 |
consRepDataAvailable = mRepresentativeDataAvailable; |
| 6403 |
return consRepDataAvailable; |
| 6404 |
} |
| 6405 |
|
| 6406 |
|
| 6407 |
|
| 6408 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::isConsistenceDataAvailable(CCalculationAlgorithmContext* calcAlgContext) { |
| 6409 |
if (loadConsistenceModelData(calcAlgContext) || loadConsistenceRepresentativeData(calcAlgContext)) { |
| 6410 |
return true; |
| 6411 |
} |
| 6412 |
return false; |
| 6413 |
} |
| 6414 |
|
| 6415 |
|
| 6416 |
|
| 6417 |
|
| 6418 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addNominalDependentIndividualNode(cint64 nominalID, CIndividualSaturationProcessNode* dependentIndiNode, CSaturationNominalDependentNodeData::NOMINALCONNECTIONTYPE connectionType, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6419 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 6420 |
CSaturationNominalDependentNodeHash* nominalDependentNodeHash = processingDataBox->getSaturationNominalDependentNodeHash(true); |
| 6421 |
nominalDependentNodeHash->addNominalDependentNode(nominalID,dependentIndiNode,connectionType); |
| 6422 |
CSaturationInfluencedNominalSet* influencedNominalSet = processingDataBox->getSaturationInfluencedNominalSet(true); |
| 6423 |
if (influencedNominalSet->isNominalInfluenced(nominalID)) { |
| 6424 |
// insufficient |
| 6425 |
updateDirectAddingIndividualStatusFlags(dependentIndiNode,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,calcAlgContext); |
| 6426 |
setInsufficientNodeOccured(calcAlgContext); |
| 6427 |
} |
| 6428 |
} |
| 6429 |
|
| 6430 |
|
| 6431 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addInfluencedNominal(cint64 influencedNominalID, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6432 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 6433 |
CSaturationInfluencedNominalSet* influencedNominalSet = processingDataBox->getSaturationInfluencedNominalSet(true); |
| 6434 |
bool firstInfluence = influencedNominalSet->setNominalInfluenced(influencedNominalID); |
| 6435 |
if (firstInfluence) { |
| 6436 |
CSaturationNominalDependentNodeHash* nominalDependentNodeHash = processingDataBox->getSaturationNominalDependentNodeHash(true); |
| 6437 |
for (CSaturationNominalDependentNodeData* nominalDepNodeDataIt = nominalDependentNodeHash->getNominalDependentNodeData(influencedNominalID); nominalDepNodeDataIt; nominalDepNodeDataIt = nominalDepNodeDataIt->getNext()) { |
| 6438 |
CIndividualSaturationProcessNode* dependentIndSatProcNode = nominalDepNodeDataIt->getDependentIndividualSaturationNode(); |
| 6439 |
// insufficient |
| 6440 |
updateDirectAddingIndividualStatusFlags(dependentIndSatProcNode,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,calcAlgContext); |
| 6441 |
setInsufficientNodeOccured(calcAlgContext); |
| 6442 |
} |
| 6443 |
} |
| 6444 |
} |
| 6445 |
|
| 6446 |
|
| 6447 |
|
| 6448 |
CIndividualProcessNode* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getCorrectedNode(cint64 individualID, CIndividualProcessNodeVector* indiVec, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6449 |
CIndividualProcessNode* indiNode = nullptr; |
| 6450 |
if (indiVec) { |
| 6451 |
indiNode = indiVec->getData(-individualID); |
| 6452 |
if (indiNode && indiNode->getMergedIntoIndividualNodeID() != indiNode->getIndividualNodeID()) { |
| 6453 |
indiNode = indiVec->getData(indiNode->getMergedIntoIndividualNodeID()); |
| 6454 |
} |
| 6455 |
} |
| 6456 |
return indiNode; |
| 6457 |
} |
| 6458 |
|
| 6459 |
|
| 6460 |
|
| 6461 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyVALUERule(CIndividualSaturationProcessNode*& processIndi, CConceptSaturationProcessLinker* conSatProLinker) { |
| 6462 |
STATINC(VALUERULEAPPLICATIONCOUNT,mCalcAlgContext); |
| 6463 |
CConceptSaturationDescriptor* conDes = conSatProLinker->getConceptSaturationDescriptor(); |
| 6464 |
bool conNegation = conDes->getNegation(); |
| 6465 |
CConcept* concept = conDes->getConcept(); |
| 6466 |
CRole* role = concept->getRole(); |
| 6467 |
CIndividual* nominalIndividual = concept->getNominalIndividual(); |
| 6468 |
cint64 nominalID = nominalIndividual->getIndividualID(); |
| 6469 |
|
| 6470 |
if (mConfNominalProcessing) { |
| 6471 |
updateDirectAddingIndividualStatusFlags(processIndi,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGNOMINALCONNECTION,mCalcAlgContext); |
| 6472 |
updateAddingSuccessorConnectedNominal(processIndi,nominalID,mCalcAlgContext); |
| 6473 |
|
| 6474 |
if (isConsistenceDataAvailable(mCalcAlgContext)) { |
| 6475 |
|
| 6476 |
CIndividualProcessNode* nominalProcessNode = getCorrectedNode(nominalID,mDetCachedCGIndiVector,mCalcAlgContext); |
| 6477 |
if (nominalProcessNode) { |
| 6478 |
|
| 6479 |
bool nominalInfluenced = false; |
| 6480 |
bool insufficientNominalConnection = false; |
| 6481 |
|
| 6482 |
CReapplyRoleSuccessorHash* nominalReapplyRoleSuccHash = nominalProcessNode->getReapplyRoleSuccessorHash(false); |
| 6483 |
for (CSortedNegLinker<CRole*>* superRoleIt = role->getIndirectSuperRoleList(); superRoleIt; superRoleIt = superRoleIt->getNext()) { |
| 6484 |
CRole* superRole = superRoleIt->getData(); |
| 6485 |
bool inversedSuperRole = superRoleIt->isNegated(); |
| 6486 |
|
| 6487 |
if (superRole->hasDisjointRoles()) { |
| 6488 |
insufficientNominalConnection = true; |
| 6489 |
} |
| 6490 |
|
| 6491 |
CIndividualSaturationProcessNodeStatusFlags* directStatFlags = processIndi->getDirectStatusFlags(); |
| 6492 |
|
| 6493 |
for (CSortedNegLinker<CConcept*>* domainConLinkerIt = superRole->getDomainRangeConceptList(inversedSuperRole); domainConLinkerIt; domainConLinkerIt = domainConLinkerIt->getNext()) { |
| 6494 |
CConcept* domainConcept = domainConLinkerIt->getData(); |
| 6495 |
bool domainConceptNegation = domainConLinkerIt->isNegated(); |
| 6496 |
addConceptFilteredToIndividual(domainConcept,domainConceptNegation,processIndi,mCalcAlgContext); |
| 6497 |
} |
| 6498 |
|
| 6499 |
for (CSortedNegLinker<CConcept*>* rangeConLinkerIt = superRole->getDomainRangeConceptList(!inversedSuperRole); rangeConLinkerIt && !directStatFlags->hasInsufficientFlag(); rangeConLinkerIt = rangeConLinkerIt->getNext()) { |
| 6500 |
CConcept* rangeConcept = rangeConLinkerIt->getData(); |
| 6501 |
bool rangeConceptNegation = rangeConLinkerIt->isNegated(); |
| 6502 |
CReapplyConceptLabelSet* nominalConSet = nominalProcessNode->getReapplyConceptLabelSet(false); |
| 6503 |
if (!nominalConSet || !nominalConSet->containsConcept(rangeConcept,rangeConceptNegation)) { |
| 6504 |
nominalInfluenced = true; |
| 6505 |
} |
| 6506 |
} |
| 6507 |
|
| 6508 |
if (inversedSuperRole) { |
| 6509 |
if (nominalReapplyRoleSuccHash) { |
| 6510 |
|
| 6511 |
CReapplyQueueIterator reapplyRoleIt(nominalReapplyRoleSuccHash->getRoleReapplyIterator(superRole)); |
| 6512 |
while (reapplyRoleIt.hasNext()) { |
| 6513 |
CReapplyConceptDescriptor* reapplyDes = reapplyRoleIt.next(); |
| 6514 |
CConceptDescriptor* reapplyConDes = reapplyDes->getConceptDescriptor(); |
| 6515 |
CConcept* reapplyConcept = reapplyConDes->getConcept(); |
| 6516 |
bool reapplyConceptNegation = reapplyConDes->isNegated(); |
| 6517 |
cint64 reapplyConceptCode = reapplyConcept->getOperatorCode(); |
| 6518 |
CConceptOperator* reapplyConceptOperator = reapplyConcept->getConceptOperator(); |
| 6519 |
if (!reapplyConceptNegation && reapplyConceptOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_PROPAGATION_ALL_TYPE)) { |
| 6520 |
// cannot be handled with this algorithm, hence mark as insufficient |
| 6521 |
insufficientNominalConnection = true; |
| 6522 |
|
| 6523 |
} else if (!reapplyConceptNegation && reapplyConceptOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_ALL_AQALL_TYPE) || reapplyConceptNegation && reapplyConceptCode == CCSOME) { |
| 6524 |
for (CSortedNegLinker<CConcept*>* reapplyConceptOpLinkerIt = reapplyConcept->getOperandList(); reapplyConceptOpLinkerIt; reapplyConceptOpLinkerIt = reapplyConceptOpLinkerIt->getNext()) { |
| 6525 |
CConcept* reapplyOperandConcept = reapplyConceptOpLinkerIt->getData(); |
| 6526 |
bool reapplyOperandConceptNegation = reapplyConceptOpLinkerIt->isNegated()^reapplyConceptNegation; |
| 6527 |
addConceptFilteredToIndividual(reapplyOperandConcept,reapplyOperandConceptNegation,processIndi,mCalcAlgContext); |
| 6528 |
} |
| 6529 |
} else if (!reapplyConceptNegation && reapplyConceptOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_AQAND_TYPE)) { |
| 6530 |
addAutomateTransitionOperands(processIndi,reapplyConcept,role,mCalcAlgContext); |
| 6531 |
} else { |
| 6532 |
insufficientNominalConnection = true; |
| 6533 |
} |
| 6534 |
} |
| 6535 |
} |
| 6536 |
} |
| 6537 |
} |
| 6538 |
|
| 6539 |
|
| 6540 |
if (nominalInfluenced) { |
| 6541 |
insufficientNominalConnection = true; |
| 6542 |
if (!processIndi->getNominalIndividual()) { |
| 6543 |
addInfluencedNominal(nominalID,mCalcAlgContext); |
| 6544 |
} |
| 6545 |
} |
| 6546 |
|
| 6547 |
if (insufficientNominalConnection) { |
| 6548 |
updateDirectAddingIndividualStatusFlags(processIndi,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,mCalcAlgContext); |
| 6549 |
setInsufficientNodeOccured(mCalcAlgContext); |
| 6550 |
} |
| 6551 |
|
| 6552 |
|
| 6553 |
|
| 6554 |
if (mNonDetConsistencyCG) { |
| 6555 |
addCriticalConceptDescriptor(conDes,CCriticalSaturationConceptTypeQueues::CCT_VALUE,processIndi,mCalcAlgContext); |
| 6556 |
} |
| 6557 |
addNominalDependentIndividualNode(nominalID,processIndi,CSaturationNominalDependentNodeData::VALUECONNECTION,mCalcAlgContext); |
| 6558 |
|
| 6559 |
} else { |
| 6560 |
|
| 6561 |
bool nominalInfluenced = false; |
| 6562 |
bool insufficientNominalConnection = false; |
| 6563 |
|
| 6564 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* indiAssData = mBackendAssCaceHandler->getIndividualAssociationData(nominalIndividual,mCalcAlgContext); |
| 6565 |
|
| 6566 |
for (CSortedNegLinker<CRole*>* superRoleIt = role->getIndirectSuperRoleList(); superRoleIt; superRoleIt = superRoleIt->getNext()) { |
| 6567 |
CRole* superRole = superRoleIt->getData(); |
| 6568 |
bool inversedSuperRole = superRoleIt->isNegated(); |
| 6569 |
|
| 6570 |
if (superRole->hasDisjointRoles()) { |
| 6571 |
insufficientNominalConnection = true; |
| 6572 |
} |
| 6573 |
|
| 6574 |
CIndividualSaturationProcessNodeStatusFlags* directStatFlags = processIndi->getDirectStatusFlags(); |
| 6575 |
|
| 6576 |
for (CSortedNegLinker<CConcept*>* domainConLinkerIt = superRole->getDomainRangeConceptList(inversedSuperRole); domainConLinkerIt; domainConLinkerIt = domainConLinkerIt->getNext()) { |
| 6577 |
CConcept* domainConcept = domainConLinkerIt->getData(); |
| 6578 |
bool domainConceptNegation = domainConLinkerIt->isNegated(); |
| 6579 |
addConceptFilteredToIndividual(domainConcept,domainConceptNegation,processIndi,mCalcAlgContext); |
| 6580 |
} |
| 6581 |
|
| 6582 |
for (CSortedNegLinker<CConcept*>* rangeConLinkerIt = superRole->getDomainRangeConceptList(!inversedSuperRole); rangeConLinkerIt && !directStatFlags->hasInsufficientFlag(); rangeConLinkerIt = rangeConLinkerIt->getNext()) { |
| 6583 |
CConcept* rangeConcept = rangeConLinkerIt->getData(); |
| 6584 |
bool rangeConceptNegation = rangeConLinkerIt->isNegated(); |
| 6585 |
|
| 6586 |
if (!mBackendAssCaceHandler->hasConceptInAssociatedFullConceptSetLabel(indiAssData, indiAssData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL), rangeConcept, rangeConceptNegation, mCalcAlgContext)) { |
| 6587 |
nominalInfluenced = true; |
| 6588 |
} |
| 6589 |
} |
| 6590 |
|
| 6591 |
if (inversedSuperRole) { |
| 6592 |
|
| 6593 |
mBackendAssCaceHandler->visitConceptsOfAssociatedFullConceptSetLabel(indiAssData, indiAssData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL), [&](CConcept* reapplyConcept, bool reapplyConceptNegation, bool deterministic) -> bool { |
| 6594 |
|
| 6595 |
if (reapplyConcept->getRole() == superRole) { |
| 6596 |
cint64 reapplyConceptCode = reapplyConcept->getOperatorCode(); |
| 6597 |
CConceptOperator* reapplyConceptOperator = reapplyConcept->getConceptOperator(); |
| 6598 |
|
| 6599 |
if (!reapplyConceptNegation && reapplyConceptOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_PROPAGATION_ALL_TYPE)) { |
| 6600 |
// cannot be handled with this algorithm, hence mark as insufficient |
| 6601 |
insufficientNominalConnection = true; |
| 6602 |
|
| 6603 |
} else if (!reapplyConceptNegation && reapplyConceptOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_ALL_AQALL_TYPE) || reapplyConceptNegation && reapplyConceptCode == CCSOME) { |
| 6604 |
for (CSortedNegLinker<CConcept*>* reapplyConceptOpLinkerIt = reapplyConcept->getOperandList(); reapplyConceptOpLinkerIt; reapplyConceptOpLinkerIt = reapplyConceptOpLinkerIt->getNext()) { |
| 6605 |
CConcept* reapplyOperandConcept = reapplyConceptOpLinkerIt->getData(); |
| 6606 |
bool reapplyOperandConceptNegation = reapplyConceptOpLinkerIt->isNegated()^reapplyConceptNegation; |
| 6607 |
addConceptFilteredToIndividual(reapplyOperandConcept,reapplyOperandConceptNegation,processIndi,mCalcAlgContext); |
| 6608 |
} |
| 6609 |
} else if (!reapplyConceptNegation && reapplyConceptOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_AQAND_TYPE)) { |
| 6610 |
addAutomateTransitionOperands(processIndi,reapplyConcept,role,mCalcAlgContext); |
| 6611 |
} else { |
| 6612 |
insufficientNominalConnection = true; |
| 6613 |
} |
| 6614 |
} |
| 6615 |
return true; |
| 6616 |
|
| 6617 |
}, true, false, mCalcAlgContext); |
| 6618 |
|
| 6619 |
} |
| 6620 |
} |
| 6621 |
|
| 6622 |
|
| 6623 |
if (nominalInfluenced) { |
| 6624 |
insufficientNominalConnection = true; |
| 6625 |
if (!processIndi->getNominalIndividual()) { |
| 6626 |
addInfluencedNominal(nominalID,mCalcAlgContext); |
| 6627 |
} |
| 6628 |
} |
| 6629 |
|
| 6630 |
if (insufficientNominalConnection) { |
| 6631 |
updateDirectAddingIndividualStatusFlags(processIndi,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,mCalcAlgContext); |
| 6632 |
setInsufficientNodeOccured(mCalcAlgContext); |
| 6633 |
} |
| 6634 |
|
| 6635 |
addNominalDependentIndividualNode(nominalID,processIndi,CSaturationNominalDependentNodeData::VALUECONNECTION,mCalcAlgContext); |
| 6636 |
} |
| 6637 |
|
| 6638 |
} else { |
| 6639 |
|
| 6640 |
for (CSortedNegLinker<CRole*>* superRoleIt = role->getIndirectSuperRoleList(); superRoleIt; superRoleIt = superRoleIt->getNext()) { |
| 6641 |
CRole* superRole = superRoleIt->getData(); |
| 6642 |
bool inversedSuperRole = superRoleIt->isNegated(); |
| 6643 |
|
| 6644 |
for (CSortedNegLinker<CConcept*>* domainConLinkerIt = superRole->getDomainRangeConceptList(inversedSuperRole); domainConLinkerIt; domainConLinkerIt = domainConLinkerIt->getNext()) { |
| 6645 |
CConcept* domainConcept = domainConLinkerIt->getData(); |
| 6646 |
bool domainConceptNegation = domainConLinkerIt->isNegated(); |
| 6647 |
addConceptFilteredToIndividual(domainConcept, domainConceptNegation, processIndi, mCalcAlgContext); |
| 6648 |
} |
| 6649 |
} |
| 6650 |
|
| 6651 |
delayNominalSaturationConceptProcessing(processIndi,conSatProLinker,nominalID,mCalcAlgContext); |
| 6652 |
} |
| 6653 |
} else { |
| 6654 |
updateDirectAddingIndividualStatusFlags(processIndi,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,mCalcAlgContext); |
| 6655 |
setInsufficientNodeOccured(mCalcAlgContext); |
| 6656 |
} |
| 6657 |
|
| 6658 |
} |
| 6659 |
|
| 6660 |
|
| 6661 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::delayNominalSaturationConceptProcessing(CIndividualSaturationProcessNode* processIndi, CConceptSaturationProcessLinker* conProLinker, cint64 nominalID, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6662 |
propagateUnloadedABoxCompletionGraphDependentIndividualNodeFlag(processIndi,conProLinker,nominalID,calcAlgContext); |
| 6663 |
CConceptSaturationProcessLinker* nomDelayedConSatProcLinker = createConceptSaturationProcessLinker(calcAlgContext); |
| 6664 |
nomDelayedConSatProcLinker->initConceptSaturationProcessLinker(conProLinker->getConceptSaturationDescriptor()); |
| 6665 |
processIndi->getNominalHandlingData(true)->addDelayedNominalConceptSaturationProcessLinker(nomDelayedConSatProcLinker); |
| 6666 |
setDelayedNominalProcessingOccured(calcAlgContext); |
| 6667 |
} |
| 6668 |
|
| 6669 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addAutomateTransitionOperands(CIndividualSaturationProcessNode*& processIndi, CConcept* automatConcept, CRole* role, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6670 |
CConceptOperator* automatConceptOperator = automatConcept->getConceptOperator(); |
| 6671 |
if (automatConceptOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_AQAND_TYPE)) { |
| 6672 |
for (CSortedNegLinker<CConcept*>* automateConceptOpLinkerIt = automatConcept->getOperandList(); automateConceptOpLinkerIt; automateConceptOpLinkerIt = automateConceptOpLinkerIt->getNext()) { |
| 6673 |
CConcept* automateOperandConcept = automateConceptOpLinkerIt->getData(); |
| 6674 |
addAutomateTransitionOperands(processIndi,automateOperandConcept,role,calcAlgContext); |
| 6675 |
} |
| 6676 |
} else if (automatConceptOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_AQALL_TYPE)) { |
| 6677 |
CRole* automateRole = automatConcept->getRole(); |
| 6678 |
if (automateRole == role) { |
| 6679 |
for (CSortedNegLinker<CConcept*>* automateConceptOpLinkerIt = automatConcept->getOperandList(); automateConceptOpLinkerIt; automateConceptOpLinkerIt = automateConceptOpLinkerIt->getNext()) { |
| 6680 |
CConcept* automateOperandConcept = automateConceptOpLinkerIt->getData(); |
| 6681 |
bool automateOperandConceptNegation = automateConceptOpLinkerIt->isNegated(); |
| 6682 |
addConceptFilteredToIndividual(automateOperandConcept,automateOperandConceptNegation,processIndi,calcAlgContext); |
| 6683 |
} |
| 6684 |
} |
| 6685 |
} |
| 6686 |
} |
| 6687 |
|
| 6688 |
|
| 6689 |
|
| 6690 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::testAutomateTransitionOperandsAddable(CIndividualSaturationProcessNode*& processIndi, CConcept* automatConcept, CRole* role, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6691 |
CConceptOperator* automatConceptOperator = automatConcept->getConceptOperator(); |
| 6692 |
if (automatConceptOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_AQAND_TYPE)) { |
| 6693 |
for (CSortedNegLinker<CConcept*>* automateConceptOpLinkerIt = automatConcept->getOperandList(); automateConceptOpLinkerIt; automateConceptOpLinkerIt = automateConceptOpLinkerIt->getNext()) { |
| 6694 |
CConcept* automateOperandConcept = automateConceptOpLinkerIt->getData(); |
| 6695 |
if (testAutomateTransitionOperandsAddable(processIndi,automateOperandConcept,role,calcAlgContext)) { |
| 6696 |
return true; |
| 6697 |
} |
| 6698 |
} |
| 6699 |
} else if (automatConceptOperator->hasPartialOperatorCodeFlag(CConceptOperator::CCFS_AQALL_TYPE)) { |
| 6700 |
CRole* automateRole = automatConcept->getRole(); |
| 6701 |
if (automateRole == role) { |
| 6702 |
CReapplyConceptSaturationLabelSet* conSet = processIndi->getReapplyConceptSaturationLabelSet(false); |
| 6703 |
for (CSortedNegLinker<CConcept*>* automateConceptOpLinkerIt = automatConcept->getOperandList(); automateConceptOpLinkerIt; automateConceptOpLinkerIt = automateConceptOpLinkerIt->getNext()) { |
| 6704 |
CConcept* automateOperandConcept = automateConceptOpLinkerIt->getData(); |
| 6705 |
bool automateOperandConceptNegation = automateConceptOpLinkerIt->isNegated(); |
| 6706 |
if (!conSet->containsConcept(automateOperandConcept,automateOperandConceptNegation)) { |
| 6707 |
return true; |
| 6708 |
} |
| 6709 |
} |
| 6710 |
} |
| 6711 |
} |
| 6712 |
return false; |
| 6713 |
} |
| 6714 |
|
| 6715 |
|
| 6716 |
|
| 6717 |
|
| 6718 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyNOMINALRule(CIndividualSaturationProcessNode*& processIndi, CConceptSaturationProcessLinker* conSatProLinker) { |
| 6719 |
STATINC(NOMINALRULEAPPLICATIONCOUNT,mCalcAlgContext); |
| 6720 |
CConceptSaturationDescriptor* conDes = conSatProLinker->getConceptSaturationDescriptor(); |
| 6721 |
bool conNegation = conDes->getNegation(); |
| 6722 |
CConcept* concept = conDes->getConcept(); |
| 6723 |
CRole* role = concept->getRole(); |
| 6724 |
CIndividual* nominalIndividual = concept->getNominalIndividual(); |
| 6725 |
cint64 nominalID = nominalIndividual->getIndividualID(); |
| 6726 |
|
| 6727 |
|
| 6728 |
//mEndSaturationDebugIndiModelString = generateExtendedDebugIndiModelStringList(mCalcAlgContext); |
| 6729 |
//QFile tmpFile("saturation-model.txt"); |
| 6730 |
//if (tmpFile.open(QIODevice::WriteOnly)) { |
| 6731 |
// tmpFile.write(mEndSaturationDebugIndiModelString.replace("<br>","").replace("<p>","\n").toLocal8Bit()); |
| 6732 |
// tmpFile.close(); |
| 6733 |
//} |
| 6734 |
|
| 6735 |
if (!processIndi->hasNominalIntegrated()) { |
| 6736 |
processIndi->setIntegratedNominal(nominalIndividual); |
| 6737 |
} |
| 6738 |
if (mConfNominalProcessing) { |
| 6739 |
updateDirectAddingIndividualStatusFlags(processIndi,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGNOMINALCONNECTION,mCalcAlgContext); |
| 6740 |
updateAddingSuccessorConnectedNominal(processIndi,nominalID,mCalcAlgContext); |
| 6741 |
|
| 6742 |
|
| 6743 |
for (CXLinker<CIndividualSaturationProcessNode*>* multipleCardinalityAncestorNodesLinkerIt = processIndi->getMultipleCardinalityAncestorNodesLinker(); multipleCardinalityAncestorNodesLinkerIt; multipleCardinalityAncestorNodesLinkerIt = multipleCardinalityAncestorNodesLinkerIt->getNext()) { |
| 6744 |
CIndividualSaturationProcessNode* multipleCardinalityAncestorNode = multipleCardinalityAncestorNodesLinkerIt->getData(); |
| 6745 |
updateDirectAddingIndividualStatusFlags(multipleCardinalityAncestorNode,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGCLASHED,mCalcAlgContext); |
| 6746 |
} |
| 6747 |
|
| 6748 |
|
| 6749 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* indiAssData = nullptr; |
| 6750 |
|
| 6751 |
if (isConsistenceDataAvailable(mCalcAlgContext)) { |
| 6752 |
CIndividualProcessNode* nominalProcessNode = getCorrectedNode(nominalID,mDetCachedCGIndiVector,mCalcAlgContext); |
| 6753 |
|
| 6754 |
if (nominalProcessNode) { |
| 6755 |
CReapplyConceptLabelSet* nominalConSet = nominalProcessNode->getReapplyConceptLabelSet(false); |
| 6756 |
if (nominalConSet) { |
| 6757 |
|
| 6758 |
bool nominalInfluenced = false; |
| 6759 |
CReapplyConceptSaturationLabelSet* satConSet = processIndi->getReapplyConceptSaturationLabelSet(false); |
| 6760 |
for (CConceptSaturationDescriptor* satConDesIt = satConSet->getConceptSaturationDescriptionLinker(); satConDesIt && !nominalInfluenced; satConDesIt = satConDesIt->getNext()) { |
| 6761 |
CConcept* satConcept = satConDesIt->getConcept(); |
| 6762 |
bool satConceptNegation = satConDesIt->isNegated(); |
| 6763 |
if (!nominalConSet->containsConcept(satConcept,satConceptNegation)) { |
| 6764 |
nominalInfluenced = true; |
| 6765 |
} |
| 6766 |
} |
| 6767 |
|
| 6768 |
if (nominalInfluenced) { |
| 6769 |
if (!processIndi->getNominalIndividual()) { |
| 6770 |
addInfluencedNominal(nominalID,mCalcAlgContext); |
| 6771 |
} |
| 6772 |
} |
| 6773 |
|
| 6774 |
for (CConceptDescriptor* nominalConDesIt = nominalConSet->getAddingSortedConceptDescriptionLinker(); nominalConDesIt; nominalConDesIt = nominalConDesIt->getNextConceptDesciptor()) { |
| 6775 |
CConcept* nominalConcept = nominalConDesIt->getConcept(); |
| 6776 |
bool nominalConceptNegation = nominalConDesIt->isNegated(); |
| 6777 |
addConceptFilteredToIndividual(nominalConcept,nominalConceptNegation,processIndi,mCalcAlgContext); |
| 6778 |
} |
| 6779 |
} |
| 6780 |
|
| 6781 |
if (mNonDetConsistencyCG) { |
| 6782 |
addCriticalConceptDescriptor(conDes,CCriticalSaturationConceptTypeQueues::CCT_NOMINAL,processIndi,mCalcAlgContext); |
| 6783 |
} |
| 6784 |
} else { |
| 6785 |
|
| 6786 |
CBackendRepresentativeMemoryCacheIndividualAssociationData* indiAssData = mBackendAssCaceHandler->getIndividualAssociationData(nominalIndividual,mCalcAlgContext); |
| 6787 |
if (indiAssData) { |
| 6788 |
CBackendRepresentativeMemoryLabelCacheItem* labelCacheItem = indiAssData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL); |
| 6789 |
if (labelCacheItem) { |
| 6790 |
bool nominalInfluenced = false; |
| 6791 |
CReapplyConceptSaturationLabelSet* satConSet = processIndi->getReapplyConceptSaturationLabelSet(false); |
| 6792 |
for (CConceptSaturationDescriptor* satConDesIt = satConSet->getConceptSaturationDescriptionLinker(); satConDesIt && !nominalInfluenced; satConDesIt = satConDesIt->getNext()) { |
| 6793 |
CConcept* satConcept = satConDesIt->getConcept(); |
| 6794 |
bool satConceptNegation = satConDesIt->isNegated(); |
| 6795 |
|
| 6796 |
if (satConceptNegation || satConcept->getOperatorCode() != CCNOMINAL || satConcept->getNominalIndividual() != nominalIndividual) { |
| 6797 |
|
| 6798 |
if (!mBackendAssCaceHandler->hasConceptInAssociatedFullConceptSetLabel(indiAssData, labelCacheItem, satConcept, satConceptNegation, mCalcAlgContext)) { |
| 6799 |
nominalInfluenced = true; |
| 6800 |
} |
| 6801 |
|
| 6802 |
} |
| 6803 |
|
| 6804 |
} |
| 6805 |
if (nominalInfluenced) { |
| 6806 |
if (!processIndi->getNominalIndividual()) { |
| 6807 |
addInfluencedNominal(nominalID,mCalcAlgContext); |
| 6808 |
} |
| 6809 |
} |
| 6810 |
|
| 6811 |
|
| 6812 |
mBackendAssCaceHandler->visitConceptsOfAssociatedFullConceptSetLabel(indiAssData, indiAssData->getLabelCacheEntry(CBackendRepresentativeMemoryLabelCacheItem::FULL_CONCEPT_SET_LABEL), [&](CConcept* addConcept, bool addConceptNegation, bool determinstic)->bool { |
| 6813 |
addConceptFilteredToIndividual(addConcept, addConceptNegation, processIndi, mCalcAlgContext); |
| 6814 |
return true; |
| 6815 |
}, true, false, mCalcAlgContext); |
| 6816 |
|
| 6817 |
} |
| 6818 |
} |
| 6819 |
} |
| 6820 |
addNominalDependentIndividualNode(nominalID,processIndi,CSaturationNominalDependentNodeData::NOMINALCONNECTION,mCalcAlgContext); |
| 6821 |
|
| 6822 |
} else { |
| 6823 |
delayNominalSaturationConceptProcessing(processIndi,conSatProLinker,nominalID,mCalcAlgContext); |
| 6824 |
} |
| 6825 |
} else { |
| 6826 |
updateDirectAddingIndividualStatusFlags(processIndi,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,mCalcAlgContext); |
| 6827 |
setInsufficientNodeOccured(mCalcAlgContext); |
| 6828 |
} |
| 6829 |
|
| 6830 |
} |
| 6831 |
|
| 6832 |
|
| 6833 |
|
| 6834 |
|
| 6835 |
|
| 6836 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::propagateUnloadedABoxCompletionGraphDependentIndividualNodeFlag(CIndividualSaturationProcessNode* processIndi, CConceptSaturationProcessLinker* conProLinker, cint64 nominalID, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6837 |
updateDirectAddingIndividualStatusFlags(processIndi,CIndividualSaturationProcessNodeStatusFlags::INDMISSEDABOXCONSISTENCYDATA,calcAlgContext); |
| 6838 |
} |
| 6839 |
|
| 6840 |
|
| 6841 |
|
| 6842 |
|
| 6843 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applySELFRule(CIndividualSaturationProcessNode*& processIndi, CConceptSaturationProcessLinker* conSatProLinker) { |
| 6844 |
STATINC(SELFRULEAPPLICATIONCOUNT,mCalcAlgContext); |
| 6845 |
CConceptSaturationDescriptor* conDes = conSatProLinker->getConceptSaturationDescriptor(); |
| 6846 |
bool conNegation = conDes->getNegation(); |
| 6847 |
CConcept* concept = conDes->getConcept(); |
| 6848 |
CRole* role = concept->getRole(); |
| 6849 |
CSortedNegLinker<CConcept*>* conceptOpLinkerIt = concept->getOperandList(); |
| 6850 |
|
| 6851 |
|
| 6852 |
CMemoryAllocationManager* taskMemMan = nullptr; |
| 6853 |
CRoleBackwardSaturationPropagationHash* backPropHash = nullptr; |
| 6854 |
CReapplyConceptSaturationLabelSet* conSet = nullptr; |
| 6855 |
CSortedNegLinker<CRole*>* superRoleIt = role->getIndirectSuperRoleList(); |
| 6856 |
while (superRoleIt) { |
| 6857 |
CRole* superRole = superRoleIt->getData(); |
| 6858 |
CSortedNegLinker<CConcept*>* domainConLinker = superRole->getDomainRangeConceptList(superRoleIt->isNegated()); |
| 6859 |
for (CSortedNegLinker<CConcept*>* domainConLinkerIt = domainConLinker; domainConLinkerIt; domainConLinkerIt = domainConLinkerIt->getNext()) { |
| 6860 |
CConcept* domainConcept = domainConLinkerIt->getData(); |
| 6861 |
bool domainConceptNegation = domainConLinkerIt->isNegated(); |
| 6862 |
if (!conSet) { |
| 6863 |
conSet = processIndi->getReapplyConceptSaturationLabelSet(true); |
| 6864 |
} |
| 6865 |
addConceptFilteredToIndividual(domainConcept,domainConceptNegation,processIndi,conSet,false,mCalcAlgContext); |
| 6866 |
} |
| 6867 |
CSortedNegLinker<CConcept*>* rangeConLinker = superRole->getDomainRangeConceptList(!superRoleIt->isNegated()); |
| 6868 |
for (CSortedNegLinker<CConcept*>* rangeConLinkerIt = rangeConLinker; rangeConLinkerIt; rangeConLinkerIt = rangeConLinkerIt->getNext()) { |
| 6869 |
CConcept* rangeConcept = rangeConLinkerIt->getData(); |
| 6870 |
bool rangeConceptNegation = rangeConLinkerIt->isNegated(); |
| 6871 |
if (!conSet) { |
| 6872 |
conSet = processIndi->getReapplyConceptSaturationLabelSet(true); |
| 6873 |
} |
| 6874 |
addConceptFilteredToIndividual(rangeConcept,rangeConceptNegation,processIndi,conSet,false,mCalcAlgContext); |
| 6875 |
} |
| 6876 |
|
| 6877 |
if (!taskMemMan) { |
| 6878 |
taskMemMan = mCalcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 6879 |
} |
| 6880 |
CBackwardSaturationPropagationLink* backPropLink = CObjectAllocator<CBackwardSaturationPropagationLink>::allocateAndConstruct(taskMemMan); |
| 6881 |
backPropLink->initBackwardPropagationLink(processIndi,superRole); |
| 6882 |
|
| 6883 |
if (!backPropHash) { |
| 6884 |
backPropHash = processIndi->getRoleBackwardPropagationHash(true); |
| 6885 |
} |
| 6886 |
CBackwardSaturationPropagationReapplyDescriptor* backPropReapplyDes = backPropHash->addSelfConnectedBackwardPropagationLink(superRole,backPropLink); |
| 6887 |
if (backPropReapplyDes) { |
| 6888 |
applyBackwardPropagationConcepts(processIndi,backPropReapplyDes,mCalcAlgContext); |
| 6889 |
} |
| 6890 |
|
| 6891 |
superRoleIt = superRoleIt->getNext(); |
| 6892 |
} |
| 6893 |
} |
| 6894 |
|
| 6895 |
|
| 6896 |
|
| 6897 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::setDelayedNominalProcessingOccured(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6898 |
calcAlgContext->getUsedProcessingDataBox()->setDelayedNominalProcessingOccured(true); |
| 6899 |
} |
| 6900 |
|
| 6901 |
|
| 6902 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::setInsufficientNodeOccured(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6903 |
calcAlgContext->getUsedProcessingDataBox()->setInsufficientNodeOccured(true); |
| 6904 |
} |
| 6905 |
|
| 6906 |
|
| 6907 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::setProblematicEQCandidateOccured(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6908 |
calcAlgContext->getUsedProcessingDataBox()->setProblematicEQCandidateOccured(true); |
| 6909 |
} |
| 6910 |
|
| 6911 |
|
| 6912 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applySOMERule(CIndividualSaturationProcessNode*& processIndi, CConceptSaturationProcessLinker* conSatProLinker) { |
| 6913 |
STATINC(SOMERULEAPPLICATIONCOUNT,mCalcAlgContext); |
| 6914 |
createSuccessorForConcept(processIndi,conSatProLinker,1,mCalcAlgContext); |
| 6915 |
} |
| 6916 |
|
| 6917 |
|
| 6918 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::createSuccessorForConcept(CIndividualSaturationProcessNode*& processIndi, CConceptSaturationProcessLinker* conSatProLinker, cint64 cardinality, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 6919 |
CConceptSaturationDescriptor* conDes = conSatProLinker->getConceptSaturationDescriptor(); |
| 6920 |
bool conNegation = conDes->getNegation(); |
| 6921 |
CConcept* concept = conDes->getConcept(); |
| 6922 |
CRole* role = concept->getRole(); |
| 6923 |
CSortedNegLinker<CConcept*>* conceptOpLinkerIt = concept->getOperandList(); |
| 6924 |
|
| 6925 |
CIndividualSaturationProcessNode* existIndiNode = nullptr; |
| 6926 |
|
| 6927 |
bool specializedExistentialRestriction = false; |
| 6928 |
bool operandExistentialRestriction = false; |
| 6929 |
CConceptData* conceptData = concept->getConceptData(); |
| 6930 |
if (!existIndiNode && conceptData) { |
| 6931 |
CConceptProcessData* conProcData = (CConceptProcessData*)conceptData; |
| 6932 |
CConceptReferenceLinking* conRefLinking = conProcData->getConceptReferenceLinking(); |
| 6933 |
if (conRefLinking) { |
| 6934 |
CConceptSaturationReferenceLinkingData* confSatRefLinkingData = (CConceptSaturationReferenceLinkingData*)conRefLinking; |
| 6935 |
CSaturationConceptReferenceLinking* extSatCalcRefLinkData = confSatRefLinkingData->getExistentialSuccessorConceptSaturationReferenceLinkingData(); |
| 6936 |
if (extSatCalcRefLinkData) { |
| 6937 |
existIndiNode = (CIndividualSaturationProcessNode*)extSatCalcRefLinkData->getIndividualProcessNodeForConcept(); |
| 6938 |
} |
| 6939 |
} |
| 6940 |
} |
| 6941 |
|
| 6942 |
|
| 6943 |
|
| 6944 |
if (!existIndiNode && !specializedExistentialRestriction) { |
| 6945 |
while (!existIndiNode && conceptOpLinkerIt) { |
| 6946 |
CConcept* opConcept = conceptOpLinkerIt->getData(); |
| 6947 |
bool opConNegation = conceptOpLinkerIt->isNegated()^conNegation; |
| 6948 |
CConceptData* opConceptData = opConcept->getConceptData(); |
| 6949 |
KONCLUDE_ASSERT_X(opConceptData,"SOME saturation rule","concept data missing"); |
| 6950 |
if (opConceptData) { |
| 6951 |
CConceptProcessData* conProcData = (CConceptProcessData*)opConceptData; |
| 6952 |
CConceptReferenceLinking* conRefLinking = conProcData->getConceptReferenceLinking(); |
| 6953 |
KONCLUDE_ASSERT_X(conRefLinking,"SOME saturation rule","concept reference linking data missing"); |
| 6954 |
if (conRefLinking) { |
| 6955 |
CConceptSaturationReferenceLinkingData* confSatRefLinkingData = (CConceptSaturationReferenceLinkingData*)conRefLinking; |
| 6956 |
CSaturationConceptReferenceLinking* satCalcRefLinkData = confSatRefLinkingData->getConceptSaturationReferenceLinkingData(opConNegation); |
| 6957 |
if (satCalcRefLinkData) { |
| 6958 |
existIndiNode = (CIndividualSaturationProcessNode*)satCalcRefLinkData->getIndividualProcessNodeForConcept(); |
| 6959 |
} |
| 6960 |
} |
| 6961 |
} |
| 6962 |
conceptOpLinkerIt = conceptOpLinkerIt->getNext(); |
| 6963 |
} |
| 6964 |
} |
| 6965 |
|
| 6966 |
if (!existIndiNode && !specializedExistentialRestriction && !operandExistentialRestriction) { |
| 6967 |
CConcept* baseTopConcept = nullptr; |
| 6968 |
if (!role->isDataRole()) { |
| 6969 |
baseTopConcept = calcAlgContext->getUsedProcessingDataBox()->getOntologyTopConcept(); |
| 6970 |
} else { |
| 6971 |
baseTopConcept = calcAlgContext->getUsedProcessingDataBox()->getOntologyTopDataRangeConcept(); |
| 6972 |
} |
| 6973 |
CConcept* opConcept = baseTopConcept; |
| 6974 |
bool opConNegation = false; |
| 6975 |
CConceptData* opConceptData = opConcept->getConceptData(); |
| 6976 |
CConceptProcessData* conProcData = (CConceptProcessData*)opConceptData; |
| 6977 |
CConceptReferenceLinking* conRefLinking = conProcData->getConceptReferenceLinking(); |
| 6978 |
KONCLUDE_ASSERT_X(conRefLinking,"SOME saturation rule","concept reference linking data missing"); |
| 6979 |
if (conRefLinking) { |
| 6980 |
CConceptSaturationReferenceLinkingData* confSatRefLinkingData = (CConceptSaturationReferenceLinkingData*)conRefLinking; |
| 6981 |
CSaturationConceptReferenceLinking* satCalcRefLinkData = confSatRefLinkingData->getConceptSaturationReferenceLinkingData(opConNegation); |
| 6982 |
if (satCalcRefLinkData) { |
| 6983 |
existIndiNode = (CIndividualSaturationProcessNode*)satCalcRefLinkData->getIndividualProcessNodeForConcept(); |
| 6984 |
} |
| 6985 |
} |
| 6986 |
} |
| 6987 |
|
| 6988 |
|
| 6989 |
KONCLUDE_ASSERT_X(existIndiNode,"SOME saturation rule","concept reference linked individual node missing"); |
| 6990 |
if (existIndiNode) { |
| 6991 |
|
| 6992 |
|
| 6993 |
bool separatedMode = processIndi->isSeparated() && !existIndiNode->isSeparated(); |
| 6994 |
if (!separatedMode) { |
| 6995 |
addUninitializedIndividualToProcessingQueue(existIndiNode,mCalcAlgContext); |
| 6996 |
} |
| 6997 |
|
| 6998 |
updateIndirectAddingIndividualStatusFlags(processIndi,existIndiNode->getIndirectStatusFlags(),mCalcAlgContext); |
| 6999 |
updateAddingSuccessorConnectedNominal(processIndi,existIndiNode->getSuccessorConnectedNominalSet(false),mCalcAlgContext); |
| 7000 |
updateMaxCardinalityCandidates(processIndi,existIndiNode->getMaxAtleastCardinalityCandidate(),existIndiNode->getMaxAtmostCardinalityCandidate(),mCalcAlgContext); |
| 7001 |
|
| 7002 |
|
| 7003 |
CMemoryAllocationManager* taskMemMan = mCalcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 7004 |
if (cardinality > 1) { |
| 7005 |
if (existIndiNode->hasNominalIntegrated()) { |
| 7006 |
updateDirectAddingIndividualStatusFlags(processIndi,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGCLASHED,calcAlgContext); |
| 7007 |
} else { |
| 7008 |
CXLinker<CIndividualSaturationProcessNode*>* multipleCardinalityAncestorNodesLinker = CObjectAllocator< CXLinker<CIndividualSaturationProcessNode*> >::allocateAndConstruct(taskMemMan); |
| 7009 |
multipleCardinalityAncestorNodesLinker->initLinker(processIndi); |
| 7010 |
existIndiNode->addMultipleCardinalityAncestorNodesLinker(multipleCardinalityAncestorNodesLinker); |
| 7011 |
} |
| 7012 |
} |
| 7013 |
|
| 7014 |
bool existIndiInitialized = existIndiNode->isInitialized(); |
| 7015 |
bool existIndiCompleted = existIndiNode->isCompleted(); |
| 7016 |
if (separatedMode && !existIndiCompleted) { |
| 7017 |
updateDirectAddingIndividualStatusFlags(processIndi,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,mCalcAlgContext); |
| 7018 |
setInsufficientNodeOccured(mCalcAlgContext); |
| 7019 |
} else { |
| 7020 |
CRoleBackwardSaturationPropagationHash* backPropHash = nullptr; |
| 7021 |
CReapplyConceptSaturationLabelSet* conSet = nullptr; |
| 7022 |
CSortedNegLinker<CRole*>* superRoleIt = role->getIndirectSuperRoleList(); |
| 7023 |
bool connected = false; |
| 7024 |
while (superRoleIt) { |
| 7025 |
CRole* superRole = superRoleIt->getData(); |
| 7026 |
if (superRole->getDisjointRoleList() != nullptr) { |
| 7027 |
updateDirectAddingIndividualStatusFlags(processIndi,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,mCalcAlgContext); |
| 7028 |
setInsufficientNodeOccured(mCalcAlgContext); |
| 7029 |
} |
| 7030 |
CSortedNegLinker<CConcept*>* domainConLinker = superRole->getDomainRangeConceptList(superRoleIt->isNegated()); |
| 7031 |
for (CSortedNegLinker<CConcept*>* domainConLinkerIt = domainConLinker; domainConLinkerIt; domainConLinkerIt = domainConLinkerIt->getNext()) { |
| 7032 |
CConcept* domainConcept = domainConLinkerIt->getData(); |
| 7033 |
bool domainConceptNegation = domainConLinkerIt->isNegated(); |
| 7034 |
if (!conSet) { |
| 7035 |
conSet = processIndi->getReapplyConceptSaturationLabelSet(true); |
| 7036 |
} |
| 7037 |
addConceptFilteredToIndividual(domainConcept,domainConceptNegation,processIndi,conSet,false,mCalcAlgContext); |
| 7038 |
} |
| 7039 |
|
| 7040 |
|
| 7041 |
if (superRoleIt->isNegated()) { |
| 7042 |
connected = true; |
| 7043 |
CBackwardSaturationPropagationLink* backPropLink = nullptr; |
| 7044 |
if (!separatedMode) { |
| 7045 |
backPropLink = CObjectAllocator<CBackwardSaturationPropagationLink>::allocateAndConstruct(taskMemMan); |
| 7046 |
backPropLink->initBackwardPropagationLink(processIndi,superRole); |
| 7047 |
if (!existIndiInitialized) { |
| 7048 |
existIndiNode->addInitializingBackwardPropagationLinks(backPropLink); |
| 7049 |
} else { |
| 7050 |
installBackwardPropagationLink(processIndi,existIndiNode,superRole,backPropLink,true,true,calcAlgContext); |
| 7051 |
|
| 7052 |
} |
| 7053 |
} else { |
| 7054 |
if (!backPropHash) { |
| 7055 |
backPropHash = existIndiNode->getRoleBackwardPropagationHash(false); |
| 7056 |
} |
| 7057 |
if (backPropHash) { |
| 7058 |
CBackwardSaturationPropagationReapplyDescriptor* backPropReapplyDes = backPropHash->getBackwardPropagationBackwardPropagationConceptDescriptor(superRole); |
| 7059 |
if (backPropReapplyDes) { |
| 7060 |
applyBackwardPropagationConcepts(processIndi,backPropReapplyDes,mCalcAlgContext); |
| 7061 |
} |
| 7062 |
} |
| 7063 |
CCriticalPredecessorRoleCardinalityHash* criticalPredRoleCardHash = existIndiNode->getCriticalPredecessorRoleCardinalityHash(false); |
| 7064 |
if (criticalPredRoleCardHash) { |
| 7065 |
CCriticalPredecessorRoleCardinalityData* criticalPredRoleCardData = criticalPredRoleCardHash->getCriticalPredecessorRoleCardinalityData(role,false); |
| 7066 |
if (criticalPredRoleCardData) { |
| 7067 |
updateDirectAddingIndividualStatusFlags(processIndi,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGINSUFFICIENT,mCalcAlgContext); |
| 7068 |
setInsufficientNodeOccured(mCalcAlgContext); |
| 7069 |
} |
| 7070 |
} |
| 7071 |
} |
| 7072 |
} else { |
| 7073 |
addNewLinkedExtensionProcessingRole(superRole,processIndi,true,true,mCalcAlgContext); |
| 7074 |
} |
| 7075 |
superRoleIt = superRoleIt->getNext(); |
| 7076 |
} |
| 7077 |
if (!connected && !separatedMode) { |
| 7078 |
CXLinker<CIndividualSaturationProcessNode*>* nonInvConnectedIndiNodeLinker = CObjectAllocator< CXLinker<CIndividualSaturationProcessNode*> >::allocateAndConstruct(taskMemMan); |
| 7079 |
nonInvConnectedIndiNodeLinker->initLinker(processIndi); |
| 7080 |
existIndiNode->addNonInverseConnectedIndividualNodeLinker(nonInvConnectedIndiNodeLinker); |
| 7081 |
} |
| 7082 |
} |
| 7083 |
} |
| 7084 |
} |
| 7085 |
|
| 7086 |
|
| 7087 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::applyBackwardPropagationConcepts(CIndividualSaturationProcessNode* sourceIndiNode, CBackwardSaturationPropagationReapplyDescriptor* backPropReapplyDesIt, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7088 |
while (backPropReapplyDesIt) { |
| 7089 |
CConceptSaturationDescriptor* reapplyConSatDes = backPropReapplyDesIt->getReapplyConceptSaturationDescriptor(); |
| 7090 |
CConcept* reapplyConcept = reapplyConSatDes->getConcept(); |
| 7091 |
bool reapplyConNegation = reapplyConSatDes->getNegation(); |
| 7092 |
|
| 7093 |
CSortedNegLinker<CConcept*>* reapplyOpLinker = reapplyConcept->getOperandList(); |
| 7094 |
while (reapplyOpLinker) { |
| 7095 |
CConcept* opConcept = reapplyOpLinker->getData(); |
| 7096 |
bool opNegation = reapplyOpLinker->isNegated()^reapplyConNegation; |
| 7097 |
STATINC(ALLROLERESTRICTIONCOUNT,calcAlgContext); |
| 7098 |
addConceptFilteredToIndividual(opConcept,opNegation,sourceIndiNode,true,calcAlgContext); |
| 7099 |
reapplyOpLinker = reapplyOpLinker->getNext(); |
| 7100 |
} |
| 7101 |
backPropReapplyDesIt = backPropReapplyDesIt->getNext(); |
| 7102 |
} |
| 7103 |
} |
| 7104 |
|
| 7105 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addIndividualToProcessingQueue(CIndividualSaturationProcessNode*& processIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7106 |
CIndividualSaturationProcessNodeLinker* processNodeLinker = processIndi->getIndividualSaturationProcessNodeLinker(); |
| 7107 |
if (!processNodeLinker->isProcessingQueued()) { |
| 7108 |
processNodeLinker->setProcessingQueued(); |
| 7109 |
calcAlgContext->getUsedProcessingDataBox()->addIndividualSaturationProcessNodeLinker(processNodeLinker); |
| 7110 |
} |
| 7111 |
} |
| 7112 |
|
| 7113 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addUninitializedIndividualToProcessingQueue(CIndividualSaturationProcessNode*& processIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7114 |
if (!processIndi->isInitialized()) { |
| 7115 |
addIndividualToProcessingQueue(processIndi,calcAlgContext); |
| 7116 |
} |
| 7117 |
} |
| 7118 |
|
| 7119 |
|
| 7120 |
|
| 7121 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addIndividualToCompletionQueue(CIndividualSaturationProcessNode*& processIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7122 |
if (!processIndi->isIndividualSaturationCompletionNodeLinkerQueued()) { |
| 7123 |
CIndividualSaturationProcessNodeLinker* processNodeLinker = processIndi->getIndividualSaturationCompletionNodeLinker(true); |
| 7124 |
processNodeLinker->setProcessingQueued(); |
| 7125 |
calcAlgContext->getUsedProcessingDataBox()->addIndividualSaturationCompletionNodeLinker(processNodeLinker); |
| 7126 |
} |
| 7127 |
} |
| 7128 |
|
| 7129 |
|
| 7130 |
|
| 7131 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addConceptsFilteredToIndividual(CSortedNegLinker<CConcept*>* conceptAddLinker, bool negate, CIndividualSaturationProcessNode*& processIndi, bool updateCopyDependedIndividual, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7132 |
CSortedNegLinker<CConcept*>* conceptAddLinkerIt = conceptAddLinker; |
| 7133 |
while (conceptAddLinkerIt) { |
| 7134 |
CConcept* opConcept = conceptAddLinkerIt->getData(); |
| 7135 |
bool opConNegation = conceptAddLinkerIt->isNegated()^negate; |
| 7136 |
addConceptFilteredToIndividual(opConcept,opConNegation,processIndi,updateCopyDependedIndividual,calcAlgContext); |
| 7137 |
conceptAddLinkerIt = conceptAddLinkerIt->getNext(); |
| 7138 |
} |
| 7139 |
} |
| 7140 |
|
| 7141 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addConceptsFilteredToIndividual(CSortedNegLinker<CConcept*>* conceptAddLinker, bool negate, CIndividualSaturationProcessNode*& processIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7142 |
CSortedNegLinker<CConcept*>* conceptAddLinkerIt = conceptAddLinker; |
| 7143 |
while (conceptAddLinkerIt) { |
| 7144 |
CConcept* opConcept = conceptAddLinkerIt->getData(); |
| 7145 |
bool opConNegation = conceptAddLinkerIt->isNegated()^negate; |
| 7146 |
addConceptFilteredToIndividual(opConcept,opConNegation,processIndi,calcAlgContext); |
| 7147 |
conceptAddLinkerIt = conceptAddLinkerIt->getNext(); |
| 7148 |
} |
| 7149 |
} |
| 7150 |
|
| 7151 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addConceptsFilteredToIndividual(CXNegLinker<CConcept*>* conceptAddLinker, bool negate, CIndividualSaturationProcessNode*& processIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7152 |
CXNegLinker<CConcept*>* conceptAddLinkerIt = conceptAddLinker; |
| 7153 |
while (conceptAddLinkerIt) { |
| 7154 |
CConcept* opConcept = conceptAddLinkerIt->getData(); |
| 7155 |
bool opConNegation = conceptAddLinkerIt->isNegated()^negate; |
| 7156 |
addConceptFilteredToIndividual(opConcept,opConNegation,processIndi,calcAlgContext); |
| 7157 |
conceptAddLinkerIt = conceptAddLinkerIt->getNext(); |
| 7158 |
} |
| 7159 |
} |
| 7160 |
|
| 7161 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addConceptsFilteredToIndividual(CXSortedNegLinker<CConcept*>* conceptAddLinker, bool negate, CIndividualSaturationProcessNode*& processIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7162 |
CXSortedNegLinker<CConcept*>* conceptAddLinkerIt = conceptAddLinker; |
| 7163 |
while (conceptAddLinkerIt) { |
| 7164 |
CConcept* opConcept = conceptAddLinkerIt->getData(); |
| 7165 |
bool opConNegation = conceptAddLinkerIt->isNegated()^negate; |
| 7166 |
addConceptFilteredToIndividual(opConcept,opConNegation,processIndi,calcAlgContext); |
| 7167 |
conceptAddLinkerIt = conceptAddLinkerIt->getNext(); |
| 7168 |
} |
| 7169 |
} |
| 7170 |
|
| 7171 |
|
| 7172 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addConceptFilteredToIndividual(CConcept* addingConcept, bool negate, CIndividualSaturationProcessNode*& processIndi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7173 |
CReapplyConceptSaturationLabelSet* labelSet = processIndi->getReapplyConceptSaturationLabelSet(); |
| 7174 |
addConceptFilteredToIndividual(addingConcept,negate,processIndi,labelSet,true,calcAlgContext); |
| 7175 |
} |
| 7176 |
|
| 7177 |
|
| 7178 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addConceptFilteredToIndividual(CConcept* addingConcept, bool negate, CIndividualSaturationProcessNode*& processIndi, bool updateCopyDependedIndividual, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7179 |
CReapplyConceptSaturationLabelSet* labelSet = processIndi->getReapplyConceptSaturationLabelSet(); |
| 7180 |
addConceptFilteredToIndividual(addingConcept,negate,processIndi,labelSet,updateCopyDependedIndividual,calcAlgContext); |
| 7181 |
} |
| 7182 |
|
| 7183 |
|
| 7184 |
|
| 7185 |
|
| 7186 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addConceptFilteredToIndividual(CConcept* addingConcept, bool negate, CIndividualSaturationProcessNode*& rootProcessIndi, CReapplyConceptSaturationLabelSet* labelSet, bool updateCopyDependedIndividual, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7187 |
cint64 opCode = addingConcept->getOperatorCode(); |
| 7188 |
bool insertConcept = mConfForceAllConceptInsertion; |
| 7189 |
if (!insertConcept) { |
| 7190 |
CSortedNegLinker<CConcept*>* opConLinkerIt = addingConcept->getOperandList(); |
| 7191 |
if (!negate && (opCode == CCAND || opCode == CCAQAND || opCode == CCIMPLAQAND || opCode == CCBRANCHAQAND) || negate && opCode == CCOR) { |
| 7192 |
addConceptsFilteredToIndividual(opConLinkerIt,negate,rootProcessIndi,updateCopyDependedIndividual,calcAlgContext); |
| 7193 |
} else if (opCode == CCAQCHOOCE) { |
| 7194 |
while (opConLinkerIt) { |
| 7195 |
CConcept* opConcept = opConLinkerIt->getData(); |
| 7196 |
bool opNegation = opConLinkerIt->isNegated(); |
| 7197 |
if (opNegation == negate) { |
| 7198 |
addConceptFilteredToIndividual(opConcept,false,rootProcessIndi,labelSet,updateCopyDependedIndividual,calcAlgContext); |
| 7199 |
} |
| 7200 |
opConLinkerIt = opConLinkerIt->getNext(); |
| 7201 |
} |
| 7202 |
} else if (mConfImplicationAddingSkipping && opCode == CCIMPL) { |
| 7203 |
insertConcept = false; |
| 7204 |
} else { |
| 7205 |
insertConcept = true; |
| 7206 |
} |
| 7207 |
} |
| 7208 |
if (insertConcept) { |
| 7209 |
addConceptToIndividual(addingConcept,negate,rootProcessIndi,labelSet,updateCopyDependedIndividual,calcAlgContext); |
| 7210 |
} |
| 7211 |
} |
| 7212 |
|
| 7213 |
|
| 7214 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::addConceptToIndividual(CConcept* addingConcept, bool negate, CIndividualSaturationProcessNode*& rootProcessIndi, CReapplyConceptSaturationLabelSet* labelSet, bool updateCopyDependedIndividual, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7215 |
STATINC(CONCEPTSADDEDINDINODELABELSETCOUNT,calcAlgContext); |
| 7216 |
|
| 7217 |
KONCLUDE_ASSERT_X(addingConcept,"adding concept to individual","concept missing"); |
| 7218 |
|
| 7219 |
|
| 7220 |
//if (rootProcessIndi->getNominalIndividual()) { |
| 7221 |
// if (CIRIName::getRecentIRIName(rootProcessIndi->getNominalIndividual()->getIndividualNameLinker()).contains("http://www.biopax.org/release/biopax-level2.owl#protein")) { |
| 7222 |
// if (CIRIName::getRecentIRIName(addingConcept->getClassNameLinker()) == "http://www.biopax.org/release/biopax-level2.owl#physicalEntityParticipant") { |
| 7223 |
// bool bug = true; |
| 7224 |
// } |
| 7225 |
// if (addingConcept->getOperandCount() == 1 && CIRIName::getRecentIRIName(addingConcept->getOperandList()->getData()->getClassNameLinker()) == "http://www.biopax.org/release/biopax-level2.owl#physicalEntityParticipant") { |
| 7226 |
// bool bug = true; |
| 7227 |
// } |
| 7228 |
// } |
| 7229 |
//} |
| 7230 |
//if (rootProcessIndi->getIndividualID() == 3087) { |
| 7231 |
// if (addingConcept->getOperatorCode() == CCALL) { |
| 7232 |
// if (CIRIName::getRecentIRIName(addingConcept->getRole()->getPropertyNameLinker()) == "http://www.science.uva.nl/~jliem/ontologies/QRvocabulary.owl#hasConfiguration") { |
| 7233 |
// bool bug = true; |
| 7234 |
// } |
| 7235 |
// } |
| 7236 |
//} |
| 7237 |
|
| 7238 |
|
| 7239 |
CConceptSaturationDescriptor* conceptSaturationDescriptor = createConceptSaturationDescriptor(calcAlgContext); |
| 7240 |
conceptSaturationDescriptor->initConceptSaturationDescriptor(addingConcept,negate); |
| 7241 |
|
| 7242 |
bool contained = insertConceptToIndividualConceptSet(conceptSaturationDescriptor,rootProcessIndi,labelSet,calcAlgContext); |
| 7243 |
if (!contained) { |
| 7244 |
STATINC(CONCEPTSADDEDINDINODEPROCESSINGQUEUECOUNT,calcAlgContext); |
| 7245 |
|
| 7246 |
CConceptSaturationProcessLinker* conceptSaturationProcessLinker = createConceptSaturationProcessLinker(calcAlgContext); |
| 7247 |
conceptSaturationProcessLinker->initConceptSaturationProcessLinker(conceptSaturationDescriptor); |
| 7248 |
rootProcessIndi->addConceptSaturationProcessLinker(conceptSaturationProcessLinker); |
| 7249 |
addIndividualToProcessingQueue(rootProcessIndi,calcAlgContext); |
| 7250 |
|
| 7251 |
if (updateCopyDependedIndividual && rootProcessIndi->hasCopyDependingIndividualNodeLinker()) { |
| 7252 |
// add concept to copy dependent individual nodes |
| 7253 |
CXNegLinker<CIndividualSaturationProcessNode*>* copyDepIndiLinkerIt = rootProcessIndi->getCopyDependingIndividualNodeLinker(); |
| 7254 |
while (copyDepIndiLinkerIt) { |
| 7255 |
CIndividualSaturationProcessNode* copyDepIndiNode = copyDepIndiLinkerIt->getData(); |
| 7256 |
addConceptToIndividual(addingConcept,negate,copyDepIndiNode,copyDepIndiNode->getReapplyConceptSaturationLabelSet(true),true,calcAlgContext); |
| 7257 |
copyDepIndiLinkerIt = copyDepIndiLinkerIt->getNext(); |
| 7258 |
} |
| 7259 |
} |
| 7260 |
|
| 7261 |
} else { |
| 7262 |
// TODO: may release the concept saturation descriptor |
| 7263 |
//releaseConceptSaturationDescriptor(conceptSaturationDescriptor,calcAlgContext); |
| 7264 |
} |
| 7265 |
} |
| 7266 |
|
| 7267 |
|
| 7268 |
CConceptSaturationDescriptor* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::createConceptSaturationDescriptor(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7269 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 7270 |
CConceptSaturationDescriptor* conSatDes = processingDataBox->takeRemainingConceptSaturationDescriptor(); |
| 7271 |
if (!conSatDes) { |
| 7272 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 7273 |
conSatDes = CObjectAllocator<CConceptSaturationDescriptor>::allocateAndConstruct(taskMemMan); |
| 7274 |
} |
| 7275 |
return conSatDes; |
| 7276 |
} |
| 7277 |
|
| 7278 |
|
| 7279 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::releaseConceptSaturationDescriptor(CConceptSaturationDescriptor* conSatDes, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7280 |
conSatDes->clearNext(); |
| 7281 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 7282 |
processingDataBox->addRemainingConceptSaturationDescriptor(conSatDes); |
| 7283 |
} |
| 7284 |
|
| 7285 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::releaseConceptSaturationProcessLinker(CConceptSaturationProcessLinker* conSatProcLinker, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7286 |
conSatProcLinker->clearNext(); |
| 7287 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 7288 |
processingDataBox->addRemainingConceptSaturationProcessLinker(conSatProcLinker); |
| 7289 |
} |
| 7290 |
|
| 7291 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::releaseRoleSaturationProcessLinker(CRoleSaturationProcessLinker* roleSatProcLinker, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7292 |
roleSatProcLinker->clearNext(); |
| 7293 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 7294 |
processingDataBox->addRemainingRoleSaturationProcessLinker(roleSatProcLinker); |
| 7295 |
} |
| 7296 |
|
| 7297 |
CRoleSaturationProcessLinker* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::createRoleSaturationProcessLinker(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7298 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 7299 |
CRoleSaturationProcessLinker* roleSatProcLinker = processingDataBox->takeRemainingRoleSaturationProcessLinker(); |
| 7300 |
if (!roleSatProcLinker) { |
| 7301 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 7302 |
roleSatProcLinker = CObjectAllocator<CRoleSaturationProcessLinker>::allocateAndConstruct(taskMemMan); |
| 7303 |
} |
| 7304 |
return roleSatProcLinker; |
| 7305 |
} |
| 7306 |
|
| 7307 |
CConceptSaturationProcessLinker* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::createConceptSaturationProcessLinker(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7308 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 7309 |
CConceptSaturationProcessLinker* conSatProcLinker = processingDataBox->takeRemainingConceptSaturationProcessLinker(); |
| 7310 |
if (!conSatProcLinker) { |
| 7311 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 7312 |
conSatProcLinker = CObjectAllocator<CConceptSaturationProcessLinker>::allocateAndConstruct(taskMemMan); |
| 7313 |
} |
| 7314 |
return conSatProcLinker; |
| 7315 |
} |
| 7316 |
|
| 7317 |
|
| 7318 |
|
| 7319 |
|
| 7320 |
|
| 7321 |
|
| 7322 |
|
| 7323 |
|
| 7324 |
|
| 7325 |
CIndividualSaturationProcessNodeLinker* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::createIndividualSaturationNodeLinker(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7326 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 7327 |
CIndividualSaturationProcessNodeLinker* indiSatNodeLinker = processingDataBox->takeRemainingIndividualSaturationNodeLinker(); |
| 7328 |
if (!indiSatNodeLinker) { |
| 7329 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 7330 |
indiSatNodeLinker = CObjectAllocator<CIndividualSaturationProcessNodeLinker>::allocateAndConstruct(taskMemMan); |
| 7331 |
} |
| 7332 |
return indiSatNodeLinker; |
| 7333 |
} |
| 7334 |
|
| 7335 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::releaseIndividualSaturationNodeLinker(CIndividualSaturationProcessNodeLinker* indSatNodeLinker, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7336 |
indSatNodeLinker->clearNext(); |
| 7337 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 7338 |
processingDataBox->addRemainingIndividualSaturationNodeLinker(indSatNodeLinker); |
| 7339 |
} |
| 7340 |
|
| 7341 |
|
| 7342 |
|
| 7343 |
|
| 7344 |
|
| 7345 |
CIndividualSaturationSuccessorLinkDataLinker* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::createIndividualSaturationSuccessorLinkDataLinker(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7346 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 7347 |
CIndividualSaturationSuccessorLinkDataLinker* succLinkDataLinker = processingDataBox->takeRemainingIndividualSuccessorLinkDataLinker(); |
| 7348 |
if (!succLinkDataLinker) { |
| 7349 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 7350 |
succLinkDataLinker = CObjectAllocator<CIndividualSaturationSuccessorLinkDataLinker>::allocateAndConstruct(taskMemMan); |
| 7351 |
} |
| 7352 |
return succLinkDataLinker; |
| 7353 |
} |
| 7354 |
|
| 7355 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::releaseIndividualSaturationSuccessorLinkDataLinker(CIndividualSaturationSuccessorLinkDataLinker* succLinkDataLinker, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7356 |
if (succLinkDataLinker) { |
| 7357 |
succLinkDataLinker->clearNext(); |
| 7358 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 7359 |
processingDataBox->addRemainingIndividualSuccessorLinkDataLinker(succLinkDataLinker); |
| 7360 |
} |
| 7361 |
} |
| 7362 |
|
| 7363 |
|
| 7364 |
|
| 7365 |
|
| 7366 |
|
| 7367 |
|
| 7368 |
|
| 7369 |
CIndividualSaturationProcessNodeStatusUpdateLinker* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::createIndividualSaturationUpdateLinker(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7370 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 7371 |
CIndividualSaturationProcessNodeStatusUpdateLinker* conSatUpdateLinker = processingDataBox->takeRemainingIndividualSaturationUpdateLinker(); |
| 7372 |
if (!conSatUpdateLinker) { |
| 7373 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 7374 |
conSatUpdateLinker = CObjectAllocator<CIndividualSaturationProcessNodeStatusUpdateLinker>::allocateAndConstruct(taskMemMan); |
| 7375 |
} |
| 7376 |
return conSatUpdateLinker; |
| 7377 |
} |
| 7378 |
|
| 7379 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::releaseIndividualSaturationUpdateLinker(CIndividualSaturationProcessNodeStatusUpdateLinker* conSatUpdateLinker, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7380 |
conSatUpdateLinker->clearNext(); |
| 7381 |
CProcessingDataBox* processingDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 7382 |
processingDataBox->addRemainingIndividualSaturationUpdateLinker(conSatUpdateLinker); |
| 7383 |
} |
| 7384 |
|
| 7385 |
|
| 7386 |
CSaturationModifiedProcessUpdateLinker* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::createModifiedProcessUpdateLinker(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7387 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 7388 |
return CObjectAllocator<CSaturationModifiedProcessUpdateLinker>::allocateAndConstruct(taskMemMan); |
| 7389 |
} |
| 7390 |
|
| 7391 |
|
| 7392 |
CImplicationReapplyConceptSaturationDescriptor* CCalculationTableauApproximationSaturationTaskHandleAlgorithm::createImplicationReapplyConceptSaturationDescriptor(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7393 |
CMemoryAllocationManager* taskMemMan = calcAlgContext->getUsedProcessTaskMemoryAllocationManager(); |
| 7394 |
CImplicationReapplyConceptSaturationDescriptor* impReaConSatDes = CObjectAllocator<CImplicationReapplyConceptSaturationDescriptor>::allocateAndConstruct(taskMemMan); |
| 7395 |
return impReaConSatDes; |
| 7396 |
} |
| 7397 |
|
| 7398 |
|
| 7399 |
|
| 7400 |
|
| 7401 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::insertConceptToIndividualConceptSet(CConceptSaturationDescriptor* conceptSaturationDescriptor, CIndividualSaturationProcessNode*& rootProcessIndi, CReapplyConceptSaturationLabelSet* labelSet, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7402 |
bool contained = false; |
| 7403 |
bool insertConcept = true; |
| 7404 |
bool implTriggerGeneration = false; |
| 7405 |
bool requiredBackProp = rootProcessIndi->getRequiredBackwardPropagation(); |
| 7406 |
CConcept* concept = conceptSaturationDescriptor->getConcept(); |
| 7407 |
bool conNeg = conceptSaturationDescriptor->getNegation(); |
| 7408 |
cint64 opCode = concept->getOperatorCode(); |
| 7409 |
if (!mConfForceAllConceptInsertion) { |
| 7410 |
if (opCode == CCATOM) { |
| 7411 |
++mAddedSUBConcepts; |
| 7412 |
} else if (opCode == CCSUB) { |
| 7413 |
++mAddedSUBConcepts; |
| 7414 |
} else if (!conNeg && (opCode == CCALL || opCode == CCIMPLALL)) { |
| 7415 |
++mAddedALLConcepts; |
| 7416 |
insertConcept = false; |
| 7417 |
contained = !requiredBackProp; |
| 7418 |
} else if ((!conNeg && (opCode == CCSOME || opCode == CCAQSOME)) || (conNeg && opCode == CCALL)) { |
| 7419 |
++mAddedSOMEConcepts; |
| 7420 |
} else if (opCode == CCIMPL) { |
| 7421 |
++mAddedIMPLConcepts; |
| 7422 |
if (!requiredBackProp && !hasConceptLocalImpact(concept,false,calcAlgContext)) { |
| 7423 |
insertConcept = false; |
| 7424 |
contained = true; |
| 7425 |
} else { |
| 7426 |
implTriggerGeneration = true; |
| 7427 |
contained = true; |
| 7428 |
} |
| 7429 |
} else if (opCode == CCIMPLTRIG || opCode == CCBRANCHTRIG) { |
| 7430 |
++mAddedTRIGGConcepts; |
| 7431 |
} else if (opCode == CCAQCHOOCE) { |
| 7432 |
insertConcept = false; |
| 7433 |
++mAddedELSEConcepts; |
| 7434 |
} else { |
| 7435 |
++mAddedELSEConcepts; |
| 7436 |
} |
| 7437 |
} |
| 7438 |
if (insertConcept) { |
| 7439 |
bool newInsertion = false; |
| 7440 |
CImplicationReapplyConceptSaturationDescriptor* reapplyImpReapplyConSatDes = nullptr; |
| 7441 |
CImplicationReapplyConceptSaturationDescriptor** reapplyImpReapplyConSatDesPtr = nullptr; |
| 7442 |
bool clashed = labelSet->insertConceptReturnClashed(conceptSaturationDescriptor,&newInsertion,&reapplyImpReapplyConSatDesPtr); |
| 7443 |
|
| 7444 |
|
| 7445 |
if (!clashed) { |
| 7446 |
if (newInsertion) { |
| 7447 |
if (reapplyImpReapplyConSatDesPtr) { |
| 7448 |
reapplyImpReapplyConSatDes = *reapplyImpReapplyConSatDesPtr; |
| 7449 |
} |
| 7450 |
|
| 7451 |
CImplicationReapplyConceptSaturationDescriptor* reapplyImpReapplyConSatDesIt = reapplyImpReapplyConSatDes; |
| 7452 |
while (reapplyImpReapplyConSatDesIt) { |
| 7453 |
CSortedNegLinker<CConcept*>* triggerConLinker = reapplyImpReapplyConSatDesIt->getNextTriggerConcept(); |
| 7454 |
if (triggerConLinker->getData() == conceptSaturationDescriptor->getConcept() && triggerConLinker->isNegated() != conceptSaturationDescriptor->isNegated()) { |
| 7455 |
updateImplicationReapplyConceptSaturationDescriptor(reapplyImpReapplyConSatDesIt,rootProcessIndi,labelSet,calcAlgContext); |
| 7456 |
} |
| 7457 |
reapplyImpReapplyConSatDesIt = reapplyImpReapplyConSatDesIt->getNext(); |
| 7458 |
} |
| 7459 |
if (implTriggerGeneration) { |
| 7460 |
// add first trigger |
| 7461 |
CImplicationReapplyConceptSaturationDescriptor tmpNewReapplyImpReapplyConSatDes; |
| 7462 |
CConcept* implConcept = conceptSaturationDescriptor->getConcept(); |
| 7463 |
CSortedNegLinker<CConcept*>* nextTriggerConcept = implConcept->getOperandList(); |
| 7464 |
tmpNewReapplyImpReapplyConSatDes.initImplicationReapllyConceptSaturationDescriptor(implConcept,nextTriggerConcept); |
| 7465 |
updateImplicationReapplyConceptSaturationDescriptor(&tmpNewReapplyImpReapplyConSatDes,rootProcessIndi,labelSet,calcAlgContext); |
| 7466 |
} |
| 7467 |
if (mConfImplicationAddingSkipping) { |
| 7468 |
if (!conNeg && (opCode == CCATOM || opCode == CCSUB || opCode == CCIMPLTRIG || opCode == CCBRANCHTRIG)) { |
| 7469 |
CSortedNegLinker<CConcept*>* opConceptLinkerIt = concept->getOperandList(); |
| 7470 |
while (opConceptLinkerIt) { |
| 7471 |
if (!opConceptLinkerIt->isNegated()) { |
| 7472 |
CConcept* opConcept = opConceptLinkerIt->getData(); |
| 7473 |
if (opConcept->getOperatorCode() == CCIMPL) { |
| 7474 |
|
| 7475 |
CImplicationReapplyConceptSaturationDescriptor tmpNewReapplyImpReapplyConSatDes; |
| 7476 |
CConcept* implConcept = opConcept; |
| 7477 |
CSortedNegLinker<CConcept*>* nextTriggerConcept = implConcept->getOperandList(); |
| 7478 |
tmpNewReapplyImpReapplyConSatDes.initImplicationReapllyConceptSaturationDescriptor(implConcept,nextTriggerConcept); |
| 7479 |
|
| 7480 |
updateImplicationReapplyConceptSaturationDescriptor(&tmpNewReapplyImpReapplyConSatDes,rootProcessIndi,labelSet,calcAlgContext); |
| 7481 |
|
| 7482 |
} |
| 7483 |
} |
| 7484 |
opConceptLinkerIt = opConceptLinkerIt->getNext(); |
| 7485 |
} |
| 7486 |
} |
| 7487 |
} |
| 7488 |
|
| 7489 |
if (labelSet->hasModifiedUpdateLinkers()) { |
| 7490 |
processModificationUpdateLinkers(rootProcessIndi,labelSet,labelSet->getModifiedUpdateLinker(),calcAlgContext); |
| 7491 |
} |
| 7492 |
|
| 7493 |
} else { |
| 7494 |
contained = true; |
| 7495 |
} |
| 7496 |
|
| 7497 |
} else { |
| 7498 |
rootProcessIndi->addClashedConceptSaturationDescriptorLinker(conceptSaturationDescriptor); |
| 7499 |
//mEndSaturationDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 7500 |
//QFile tmpFile("saturation-model.txt"); |
| 7501 |
//if (tmpFile.open(QIODevice::WriteOnly)) { |
| 7502 |
// tmpFile.write(mEndSaturationDebugIndiModelString.replace("<br>","").replace("<p>","\n").toLocal8Bit()); |
| 7503 |
// tmpFile.close(); |
| 7504 |
//} |
| 7505 |
updateDirectAddingIndividualStatusFlags(rootProcessIndi,CIndividualSaturationProcessNodeStatusFlags::INDSATFLAGCLASHED,calcAlgContext); |
| 7506 |
contained = true; |
| 7507 |
} |
| 7508 |
|
| 7509 |
} |
| 7510 |
|
| 7511 |
return contained; |
| 7512 |
} |
| 7513 |
|
| 7514 |
|
| 7515 |
|
| 7516 |
|
| 7517 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::processModificationUpdateLinkers(CIndividualSaturationProcessNode*& rootProcessIndi, CReapplyConceptSaturationLabelSet* labelSet, CSaturationModifiedProcessUpdateLinker* modProcUpdateLinker, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7518 |
for (CSaturationModifiedProcessUpdateLinker* modProcUpdateLinkerIt = modProcUpdateLinker; modProcUpdateLinkerIt; modProcUpdateLinkerIt = modProcUpdateLinkerIt->getNext()) { |
| 7519 |
CIndividualSaturationProcessNode* indiProcNode = modProcUpdateLinkerIt->getProcessingIndividual(); |
| 7520 |
CSaturationModifiedProcessUpdateLinker::MODIFICATIONPROCESSUPDATETYPE updateType = modProcUpdateLinkerIt->getUpdateType(); |
| 7521 |
if (updateType == CSaturationModifiedProcessUpdateLinker::UPDATEPDISJUNCTCOMMONCONCEPTSEXTRACTION) { |
| 7522 |
addDisjunctCommonConceptExtractionToProcessingQueue(indiProcNode,calcAlgContext); |
| 7523 |
} |
| 7524 |
} |
| 7525 |
} |
| 7526 |
|
| 7527 |
|
| 7528 |
|
| 7529 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::updateImplicationReapplyConceptSaturationDescriptor(CImplicationReapplyConceptSaturationDescriptor* reapplyImpReapplyConSatDes, CIndividualSaturationProcessNode*& rootProcessIndi, CReapplyConceptSaturationLabelSet* labelSet, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7530 |
STATINC(IMPLICATIONTRIGGERINGCOUNT,calcAlgContext); |
| 7531 |
CSortedNegLinker<CConcept*>* currTriggerConcept = reapplyImpReapplyConSatDes->getNextTriggerConcept(); |
| 7532 |
CSortedNegLinker<CConcept*>* nextTriggerConcept = currTriggerConcept->getNext(); |
| 7533 |
CConcept* implConcept = reapplyImpReapplyConSatDes->getImplicationConcept(); |
| 7534 |
if (!nextTriggerConcept) { |
| 7535 |
// execute implication |
| 7536 |
STATINC(IMPLICATIONEXECUTINGCOUNT,calcAlgContext); |
| 7537 |
CSortedNegLinker<CConcept*>* impExConOpLinker = implConcept->getOperandList(); |
| 7538 |
addConceptFilteredToIndividual(impExConOpLinker->getData(),impExConOpLinker->isNegated(),rootProcessIndi,labelSet,false,calcAlgContext); |
| 7539 |
} else { |
| 7540 |
CConcept* nextTrigger = nextTriggerConcept->getData(); |
| 7541 |
|
| 7542 |
// add next trigger |
| 7543 |
CImplicationReapplyConceptSaturationDescriptor* newReapplyImpReapplyConSatDes = createImplicationReapplyConceptSaturationDescriptor(calcAlgContext); |
| 7544 |
newReapplyImpReapplyConSatDes->initImplicationReapllyConceptSaturationDescriptor(implConcept,nextTriggerConcept); |
| 7545 |
|
| 7546 |
CConceptSaturationDescriptor* conSatDes = nullptr; |
| 7547 |
bool triggered = labelSet->insertConceptReapplicationReturnTriggered(nextTrigger->getConceptTag(),newReapplyImpReapplyConSatDes,&conSatDes); |
| 7548 |
if (triggered) { |
| 7549 |
updateImplicationReapplyConceptSaturationDescriptor(newReapplyImpReapplyConSatDes,rootProcessIndi,labelSet,calcAlgContext); |
| 7550 |
} |
| 7551 |
} |
| 7552 |
return true; |
| 7553 |
} |
| 7554 |
|
| 7555 |
|
| 7556 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::hasConceptLocalImpact(CConcept* concept, bool conNeg, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7557 |
cint64 opCode = concept->getOperatorCode(); |
| 7558 |
if (opCode == CCSUB || opCode == CCIMPLTRIG || opCode == CCBRANCHTRIG) { |
| 7559 |
return true; |
| 7560 |
} else if (!conNeg && (opCode == CCALL || opCode == CCIMPLALL || opCode == CCBRANCHALL) || conNeg && (opCode == CCSOME)) { |
| 7561 |
return false; |
| 7562 |
} else if (!conNeg && (opCode == CCAND || opCode == CCAQAND || opCode == CCBRANCHAQAND || opCode == CCIMPLAQAND) || conNeg && opCode == CCOR) { |
| 7563 |
CSortedNegLinker<CConcept*>* opConList = concept->getOperandList(); |
| 7564 |
while (opConList) { |
| 7565 |
CConcept* opConcept = opConList->getData(); |
| 7566 |
bool opConNeg = opConList->isNegated()^conNeg; |
| 7567 |
if (hasConceptLocalImpact(opConcept,opConNeg,calcAlgContext)) { |
| 7568 |
return true; |
| 7569 |
} |
| 7570 |
opConList = opConList->getNext(); |
| 7571 |
} |
| 7572 |
return false; |
| 7573 |
} else if (!conNeg && (opCode == CCSOME || opCode == CCAQSOME) || conNeg && (opCode == CCALL)) { |
| 7574 |
return true; |
| 7575 |
} else if (!conNeg && (opCode == CCAQALL || opCode == CCIMPLAQALL || opCode == CCBRANCHAQALL) || conNeg && (opCode == CCSOME || opCode == CCAQSOME)) { |
| 7576 |
return false; |
| 7577 |
} else if (opCode == CCAQCHOOCE) { |
| 7578 |
CSortedNegLinker<CConcept*>* opConList = concept->getOperandList(); |
| 7579 |
while (opConList) { |
| 7580 |
CConcept* opConcept = opConList->getData(); |
| 7581 |
bool opNegation = opConList->isNegated(); |
| 7582 |
if (opNegation == conNeg) { |
| 7583 |
if (hasConceptLocalImpact(opConcept,false,calcAlgContext)) { |
| 7584 |
return true; |
| 7585 |
} |
| 7586 |
} |
| 7587 |
opConList = opConList->getNext(); |
| 7588 |
} |
| 7589 |
return false; |
| 7590 |
} else if (opCode == CCIMPL) { |
| 7591 |
CSortedNegLinker<CConcept*>* opConList = concept->getOperandList(); |
| 7592 |
CConcept* opConcept = opConList->getData(); |
| 7593 |
bool opNegation = opConList->isNegated(); |
| 7594 |
if (hasConceptLocalImpact(opConcept,opNegation,calcAlgContext)) { |
| 7595 |
return true; |
| 7596 |
} |
| 7597 |
return false; |
| 7598 |
} |
| 7599 |
return false; |
| 7600 |
} |
| 7601 |
|
| 7602 |
|
| 7603 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::updateDirectAddingIndividualStatusFlags(CIndividualSaturationProcessNode* indiNode, cint64 flags, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7604 |
CIndividualSaturationProcessNodeStatusFlags addingFlags; |
| 7605 |
addingFlags.initStatusFlags(); |
| 7606 |
addingFlags.addFlags(flags); |
| 7607 |
updateDirectAddingIndividualStatusFlags(indiNode,&addingFlags,calcAlgContext); |
| 7608 |
} |
| 7609 |
|
| 7610 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::updateDirectNotDependentAddingIndividualStatusFlags(CIndividualSaturationProcessNode* indiNode, cint64 flags, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7611 |
CIndividualSaturationProcessNodeStatusFlags addingFlags; |
| 7612 |
addingFlags.initStatusFlags(); |
| 7613 |
addingFlags.addFlags(flags); |
| 7614 |
updateDirectNotDependentAddingIndividualStatusFlags(indiNode,&addingFlags,calcAlgContext); |
| 7615 |
} |
| 7616 |
|
| 7617 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::requiresDirectAddingIndividualStatusFlagsUpdate(CIndividualSaturationProcessNode* indiNode, CIndividualSaturationProcessNodeStatusFlags* addingFlags, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7618 |
CIndividualSaturationProcessNodeStatusFlags* indiDirectFlags = indiNode->getDirectStatusFlags(); |
| 7619 |
return !indiDirectFlags->hasFlags(addingFlags,true); |
| 7620 |
} |
| 7621 |
|
| 7622 |
|
| 7623 |
|
| 7624 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::requiresIndirectAddingIndividualStatusFlagsUpdate(CIndividualSaturationProcessNode* indiNode, CIndividualSaturationProcessNodeStatusFlags* addingFlags, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7625 |
CIndividualSaturationProcessNodeStatusFlags* indiIndirectFlags = indiNode->getIndirectStatusFlags(); |
| 7626 |
return !indiIndirectFlags->hasFlags(addingFlags,true); |
| 7627 |
} |
| 7628 |
|
| 7629 |
|
| 7630 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::updateDirectAddingIndividualStatusFlags(CIndividualSaturationProcessNode* indiNode, CIndividualSaturationProcessNodeStatusFlags* addingFlags, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7631 |
if (requiresDirectAddingIndividualStatusFlagsUpdate(indiNode,addingFlags,calcAlgContext)) { |
| 7632 |
CIndividualSaturationProcessNodeStatusUpdateLinker* directUpdateLinker = createIndividualSaturationUpdateLinker(calcAlgContext); |
| 7633 |
directUpdateLinker->initUpdateNodeLinker(indiNode); |
| 7634 |
CIndividualSaturationProcessNodeStatusFlags* directIndiFlags = indiNode->getDirectStatusFlags(); |
| 7635 |
directIndiFlags->addFlags(addingFlags); |
| 7636 |
++mDirectUpdatedStatusIndiNodeCount; |
| 7637 |
|
| 7638 |
while (directUpdateLinker) { |
| 7639 |
CIndividualSaturationProcessNodeStatusUpdateLinker* nextUpdateLinker = directUpdateLinker; |
| 7640 |
directUpdateLinker = directUpdateLinker->getNext(); |
| 7641 |
CIndividualSaturationProcessNode* updateIndiNode = nextUpdateLinker->getData(); |
| 7642 |
nextUpdateLinker->clearNext(); |
| 7643 |
releaseIndividualSaturationUpdateLinker(nextUpdateLinker,calcAlgContext); |
| 7644 |
|
| 7645 |
for (CXNegLinker<CIndividualSaturationProcessNode*>* depdendingIndiLinkerIt = updateIndiNode->getCopyDependingIndividualNodeLinker(); depdendingIndiLinkerIt; depdendingIndiLinkerIt = depdendingIndiLinkerIt->getNext()) { |
| 7646 |
CIndividualSaturationProcessNode* dependingIndi = depdendingIndiLinkerIt->getData(); |
| 7647 |
if (requiresDirectAddingIndividualStatusFlagsUpdate(dependingIndi,addingFlags,calcAlgContext)) { |
| 7648 |
CIndividualSaturationProcessNodeStatusFlags* directIndiFlags = dependingIndi->getDirectStatusFlags(); |
| 7649 |
directIndiFlags->addFlags(addingFlags); |
| 7650 |
++mDirectUpdatedStatusIndiNodeCount; |
| 7651 |
directUpdateLinker = createIndividualSaturationUpdateLinker(calcAlgContext)->initUpdateNodeLinker(dependingIndi)->append(directUpdateLinker); |
| 7652 |
} |
| 7653 |
} |
| 7654 |
|
| 7655 |
updateIndirectAddingIndividualStatusFlags(updateIndiNode,addingFlags,calcAlgContext); |
| 7656 |
} |
| 7657 |
} |
| 7658 |
} |
| 7659 |
|
| 7660 |
|
| 7661 |
|
| 7662 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::updateDirectNotDependentAddingIndividualStatusFlags(CIndividualSaturationProcessNode* indiNode, CIndividualSaturationProcessNodeStatusFlags* addingFlags, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7663 |
if (requiresDirectAddingIndividualStatusFlagsUpdate(indiNode,addingFlags,calcAlgContext)) { |
| 7664 |
CIndividualSaturationProcessNodeStatusFlags* directIndiFlags = indiNode->getDirectStatusFlags(); |
| 7665 |
directIndiFlags->addFlags(addingFlags); |
| 7666 |
if (requiresIndirectAddingIndividualStatusFlagsUpdate(indiNode,addingFlags,calcAlgContext)) { |
| 7667 |
CIndividualSaturationProcessNodeStatusFlags* indirectIndiFlags = indiNode->getIndirectStatusFlags(); |
| 7668 |
indirectIndiFlags->addFlags(addingFlags); |
| 7669 |
++mIndirectUpdatedStatusIndiNodeCount; |
| 7670 |
} |
| 7671 |
++mDirectUpdatedStatusIndiNodeCount; |
| 7672 |
|
| 7673 |
if (!indiNode->isABoxIndividualRepresentationNode()) { |
| 7674 |
CRoleBackwardSaturationPropagationHash* backwardPropHash = indiNode->getRoleBackwardPropagationHash(false); |
| 7675 |
if (backwardPropHash) { |
| 7676 |
CPROCESSHASH<CRole*,CRoleBackwardSaturationPropagationHashData>* backPropHash = backwardPropHash->getRoleBackwardPropagationDataHash(); |
| 7677 |
for (CPROCESSHASH<CRole*,CRoleBackwardSaturationPropagationHashData>::const_iterator it = backPropHash->constBegin(), itEnd = backPropHash->constEnd(); it != itEnd; ++it) { |
| 7678 |
CRole* backwardPropRole = it.key(); |
| 7679 |
const CRoleBackwardSaturationPropagationHashData& backwardPropData = it.value(); |
| 7680 |
for (CBackwardSaturationPropagationLink* linkIt = backwardPropData.mLinkLinker; linkIt; linkIt = linkIt->getNext()) { |
| 7681 |
CIndividualSaturationProcessNode* sourceIndividual = linkIt->getSourceIndividual(); |
| 7682 |
updateIndirectAddingIndividualStatusFlags(sourceIndividual,addingFlags,calcAlgContext); |
| 7683 |
} |
| 7684 |
} |
| 7685 |
} |
| 7686 |
|
| 7687 |
for (CXLinker<CIndividualSaturationProcessNode*>* nonInvConnIndiLinkerIt = indiNode->getNonInverseConnectedIndividualNodeLinker(); nonInvConnIndiLinkerIt; nonInvConnIndiLinkerIt = nonInvConnIndiLinkerIt->getNext()) { |
| 7688 |
CIndividualSaturationProcessNode* sourceIndividual = nonInvConnIndiLinkerIt->getData(); |
| 7689 |
updateIndirectAddingIndividualStatusFlags(sourceIndividual,addingFlags,calcAlgContext); |
| 7690 |
} |
| 7691 |
} |
| 7692 |
} |
| 7693 |
} |
| 7694 |
|
| 7695 |
|
| 7696 |
|
| 7697 |
|
| 7698 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::updateIndirectAddingIndividualStatusFlags(CIndividualSaturationProcessNode* indiNode, CIndividualSaturationProcessNodeStatusFlags* addingFlags, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7699 |
if (requiresIndirectAddingIndividualStatusFlagsUpdate(indiNode,addingFlags,calcAlgContext)) { |
| 7700 |
CIndividualSaturationProcessNodeStatusUpdateLinker* directUpdateLinker = createIndividualSaturationUpdateLinker(calcAlgContext); |
| 7701 |
directUpdateLinker->initUpdateNodeLinker(indiNode); |
| 7702 |
CIndividualSaturationProcessNodeStatusFlags* indirectIndiFlags = indiNode->getIndirectStatusFlags(); |
| 7703 |
indirectIndiFlags->addFlags(addingFlags); |
| 7704 |
++mIndirectUpdatedStatusIndiNodeCount; |
| 7705 |
|
| 7706 |
while (directUpdateLinker) { |
| 7707 |
CIndividualSaturationProcessNodeStatusUpdateLinker* nextUpdateLinker = directUpdateLinker; |
| 7708 |
directUpdateLinker = directUpdateLinker->getNext(); |
| 7709 |
CIndividualSaturationProcessNode* updateIndiNode = nextUpdateLinker->getData(); |
| 7710 |
nextUpdateLinker->clearNext(); |
| 7711 |
releaseIndividualSaturationUpdateLinker(nextUpdateLinker,calcAlgContext); |
| 7712 |
for (CXNegLinker<CIndividualSaturationProcessNode*>* depdendingIndiLinkerIt = updateIndiNode->getCopyDependingIndividualNodeLinker(); depdendingIndiLinkerIt; depdendingIndiLinkerIt = depdendingIndiLinkerIt->getNext()) { |
| 7713 |
CIndividualSaturationProcessNode* dependingIndi = depdendingIndiLinkerIt->getData(); |
| 7714 |
if (requiresIndirectAddingIndividualStatusFlagsUpdate(dependingIndi,addingFlags,calcAlgContext)) { |
| 7715 |
CIndividualSaturationProcessNodeStatusFlags* indirectIndiFlags = dependingIndi->getIndirectStatusFlags(); |
| 7716 |
indirectIndiFlags->addFlags(addingFlags); |
| 7717 |
++mIndirectUpdatedStatusIndiNodeCount; |
| 7718 |
directUpdateLinker = createIndividualSaturationUpdateLinker(calcAlgContext)->initUpdateNodeLinker(dependingIndi)->append(directUpdateLinker); |
| 7719 |
} |
| 7720 |
} |
| 7721 |
|
| 7722 |
|
| 7723 |
CRoleBackwardSaturationPropagationHash* backwardPropHash = updateIndiNode->getRoleBackwardPropagationHash(false); |
| 7724 |
if (backwardPropHash && !updateIndiNode->isABoxIndividualRepresentationNode()) { |
| 7725 |
CPROCESSHASH<CRole*,CRoleBackwardSaturationPropagationHashData>* backPropHash = backwardPropHash->getRoleBackwardPropagationDataHash(); |
| 7726 |
for (CPROCESSHASH<CRole*,CRoleBackwardSaturationPropagationHashData>::const_iterator it = backPropHash->constBegin(), itEnd = backPropHash->constEnd(); it != itEnd; ++it) { |
| 7727 |
CRole* backwardPropRole = it.key(); |
| 7728 |
const CRoleBackwardSaturationPropagationHashData& backwardPropData = it.value(); |
| 7729 |
for (CBackwardSaturationPropagationLink* linkIt = backwardPropData.mLinkLinker; linkIt; linkIt = linkIt->getNext()) { |
| 7730 |
CIndividualSaturationProcessNode* sourceIndividual = linkIt->getSourceIndividual(); |
| 7731 |
if (requiresIndirectAddingIndividualStatusFlagsUpdate(sourceIndividual,addingFlags,calcAlgContext)) { |
| 7732 |
CIndividualSaturationProcessNodeStatusFlags* indirectIndiFlags = sourceIndividual->getIndirectStatusFlags(); |
| 7733 |
indirectIndiFlags->addFlags(addingFlags); |
| 7734 |
++mIndirectUpdatedStatusIndiNodeCount; |
| 7735 |
directUpdateLinker = createIndividualSaturationUpdateLinker(calcAlgContext)->initUpdateNodeLinker(sourceIndividual)->append(directUpdateLinker); |
| 7736 |
} |
| 7737 |
} |
| 7738 |
} |
| 7739 |
} |
| 7740 |
|
| 7741 |
|
| 7742 |
if (!updateIndiNode->isABoxIndividualRepresentationNode()) { |
| 7743 |
for (CXLinker<CIndividualSaturationProcessNode*>* nonInvConnIndiLinkerIt = updateIndiNode->getNonInverseConnectedIndividualNodeLinker(); nonInvConnIndiLinkerIt; nonInvConnIndiLinkerIt = nonInvConnIndiLinkerIt->getNext()) { |
| 7744 |
CIndividualSaturationProcessNode* sourceIndividual = nonInvConnIndiLinkerIt->getData(); |
| 7745 |
if (requiresIndirectAddingIndividualStatusFlagsUpdate(sourceIndividual, addingFlags, calcAlgContext)) { |
| 7746 |
CIndividualSaturationProcessNodeStatusFlags* indirectIndiFlags = sourceIndividual->getIndirectStatusFlags(); |
| 7747 |
indirectIndiFlags->addFlags(addingFlags); |
| 7748 |
++mIndirectUpdatedStatusIndiNodeCount; |
| 7749 |
directUpdateLinker = createIndividualSaturationUpdateLinker(calcAlgContext)->initUpdateNodeLinker(sourceIndividual)->append(directUpdateLinker); |
| 7750 |
} |
| 7751 |
} |
| 7752 |
} |
| 7753 |
|
| 7754 |
|
| 7755 |
} |
| 7756 |
} |
| 7757 |
} |
| 7758 |
|
| 7759 |
|
| 7760 |
|
| 7761 |
|
| 7762 |
|
| 7763 |
|
| 7764 |
|
| 7765 |
|
| 7766 |
|
| 7767 |
|
| 7768 |
|
| 7769 |
|
| 7770 |
|
| 7771 |
|
| 7772 |
|
| 7773 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::requiresAddingSuccessorConnectedNominals(CIndividualSaturationProcessNode* indiNode, cint64 addingNominalID, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7774 |
CSuccessorConnectedNominalSet* succConnNomSet = indiNode->getSuccessorConnectedNominalSet(false); |
| 7775 |
if (succConnNomSet) { |
| 7776 |
if (succConnNomSet->hasSuccessorConnectedNominal(addingNominalID)) { |
| 7777 |
return false; |
| 7778 |
} |
| 7779 |
} |
| 7780 |
return true; |
| 7781 |
} |
| 7782 |
|
| 7783 |
|
| 7784 |
|
| 7785 |
|
| 7786 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::updateAddingSuccessorConnectedNominal(CIndividualSaturationProcessNode* indiNode, CSuccessorConnectedNominalSet* succConnNomSet, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7787 |
if (succConnNomSet) { |
| 7788 |
for (CSuccessorConnectedNominalSet::const_iterator it = succConnNomSet->constBegin(), itEnd = succConnNomSet->constEnd(); it != itEnd; ++it) { |
| 7789 |
cint64 connectedNominalID(*it); |
| 7790 |
updateAddingSuccessorConnectedNominal(indiNode,connectedNominalID,calcAlgContext); |
| 7791 |
} |
| 7792 |
} |
| 7793 |
} |
| 7794 |
|
| 7795 |
|
| 7796 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::updateAddingSuccessorConnectedNominal(CIndividualSaturationProcessNode* indiNode, cint64 addingNominalID, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7797 |
if (requiresAddingSuccessorConnectedNominals(indiNode,addingNominalID,calcAlgContext)) { |
| 7798 |
CIndividualSaturationProcessNodeStatusUpdateLinker* directUpdateLinker = createIndividualSaturationUpdateLinker(calcAlgContext); |
| 7799 |
directUpdateLinker->initUpdateNodeLinker(indiNode); |
| 7800 |
|
| 7801 |
CSuccessorConnectedNominalSet* succConnNomSet = indiNode->getSuccessorConnectedNominalSet(true); |
| 7802 |
succConnNomSet->addSuccessorConnectedNominal(addingNominalID); |
| 7803 |
|
| 7804 |
++mSuccessorConnectedNominalUpdatedCount; |
| 7805 |
|
| 7806 |
while (directUpdateLinker) { |
| 7807 |
CIndividualSaturationProcessNodeStatusUpdateLinker* nextUpdateLinker = directUpdateLinker; |
| 7808 |
directUpdateLinker = directUpdateLinker->getNext(); |
| 7809 |
CIndividualSaturationProcessNode* updateIndiNode = nextUpdateLinker->getData(); |
| 7810 |
nextUpdateLinker->clearNext(); |
| 7811 |
releaseIndividualSaturationUpdateLinker(nextUpdateLinker,calcAlgContext); |
| 7812 |
|
| 7813 |
|
| 7814 |
for (CXNegLinker<CIndividualSaturationProcessNode*>* depdendingIndiLinkerIt = updateIndiNode->getCopyDependingIndividualNodeLinker(); depdendingIndiLinkerIt; depdendingIndiLinkerIt = depdendingIndiLinkerIt->getNext()) { |
| 7815 |
CIndividualSaturationProcessNode* dependingIndi = depdendingIndiLinkerIt->getData(); |
| 7816 |
if (requiresAddingSuccessorConnectedNominals(dependingIndi,addingNominalID,calcAlgContext)) { |
| 7817 |
CSuccessorConnectedNominalSet* depIndiSuccConnNomSet = dependingIndi->getSuccessorConnectedNominalSet(true); |
| 7818 |
depIndiSuccConnNomSet->addSuccessorConnectedNominal(addingNominalID); |
| 7819 |
++mSuccessorConnectedNominalUpdatedCount; |
| 7820 |
directUpdateLinker = createIndividualSaturationUpdateLinker(calcAlgContext)->initUpdateNodeLinker(dependingIndi)->append(directUpdateLinker); |
| 7821 |
} |
| 7822 |
} |
| 7823 |
|
| 7824 |
|
| 7825 |
if (!updateIndiNode->isABoxIndividualRepresentationNode()) { |
| 7826 |
CRoleBackwardSaturationPropagationHash* backwardPropHash = updateIndiNode->getRoleBackwardPropagationHash(false); |
| 7827 |
if (backwardPropHash) { |
| 7828 |
CPROCESSHASH<CRole*, CRoleBackwardSaturationPropagationHashData>* backPropHash = backwardPropHash->getRoleBackwardPropagationDataHash(); |
| 7829 |
for (CPROCESSHASH<CRole*, CRoleBackwardSaturationPropagationHashData>::const_iterator it = backPropHash->constBegin(), itEnd = backPropHash->constEnd(); it != itEnd; ++it) { |
| 7830 |
CRole* backwardPropRole = it.key(); |
| 7831 |
const CRoleBackwardSaturationPropagationHashData& backwardPropData = it.value(); |
| 7832 |
for (CBackwardSaturationPropagationLink* linkIt = backwardPropData.mLinkLinker; linkIt; linkIt = linkIt->getNext()) { |
| 7833 |
CIndividualSaturationProcessNode* sourceIndividual = linkIt->getSourceIndividual(); |
| 7834 |
if (requiresAddingSuccessorConnectedNominals(sourceIndividual, addingNominalID, calcAlgContext)) { |
| 7835 |
CSuccessorConnectedNominalSet* sourceIndiSuccConnNomSet = sourceIndividual->getSuccessorConnectedNominalSet(true); |
| 7836 |
sourceIndiSuccConnNomSet->addSuccessorConnectedNominal(addingNominalID); |
| 7837 |
++mSuccessorConnectedNominalUpdatedCount; |
| 7838 |
directUpdateLinker = createIndividualSaturationUpdateLinker(calcAlgContext)->initUpdateNodeLinker(sourceIndividual)->append(directUpdateLinker); |
| 7839 |
} |
| 7840 |
} |
| 7841 |
} |
| 7842 |
} |
| 7843 |
|
| 7844 |
|
| 7845 |
for (CXLinker<CIndividualSaturationProcessNode*>* nonInvConnIndiLinkerIt = updateIndiNode->getNonInverseConnectedIndividualNodeLinker(); nonInvConnIndiLinkerIt; nonInvConnIndiLinkerIt = nonInvConnIndiLinkerIt->getNext()) { |
| 7846 |
CIndividualSaturationProcessNode* sourceIndividual = nonInvConnIndiLinkerIt->getData(); |
| 7847 |
if (requiresAddingSuccessorConnectedNominals(sourceIndividual, addingNominalID, calcAlgContext)) { |
| 7848 |
CSuccessorConnectedNominalSet* sourceIndiSuccConnNomSet = sourceIndividual->getSuccessorConnectedNominalSet(true); |
| 7849 |
sourceIndiSuccConnNomSet->addSuccessorConnectedNominal(addingNominalID); |
| 7850 |
++mSuccessorConnectedNominalUpdatedCount; |
| 7851 |
directUpdateLinker = createIndividualSaturationUpdateLinker(calcAlgContext)->initUpdateNodeLinker(sourceIndividual)->append(directUpdateLinker); |
| 7852 |
} |
| 7853 |
} |
| 7854 |
} |
| 7855 |
} |
| 7856 |
} |
| 7857 |
} |
| 7858 |
|
| 7859 |
|
| 7860 |
|
| 7861 |
|
| 7862 |
|
| 7863 |
|
| 7864 |
|
| 7865 |
|
| 7866 |
|
| 7867 |
|
| 7868 |
|
| 7869 |
|
| 7870 |
|
| 7871 |
|
| 7872 |
|
| 7873 |
|
| 7874 |
bool CCalculationTableauApproximationSaturationTaskHandleAlgorithm::requiresMaxCardinalityCandidatePropagation(CIndividualSaturationProcessNode* indiNode, cint64 atleastCandidate, cint64 atmostCandidate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7875 |
if (atleastCandidate > indiNode->getMaxAtleastCardinalityCandidate() || atmostCandidate > indiNode->getMaxAtmostCardinalityCandidate()) { |
| 7876 |
return true; |
| 7877 |
} |
| 7878 |
return false; |
| 7879 |
} |
| 7880 |
|
| 7881 |
|
| 7882 |
|
| 7883 |
|
| 7884 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::updateMaxCardinalityCandidates(CIndividualSaturationProcessNode* indiNode, cint64 atleastCandidate, cint64 atmostCandidate, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 7885 |
if (requiresMaxCardinalityCandidatePropagation(indiNode,atleastCandidate,atmostCandidate,calcAlgContext)) { |
| 7886 |
CIndividualSaturationProcessNodeStatusUpdateLinker* directUpdateLinker = createIndividualSaturationUpdateLinker(calcAlgContext); |
| 7887 |
directUpdateLinker->initUpdateNodeLinker(indiNode); |
| 7888 |
|
| 7889 |
indiNode->addMaxAtleastCardinalityCandidate(atleastCandidate); |
| 7890 |
indiNode->addMaxAtmostCardinalityCandidate(atmostCandidate); |
| 7891 |
|
| 7892 |
while (directUpdateLinker) { |
| 7893 |
CIndividualSaturationProcessNodeStatusUpdateLinker* nextUpdateLinker = directUpdateLinker; |
| 7894 |
directUpdateLinker = directUpdateLinker->getNext(); |
| 7895 |
CIndividualSaturationProcessNode* updateIndiNode = nextUpdateLinker->getData(); |
| 7896 |
nextUpdateLinker->clearNext(); |
| 7897 |
releaseIndividualSaturationUpdateLinker(nextUpdateLinker,calcAlgContext); |
| 7898 |
++mMaximumCardinalityCandidatesUpdatedCount; |
| 7899 |
|
| 7900 |
|
| 7901 |
for (CXNegLinker<CIndividualSaturationProcessNode*>* depdendingIndiLinkerIt = updateIndiNode->getCopyDependingIndividualNodeLinker(); depdendingIndiLinkerIt; depdendingIndiLinkerIt = depdendingIndiLinkerIt->getNext()) { |
| 7902 |
CIndividualSaturationProcessNode* dependingIndi = depdendingIndiLinkerIt->getData(); |
| 7903 |
if (requiresMaxCardinalityCandidatePropagation(dependingIndi,atleastCandidate,atmostCandidate,calcAlgContext)) { |
| 7904 |
dependingIndi->addMaxAtleastCardinalityCandidate(atleastCandidate); |
| 7905 |
dependingIndi->addMaxAtmostCardinalityCandidate(atmostCandidate); |
| 7906 |
++mMaximumCardinalityCandidatesUpdatedCount; |
| 7907 |
directUpdateLinker = createIndividualSaturationUpdateLinker(calcAlgContext)->initUpdateNodeLinker(dependingIndi)->append(directUpdateLinker); |
| 7908 |
} |
| 7909 |
} |
| 7910 |
|
| 7911 |
|
| 7912 |
if (!updateIndiNode->isABoxIndividualRepresentationNode()) { |
| 7913 |
CRoleBackwardSaturationPropagationHash* backwardPropHash = updateIndiNode->getRoleBackwardPropagationHash(false); |
| 7914 |
if (backwardPropHash) { |
| 7915 |
CPROCESSHASH<CRole*,CRoleBackwardSaturationPropagationHashData>* backPropHash = backwardPropHash->getRoleBackwardPropagationDataHash(); |
| 7916 |
for (CPROCESSHASH<CRole*,CRoleBackwardSaturationPropagationHashData>::const_iterator it = backPropHash->constBegin(), itEnd = backPropHash->constEnd(); it != itEnd; ++it) { |
| 7917 |
CRole* backwardPropRole = it.key(); |
| 7918 |
const CRoleBackwardSaturationPropagationHashData& backwardPropData = it.value(); |
| 7919 |
for (CBackwardSaturationPropagationLink* linkIt = backwardPropData.mLinkLinker; linkIt; linkIt = linkIt->getNext()) { |
| 7920 |
CIndividualSaturationProcessNode* sourceIndividual = linkIt->getSourceIndividual(); |
| 7921 |
if (requiresMaxCardinalityCandidatePropagation(sourceIndividual,atleastCandidate,atmostCandidate,calcAlgContext)) { |
| 7922 |
sourceIndividual->addMaxAtleastCardinalityCandidate(atleastCandidate); |
| 7923 |
sourceIndividual->addMaxAtmostCardinalityCandidate(atmostCandidate); |
| 7924 |
++mMaximumCardinalityCandidatesUpdatedCount; |
| 7925 |
directUpdateLinker = createIndividualSaturationUpdateLinker(calcAlgContext)->initUpdateNodeLinker(sourceIndividual)->append(directUpdateLinker); |
| 7926 |
} |
| 7927 |
} |
| 7928 |
} |
| 7929 |
} |
| 7930 |
|
| 7931 |
|
| 7932 |
for (CXLinker<CIndividualSaturationProcessNode*>* nonInvConnIndiLinkerIt = updateIndiNode->getNonInverseConnectedIndividualNodeLinker(); nonInvConnIndiLinkerIt; nonInvConnIndiLinkerIt = nonInvConnIndiLinkerIt->getNext()) { |
| 7933 |
CIndividualSaturationProcessNode* sourceIndividual = nonInvConnIndiLinkerIt->getData(); |
| 7934 |
if (requiresMaxCardinalityCandidatePropagation(sourceIndividual,atleastCandidate,atmostCandidate,calcAlgContext)) { |
| 7935 |
sourceIndividual->addMaxAtleastCardinalityCandidate(atleastCandidate); |
| 7936 |
sourceIndividual->addMaxAtmostCardinalityCandidate(atmostCandidate); |
| 7937 |
++mMaximumCardinalityCandidatesUpdatedCount; |
| 7938 |
directUpdateLinker = createIndividualSaturationUpdateLinker(calcAlgContext)->initUpdateNodeLinker(sourceIndividual)->append(directUpdateLinker); |
| 7939 |
} |
| 7940 |
} |
| 7941 |
} |
| 7942 |
} |
| 7943 |
} |
| 7944 |
} |
| 7945 |
|
| 7946 |
|
| 7947 |
|
| 7948 |
|
| 7949 |
|
| 7950 |
|
| 7951 |
|
| 7952 |
|
| 7953 |
|
| 7954 |
|
| 7955 |
|
| 7956 |
|
| 7957 |
|
| 7958 |
|
| 7959 |
|
| 7960 |
|
| 7961 |
|
| 7962 |
|
| 7963 |
|
| 7964 |
|
| 7965 |
|
| 7966 |
|
| 7967 |
|
| 7968 |
|
| 7969 |
|
| 7970 |
cint64 CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getAppliedANDRuleCount() { |
| 7971 |
return mAppliedANDRuleCount; |
| 7972 |
} |
| 7973 |
|
| 7974 |
cint64 CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getAppliedORRuleCount() { |
| 7975 |
return mAppliedORRuleCount; |
| 7976 |
} |
| 7977 |
|
| 7978 |
cint64 CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getAppliedSOMERuleCount() { |
| 7979 |
return mAppliedSOMERuleCount; |
| 7980 |
} |
| 7981 |
|
| 7982 |
cint64 CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getAppliedATLEASTRuleCount() { |
| 7983 |
return mAppliedATLEASTRuleCount; |
| 7984 |
} |
| 7985 |
|
| 7986 |
cint64 CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getAppliedALLRuleCount() { |
| 7987 |
return mAppliedALLRuleCount; |
| 7988 |
} |
| 7989 |
|
| 7990 |
cint64 CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getAppliedATMOSTRuleCount() { |
| 7991 |
return mAppliedATMOSTRuleCount; |
| 7992 |
} |
| 7993 |
|
| 7994 |
cint64 CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getAppliedTotalRuleCount() { |
| 7995 |
return mAppliedTOTALRuleCount; |
| 7996 |
} |
| 7997 |
|
| 7998 |
|
| 7999 |
|
| 8000 |
|
| 8001 |
|
| 8002 |
QString CCalculationTableauApproximationSaturationTaskHandleAlgorithm::writeGeneratedExtendedDebugIndiModelStringList(const QString& filename, CCalculationAlgorithmContextBase* calcAlgContext, cint64 firstIndiID, cint64 lastIndiID) { |
| 8003 |
QStringList indiStringList; |
| 8004 |
QString remainingDebugString = generateExtendedDebugIndiModelStringList(calcAlgContext, firstIndiID, lastIndiID, &indiStringList); |
| 8005 |
|
| 8006 |
QFile file(filename); |
| 8007 |
if (file.open(QIODevice::WriteOnly)) { |
| 8008 |
|
| 8009 |
for (const QString& tmpString : indiStringList) { |
| 8010 |
|
| 8011 |
QString tmpReplacedString = tmpString; |
| 8012 |
tmpReplacedString = tmpReplacedString.replace("<br>", "").replace("<p>", "\n"); |
| 8013 |
file.write(tmpReplacedString.toLocal8Bit()); |
| 8014 |
file.write(QString("\r\n\r\n\r\n").toLocal8Bit()); |
| 8015 |
} |
| 8016 |
file.write(remainingDebugString.toLocal8Bit()); |
| 8017 |
file.close(); |
| 8018 |
} |
| 8019 |
|
| 8020 |
if (indiStringList.size() < 100000) { |
| 8021 |
mDebugIndiModelStringList = indiStringList; |
| 8022 |
mDebugIndiModelString = mDebugIndiModelStringList.join("<br><p><br>\r\n"); |
| 8023 |
|
| 8024 |
mDebugIndiModelString += remainingDebugString; |
| 8025 |
} |
| 8026 |
|
| 8027 |
return mDebugIndiModelString; |
| 8028 |
} |
| 8029 |
|
| 8030 |
|
| 8031 |
QString CCalculationTableauApproximationSaturationTaskHandleAlgorithm::generateExtendedDebugIndiModelStringList(CCalculationAlgorithmContextBase* calcAlgContext, cint64 firstIndiID, cint64 lastIndiID, QStringList* list) { |
| 8032 |
CProcessingDataBox* procDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 8033 |
CIndividualSaturationProcessNodeVector* indiVec = procDataBox->getIndividualSaturationProcessNodeVector(); |
| 8034 |
cint64 indiCount = indiVec->getItemCount(); |
| 8035 |
if (lastIndiID >= 0) { |
| 8036 |
indiCount = qMin(lastIndiID,indiCount); |
| 8037 |
} |
| 8038 |
firstIndiID = qMin(firstIndiID,indiCount); |
| 8039 |
QStringList indiStringList; |
| 8040 |
for (cint64 i = firstIndiID; i < indiCount; ++i) { |
| 8041 |
CIndividualSaturationProcessNode* indi = indiVec->getData(i); |
| 8042 |
if (indi) { |
| 8043 |
CExtendedConceptReferenceLinkingData* extConRefLinkData = indi->getSaturationConceptReferenceLinking(); |
| 8044 |
CSaturationConceptDataItem* conceptSatItem = (CSaturationConceptDataItem*)extConRefLinkData; |
| 8045 |
QString nominalString = QString(""); |
| 8046 |
if (conceptSatItem) { |
| 8047 |
CConcept* initializedConcept = conceptSatItem->getSaturationConcept(); |
| 8048 |
bool initializedNegation = conceptSatItem->getSaturationNegation(); |
| 8049 |
if (initializedConcept->hasClassName() && !initializedNegation) { |
| 8050 |
nominalString = QString(", ")+CIRIName::getRecentIRIName(initializedConcept->getClassNameLinker()); |
| 8051 |
} else { |
| 8052 |
if (!initializedNegation) { |
| 8053 |
nominalString = QString(", %1").arg(initializedConcept->getConceptTag()); |
| 8054 |
} else { |
| 8055 |
nominalString = QString(", %1%2").arg(QChar(0x00AC)).arg(initializedConcept->getConceptTag()); |
| 8056 |
} |
| 8057 |
} |
| 8058 |
//if (indi->getNominalIndividual()) { |
| 8059 |
// nominalString = QString(", ")+CIRIName::getRecentIRIName(indi->getNominalIndividual()->getNameLinker()); |
| 8060 |
//} |
| 8061 |
} else { |
| 8062 |
if (indi->getNominalIndividual()) { |
| 8063 |
nominalString = QString(", ")+CIRIName::getRecentIRIName(indi->getNominalIndividual()->getNameLinker()); |
| 8064 |
} else { |
| 8065 |
nominalString = QString(",Resolved-Extension-Node"); |
| 8066 |
} |
| 8067 |
} |
| 8068 |
QString refModeString("[new root node]"); |
| 8069 |
CIndividualSaturationProcessNode* refIndi = indi->getReferenceIndividualSaturationProcessNode(); |
| 8070 |
if (refIndi) { |
| 8071 |
cint64 refIndiID = refIndi->getIndividualID(); |
| 8072 |
if (refIndi->getReferenceMode() == 1) { |
| 8073 |
refModeString = QString("[substitute node %1]").arg(refIndiID); |
| 8074 |
} else if (refIndi->getReferenceMode() == 2) { |
| 8075 |
refModeString = QString("[copy node %1]").arg(refIndiID); |
| 8076 |
} |
| 8077 |
} |
| 8078 |
QString indiString = QString("[ %1%2 ] <- %3<br>\n").arg(indi->getIndividualID()).arg(nominalString).arg(refModeString); |
| 8079 |
QString conSetString; |
| 8080 |
CReapplyConceptSaturationLabelSet* conSet = indi->getReapplyConceptSaturationLabelSet(false); |
| 8081 |
if (conSet) { |
| 8082 |
CCriticalIndividualNodeConceptTestSet* criticalIndiNodeConTestSet = calcAlgContext->getProcessingDataBox()->getSaturationCriticalIndividualNodeConceptTestSet(false); |
| 8083 |
CConceptSaturationDescriptor* conDesIt = conSet->getConceptSaturationDescriptionLinker(); |
| 8084 |
while (conDesIt) { |
| 8085 |
CConceptSaturationDescriptor* conDes = conDesIt; |
| 8086 |
CConcept* concept = conDes->getConcept(); |
| 8087 |
cint64 conTag = conDes->getConceptTag(); |
| 8088 |
if (conTag != 1) { |
| 8089 |
QString conceptString("null"); |
| 8090 |
if (conDes) { |
| 8091 |
conceptString = CConceptTextFormater::getConceptString(conDes->getConcept(),conDes->isNegated()); |
| 8092 |
} |
| 8093 |
if (!conSetString.isEmpty()) { |
| 8094 |
conSetString += QString("<br>\n"); |
| 8095 |
} |
| 8096 |
conSetString += conceptString; |
| 8097 |
if (criticalIndiNodeConTestSet && criticalIndiNodeConTestSet->isConceptTestedForIndividual(conDes, indi)) { |
| 8098 |
conSetString += " {critical checked}"; |
| 8099 |
} |
| 8100 |
} |
| 8101 |
conDesIt = conDesIt->getNextConceptDesciptor(); |
| 8102 |
} |
| 8103 |
} |
| 8104 |
|
| 8105 |
|
| 8106 |
QString appliedDataLiteralString; |
| 8107 |
if (indi->getAppliedDatatypeData(false)) { |
| 8108 |
if (indi->getAppliedDatatypeData(false)->getAppliedDataLiteral() && indi->getAppliedDatatypeData(false)->getAppliedDatatype()) { |
| 8109 |
appliedDataLiteralString = QString("AppliedDataLiteral: %1^^%2<br>\n").arg(indi->getAppliedDatatypeData(false)->getAppliedDataLiteral()->getLexicalDataLiteralValueString()).arg(indi->getAppliedDatatypeData(false)->getAppliedDatatype()->getDatatypeIRI()); |
| 8110 |
} else if (indi->getAppliedDatatypeData(false)->getAppliedDataLiteral()) { |
| 8111 |
appliedDataLiteralString = QString("AppliedDataLiteral: %1 (without datatype)<br>\n").arg(indi->getAppliedDatatypeData(false)->getAppliedDataLiteral()->getLexicalDataLiteralValueString()); |
| 8112 |
} |
| 8113 |
|
| 8114 |
} |
| 8115 |
|
| 8116 |
QString propString; |
| 8117 |
CRoleBackwardSaturationPropagationHash* backwardPropHash = indi->getRoleBackwardPropagationHash(false); |
| 8118 |
if (backwardPropHash) { |
| 8119 |
CPROCESSHASH<CRole*,CRoleBackwardSaturationPropagationHashData>* backPropHash = backwardPropHash->getRoleBackwardPropagationDataHash(); |
| 8120 |
for (CPROCESSHASH<CRole*,CRoleBackwardSaturationPropagationHashData>::const_iterator it = backPropHash->constBegin(), itEnd = backPropHash->constEnd(); it != itEnd; ++it) { |
| 8121 |
CRole* backwardPropRole = it.key(); |
| 8122 |
const CRoleBackwardSaturationPropagationHashData& backwardPropData = it.value(); |
| 8123 |
QString roleString; |
| 8124 |
roleString += QString::number(backwardPropRole->getRoleTag()); |
| 8125 |
if (backwardPropRole->hasPropertyName()) { |
| 8126 |
roleString += QString("~")+CIRIName::getRecentIRIName(backwardPropRole->getPropertyNameLinker()); |
| 8127 |
} |
| 8128 |
|
| 8129 |
QString sourceIndiListString; |
| 8130 |
CBackwardSaturationPropagationLink* backPropLinkIt = backwardPropData.mLinkLinker; |
| 8131 |
while (backPropLinkIt) { |
| 8132 |
CIndividualSaturationProcessNode* sourceIndiNode = backPropLinkIt->getSourceIndividual(); |
| 8133 |
if (!sourceIndiListString.isEmpty()) { |
| 8134 |
sourceIndiListString.append(", ->"); |
| 8135 |
} else { |
| 8136 |
sourceIndiListString.append(" ->"); |
| 8137 |
} |
| 8138 |
sourceIndiListString += QString::number(sourceIndiNode->getIndividualID()); |
| 8139 |
backPropLinkIt = backPropLinkIt->getNext(); |
| 8140 |
} |
| 8141 |
|
| 8142 |
QString roleBackPropString = QString("%1:%2").arg(roleString).arg(sourceIndiListString); |
| 8143 |
propString += QString("<br>\n%1").arg(roleBackPropString); |
| 8144 |
} |
| 8145 |
} |
| 8146 |
if (propString.isEmpty()) { |
| 8147 |
propString = "-"; |
| 8148 |
} |
| 8149 |
|
| 8150 |
|
| 8151 |
|
| 8152 |
|
| 8153 |
|
| 8154 |
QString succString; |
| 8155 |
CLinkedRoleSaturationSuccessorHash* linkedSuccHash = indi->getLinkedRoleSuccessorHash(false); |
| 8156 |
if (linkedSuccHash) { |
| 8157 |
QStringList succRoleStringList; |
| 8158 |
CPROCESSHASH<CRole*,CLinkedRoleSaturationSuccessorData*>* succHash = linkedSuccHash->getLinkedRoleSuccessorHash(); |
| 8159 |
for (CPROCESSHASH<CRole*,CLinkedRoleSaturationSuccessorData*>::const_iterator it = succHash->constBegin(), itEnd = succHash->constEnd(); it != itEnd; ++it) { |
| 8160 |
CRole* role(it.key()); |
| 8161 |
CLinkedRoleSaturationSuccessorData* succLinkData(it.value()); |
| 8162 |
CPROCESSMAP<cint64,CSaturationSuccessorData*>* succDataMap = succLinkData->getSuccessorNodeDataMap(false); |
| 8163 |
QStringList linkedSuccIndiStringList; |
| 8164 |
for (CPROCESSMAP<cint64,CSaturationSuccessorData*>::const_iterator itSucc = succDataMap->constBegin(), itSuccEnd = succDataMap->constEnd(); itSucc != itSuccEnd; ++itSucc) { |
| 8165 |
cint64 succIndiID = itSucc.key(); |
| 8166 |
CSaturationSuccessorData* succData(itSucc.value()); |
| 8167 |
QStringList indiSuccStatusStringList; |
| 8168 |
if (succData->mExtension) { |
| 8169 |
indiSuccStatusStringList << QString("~extension"); |
| 8170 |
} else { |
| 8171 |
indiSuccStatusStringList << QString("~base"); |
| 8172 |
} |
| 8173 |
if (succData->mActiveCount > 0) { |
| 8174 |
indiSuccStatusStringList << QString("~active"); |
| 8175 |
} else { |
| 8176 |
indiSuccStatusStringList << QString("~inactive"); |
| 8177 |
} |
| 8178 |
if (succLinkData->mRoleALLConceptsProcessingQueued) { |
| 8179 |
indiSuccStatusStringList << QString("~all-ext-queued"); |
| 8180 |
} |
| 8181 |
QStringList createRoleStingList; |
| 8182 |
for (CXNegLinker<CRole*>* roleCreationLinkerIt = succData->mCreationRoleLinker; roleCreationLinkerIt; roleCreationLinkerIt = roleCreationLinkerIt->getNext()) { |
| 8183 |
QString creationRoleString; |
| 8184 |
CRole* creationRole = roleCreationLinkerIt->getData(); |
| 8185 |
creationRoleString += QString::number(creationRole->getRoleTag()); |
| 8186 |
if (creationRole->hasPropertyName()) { |
| 8187 |
creationRoleString += QString("~")+CIRIName::getRecentIRIName(creationRole->getPropertyNameLinker()); |
| 8188 |
} |
| 8189 |
createRoleStingList << creationRoleString; |
| 8190 |
} |
| 8191 |
QString linkedSuccIndiString = QString("\t~>%1; link-status: %2; creation-roles: %3;").arg(succIndiID).arg(indiSuccStatusStringList.join(", ")).arg(createRoleStingList.join(", ")); |
| 8192 |
linkedSuccIndiStringList.append(linkedSuccIndiString); |
| 8193 |
} |
| 8194 |
|
| 8195 |
if (!linkedSuccIndiStringList.isEmpty()) { |
| 8196 |
QString roleString; |
| 8197 |
roleString += QString::number(role->getRoleTag()); |
| 8198 |
if (role->hasPropertyName()) { |
| 8199 |
roleString += QString("~")+CIRIName::getRecentIRIName(role->getPropertyNameLinker()); |
| 8200 |
} |
| 8201 |
|
| 8202 |
QString roleSuccString = QString("<br>\n%1:<br>\n%2").arg(roleString).arg(linkedSuccIndiStringList.join("<br>\n")); |
| 8203 |
succRoleStringList.append(roleSuccString); |
| 8204 |
} |
| 8205 |
} |
| 8206 |
succString = QString("<br>\n%1").arg(succRoleStringList.join("")); |
| 8207 |
} |
| 8208 |
if (succString.isEmpty()) { |
| 8209 |
succString = "-"; |
| 8210 |
} |
| 8211 |
|
| 8212 |
|
| 8213 |
QString depIndiString; |
| 8214 |
CXNegLinker<CIndividualSaturationProcessNode*>* depIndiLinker = indi->getCopyDependingIndividualNodeLinker(); |
| 8215 |
if (depIndiLinker) { |
| 8216 |
QString depIndiListString; |
| 8217 |
while (depIndiLinker) { |
| 8218 |
CIndividualSaturationProcessNode* depIndi = depIndiLinker->getData(); |
| 8219 |
depIndiLinker = depIndiLinker->getNext(); |
| 8220 |
if (!depIndiListString.isEmpty()) { |
| 8221 |
depIndiListString.append(", "); |
| 8222 |
} else { |
| 8223 |
depIndiListString.append(">>"); |
| 8224 |
} |
| 8225 |
depIndiListString.append(QString::number(depIndi->getIndividualID())); |
| 8226 |
} |
| 8227 |
depIndiString = QString("<br>\nForwarding to: %1<br>\n").arg(depIndiListString); |
| 8228 |
} |
| 8229 |
|
| 8230 |
CIndividualSaturationProcessNodeStatusFlags* directStatusFlags = indi->getDirectStatusFlags(); |
| 8231 |
QString directFlagString; |
| 8232 |
QStringList directFlagsStringList = generateStatusFlagsStringList(directStatusFlags,calcAlgContext); |
| 8233 |
if (indi->isABoxIndividualRepresentationNode()) { |
| 8234 |
directFlagsStringList += "individual representation node"; |
| 8235 |
} |
| 8236 |
if (indi->isOccurrenceStatisticsCollectingRequired()) { |
| 8237 |
directFlagsStringList += "occurrence statistics collection marked"; |
| 8238 |
} |
| 8239 |
if (indi->isOccurrenceStatisticsCollected()) { |
| 8240 |
directFlagsStringList += "occurrence statistics collected"; |
| 8241 |
} |
| 8242 |
|
| 8243 |
if (!directFlagsStringList.isEmpty()) { |
| 8244 |
directFlagString = QString("<br>\nDirect Flags: %1<br>\n").arg(directFlagsStringList.join(",")); |
| 8245 |
} |
| 8246 |
CIndividualSaturationProcessNodeStatusFlags* indirectStatusFlags = indi->getIndirectStatusFlags(); |
| 8247 |
QString indirectFlagString; |
| 8248 |
QStringList indirectFlagsStringList = generateStatusFlagsStringList(indirectStatusFlags,calcAlgContext); |
| 8249 |
if (!indirectFlagsStringList.isEmpty()) { |
| 8250 |
indirectFlagString = QString("<br>\nIndirect Flags: %1<br>\n").arg(indirectFlagsStringList.join(",")); |
| 8251 |
} |
| 8252 |
|
| 8253 |
|
| 8254 |
QString clashedString; |
| 8255 |
CConceptSaturationDescriptor* clashConDesLinker = indi->getClashedConceptSaturationDescriptorLinker(); |
| 8256 |
if (clashConDesLinker) { |
| 8257 |
QString clashedConDesString; |
| 8258 |
for (CConceptSaturationDescriptor* clashConDesLinkerIt = clashConDesLinker; clashConDesLinkerIt; clashConDesLinkerIt = clashConDesLinkerIt->getNext()) { |
| 8259 |
CConcept* concept = clashConDesLinkerIt->getConcept(); |
| 8260 |
cint64 conTag = clashConDesLinkerIt->getConceptTag(); |
| 8261 |
QString conceptString("null"); |
| 8262 |
if (clashConDesLinkerIt) { |
| 8263 |
conceptString = CConceptTextFormater::getConceptString(clashConDesLinkerIt->getConcept(),clashConDesLinkerIt->isNegated()); |
| 8264 |
} |
| 8265 |
if (!clashedConDesString.isEmpty()) { |
| 8266 |
clashedConDesString += QString("<br>\n"); |
| 8267 |
} |
| 8268 |
clashedConDesString += conceptString; |
| 8269 |
} |
| 8270 |
clashedString += QString("<br>\nClashed Inserted Concepts: {<br>\n%1<br>\n}<br>\n").arg(clashedConDesString); |
| 8271 |
} |
| 8272 |
|
| 8273 |
|
| 8274 |
indiString += QString("{%1} <br>\n<br>\n%2Backwardlinks %3<br>\nSuccessorLinks %4<br>\n%5%6%7%8").arg(conSetString).arg(appliedDataLiteralString).arg(propString).arg(succString).arg(depIndiString).arg(directFlagString).arg(indirectFlagString).arg(clashedString); |
| 8275 |
indiStringList.append(indiString); |
| 8276 |
} |
| 8277 |
} |
| 8278 |
|
| 8279 |
|
| 8280 |
if (!list) { |
| 8281 |
if (indiStringList.size() >= 1000000) { |
| 8282 |
QFile file(QString("./Debugging/SaturationTasks/tmp-%1.txt").arg(calcAlgContext->getUsedSatisfiableCalculationTask()->getTaskDepth())); |
| 8283 |
if (file.open(QIODevice::WriteOnly)) { |
| 8284 |
|
| 8285 |
for (const QString& tmpString : indiStringList) { |
| 8286 |
|
| 8287 |
QString tmpReplacedString = tmpString; |
| 8288 |
tmpReplacedString = tmpReplacedString.replace("<br>", "\r\n"); |
| 8289 |
file.write(tmpReplacedString.toLocal8Bit()); |
| 8290 |
file.write(QString("\r\n\r\n\r\n").toLocal8Bit()); |
| 8291 |
} |
| 8292 |
|
| 8293 |
|
| 8294 |
file.close(); |
| 8295 |
} |
| 8296 |
} else { |
| 8297 |
|
| 8298 |
mDebugIndiModelStringList = indiStringList; |
| 8299 |
mDebugIndiModelString = mDebugIndiModelStringList.join("<br>\n<p><br>\n\r\n"); |
| 8300 |
} |
| 8301 |
} else { |
| 8302 |
mDebugIndiModelString.clear(); |
| 8303 |
*list = indiStringList; |
| 8304 |
} |
| 8305 |
|
| 8306 |
|
| 8307 |
return mDebugIndiModelString; |
| 8308 |
} |
| 8309 |
|
| 8310 |
QStringList CCalculationTableauApproximationSaturationTaskHandleAlgorithm::generateStatusFlagsStringList(CIndividualSaturationProcessNodeStatusFlags* statusFlags, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 8311 |
QStringList flagsStringList; |
| 8312 |
if (statusFlags->hasClashedFlag()) { |
| 8313 |
flagsStringList += QString("clashed"); |
| 8314 |
} |
| 8315 |
if (statusFlags->hasInsufficientFlag()) { |
| 8316 |
flagsStringList += QString("insufficient"); |
| 8317 |
} |
| 8318 |
if (statusFlags->hasNominalConnectionFlag()) { |
| 8319 |
flagsStringList += QString("nominal connection"); |
| 8320 |
} |
| 8321 |
if (statusFlags->hasCriticalFlag()) { |
| 8322 |
flagsStringList += QString("critical"); |
| 8323 |
} |
| 8324 |
if (statusFlags->hasCardinalityProplematicFlag()) { |
| 8325 |
flagsStringList += QString("cardinality problematic"); |
| 8326 |
} |
| 8327 |
if (statusFlags->hasEQCandidateProplematicFlag()) { |
| 8328 |
flagsStringList += QString("eqCandidate problematic"); |
| 8329 |
} |
| 8330 |
if (statusFlags->hasMissedABoxConsistencyFlag()) { |
| 8331 |
flagsStringList += QString("missed ABox consistency data"); |
| 8332 |
} |
| 8333 |
if (statusFlags->hasInitializedFlag()) { |
| 8334 |
flagsStringList += QString("initialized"); |
| 8335 |
} |
| 8336 |
if (statusFlags->hasCompletedFlag()) { |
| 8337 |
flagsStringList += QString("completed"); |
| 8338 |
} |
| 8339 |
if (statusFlags->hasUnprocessedFlag()) { |
| 8340 |
flagsStringList += QString("unprocessed"); |
| 8341 |
} |
| 8342 |
if (statusFlags->hasUnmarkedRoleAssertionFlag()) { |
| 8343 |
flagsStringList += QString("unmarked role assertion"); |
| 8344 |
} |
| 8345 |
if (statusFlags->hasUnregisteredPropagationFlag()) { |
| 8346 |
flagsStringList += QString("unregistered role assertion"); |
| 8347 |
} |
| 8348 |
if (statusFlags->hasPropagationIncompleteFlag()) { |
| 8349 |
flagsStringList += QString("propagation incomplete"); |
| 8350 |
} |
| 8351 |
if (flagsStringList.isEmpty()) { |
| 8352 |
flagsStringList += QString("none"); |
| 8353 |
} |
| 8354 |
return flagsStringList; |
| 8355 |
} |
| 8356 |
|
| 8357 |
QString CCalculationTableauApproximationSaturationTaskHandleAlgorithm::getDebugIndividualConceptName(CIndividualSaturationProcessNode* indi, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 8358 |
CExtendedConceptReferenceLinkingData* extConRefLinkData = indi->getSaturationConceptReferenceLinking(); |
| 8359 |
CSaturationConceptDataItem* conceptSatItem = (CSaturationConceptDataItem*)extConRefLinkData; |
| 8360 |
QString nominalString = QString(""); |
| 8361 |
if (conceptSatItem) { |
| 8362 |
CConcept* initializedConcept = conceptSatItem->getSaturationConcept(); |
| 8363 |
bool initializedNegation = conceptSatItem->getSaturationNegation(); |
| 8364 |
if (initializedConcept->hasClassName() && !initializedNegation) { |
| 8365 |
nominalString = CIRIName::getRecentIRIName(initializedConcept->getClassNameLinker()); |
| 8366 |
} |
| 8367 |
} |
| 8368 |
return nominalString; |
| 8369 |
} |
| 8370 |
|
| 8371 |
QString CCalculationTableauApproximationSaturationTaskHandleAlgorithm::generateDebugIndiModelStringList(CCalculationAlgorithmContextBase* calcAlgContext) { |
| 8372 |
CProcessingDataBox* procDataBox = calcAlgContext->getUsedProcessingDataBox(); |
| 8373 |
CIndividualSaturationProcessNodeVector* indiVec = procDataBox->getIndividualSaturationProcessNodeVector(); |
| 8374 |
cint64 indiCount = indiVec->getItemCount(); |
| 8375 |
QStringList indiStringList; |
| 8376 |
for (cint64 i = 0; i < indiCount; ++i) { |
| 8377 |
CIndividualSaturationProcessNode* indi = indiVec->getData(i); |
| 8378 |
CReapplyConceptSaturationLabelSet* conSet = indi->getReapplyConceptSaturationLabelSet(false); |
| 8379 |
if (conSet) { |
| 8380 |
QString nominalString = QString(""); |
| 8381 |
//if (indi->getNominalIndividual()) { |
| 8382 |
// nominalString = QString(", ")+CIRIName::getRecentIRIName(indi->getNominalIndividual()->getNameLinker()); |
| 8383 |
//} |
| 8384 |
QString indiString = QString("[ %1%2 ] = ").arg(indi->getIndividualID()).arg(nominalString); |
| 8385 |
QString conSetString; |
| 8386 |
CReapplyConceptSaturationLabelSetIterator conSetIt = conSet->getIterator(true,false); |
| 8387 |
while (conSetIt.hasNext()) { |
| 8388 |
CConceptSaturationDescriptor* conDes = conSetIt.getConceptSaturationDescriptor(); |
| 8389 |
CConcept* concept = conDes->getConcept(); |
| 8390 |
cint64 conTag = conDes->getConceptTag(); |
| 8391 |
if (conTag != 1) { |
| 8392 |
QString conString = QString("%1%2").arg((conDes->isNegated())?"-":"").arg(conTag); |
| 8393 |
if (concept->hasClassName()) { |
| 8394 |
conString += CIRIName::getRecentIRIName(concept->getClassNameLinker()); |
| 8395 |
} |
| 8396 |
if (!conSetString.isEmpty()) { |
| 8397 |
conSetString += QString(", "); |
| 8398 |
} |
| 8399 |
conSetString += conString; |
| 8400 |
} |
| 8401 |
conSetIt.moveNext(); |
| 8402 |
} |
| 8403 |
indiString += QString("{%1} ").arg(conSetString); |
| 8404 |
indiStringList.append(indiString); |
| 8405 |
} |
| 8406 |
} |
| 8407 |
|
| 8408 |
mDebugIndiModelStringList = indiStringList; |
| 8409 |
mDebugIndiModelString = mDebugIndiModelStringList.join("\n"); |
| 8410 |
return mDebugIndiModelString; |
| 8411 |
} |
| 8412 |
|
| 8413 |
|
| 8414 |
|
| 8415 |
|
| 8416 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::testDebugSaturationTaskContainsConcepts(CIndividualSaturationProcessNode* indiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 8417 |
CReapplyConceptSaturationLabelSet* conSet = indiNode->getReapplyConceptSaturationLabelSet(); |
| 8418 |
if (conSet) { |
| 8419 |
CReapplyConceptSaturationLabelSetIterator it = conSet->getIterator(true,false); |
| 8420 |
while (it.hasNext()) { |
| 8421 |
CConceptSaturationDescriptor* conSatDes = it.getConceptSaturationDescriptor(); |
| 8422 |
if (conSatDes) { |
| 8423 |
CConcept* concept = conSatDes->getConcept(); |
| 8424 |
bool conceptNegation = conSatDes->getNegation(); |
| 8425 |
testDebugSaturationTaskContainsConcept(concept,conceptNegation,indiNode,calcAlgContext); |
| 8426 |
} |
| 8427 |
it.moveNext(); |
| 8428 |
} |
| 8429 |
} |
| 8430 |
} |
| 8431 |
|
| 8432 |
|
| 8433 |
void CCalculationTableauApproximationSaturationTaskHandleAlgorithm::testDebugSaturationTaskContainsConcept(CConcept* concept, bool conNegation, CIndividualSaturationProcessNode* indiNode, CCalculationAlgorithmContextBase* calcAlgContext) { |
| 8434 |
if (mDebugTestingSaturationTask) { |
| 8435 |
cint64 individualID = indiNode->getIndividualID(); |
| 8436 |
CProcessingDataBox* procDataBox = mDebugTestingSaturationTask->getProcessingDataBox(); |
| 8437 |
if (procDataBox) { |
| 8438 |
CIndividualProcessNodeVector* indiVec = procDataBox->getIndividualProcessNodeVector(); |
| 8439 |
CIndividualProcessNode* indiNode = indiVec->getData(individualID); |
| 8440 |
CReapplyConceptLabelSet* conSet = indiNode->getReapplyConceptLabelSet(false); |
| 8441 |
bool contained = conSet->containsConcept(concept,conNegation); |
| 8442 |
if (!contained) { |
| 8443 |
|
| 8444 |
mDebugTestSaturationDebugIndiModelString = generateExtendedDebugIndiModelStringList(calcAlgContext); |
| 8445 |
QFile tmpFile("tmp4.txt"); |
| 8446 |
if (tmpFile.open(QIODevice::WriteOnly)) { |
| 8447 |
tmpFile.write(mDebugTestSaturationDebugIndiModelString.toLocal8Bit()); |
| 8448 |
tmpFile.close(); |
| 8449 |
} |
| 8450 |
|
| 8451 |
bool bug = true; |
| 8452 |
} |
| 8453 |
} |
| 8454 |
} |
| 8455 |
} |
| 8456 |
|
| 8457 |
}; // end namespace Algorithm |
| 8458 |
|
| 8459 |
}; // end namespace Kernel |
| 8460 |
|
| 8461 |
}; // end namespace Reasoner |
| 8462 |
|
| 8463 |
}; // end namespace Konclude |