| 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 "CRequirementConfigPreprocessingThread.h" |
| 22 |
|
| 23 |
|
| 24 |
namespace Konclude { |
| 25 |
|
| 26 |
namespace Reasoner { |
| 27 |
|
| 28 |
namespace Preprocess { |
| 29 |
|
| 30 |
|
| 31 |
CRequirementConfigPreprocessingThread::CRequirementConfigPreprocessingThread(CReasonerManager *reasonerManager) : CPreprocessingThread(reasonerManager),CLogDomain("::Konclude::Reasoner::Kernel::Preprocessor") { |
| 32 |
} |
| 33 |
|
| 34 |
|
| 35 |
CRequirementConfigPreprocessingThread::~CRequirementConfigPreprocessingThread() { |
| 36 |
} |
| 37 |
|
| 38 |
|
| 39 |
COntologyPreprocessingItem* CRequirementConfigPreprocessingThread::initializeOntologyPreprocessingItem(CConcreteOntology* ontology, CConfigurationBase* config) { |
| 40 |
CRequirementConfigPreprocessingItem* item = new CRequirementConfigPreprocessingItem(); |
| 41 |
item->initRequirementConfigPreprocessingItem(ontology,config); |
| 42 |
return item; |
| 43 |
} |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
bool CRequirementConfigPreprocessingThread::createNextTest() { |
| 53 |
|
| 54 |
|
| 55 |
COntologyPreprocessingItem* loopOntPreCompItem = 0; |
| 56 |
bool workTestCreated = false; |
| 57 |
while (!workTestCreated && !mProcessingOntItemList.isEmpty()) { |
| 58 |
COntologyPreprocessingItem* ontPreCompItem = mProcessingOntItemList.first(); |
| 59 |
|
| 60 |
if (ontPreCompItem == loopOntPreCompItem) { |
| 61 |
// don't run into infinite loop without doing something |
| 62 |
break; |
| 63 |
} |
| 64 |
|
| 65 |
CRequirementConfigPreprocessingItem* reqConfPreCompItem = (CRequirementConfigPreprocessingItem*)ontPreCompItem; |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
bool failDebug = false; |
| 70 |
|
| 71 |
if (!workTestCreated && reqConfPreCompItem->isTriplesMappingStepRequired()) { |
| 72 |
if (!reqConfPreCompItem->isTriplesMappingStepFinished()) { |
| 73 |
if (reqConfPreCompItem->areTriplesMappingStepProcessingRequirementSatisfied()) { |
| 74 |
if (!reqConfPreCompItem->getOntology()->getOntologyTriplesData()->getAllTriplesData()->isEmpty()) { |
| 75 |
LOG(INFO, getDomain(), logTr("Mapping RDF triples to OWL expressions and axioms."), this); |
| 76 |
} |
| 77 |
mapTriplesToOWL(reqConfPreCompItem); |
| 78 |
reqConfPreCompItem->getTriplesMappingProcessingStep()->setStepFinished(true); |
| 79 |
reqConfPreCompItem->getTriplesMappingProcessingStep()->submitRequirementsUpdate(); |
| 80 |
} |
| 81 |
else { |
| 82 |
reqConfPreCompItem->getTriplesMappingProcessingStep()->submitRequirementsUpdate(COntologyProcessingStatus::PSFAILED | COntologyProcessingStatus::PSFAILEDREQUIREMENT); |
| 83 |
} |
| 84 |
} else { |
| 85 |
reqConfPreCompItem->getTriplesMappingProcessingStep()->submitRequirementsUpdate(); |
| 86 |
} |
| 87 |
} |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
if (!workTestCreated && reqConfPreCompItem->isActiveCountingStepRequired()) { |
| 92 |
if (!reqConfPreCompItem->isActiveCountingStepFinished()) { |
| 93 |
if (reqConfPreCompItem->areActiveCountingStepProcessingRequirementSatisfied()) { |
| 94 |
LOG(INFO,getDomain(),logTr("Counting active entities."),this); |
| 95 |
countActiveEntites(reqConfPreCompItem); |
| 96 |
reqConfPreCompItem->getActiveCountingProcessingStep()->setStepFinished(true); |
| 97 |
reqConfPreCompItem->getActiveCountingProcessingStep()->submitRequirementsUpdate(); |
| 98 |
} else { |
| 99 |
reqConfPreCompItem->getActiveCountingProcessingStep()->submitRequirementsUpdate(COntologyProcessingStatus::PSFAILED | COntologyProcessingStatus::PSFAILEDREQUIREMENT); |
| 100 |
} |
| 101 |
} else { |
| 102 |
reqConfPreCompItem->getActiveCountingProcessingStep()->submitRequirementsUpdate(); |
| 103 |
} |
| 104 |
} |
| 105 |
|
| 106 |
|
| 107 |
if (!workTestCreated && reqConfPreCompItem->isBuildStepRequired()) { |
| 108 |
if (!reqConfPreCompItem->isBuildStepFinished()) { |
| 109 |
if (reqConfPreCompItem->areBuildStepProcessingRequirementSatisfied()) { |
| 110 |
LOG(INFO,getDomain(),logTr("Build intern ontology representation."),this); |
| 111 |
createBuild(reqConfPreCompItem); |
| 112 |
if (reqConfPreCompItem->failAfterBuilt()) { |
| 113 |
failDebug = true; |
| 114 |
reqConfPreCompItem->getBuildProcessingStep()->submitRequirementsUpdate(COntologyProcessingStatus::PSFAILED); |
| 115 |
} else { |
| 116 |
reqConfPreCompItem->getBuildProcessingStep()->setStepFinished(true); |
| 117 |
reqConfPreCompItem->getBuildProcessingStep()->submitRequirementsUpdate(); |
| 118 |
} |
| 119 |
} else { |
| 120 |
reqConfPreCompItem->getBuildProcessingStep()->submitRequirementsUpdate(COntologyProcessingStatus::PSFAILED | COntologyProcessingStatus::PSFAILEDREQUIREMENT); |
| 121 |
} |
| 122 |
} else { |
| 123 |
reqConfPreCompItem->getBuildProcessingStep()->submitRequirementsUpdate(); |
| 124 |
} |
| 125 |
} |
| 126 |
|
| 127 |
|
| 128 |
if (!workTestCreated && reqConfPreCompItem->isPreprocessStepRequired()) { |
| 129 |
if (!reqConfPreCompItem->isPreprocessStepFinished()) { |
| 130 |
if (reqConfPreCompItem->arePreprocessStepProcessingRequirementSatisfied()) { |
| 131 |
LOG(INFO,getDomain(),logTr("Preprocess ontology."),this); |
| 132 |
createPreprocess(reqConfPreCompItem); |
| 133 |
if (reqConfPreCompItem->failAfterPreprocessing()) { |
| 134 |
failDebug = true; |
| 135 |
reqConfPreCompItem->getPreprocessProcessingStep()->submitRequirementsUpdate(COntologyProcessingStatus::PSFAILED); |
| 136 |
} else { |
| 137 |
reqConfPreCompItem->getPreprocessProcessingStep()->setStepFinished(true); |
| 138 |
reqConfPreCompItem->getPreprocessProcessingStep()->submitRequirementsUpdate(); |
| 139 |
} |
| 140 |
} else { |
| 141 |
reqConfPreCompItem->getPreprocessProcessingStep()->submitRequirementsUpdate(COntologyProcessingStatus::PSFAILED | COntologyProcessingStatus::PSFAILEDREQUIREMENT); |
| 142 |
} |
| 143 |
} else { |
| 144 |
reqConfPreCompItem->getPreprocessProcessingStep()->submitRequirementsUpdate(); |
| 145 |
} |
| 146 |
} |
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
if (!workTestCreated && reqConfPreCompItem->getTriplesIndexingProcessingStep()) { |
| 151 |
if (!reqConfPreCompItem->isTriplesIndexingStepFinished()) { |
| 152 |
if (reqConfPreCompItem->areTriplesIndexingStepProcessingRequirementSatisfied()) { |
| 153 |
LOG(INFO, getDomain(), logTr("Indexing triple encoded assertions."), this); |
| 154 |
indexTripleEncodedAssertions(reqConfPreCompItem); |
| 155 |
reqConfPreCompItem->getTriplesIndexingProcessingStep()->setStepFinished(true); |
| 156 |
reqConfPreCompItem->getTriplesIndexingProcessingStep()->submitRequirementsUpdate(); |
| 157 |
} else { |
| 158 |
reqConfPreCompItem->getTriplesIndexingProcessingStep()->submitRequirementsUpdate(COntologyProcessingStatus::PSFAILED | COntologyProcessingStatus::PSFAILEDREQUIREMENT); |
| 159 |
} |
| 160 |
} else { |
| 161 |
reqConfPreCompItem->getTriplesIndexingProcessingStep()->submitRequirementsUpdate(); |
| 162 |
} |
| 163 |
} |
| 164 |
|
| 165 |
if (!workTestCreated) { |
| 166 |
if (!reqConfPreCompItem->hasRemainingProcessingRequirements()) { |
| 167 |
finishOntologyPreprocessing(reqConfPreCompItem); |
| 168 |
mProcessingOntItemList.removeFirst(); |
| 169 |
} else { |
| 170 |
mProcessingOntItemList.removeFirst(); |
| 171 |
mProcessingOntItemList.append(reqConfPreCompItem); |
| 172 |
loopOntPreCompItem = ontPreCompItem; |
| 173 |
} |
| 174 |
} |
| 175 |
} |
| 176 |
return workTestCreated; |
| 177 |
} |
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
bool CRequirementConfigPreprocessingThread::mapTriplesToOWL(CRequirementConfigPreprocessingItem* reqConfPreCompItem) { |
| 182 |
bool newTriplesMapped = false; |
| 183 |
CConcreteOntology* ontology = reqConfPreCompItem->getOntology(); |
| 184 |
COntologyTriplesData* triplesData = ontology->getOntologyTriplesData(); |
| 185 |
|
| 186 |
//CConcreteOntologyUpdateCollectorBuilder* updateBuilder = new CConcreteOntologyUpdateCollectorBuilder(ontology); |
| 187 |
//updateBuilder->initializeBuilding(); |
| 188 |
//CConcreteOntologyRedlandTriplesDataExpressionMapper* triplesMapper = new CConcreteOntologyRedlandTriplesDataExpressionMapper(updateBuilder); |
| 189 |
//newTriplesMapped = triplesMapper->mapTriples(ontology, triplesData); |
| 190 |
//updateBuilder->completeBuilding(); |
| 191 |
return newTriplesMapped; |
| 192 |
} |
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
bool CRequirementConfigPreprocessingThread::indexTripleEncodedAssertions(CRequirementConfigPreprocessingItem* reqConfPreCompItem) { |
| 197 |
bool triplesIndexed = false; |
| 198 |
CConcreteOntology* ontology = reqConfPreCompItem->getOntology(); |
| 199 |
COntologyTriplesData* triplesData = ontology->getOntologyTriplesData(); |
| 200 |
|
| 201 |
bool convertToIndividualData = CConfigDataReader::readConfigBoolean(reqConfPreCompItem->getConfiguration(), "Konclude.Calculation.Preprocessing.TripleEncodedAssertionsIndexing.IndividualDataConvertion"); |
| 202 |
bool concurrentIndividualDataConvertion = CConfigDataReader::readConfigBoolean(reqConfPreCompItem->getConfiguration(), "Konclude.Calculation.Preprocessing.TripleEncodedAssertionsIndexing.ConcurrentIndividualDataConvertion"); |
| 203 |
|
| 204 |
#ifdef KONCLUDE_REDLAND_INTEGRATION |
| 205 |
if (convertToIndividualData) { |
| 206 |
if (!concurrentIndividualDataConvertion) { |
| 207 |
CRedlandStoredTriplesIndividualAssertionConvertionIndexer* triplesMapper = new CRedlandStoredTriplesIndividualAssertionConvertionIndexer(); |
| 208 |
triplesIndexed = triplesMapper->indexABoxIndividuals(ontology, triplesData); |
| 209 |
} else { |
| 210 |
CRedlandStoredTriplesIndividualAssertionConvertionQtConcurrentIndexer* triplesMapper = new CRedlandStoredTriplesIndividualAssertionConvertionQtConcurrentIndexer(); |
| 211 |
triplesIndexed = triplesMapper->indexABoxIndividuals(ontology, triplesData); |
| 212 |
} |
| 213 |
} else { |
| 214 |
CRedlandStoredTriplesIndividualAssertionIndexer* triplesMapper = new CRedlandStoredTriplesIndividualAssertionIndexer(); |
| 215 |
triplesIndexed = triplesMapper->indexABoxIndividuals(ontology, triplesData); |
| 216 |
} |
| 217 |
#endif // !KONCLUDE_REDLAND_INTEGRATION |
| 218 |
return triplesIndexed; |
| 219 |
} |
| 220 |
|
| 221 |
|
| 222 |
bool CRequirementConfigPreprocessingThread::countActiveEntites(CRequirementConfigPreprocessingItem* reqConfPreCompItem) { |
| 223 |
|
| 224 |
CConcreteOntology* ontology = reqConfPreCompItem->getOntology(); |
| 225 |
CConfiguration* ontConfig = ontology->getConfiguration(); |
| 226 |
COntologyIncrementalRevisionData* incRevData = ontology->getIncrementalRevisionData(); |
| 227 |
|
| 228 |
|
| 229 |
CONTOLOGYAXIOMLIST< QPair<CAxiomExpression*,bool> >* changeAxiomList = ontology->getBuildData()->getChangeAxiomList(); |
| 230 |
cint64 newAxiomCount = changeAxiomList->size(); |
| 231 |
|
| 232 |
cint64 lastChangeCountedAxiom = incRevData->getLastChangeCountedAxiom(); |
| 233 |
COntologyIncrementalAxiomChangeData* incAxChangeData = incRevData->getAxiomChangeData(); |
| 234 |
bool axiomsChanged = false; |
| 235 |
for (cint64 currAxiom = lastChangeCountedAxiom; currAxiom < newAxiomCount; ++currAxiom) { |
| 236 |
const QPair<CAxiomExpression*,bool>& axiomChangePair((*changeAxiomList)[currAxiom]); |
| 237 |
bool axiomAdded = axiomChangePair.second; |
| 238 |
CAxiomExpression* axiom = axiomChangePair.first; |
| 239 |
CBuildExpression::ExpressionType axiomType = axiom->getType(); |
| 240 |
if (axiomType == CBuildExpression::BETDECLARATION) { |
| 241 |
CDeclarationAxiomExpression* decAxiomExp = dynamic_cast<CDeclarationAxiomExpression*>(axiom); |
| 242 |
if (decAxiomExp) { |
| 243 |
CExpressionEntity* entityExp = decAxiomExp->getEntity(); |
| 244 |
CClassExpression* classExp = dynamic_cast<CClassExpression*>(entityExp); |
| 245 |
if (classExp) { |
| 246 |
if (axiomAdded) { |
| 247 |
incAxChangeData->incAddedTBoxAxiomCount(); |
| 248 |
} else { |
| 249 |
incAxChangeData->incDeletedTBoxAxiomCount(); |
| 250 |
} |
| 251 |
} else { |
| 252 |
CObjectPropertyExpression* objPropExp = dynamic_cast<CObjectPropertyExpression*>(entityExp); |
| 253 |
if (objPropExp) { |
| 254 |
if (axiomAdded) { |
| 255 |
incAxChangeData->incAddedRBoxAxiomCount(); |
| 256 |
} else { |
| 257 |
incAxChangeData->incDeletedRBoxAxiomCount(); |
| 258 |
} |
| 259 |
} else { |
| 260 |
CDataPropertyExpression* dataPropExp = dynamic_cast<CDataPropertyExpression*>(entityExp); |
| 261 |
if (dataPropExp) { |
| 262 |
if (axiomAdded) { |
| 263 |
incAxChangeData->incAddedRBoxAxiomCount(); |
| 264 |
} else { |
| 265 |
incAxChangeData->incDeletedRBoxAxiomCount(); |
| 266 |
} |
| 267 |
} else { |
| 268 |
CNamedIndividualExpression* namedIndiExp = dynamic_cast<CNamedIndividualExpression*>(entityExp); |
| 269 |
if (namedIndiExp) { |
| 270 |
if (axiomAdded) { |
| 271 |
incAxChangeData->incAddedABoxAxiomCount(); |
| 272 |
} else { |
| 273 |
incAxChangeData->incDeletedABoxAxiomCount(); |
| 274 |
} |
| 275 |
} else { |
| 276 |
CAnonymousIndividualExpression* anonyIndiExp = dynamic_cast<CAnonymousIndividualExpression*>(entityExp); |
| 277 |
if (anonyIndiExp) { |
| 278 |
if (axiomAdded) { |
| 279 |
incAxChangeData->incAddedABoxAxiomCount(); |
| 280 |
} else { |
| 281 |
incAxChangeData->incDeletedABoxAxiomCount(); |
| 282 |
} |
| 283 |
} |
| 284 |
} |
| 285 |
} |
| 286 |
} |
| 287 |
} |
| 288 |
} |
| 289 |
} else if (axiomType == CBuildExpression::BETEQUIVALENTCLASSES || axiomType == CBuildExpression::BETESUBCLASSOF || axiomType == CBuildExpression::BETDISJOINTUNION || axiomType == CBuildExpression::BETDISJOINTCLASSES) { |
| 290 |
if (axiomAdded) { |
| 291 |
incAxChangeData->incAddedTBoxAxiomCount(); |
| 292 |
} else { |
| 293 |
incAxChangeData->incDeletedTBoxAxiomCount(); |
| 294 |
} |
| 295 |
} else if (axiomType == CBuildExpression::BETCLASSASSERTION || axiomType == CBuildExpression::BETOBJECTPROPERTYASSERTION || axiomType == CBuildExpression::BETSAMEINDIVIDUAL || |
| 296 |
axiomType == CBuildExpression::BETDIFFERENTINDIVIDUAL || axiomType == CBuildExpression::BETNEGATIVEOBJECTPROPERTYASSERTION || |
| 297 |
axiomType == CBuildExpression::BETDATAPROPERTYASSERTION || axiomType == CBuildExpression::BETNEGATIVEDATAPROPERTYASSERTION) { |
| 298 |
if (axiomAdded) { |
| 299 |
incAxChangeData->incAddedABoxAxiomCount(); |
| 300 |
} else { |
| 301 |
incAxChangeData->incDeletedABoxAxiomCount(); |
| 302 |
} |
| 303 |
} else if (axiomType == CBuildExpression::BETSUBOBJECTPROPERTYOF || axiomType == CBuildExpression::BETTRANSETIVEPROPERTYOF || axiomType == CBuildExpression::BETINVERSEOBJECTPROPERTYOF || axiomType == CBuildExpression::BETFUNCTIONALPROPERTYOF || |
| 304 |
axiomType == CBuildExpression::BETOBJECTPROPERTYDOMAIN || axiomType == CBuildExpression::BETOBJECTPROPERTYRANGE || axiomType == CBuildExpression::BETFUNCTIONALOBJECTPROPERTY || axiomType == CBuildExpression::BETTRANSITIVEOBJECTPROPERTY || |
| 305 |
axiomType == CBuildExpression::BETINVERSEOBJECTPROPERTIES || axiomType == CBuildExpression::BETEQUIVALENTOBJECTPROPERTIES || axiomType == CBuildExpression::BETSYMMETRICPROPERTY || axiomType == CBuildExpression::BETASYMMETRICPROPERTY || |
| 306 |
axiomType == CBuildExpression::BETREFLEXIVEPROPERTY || axiomType == CBuildExpression::BETIRREFLEXIVEPROPERTY || axiomType == CBuildExpression::BETOBJECTPROPERTYCHAIN || axiomType == CBuildExpression::BETDISJOINTOBJECTPROPERTIES || axiomType == CBuildExpression::BETINVERSEFUNCTIONALPROPERTY) { |
| 307 |
if (axiomAdded) { |
| 308 |
incAxChangeData->incAddedRBoxAxiomCount(); |
| 309 |
} else { |
| 310 |
incAxChangeData->incDeletedRBoxAxiomCount(); |
| 311 |
} |
| 312 |
} else if (axiomType == CBuildExpression::BETDATAPROPERTYDOMAIN || axiomType == CBuildExpression::BETDATAPROPERTYRANGE || axiomType == CBuildExpression::BETSUBDATAPROPERTYOF || axiomType == CBuildExpression::BETDISJOINTDATAPROPERTIES || |
| 313 |
axiomType == CBuildExpression::BETEQUIVALENTDATAPROPERTIES || axiomType == CBuildExpression::BETFUNCTIONALDATAPROPERTY || axiomType == CBuildExpression::BETDATAPROPERTYASSERTION || axiomType == CBuildExpression::BETNEGATIVEDATAPROPERTYASSERTION) { |
| 314 |
if (axiomAdded) { |
| 315 |
incAxChangeData->incAddedRBoxAxiomCount(); |
| 316 |
} else { |
| 317 |
incAxChangeData->incDeletedRBoxAxiomCount(); |
| 318 |
} |
| 319 |
} |
| 320 |
axiomsChanged = true; |
| 321 |
} |
| 322 |
incRevData->setLastChangeCountedAxiom(newAxiomCount); |
| 323 |
COntologyIncrementalAxiomChangeData* cummAxChangeData = incRevData->getCummulativeAxiomChangeData(); |
| 324 |
cummAxChangeData->addAxiomChangeData(incAxChangeData); |
| 325 |
|
| 326 |
|
| 327 |
|
| 328 |
bool incRebuild = CConfigDataReader::readConfigBoolean(ontConfig,"Konclude.Ontology.Revision.IncrementalRebuild"); |
| 329 |
if (!incRebuild && ontology->getIncrementalRevisionData()->getBasementOntology() != ontology) { |
| 330 |
COntologyIncrementalRevisionData* incRevData = ontology->getIncrementalRevisionData(); |
| 331 |
ontology->getDataBoxes()->referenceDataBoxes(incRevData->getBasementOntology()->getDataBoxes()); |
| 332 |
} else { |
| 333 |
incRevData->setPreviousBuiltOntology(searchPreviousBuiltOntologyVersion(incRevData,reqConfPreCompItem)); |
| 334 |
incRevData->setPreviousConsistentOntology(searchPreviousConsistentOntologyVersion(incRevData,reqConfPreCompItem)); |
| 335 |
incRevData->setPreviousClassesClassifiedOntology(searchPreviousClassesClassifiedOntologyVersion(incRevData,reqConfPreCompItem)); |
| 336 |
incRevData->setPreviousClassTypesRealizedOntology(searchPreviousClassRealizedOntologyVersion(incRevData,reqConfPreCompItem)); |
| 337 |
|
| 338 |
} |
| 339 |
|
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
bool newAxiomsCounted = false; |
| 344 |
CExpressionDataBoxMapping* expDataBoxMapping = ontology->getDataBoxes()->getExpressionDataBoxMapping(); |
| 345 |
CActiveEntityCountVector* activeEntityCountVector = expDataBoxMapping->getActiveEntityVector(); |
| 346 |
activeEntityCountVector->increaseVectorSize(ontology->getBuildData()->getNextEntityNumber(false)); |
| 347 |
CActiveEntitySubExpressionVisitorUpdater* activeEntityCountUpdater = new CActiveEntitySubExpressionVisitorUpdater(activeEntityCountVector); |
| 348 |
|
| 349 |
cint64 lastCountedAxiom = expDataBoxMapping->getLastActiveCountedEntityAxiom(); |
| 350 |
for (cint64 currAxiom = lastCountedAxiom; currAxiom < newAxiomCount; ++currAxiom) { |
| 351 |
const QPair<CAxiomExpression*,bool>& axiomChangePair((*changeAxiomList)[currAxiom]); |
| 352 |
bool axiomAdded = axiomChangePair.second; |
| 353 |
CAxiomExpression* axiom = axiomChangePair.first; |
| 354 |
activeEntityCountUpdater->updateEntitiesForAxioms(axiom,axiomAdded); |
| 355 |
newAxiomsCounted = true; |
| 356 |
} |
| 357 |
expDataBoxMapping->setLastActiveCountedEntityAxiom(newAxiomCount); |
| 358 |
|
| 359 |
delete activeEntityCountUpdater; |
| 360 |
return newAxiomsCounted; |
| 361 |
} |
| 362 |
|
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
CConcreteOntology* CRequirementConfigPreprocessingThread::searchPreviousClassRealizedOntologyVersion(COntologyIncrementalRevisionData* incRevData, CRequirementConfigPreprocessingItem* reqConfPreCompItem) { |
| 368 |
CConcreteOntology* lastRealizedOntology = nullptr; |
| 369 |
CConcreteOntology* prevOntology = incRevData->getPreviousConsistentOntology(); |
| 370 |
while (prevOntology && !lastRealizedOntology) { |
| 371 |
CRealization* prevRealizedData = prevOntology->getRealization(); |
| 372 |
if (prevRealizedData && prevRealizedData->hasConceptRealization()) { |
| 373 |
lastRealizedOntology = prevOntology; |
| 374 |
} |
| 375 |
if (!lastRealizedOntology) { |
| 376 |
prevOntology = prevOntology->getIncrementalRevisionData()->getPreviousOntologyVersion(); |
| 377 |
} |
| 378 |
} |
| 379 |
return lastRealizedOntology; |
| 380 |
} |
| 381 |
|
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
CConcreteOntology* CRequirementConfigPreprocessingThread::searchPreviousClassesClassifiedOntologyVersion(COntologyIncrementalRevisionData* incRevData, CRequirementConfigPreprocessingItem* reqConfPreCompItem) { |
| 386 |
CConcreteOntology* lastClassifiedOntology = nullptr; |
| 387 |
CConcreteOntology* prevOntology = incRevData->getPreviousConsistentOntology(); |
| 388 |
while (prevOntology && !lastClassifiedOntology) { |
| 389 |
CClassification* prevClassifiedData = prevOntology->getClassification(); |
| 390 |
if (prevClassifiedData && prevClassifiedData->hasClassConceptClassification()) { |
| 391 |
lastClassifiedOntology = prevOntology; |
| 392 |
} |
| 393 |
if (!lastClassifiedOntology) { |
| 394 |
prevOntology = prevOntology->getIncrementalRevisionData()->getPreviousOntologyVersion(); |
| 395 |
} |
| 396 |
} |
| 397 |
return lastClassifiedOntology; |
| 398 |
} |
| 399 |
|
| 400 |
|
| 401 |
|
| 402 |
|
| 403 |
|
| 404 |
CConcreteOntology* CRequirementConfigPreprocessingThread::searchPreviousBuiltOntologyVersion(COntologyIncrementalRevisionData* incRevData, CRequirementConfigPreprocessingItem* reqConfPreCompItem) { |
| 405 |
CConcreteOntology* lastBuiltOntology = nullptr; |
| 406 |
CConcreteOntology* prevOntology = incRevData->getPreviousOntologyVersion(); |
| 407 |
while (prevOntology && !lastBuiltOntology) { |
| 408 |
bool prevBuiltData = prevOntology->getDataBoxes()->isIterationBuild(); |
| 409 |
if (prevBuiltData) { |
| 410 |
lastBuiltOntology = prevOntology; |
| 411 |
} |
| 412 |
if (!lastBuiltOntology) { |
| 413 |
prevOntology = prevOntology->getIncrementalRevisionData()->getPreviousOntologyVersion(); |
| 414 |
} |
| 415 |
} |
| 416 |
return lastBuiltOntology; |
| 417 |
} |
| 418 |
|
| 419 |
|
| 420 |
|
| 421 |
CConcreteOntology* CRequirementConfigPreprocessingThread::searchPreviousConsistentOntologyVersion(COntologyIncrementalRevisionData* incRevData, CRequirementConfigPreprocessingItem* reqConfPreCompItem) { |
| 422 |
CConcreteOntology* lastConsOntology = nullptr; |
| 423 |
CConcreteOntology* prevOntology = incRevData->getPreviousOntologyVersion(); |
| 424 |
while (prevOntology && !lastConsOntology) { |
| 425 |
CConsistence* prevConsistenceData = prevOntology->getConsistence(); |
| 426 |
if (prevConsistenceData && prevConsistenceData->isOntologyConsistent()) { |
| 427 |
if (prevConsistenceData->areAllIndividualsRepresentativelyStored() || prevConsistenceData->hasConsistenceModelData()) { |
| 428 |
lastConsOntology = prevOntology; |
| 429 |
} |
| 430 |
} |
| 431 |
if (!lastConsOntology) { |
| 432 |
prevOntology = prevOntology->getIncrementalRevisionData()->getPreviousOntologyVersion(); |
| 433 |
} |
| 434 |
} |
| 435 |
return lastConsOntology; |
| 436 |
} |
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
|
| 441 |
|
| 442 |
bool CRequirementConfigPreprocessingThread::createBuild(CRequirementConfigPreprocessingItem* reqConfPreCompItem) { |
| 443 |
CConcreteOntology* ontology = reqConfPreCompItem->getOntology(); |
| 444 |
ontology->getDataBoxes()->setBuildContinuation(); |
| 445 |
CConcreteOntologyUpdateBuilder upBuilder(ontology); |
| 446 |
upBuilder.initializeBuilding(); |
| 447 |
upBuilder.completeBuilding(); |
| 448 |
return false; |
| 449 |
} |
| 450 |
|
| 451 |
|
| 452 |
bool CRequirementConfigPreprocessingThread::createPreprocess(CRequirementConfigPreprocessingItem* reqConfPreCompItem) { |
| 453 |
CConcreteOntology* ontology = reqConfPreCompItem->getOntology(); |
| 454 |
CConfiguration* config = reqConfPreCompItem->getCalculationConfiguration(); |
| 455 |
|
| 456 |
COntologyConfigDependedPreProcesser ontConDepPreProcessor; |
| 457 |
ontConDepPreProcessor.preprocess(ontology,config); |
| 458 |
return false; |
| 459 |
} |
| 460 |
|
| 461 |
|
| 462 |
bool CRequirementConfigPreprocessingThread::preprocessingTested(COntologyPreprocessingItem* ontPreCompItem, CPreprocessingTestingItem* preTestItem, CPreprocessingCalculatedCallbackEvent* pcce) { |
| 463 |
return false; |
| 464 |
} |
| 465 |
|
| 466 |
|
| 467 |
bool CRequirementConfigPreprocessingThread::finishOntologyPreprocessing(CRequirementConfigPreprocessingItem* reqConfPreCompItem) { |
| 468 |
if (reqConfPreCompItem->areAllStepFinished()) { |
| 469 |
reqConfPreCompItem->setPreprocessingFinished(true); |
| 470 |
CConcreteOntology* ontology = reqConfPreCompItem->getOntology(); |
| 471 |
|
| 472 |
CPreprocessing* preprocessing = ontology->getPreprocessing(); |
| 473 |
preprocessing->setPreprocessed(true); |
| 474 |
} |
| 475 |
|
| 476 |
mActiveOntItemSet.remove(reqConfPreCompItem); |
| 477 |
mInactiveOntItemSet.insert(reqConfPreCompItem); |
| 478 |
|
| 479 |
reqConfPreCompItem->doPreprocessingFinishedCallback(true); |
| 480 |
return true; |
| 481 |
} |
| 482 |
|
| 483 |
|
| 484 |
}; // end namespace Preprocess |
| 485 |
|
| 486 |
}; // end namespace Reasoner |
| 487 |
|
| 488 |
}; // end namespace Konclude |