Debian Codegraph @

Source/Reasoner/Ontology/COntologyIncrementalAxiomChangeData.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 "COntologyIncrementalAxiomChangeData.h"
22
23
24 namespace Konclude {
25
26 namespace Reasoner {
27
28 namespace Ontology {
29
30
31 COntologyIncrementalAxiomChangeData::COntologyIncrementalAxiomChangeData(COntologyContext* ontoContext) {
32 mOntoContext = ontoContext;
33
34 mAddedABoxAxiomCount = 0;
35 mAddedTBoxAxiomCount = 0;
36 mAddedRBoxAxiomCount = 0;
37 mDeletedABoxAxiomCount = 0;
38 mDeletedTBoxAxiomCount = 0;
39 mDeletedRBoxAxiomCount = 0;
40
41
42 }
43
44
45
46 COntologyIncrementalAxiomChangeData* COntologyIncrementalAxiomChangeData::addAxiomChangeData(COntologyIncrementalAxiomChangeData* changeData) {
47 mAddedABoxAxiomCount += changeData->mAddedABoxAxiomCount;
48 mAddedTBoxAxiomCount += changeData->mAddedTBoxAxiomCount;
49 mAddedRBoxAxiomCount += changeData->mAddedRBoxAxiomCount;
50 mDeletedABoxAxiomCount += changeData->mDeletedABoxAxiomCount;
51 mDeletedTBoxAxiomCount += changeData->mDeletedTBoxAxiomCount;
52 mDeletedRBoxAxiomCount += changeData->mDeletedRBoxAxiomCount;
53 return this;
54 }
55
56
57 bool COntologyIncrementalAxiomChangeData::hasAxiomChanges(COntologyIncrementalAxiomChangeData* changeData) {
58 if (!changeData) {
59 return true;
60 }
61 if (mAddedABoxAxiomCount != changeData->mAddedABoxAxiomCount) {
62 return true;
63 }
64 if (mAddedTBoxAxiomCount != changeData->mAddedTBoxAxiomCount) {
65 return true;
66 }
67 if (mAddedRBoxAxiomCount != changeData->mAddedRBoxAxiomCount) {
68 return true;
69 }
70 if (mDeletedABoxAxiomCount != changeData->mDeletedABoxAxiomCount) {
71 return true;
72 }
73 if (mDeletedTBoxAxiomCount != changeData->mDeletedTBoxAxiomCount) {
74 return true;
75 }
76 if (mDeletedRBoxAxiomCount != changeData->mDeletedRBoxAxiomCount) {
77 return true;
78 }
79 return false;
80 }
81
82
83
84 cint64 COntologyIncrementalAxiomChangeData::getAddedABoxAxiomCount() {
85 return mAddedABoxAxiomCount;
86 }
87
88 cint64 COntologyIncrementalAxiomChangeData::getAddedTBoxAxiomCount() {
89 return mAddedTBoxAxiomCount;
90 }
91
92 cint64 COntologyIncrementalAxiomChangeData::getAddedRBoxAxiomCount() {
93 return mAddedRBoxAxiomCount;
94 }
95
96 cint64 COntologyIncrementalAxiomChangeData::getDeletedABoxAxiomCount() {
97 return mDeletedABoxAxiomCount;
98 }
99
100 cint64 COntologyIncrementalAxiomChangeData::getDeletedTBoxAxiomCount() {
101 return mDeletedTBoxAxiomCount;
102 }
103
104 cint64 COntologyIncrementalAxiomChangeData::getDeletedRBoxAxiomCount() {
105 return mDeletedRBoxAxiomCount;
106 }
107
108
109
110 COntologyIncrementalAxiomChangeData* COntologyIncrementalAxiomChangeData::incAddedABoxAxiomCount(cint64 incCount) {
111 mAddedABoxAxiomCount += incCount;
112 return this;
113 }
114
115 COntologyIncrementalAxiomChangeData* COntologyIncrementalAxiomChangeData::incAddedTBoxAxiomCount(cint64 incCount) {
116 mAddedTBoxAxiomCount += incCount;
117 return this;
118 }
119
120 COntologyIncrementalAxiomChangeData* COntologyIncrementalAxiomChangeData::incAddedRBoxAxiomCount(cint64 incCount) {
121 mAddedRBoxAxiomCount += incCount;
122 return this;
123 }
124
125 COntologyIncrementalAxiomChangeData* COntologyIncrementalAxiomChangeData::incDeletedABoxAxiomCount(cint64 incCount) {
126 mDeletedABoxAxiomCount += incCount;
127 return this;
128 }
129
130 COntologyIncrementalAxiomChangeData* COntologyIncrementalAxiomChangeData::incDeletedTBoxAxiomCount(cint64 incCount) {
131 mDeletedTBoxAxiomCount += incCount;
132 return this;
133 }
134
135 COntologyIncrementalAxiomChangeData* COntologyIncrementalAxiomChangeData::incDeletedRBoxAxiomCount(cint64 incCount) {
136 mDeletedRBoxAxiomCount += incCount;
137 return this;
138 }
139
140
141
142 bool COntologyIncrementalAxiomChangeData::hasAddedABoxAxioms() {
143 return mAddedABoxAxiomCount > 0;
144 }
145
146 bool COntologyIncrementalAxiomChangeData::hasAddedTBoxAxioms() {
147 return mAddedTBoxAxiomCount > 0;
148 }
149
150 bool COntologyIncrementalAxiomChangeData::hasAddedRBoxAxioms() {
151 return mAddedRBoxAxiomCount > 0;
152 }
153
154 bool COntologyIncrementalAxiomChangeData::hasDeletedABoxAxioms() {
155 return mDeletedABoxAxiomCount > 0;
156 }
157
158 bool COntologyIncrementalAxiomChangeData::hasDeletedTBoxAxioms() {
159 return mDeletedTBoxAxiomCount > 0;
160 }
161
162 bool COntologyIncrementalAxiomChangeData::hasDeletedRBoxAxioms() {
163 return mDeletedRBoxAxiomCount > 0;
164 }
165
166
167
168
169 bool COntologyIncrementalAxiomChangeData::hasChangedABoxAxioms() {
170 return hasAddedABoxAxioms() || hasDeletedABoxAxioms();
171 }
172
173 bool COntologyIncrementalAxiomChangeData::hasChangedTBoxAxioms() {
174 return hasAddedTBoxAxioms() || hasDeletedTBoxAxioms();
175 }
176
177 bool COntologyIncrementalAxiomChangeData::hasChangedRBoxAxioms() {
178 return hasAddedRBoxAxioms() || hasDeletedRBoxAxioms();
179 }
180
181
182 bool COntologyIncrementalAxiomChangeData::hasAxiomAdditions() {
183 return hasAddedABoxAxioms() || hasAddedRBoxAxioms() || hasAddedTBoxAxioms();
184 }
185
186 bool COntologyIncrementalAxiomChangeData::hasAxiomDeletions() {
187 return hasDeletedABoxAxioms() || hasDeletedTBoxAxioms() || hasDeletedRBoxAxioms();
188 }
189
190
191 bool COntologyIncrementalAxiomChangeData::hasAxiomChanges() {
192 return hasChangedABoxAxioms() || hasChangedRBoxAxioms() || hasChangedTBoxAxioms();
193 }
194
195
196 bool COntologyIncrementalAxiomChangeData::hasOnlyChangedABoxAxioms() {
197 if (hasChangedRBoxAxioms() || hasChangedTBoxAxioms()) {
198 return false;
199 }
200 return hasChangedABoxAxioms();
201 }
202
203 bool COntologyIncrementalAxiomChangeData::hasOnlyChangedTBoxAxioms() {
204 if (hasChangedABoxAxioms() || hasChangedRBoxAxioms()) {
205 return false;
206 }
207 return hasChangedTBoxAxioms();
208 }
209
210 bool COntologyIncrementalAxiomChangeData::hasOnlyChangedRBoxAxioms() {
211 if (hasChangedABoxAxioms() || hasChangedTBoxAxioms()) {
212 return false;
213 }
214 return hasChangedRBoxAxioms();
215 }
216
217 }; // end namespace Ontology
218
219 }; // end namespace Reasoner
220
221 }; // end namespace Konclude