Debian Codegraph @

Source/Reasoner/Kernel/Manager/COntologyRequirementPreparingData.cpp

raw
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 "COntologyRequirementPreparingData.h"
22
23
24 namespace Konclude {
25
26 namespace Reasoner {
27
28 namespace Kernel {
29
30 namespace Manager {
31
32
33 COntologyRequirementPreparingData::COntologyRequirementPreparingData(CConcreteOntology* ontology) {
34 mOntology = ontology;
35 mRequirementsProcessed = false;
36 }
37
38
39 COntologyRequirementPreparingData::~COntologyRequirementPreparingData() {
40 foreach (COntologyProcessingRequirement* requirement, mAllReqList) {
41 if (requirement->isDynamicRequirement()) {
42 delete requirement;
43 }
44 }
45 }
46
47
48
49 COntologyRequirementPreparingData* COntologyRequirementPreparingData::addOntologyRequirement(COntologyProcessingRequirement* requirement) {
50 mAllReqList.append(requirement);
51 bool addedReq = false;
52 COntologyProcessingStepRequirement* requirementStep = dynamic_cast<COntologyProcessingStepRequirement*>(requirement);
53 if (requirementStep) {
54 COntologyProcessingStep::PROCESSORTYPE proType = requirementStep->getRequiredProcessingStep()->getProcessorType();
55 if (proType == COntologyProcessingStep::OPPREPROCESSOR) {
56 mPreprocessorReqList.append(requirement);
57 addedReq = true;
58 } else if (proType == COntologyProcessingStep::OPPRECOMPUTER) {
59 mPrecomputorReqList.append(requirement);
60 addedReq = true;
61 } else if (proType == COntologyProcessingStep::OPCLASSCLASSIFIER) {
62 mClassClassifierReqList.append(requirement);
63 addedReq = true;
64 } else if (proType == COntologyProcessingStep::OPDATAPROPERTYCLASSIFIER) {
65 mDataPropertyClassifierReqList.append(requirement);
66 addedReq = true;
67 } else if (proType == COntologyProcessingStep::OPOBJECTPROPERTYCLASSIFIER) {
68 mObjectPropertyClassifierReqList.append(requirement);
69 addedReq = true;
70 } else if (proType == COntologyProcessingStep::OPREALIZER) {
71 mRealizerReqList.append(requirement);
72 addedReq = true;
73 } else if (proType == COntologyProcessingStep::OPANSWERER) {
74 mAnswererReqList.append(requirement);
75 addedReq = true;
76 }
77 }
78 COntologyProcessingConceptSaturationRequirement* conSatRequirement = dynamic_cast<COntologyProcessingConceptSaturationRequirement*>(requirement);
79 if (conSatRequirement) {
80 mPrecomputorReqList.append(requirement);
81 addedReq = true;
82 }
83 COntologyProcessingDynamicRealizationRequirement* dynRealRequirement = dynamic_cast<COntologyProcessingDynamicRealizationRequirement*>(requirement);
84 if (dynRealRequirement) {
85 mRealizerReqList.append(requirement);
86 addedReq = true;
87 }
88
89 if (!addedReq) {
90 mFailedReqList.append(requirement);
91 }
92 return this;
93 }
94
95
96 }; // end namespace Manager
97
98 }; // end namespace Kernel
99
100 }; // end namespace Reasoner
101
102 }; // end namespace Konclude