| 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 "CAnsweringPropagationSteeringAbsorptionExtensionItemBindingController.h" |
| 22 |
|
| 23 |
namespace Konclude { |
| 24 |
|
| 25 |
namespace Reasoner { |
| 26 |
|
| 27 |
namespace Answerer { |
| 28 |
|
| 29 |
|
| 30 |
CAnsweringPropagationSteeringAbsorptionExtensionItemBindingController::CAnsweringPropagationSteeringAbsorptionExtensionItemBindingController(COptimizedComplexVariableAbsorptionBasedHandlingExtensionItem* absorptionPropagationItem, const COptimizedComplexVariableIndividualBindings& binding, CSameRealization* sameRealization) |
| 31 |
: mBinding(binding) { |
| 32 |
mAbsorptionPropagationItem = absorptionPropagationItem; |
| 33 |
mSameRealization = sameRealization; |
| 34 |
} |
| 35 |
|
| 36 |
|
| 37 |
CAnsweringPropagationSteeringAbsorptionExtensionItemBindingController::~CAnsweringPropagationSteeringAbsorptionExtensionItemBindingController() { |
| 38 |
} |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
bool CAnsweringPropagationSteeringAbsorptionExtensionItemBindingController::finalizeWithClashing() { |
| 44 |
return true; |
| 45 |
} |
| 46 |
|
| 47 |
bool CAnsweringPropagationSteeringAbsorptionExtensionItemBindingController::finalizeWithBindingExtraction() { |
| 48 |
return false; |
| 49 |
} |
| 50 |
|
| 51 |
bool CAnsweringPropagationSteeringAbsorptionExtensionItemBindingController::isPreparationBindingNominalIndividual(CVariable* variable, CIndividual* indi) { |
| 52 |
|
| 53 |
cint64 index = mAbsorptionPropagationItem->getVariableIndexHash()->value(variable); |
| 54 |
TIndividualInstanceItemDataBinding sameItemInstance = mBinding.getBinding(index); |
| 55 |
|
| 56 |
bool containsIndiFlag = false; |
| 57 |
CInstanceBindingIndividualCheckingVisitor visitor(&containsIndiFlag, indi); |
| 58 |
mSameRealization->visitSameIndividuals(sameItemInstance.reference, &visitor); |
| 59 |
|
| 60 |
return containsIndiFlag; |
| 61 |
} |
| 62 |
|
| 63 |
bool CAnsweringPropagationSteeringAbsorptionExtensionItemBindingController::isPreparationBindingNominalIndividual(CVariable* variable, cint64 indiId) { |
| 64 |
cint64 index = mAbsorptionPropagationItem->getVariableIndexHash()->value(variable); |
| 65 |
TIndividualInstanceItemDataBinding sameItemInstance = mBinding.getBinding(index); |
| 66 |
|
| 67 |
bool containsIndiFlag = false; |
| 68 |
CInstanceBindingIndividualCheckingVisitor visitor(&containsIndiFlag, indiId); |
| 69 |
mSameRealization->visitSameIndividuals(sameItemInstance.reference, &visitor); |
| 70 |
|
| 71 |
return containsIndiFlag; |
| 72 |
} |
| 73 |
|
| 74 |
bool CAnsweringPropagationSteeringAbsorptionExtensionItemBindingController::isPreparationBindingAllIndividuals(CVariable* variable) { |
| 75 |
COptimizedComplexVariableAbsorptionBasedHandlingQueryPartData* absorptionData = mAbsorptionPropagationItem->getAbsorptionBasedHandlingData(); |
| 76 |
CExpressionVariable* expVariable = absorptionData->getExpressionVariableVariableHash()->value(variable); |
| 77 |
if (!expVariable) { |
| 78 |
return true; |
| 79 |
} |
| 80 |
if (absorptionData->getAnonymousVariableSet()->contains(expVariable)) { |
| 81 |
return true; |
| 82 |
} |
| 83 |
return false; |
| 84 |
} |
| 85 |
|
| 86 |
bool CAnsweringPropagationSteeringAbsorptionExtensionItemBindingController::isRestrictedTopPropagation(CConcept* concept) { |
| 87 |
return false; |
| 88 |
} |
| 89 |
|
| 90 |
|
| 91 |
}; // end namespace Answerer |
| 92 |
|
| 93 |
}; // end namespace Reasoner |
| 94 |
|
| 95 |
}; // end namespace Konclude |