| 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 "COntologyPropertyRoleClassificationItem.h" |
| 22 |
|
| 23 |
|
| 24 |
namespace Konclude { |
| 25 |
|
| 26 |
namespace Reasoner { |
| 27 |
|
| 28 |
namespace Classifier { |
| 29 |
|
| 30 |
|
| 31 |
COntologyPropertyRoleClassificationItem::COntologyPropertyRoleClassificationItem(CConfigurationBase *configuration, CClassifierStatistics *nextClassificationStatistics) : COntologyClassificationItem(configuration,nextClassificationStatistics) { |
| 32 |
mHierarchyConstructed = false; |
| 33 |
mHierarchyConstructionFailed = false; |
| 34 |
|
| 35 |
} |
| 36 |
|
| 37 |
|
| 38 |
COntologyPropertyRoleClassificationItem::~COntologyPropertyRoleClassificationItem() { |
| 39 |
} |
| 40 |
|
| 41 |
|
| 42 |
COntologyPropertyRoleClassificationItem *COntologyPropertyRoleClassificationItem::initClassificationItem(CConcreteOntology *ontology, CRolePropertiesHierarchy *hierarchy, bool classifyDataProperties) { |
| 43 |
onto = ontology; |
| 44 |
mHierarchy = hierarchy; |
| 45 |
|
| 46 |
currentCalculatingCount = 0; |
| 47 |
mClassifyDataRoles = classifyDataProperties; |
| 48 |
|
| 49 |
if (!mClassifyDataRoles) { |
| 50 |
mClassifyProcessingStepData = onto->getProcessingSteps()->getOntologyProcessingStepDataVector()->getProcessingStepData(COntologyProcessingStep::OPSOBJECTROPERTYCLASSIFY); |
| 51 |
} else { |
| 52 |
mClassifyProcessingStepData = onto->getProcessingSteps()->getOntologyProcessingStepDataVector()->getProcessingStepData(COntologyProcessingStep::OPSDATAROPERTYCLASSIFY); |
| 53 |
} |
| 54 |
mHierarchyConstructionFailed = !mClassifyProcessingStepData->getProcessingStep()->areAllRequirementsSatisfied(ontology); |
| 55 |
|
| 56 |
remainingTests = true; |
| 57 |
|
| 58 |
return this; |
| 59 |
} |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
CRolePropertiesHierarchy *COntologyPropertyRoleClassificationItem::getHierarchy() { |
| 64 |
return mHierarchy; |
| 65 |
} |
| 66 |
|
| 67 |
CTBox *COntologyPropertyRoleClassificationItem::getTBox() { |
| 68 |
return onto->getTBox(); |
| 69 |
} |
| 70 |
|
| 71 |
QHash<CSatisfiableCalculationJob*,CPropertyClassificationComputationItem*>* COntologyPropertyRoleClassificationItem::getComputationItemHash() |
| 72 |
{ |
| 73 |
return &mWorkItemHash; |
| 74 |
} |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
CPropertyRoleClassification* COntologyPropertyRoleClassificationItem::getPropertyRoleClassification() { |
| 79 |
return this; |
| 80 |
} |
| 81 |
|
| 82 |
|
| 83 |
bool COntologyPropertyRoleClassificationItem::isHierarchyConstructed() { |
| 84 |
return mHierarchyConstructed; |
| 85 |
} |
| 86 |
|
| 87 |
COntologyPropertyRoleClassificationItem* COntologyPropertyRoleClassificationItem::setHierarchyConstructionFailed() { |
| 88 |
mHierarchyConstructionFailed = true; |
| 89 |
return this; |
| 90 |
} |
| 91 |
|
| 92 |
bool COntologyPropertyRoleClassificationItem::isHierarchyConstructionFailed() { |
| 93 |
return mHierarchyConstructionFailed; |
| 94 |
} |
| 95 |
|
| 96 |
COntologyPropertyRoleClassificationItem* COntologyPropertyRoleClassificationItem::submitHierarchyConstructed() { |
| 97 |
mHierarchyConstructed = true; |
| 98 |
mClassifyProcessingStepData->getProcessingStatus()->setProcessingFlags(COntologyProcessingStatus::PSCOMPLETELYYPROCESSED); |
| 99 |
cint64 errorFlags = COntologyProcessingStatus::PSSUCESSFULL; |
| 100 |
if (mHierarchyConstructionFailed) { |
| 101 |
errorFlags = COntologyProcessingStatus::PSFAILED; |
| 102 |
} |
| 103 |
mClassifyProcessingStepData->getProcessingStatus()->setErrorFlags(errorFlags); |
| 104 |
for (QList<COntologyProcessingRequirement*>::const_iterator it = mRequirementList.constBegin(), itEnd = mRequirementList.constEnd(); it != itEnd; ++it) { |
| 105 |
COntologyProcessingRequirement* ontReq(*it); |
| 106 |
ontReq->submitRequirementUpdate(COntologyProcessingStatus::PSCOMPLETELYYPROCESSED,errorFlags); |
| 107 |
} |
| 108 |
return this; |
| 109 |
} |
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
bool COntologyPropertyRoleClassificationItem::isDataRolesClassification() { |
| 114 |
return mClassifyDataRoles; |
| 115 |
} |
| 116 |
|
| 117 |
bool COntologyPropertyRoleClassificationItem::isObjectRolesClassification() { |
| 118 |
return !mClassifyDataRoles; |
| 119 |
} |
| 120 |
|
| 121 |
COntologyPropertyRoleClassificationItem* COntologyPropertyRoleClassificationItem::setDataRolesClassification(bool classifyDataRoles) { |
| 122 |
mClassifyDataRoles = classifyDataRoles; |
| 123 |
return this; |
| 124 |
} |
| 125 |
|
| 126 |
}; // end namespace Classifier |
| 127 |
|
| 128 |
}; // end namespace Reasoner |
| 129 |
|
| 130 |
}; // end namespace Konclude |