Debian Codegraph @

Source/Reasoner/Ontology/CConceptCycleData.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 "CConceptCycleData.h"
22
23
24 namespace Konclude {
25
26 namespace Reasoner {
27
28 namespace Ontology {
29
30
31 CConceptCycleData::CConceptCycleData(CContext* context) : mContext(context),mCycleConceptSet(context) {
32 }
33
34 cint64 CConceptCycleData::getCycleID() {
35 return mCycleID;
36 }
37
38 CConceptCycleData* CConceptCycleData::setCycleID(cint64 cycleID) {
39 mCycleID = cycleID;
40 return this;
41 }
42
43 CConceptCycleData* CConceptCycleData::initConceptCycleData(CConceptCycleData* prevData) {
44 if (prevData) {
45 mCycleID = prevData->mCycleID;
46 mCycleConceptSet = prevData->mCycleConceptSet;
47 mRepCycleClass = prevData->mRepCycleClass;
48 mNominalConnection = prevData->mNominalConnection;
49 } else {
50 mCycleID = 0;
51 mCycleConceptSet.clear();
52 mRepCycleClass = nullptr;
53 mNominalConnection = false;
54 }
55 return this;
56 }
57
58 cint64 CConceptCycleData::getConceptCount() {
59 return mCycleConceptSet.count();
60 }
61
62 CBOXSET<TConceptNegPair>* CConceptCycleData::getCycleConceptSet() {
63 return &mCycleConceptSet;
64 }
65
66 CConceptCycleData* CConceptCycleData::addCycleConcept(CConcept* concept, bool negation) {
67 addCycleConcept(TConceptNegPair(concept,negation));
68 return this;
69 }
70
71 CConceptCycleData* CConceptCycleData::addCycleConcept(const TConceptNegPair& conNegPair) {
72 mCycleConceptSet.insert(conNegPair);
73 CConcept* concept = conNegPair.first;
74 bool conNeg = conNegPair.second;
75 if (!conNeg && concept->hasClassName()) {
76 mCycleClassSet.insert(concept);
77 if (!mRepCycleClass) {
78 mRepCycleClass = concept;
79 }
80 }
81 return this;
82 }
83
84 CConceptCycleData* CConceptCycleData::addCycleConcepts(const QSet<TConceptNegPair>& conNegPairSet) {
85 for (QSet<TConceptNegPair>::const_iterator it = conNegPairSet.constBegin(), itEnd = conNegPairSet.constEnd(); it != itEnd; ++it) {
86 addCycleConcept(*it);
87 }
88 return this;
89 }
90
91
92 CBOXSET<CConcept*>* CConceptCycleData::getCycleClassSet() {
93 return &mCycleClassSet;
94 }
95
96 CConcept* CConceptCycleData::getRepresentativeCycleClass() {
97 return mRepCycleClass;
98 }
99
100 bool CConceptCycleData::hasNominalConnection() {
101 return mNominalConnection;
102 }
103
104 CConceptCycleData* CConceptCycleData::setNominalConnection(bool nominalConnection) {
105 mNominalConnection = nominalConnection;
106 return this;
107 }
108
109 }; // end namespace Ontology
110
111 }; // end namespace Reasoner
112
113 }; // end namespace Konclude