| 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 |
#ifndef KONCLUDE_REASONER_TAXONOMY_CHIERARCHYNODE_H |
| 22 |
#define KONCLUDE_REASONER_TAXONOMY_CHIERARCHYNODE_H |
| 23 |
|
| 24 |
// Libraries includes |
| 25 |
#include <QStringList> |
| 26 |
|
| 27 |
// Namespace includes |
| 28 |
#include "TaxonomySettings.h" |
| 29 |
|
| 30 |
// Other includes |
| 31 |
#include "Reasoner/Ontology/CConcept.h" |
| 32 |
#include "Reasoner/Ontology/CAbbreviatedIRIName.h" |
| 33 |
|
| 34 |
#include "KoncludeSettings.h" |
| 35 |
|
| 36 |
// Logger includes |
| 37 |
#include "Logger/CLogger.h" |
| 38 |
|
| 39 |
|
| 40 |
namespace Konclude { |
| 41 |
|
| 42 |
namespace Reasoner { |
| 43 |
|
| 44 |
using namespace Ontology; |
| 45 |
|
| 46 |
namespace Taxonomy { |
| 47 |
|
| 48 |
#ifndef KONCLUDE_FORCE_ALL_DEBUG_DEACTIVATED |
| 49 |
|
| 50 |
//#define DEBUGHIERARCHYNODECONCEPTSTRINGS |
| 51 |
|
| 52 |
#endif |
| 53 |
|
| 54 |
/*! |
| 55 |
* |
| 56 |
* \class CHierarchyNode |
| 57 |
* \author Andreas Steigmiller |
| 58 |
* \version 0.1 |
| 59 |
* \brief TODO |
| 60 |
* |
| 61 |
*/ |
| 62 |
class CHierarchyNode { |
| 63 |
// public methods |
| 64 |
public: |
| 65 |
//! Constructor |
| 66 |
CHierarchyNode(CConcept *representiveConcept); |
| 67 |
|
| 68 |
//! Destructor |
| 69 |
virtual ~CHierarchyNode(); |
| 70 |
|
| 71 |
virtual CHierarchyNode *addParentNode(CHierarchyNode *parentNode); |
| 72 |
virtual CHierarchyNode *addChildNode(CHierarchyNode *childNode); |
| 73 |
|
| 74 |
virtual CHierarchyNode *makeParent(CHierarchyNode *parentNode); |
| 75 |
virtual CHierarchyNode *makeChild(CHierarchyNode *childNode); |
| 76 |
|
| 77 |
virtual CHierarchyNode *addEquivalentConcept(CConcept *concept); |
| 78 |
|
| 79 |
virtual bool hasChildNode(CHierarchyNode *node); |
| 80 |
virtual bool hasParentNode(CHierarchyNode *node); |
| 81 |
|
| 82 |
virtual CHierarchyNode *addPredecessorNode(CHierarchyNode *preNode); |
| 83 |
virtual CHierarchyNode *addSuccessorNode(CHierarchyNode *succNode); |
| 84 |
|
| 85 |
virtual CHierarchyNode *makePredecessor(CHierarchyNode *parentNode); |
| 86 |
virtual CHierarchyNode *makeSuccessor(CHierarchyNode *childNode); |
| 87 |
|
| 88 |
virtual bool hasSuccessorNode(CHierarchyNode *node); |
| 89 |
virtual bool hasPredecessorNode(CHierarchyNode *node); |
| 90 |
|
| 91 |
|
| 92 |
virtual CHierarchyNode *removeParent(CHierarchyNode *parentNode); |
| 93 |
virtual CHierarchyNode *removeChild(CHierarchyNode *childNode); |
| 94 |
virtual CHierarchyNode *removePredecessor(CHierarchyNode *predNode); |
| 95 |
virtual CHierarchyNode *removeSuccessor(CHierarchyNode *succNode); |
| 96 |
|
| 97 |
cint64 getPredecessorNodeCount() const; |
| 98 |
|
| 99 |
|
| 100 |
virtual QSet<CHierarchyNode *> *getParentNodeSet(); |
| 101 |
virtual QSet<CHierarchyNode *> *getChildNodeSet(); |
| 102 |
virtual QSet<CHierarchyNode *> *getPredecessorNodeSet(); |
| 103 |
virtual QSet<CHierarchyNode *> *getSuccessorNodeSet(); |
| 104 |
virtual QList<CConcept *> *getEquivalentConceptList(); |
| 105 |
|
| 106 |
virtual QList<CHierarchyNode *> getParentNodeList(); |
| 107 |
virtual QList<CHierarchyNode *> getChildNodeList(); |
| 108 |
virtual QList<CHierarchyNode *> getPredecessorNodeList(); |
| 109 |
virtual QList<CHierarchyNode *> getSuccessorNodeList(); |
| 110 |
|
| 111 |
|
| 112 |
virtual CHierarchyNode *addIncompatiblePredecessorNode(CHierarchyNode *incompNode); |
| 113 |
virtual CHierarchyNode *makeIncompatiblePredecessor(CHierarchyNode *incompNode); |
| 114 |
virtual bool hasIncompatiblePredecessorNode(CHierarchyNode *node); |
| 115 |
virtual CHierarchyNode *removeIncompatiblePredecessorNode(CHierarchyNode *incompNode); |
| 116 |
|
| 117 |
|
| 118 |
virtual CHierarchyNode *addDisjointNode(CHierarchyNode *disjNode); |
| 119 |
virtual CHierarchyNode *makeDisjoint(CHierarchyNode *disjNode); |
| 120 |
virtual bool hasDisjointNode(CHierarchyNode *node); |
| 121 |
virtual CHierarchyNode *removeDisjointNode(CHierarchyNode *disjNode); |
| 122 |
|
| 123 |
|
| 124 |
virtual CHierarchyNode *addIncompatibleSuccessorNode(CHierarchyNode *incompNode); |
| 125 |
virtual CHierarchyNode *makeIncompatibleSuccessor(CHierarchyNode *incompNode); |
| 126 |
virtual bool hasIncompatibleSuccessorNode(CHierarchyNode *node); |
| 127 |
virtual CHierarchyNode *removeIncompatibleSuccessorNode(CHierarchyNode *incompNode); |
| 128 |
|
| 129 |
|
| 130 |
virtual QSet<CHierarchyNode *> *getIncompatibleSuccessorNodeSet(); |
| 131 |
virtual QSet<CHierarchyNode *> *getIncompatiblePredecessorNodeSet(); |
| 132 |
virtual QList<CHierarchyNode *> getIncompatibleSuccessorNodeList(); |
| 133 |
virtual QList<CHierarchyNode *> getIncompatiblePredecessorNodeList(); |
| 134 |
|
| 135 |
virtual QSet<CHierarchyNode *> *getDisjointNodeSet(); |
| 136 |
virtual QList<CHierarchyNode *> getDisjointNodeList(); |
| 137 |
|
| 138 |
virtual CConcept *getOneEquivalentConcept(); |
| 139 |
virtual QString getEquivalentConceptsNodeString(); |
| 140 |
virtual QString getHierarchyConceptsNodeString(qint64 depth); |
| 141 |
|
| 142 |
virtual QStringList getEquivalentConceptStringList(bool preferAbbreviatedNames); |
| 143 |
virtual qint64 getEquivalentConceptCount(); |
| 144 |
|
| 145 |
virtual bool isActive(); |
| 146 |
virtual CHierarchyNode *setActive(bool activeNode = true); |
| 147 |
virtual CHierarchyNode *setInactive(bool inactiveNode = true); |
| 148 |
|
| 149 |
virtual bool isNeedExplicitMentioned(); |
| 150 |
virtual CHierarchyNode *setNeedExplicitMentioned(bool needsExplicitMentioned = true); |
| 151 |
|
| 152 |
// protected methods |
| 153 |
protected: |
| 154 |
#ifdef DEBUGHIERARCHYNODECONCEPTSTRINGS |
| 155 |
virtual CHierarchyNode *generateNodeStrings(); |
| 156 |
#endif |
| 157 |
|
| 158 |
// protected variables |
| 159 |
protected: |
| 160 |
#ifdef DEBUGHIERARCHYNODECONCEPTSTRINGS |
| 161 |
QStringList nodeStrings; |
| 162 |
QStringList parentNodeStrings; |
| 163 |
QStringList childNodeStrings; |
| 164 |
QStringList precNodeStrings; |
| 165 |
QStringList succNodeStrings; |
| 166 |
QStringList incPrecNodeStrings; |
| 167 |
QStringList incSuccNodeStrings; |
| 168 |
QStringList disjointNodeStrings; |
| 169 |
#endif |
| 170 |
|
| 171 |
QList<CConcept *> eqConList; |
| 172 |
qint64 eqConCount; |
| 173 |
|
| 174 |
bool active; |
| 175 |
bool mention; |
| 176 |
|
| 177 |
QSet<CHierarchyNode *> parentNodeSet; |
| 178 |
QSet<CHierarchyNode *> childNodeSet; |
| 179 |
|
| 180 |
QSet<CHierarchyNode *> predNodeSet; |
| 181 |
QSet<CHierarchyNode *> succNodeSet; |
| 182 |
|
| 183 |
QSet<CHierarchyNode *> incompPredNodeSet; |
| 184 |
QSet<CHierarchyNode *> incompSuccNodeSet; |
| 185 |
|
| 186 |
QSet<CHierarchyNode *> disjointNodeSet; |
| 187 |
|
| 188 |
|
| 189 |
// private methods |
| 190 |
private: |
| 191 |
|
| 192 |
// private variables |
| 193 |
private: |
| 194 |
|
| 195 |
}; |
| 196 |
|
| 197 |
}; // end namespace Taxonomy |
| 198 |
|
| 199 |
}; // end namespace Reasoner |
| 200 |
|
| 201 |
}; // end namespace Konclude |
| 202 |
|
| 203 |
#endif // KONCLUDE_REASONER_TAXONOMY_CHIERARCHYNODE_H |