| 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 |
#ifndef KONCLUDE_REASONER_KERNEL_PROCESS_CDATATYPECOMPAREVALUESPACEMAP_H |
| 22 |
#define KONCLUDE_REASONER_KERNEL_PROCESS_CDATATYPECOMPAREVALUESPACEMAP_H |
| 23 |
|
| 24 |
// Libraries includes |
| 25 |
|
| 26 |
|
| 27 |
// Namespace includes |
| 28 |
#include "ProcessSettings.h" |
| 29 |
#include "CProcessContext.h" |
| 30 |
#include "CDatatypeCompareValueData.h" |
| 31 |
#include "CDatatypeCompareValueSpaceMapData.h" |
| 32 |
#include "CDatatypeCompareValueSpaceMapArranger.h" |
| 33 |
#include "CClashedDependencyDescriptor.h" |
| 34 |
#include "CDatatypeValueSpaceValuesCounter.h" |
| 35 |
#include "CDatatypeValueSpaceDependencyCollector.h" |
| 36 |
|
| 37 |
|
| 38 |
// Other includes |
| 39 |
#include "Utilities/Container/CLinker.h" |
| 40 |
|
| 41 |
#include "Reasoner/Ontology/CDatatypeValueSpaceType.h" |
| 42 |
#include "Reasoner/Ontology/CDatatypeValueSpaceCompareType.h" |
| 43 |
|
| 44 |
// Logger includes |
| 45 |
#include "Logger/CLogger.h" |
| 46 |
|
| 47 |
|
| 48 |
namespace Konclude { |
| 49 |
|
| 50 |
namespace Reasoner { |
| 51 |
|
| 52 |
using namespace Ontology; |
| 53 |
|
| 54 |
namespace Kernel { |
| 55 |
|
| 56 |
namespace Process { |
| 57 |
|
| 58 |
/*! |
| 59 |
* |
| 60 |
* \class CDatatypeCompareValueSpaceMap |
| 61 |
* \author Andreas Steigmiller |
| 62 |
* \version 0.1 |
| 63 |
* \brief TODO |
| 64 |
* |
| 65 |
*/ |
| 66 |
class CDatatypeCompareValueSpaceMap : public CPROCESSMAP<CDatatypeCompareValueSpaceMapArranger,CDatatypeCompareValueSpaceMapData> { |
| 67 |
// public methods |
| 68 |
public: |
| 69 |
//! Constructor |
| 70 |
CDatatypeCompareValueSpaceMap(CProcessContext* processContext); |
| 71 |
|
| 72 |
CDatatypeCompareValueSpaceMap* initDatatypeCompareValueSpaceMap(CDatatypeCompareValueSpaceMap* map); |
| 73 |
CDatatypeCompareValueSpaceMap* initDatatypeCompareValueSpaceMap(CDatatypeValueSpaceCompareType* valueSpaceType); |
| 74 |
|
| 75 |
|
| 76 |
bool hasExcludedMinimum(CDataLiteralCompareValue* value, bool valueInclusively); |
| 77 |
bool hasExcludedMaximum(CDataLiteralCompareValue* value, bool valueInclusively); |
| 78 |
|
| 79 |
bool isValueExcluded(CDataLiteralCompareValue* value); |
| 80 |
|
| 81 |
|
| 82 |
bool restrictToValue(CDataLiteralCompareValue* value, CDependencyTrackPoint* depTrackPoint); |
| 83 |
|
| 84 |
bool excludeMinimum(CDataLiteralCompareValue* value, bool valueInclusively, CDependencyTrackPoint* depTrackPoint); |
| 85 |
bool excludeMaximum(CDataLiteralCompareValue* value, bool valueInclusively, CDependencyTrackPoint* depTrackPoint); |
| 86 |
|
| 87 |
|
| 88 |
bool excludeValue(CDataLiteralCompareValue* value, CDependencyTrackPoint* depTrackPoint); |
| 89 |
bool excludeInterval(CDataLiteralCompareValue* leftValue, bool leftValueInclusive, CDataLiteralCompareValue* rightValue, bool rightValueInclusive, CDependencyTrackPoint* depTrackPoint); |
| 90 |
bool excludeAll(CDependencyTrackPoint* depTrackPoint); |
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
bool testValueSpaceReturnClashed(); |
| 95 |
bool addValueSpaceDependencies(CDatatypeValueSpaceDependencyCollector* depCollector); |
| 96 |
|
| 97 |
|
| 98 |
bool getAbsoluteMinimumValue(CDataLiteralCompareValue*& minValue, bool& minValueInclusive, CDependencyTrackPoint** depTrackPoint = nullptr); |
| 99 |
bool getAbsoluteMaximumValue(CDataLiteralCompareValue*& maxValue, bool& maxValueInclusive, CDependencyTrackPoint** depTrackPoint = nullptr); |
| 100 |
|
| 101 |
|
| 102 |
bool countAllValues(CDatatypeValueSpaceValuesCounter* counter); |
| 103 |
bool countIntervalValues(CDataLiteralCompareValue* leftValue, bool leftValueInclusive, CDataLiteralCompareValue* rightValue, bool rightValueInclusive, CDatatypeValueSpaceValuesCounter* counter); |
| 104 |
bool countValueValues(CDataLiteralCompareValue* value, CDatatypeValueSpaceValuesCounter* counter); |
| 105 |
|
| 106 |
|
| 107 |
bool addIntervalExclusionDependencies(CDataLiteralCompareValue* leftValue, bool leftValueInclusive, CDataLiteralCompareValue* rightValue, bool rightValueInclusive, CDatatypeValueSpaceDependencyCollector* depCollector); |
| 108 |
bool addValueExclusionDependencies(CDataLiteralCompareValue* value, CDatatypeValueSpaceDependencyCollector* depCollector); |
| 109 |
|
| 110 |
|
| 111 |
bool getNextPossibleDataValue(CDataLiteralCompareValue* nextValue, CDataLiteralCompareValue* lastValue); |
| 112 |
|
| 113 |
// protected methods |
| 114 |
protected: |
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
bool adaptNewCompareValueDataToNeighbours(CDatatypeCompareValueData* valueData); |
| 119 |
|
| 120 |
CDatatypeCompareValueData* getDatatypeCompareValueData(CDataLiteralCompareValue* value, bool createOrLocalize = false, bool* newValueInsertion = nullptr); |
| 121 |
CDatatypeCompareValueData* getDatatypeCompareValueData(CDataLiteralCompareValue* value, CDatatypeCompareValueSpaceMapData& valueMapData, bool createOrLocalize, bool* newValueInsertion); |
| 122 |
|
| 123 |
bool isDataIntervalExcluded(CDatatypeCompareValueData* leftValueExcluded, CDatatypeCompareValueData* rightValueExcluded); |
| 124 |
bool isDataIntervalExcluded(CDataLiteralCompareValue* leftValueExcluded, CDatatypeCompareValueData* rightValueExcluded); |
| 125 |
bool isDataIntervalExcluded(CDatatypeCompareValueData* leftValueExcluded, CDataLiteralCompareValue* rightValueExcluded); |
| 126 |
|
| 127 |
|
| 128 |
bool isLeftDataIntervalExcluded(CDatatypeCompareValueData* dataValue); |
| 129 |
bool isRightDataIntervalExcluded(CDatatypeCompareValueData* dataValue); |
| 130 |
|
| 131 |
bool isDataValueExcluded(CDatatypeCompareValueData* dataValue); |
| 132 |
bool isDataValueExcluded(CDataLiteralCompareValue* dataValue); |
| 133 |
|
| 134 |
|
| 135 |
bool excludeData(CDatatypeCompareValueDataExclusion* exlcusionData, CDependencyTrackPoint* depTrackPoint, bool force); |
| 136 |
bool excludeDataValue(CDatatypeCompareValueData* dataValue, CDependencyTrackPoint* depTrackPoint, bool force); |
| 137 |
bool excludeLeftDataInterval(CDatatypeCompareValueData* dataValue, CDependencyTrackPoint* depTrackPoint, bool force); |
| 138 |
bool excludeRightDataInterval(CDatatypeCompareValueData* dataValue, CDependencyTrackPoint* depTrackPoint, bool force); |
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
bool addDataValueExclusionDependencies(CDatatypeCompareValueData* dataValue, CDatatypeValueSpaceDependencyCollector* depCollector); |
| 144 |
bool addDataIntervalExclusionDependencies(CDatatypeCompareValueData* leftValueExcluded, CDatatypeCompareValueData* rightValueExcluded, CDatatypeValueSpaceDependencyCollector* depCollector); |
| 145 |
|
| 146 |
bool addLeftIntervalExclusionDependencies(CDatatypeCompareValueData* valueData, CDatatypeValueSpaceDependencyCollector* depCollector); |
| 147 |
bool addRightIntervalExclusionDependencies(CDatatypeCompareValueData* valueData, CDatatypeValueSpaceDependencyCollector* depCollector); |
| 148 |
bool addExclusionDependencies(CDatatypeCompareValueDataExclusion* exclusionData, CDatatypeValueSpaceDependencyCollector* depCollector); |
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
bool countDataIntervalValues(CDataLiteralCompareValue* leftValueExcluded, CDataLiteralCompareValue* rightValueExcluded, CDatatypeCompareValueDataExclusion* exlcusionData, CDatatypeValueSpaceValuesCounter* counter); |
| 153 |
bool countDataIntervalValues(CDatatypeCompareValueData* leftValueExcluded, CDatatypeCompareValueData* rightValueExcluded, CDatatypeValueSpaceValuesCounter* counter); |
| 154 |
bool countDataIntervalValues(CDataLiteralCompareValue* leftValueExcluded, CDatatypeCompareValueData* rightValueExcluded, CDatatypeValueSpaceValuesCounter* counter); |
| 155 |
bool countDataIntervalValues(CDatatypeCompareValueData* leftValueExcluded, CDataLiteralCompareValue* rightValueExcluded, CDatatypeValueSpaceValuesCounter* counter); |
| 156 |
|
| 157 |
bool countDataValue(CDataLiteralCompareValue* value, CDatatypeCompareValueDataExclusion* exlcusionData, CDatatypeValueSpaceValuesCounter* counter); |
| 158 |
bool countDataValue(CDatatypeCompareValueData* dataValue, CDatatypeValueSpaceValuesCounter* counter); |
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
virtual bool representsInfinitelyManyValues(CDataLiteralCompareValue* value) = 0; |
| 163 |
virtual bool representsInfinitelyManyValues(CDataLiteralCompareValue* leftValueExcluded, CDataLiteralCompareValue* rightValueExcluded) = 0; |
| 164 |
virtual bool getValueCopy(CDataLiteralCompareValue* valueCopyInto, CDataLiteralCompareValue* valueCopyFrom) = 0; |
| 165 |
virtual bool getValueNext(CDataLiteralCompareValue* valueNext, CDataLiteralCompareValue* valueLast) = 0; |
| 166 |
virtual cuint64 getIntervalValueCount(CDataLiteralCompareValue* leftValueExcluded, CDataLiteralCompareValue* rightValueExcluded) = 0; |
| 167 |
|
| 168 |
|
| 169 |
// protected variables |
| 170 |
protected: |
| 171 |
CProcessContext* mProcessContext; |
| 172 |
|
| 173 |
CDatatypeCompareValueData* mAbsoluteMinimumExclusionValue; |
| 174 |
CDatatypeCompareValueData* mAbsoluteMaximumExclusionValue; |
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
// private methods |
| 179 |
private: |
| 180 |
|
| 181 |
// private variables |
| 182 |
private: |
| 183 |
|
| 184 |
}; |
| 185 |
|
| 186 |
}; // end namespace Process |
| 187 |
|
| 188 |
}; // end namespace Kernel |
| 189 |
|
| 190 |
}; // end namespace Reasoner |
| 191 |
|
| 192 |
}; // end namespace Konclude |
| 193 |
|
| 194 |
#endif // KONCLUDE_REASONER_KERNEL_PROCESS_CDATATYPECOMPAREVALUESPACEMAP_H |