| 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_ONTOLOGY_CROLE_H |
| 22 |
#define KONCLUDE_REASONER_ONTOLOGY_CROLE_H |
| 23 |
|
| 24 |
// Libraries includes |
| 25 |
|
| 26 |
|
| 27 |
// Namespace includes |
| 28 |
#include "OntologySettings.h" |
| 29 |
#include "CConcept.h" |
| 30 |
#include "CTerminology.h" |
| 31 |
#include "CName.h" |
| 32 |
#include "CTagItem.h" |
| 33 |
#include "CNamedItem.h" |
| 34 |
#include "CRoleChain.h" |
| 35 |
#include "CRoleData.h" |
| 36 |
|
| 37 |
// Other includes |
| 38 |
#include "Utilities/CSortedNegLinker.hpp" |
| 39 |
#include "Utilities/CMemoryManager.hpp" |
| 40 |
#include "Utilities/CLinker.hpp" |
| 41 |
|
| 42 |
#include "Utilities/Container/CLinker.h" |
| 43 |
|
| 44 |
// Logger includes |
| 45 |
#include "Logger/CLogger.h" |
| 46 |
|
| 47 |
|
| 48 |
namespace Konclude { |
| 49 |
|
| 50 |
using namespace Utilities; |
| 51 |
using namespace Utilities::Container; |
| 52 |
|
| 53 |
namespace Reasoner { |
| 54 |
|
| 55 |
namespace Ontology { |
| 56 |
|
| 57 |
/*! |
| 58 |
* |
| 59 |
* \class CRole |
| 60 |
* \author Andreas Steigmiller |
| 61 |
* \version 0.1 |
| 62 |
* \brief TODO |
| 63 |
* |
| 64 |
*/ |
| 65 |
class CRole : public CTagItem, public CNamedItem { |
| 66 |
// public methods |
| 67 |
public: |
| 68 |
//! Constructor |
| 69 |
CRole(); |
| 70 |
|
| 71 |
CRole *initRole(); |
| 72 |
CRole *initRoleCopy(CRole *role, CMemoryAllocationManager* memMan); |
| 73 |
|
| 74 |
CRole *setRoleTag(qint64 roleTag); |
| 75 |
qint64 getRoleTag() const; |
| 76 |
|
| 77 |
CRole *setTerminology(CTerminology *ontology); |
| 78 |
CTerminology *getTerminology(); |
| 79 |
qint64 getTerminologyTag() const; |
| 80 |
|
| 81 |
|
| 82 |
bool hasPropertyName(); |
| 83 |
CRole *setPropertyNameLinker(CLinker<CName *> *propertyNameLinker); |
| 84 |
CRole *addPropertyNameLinker(CLinker<CName *> *propertyNameLinker); |
| 85 |
CLinker<CName *> *getPropertyNameLinker(); |
| 86 |
|
| 87 |
|
| 88 |
CRole* getInverseRole(); |
| 89 |
CRole* setInverseRole(CRole* inverseRole); |
| 90 |
|
| 91 |
|
| 92 |
bool isDataRole(); |
| 93 |
bool isObjectRole(); |
| 94 |
CRole* setDataRole(bool dataRole); |
| 95 |
CRole* setObjectRole(bool objectRole); |
| 96 |
|
| 97 |
|
| 98 |
// domain and range methods |
| 99 |
CSortedNegLinker<CConcept *> *getRelativeRangeConceptList(bool roleInversed); |
| 100 |
CSortedNegLinker<CConcept *> *getDomainRangeConceptList(bool roleInversed); |
| 101 |
|
| 102 |
|
| 103 |
CSortedNegLinker<CConcept *> *getRangeConceptList(); |
| 104 |
CRole *setRangeConceptList(CSortedNegLinker<CConcept *> *rangeConceptList); |
| 105 |
CRole *addRangeConceptLinker(CSortedNegLinker<CConcept *> *rangeConceptLinker); |
| 106 |
bool hasRangeConceptTag(qint64 rangeConceptTag); |
| 107 |
bool hasRangeConcept(CConcept* concept); |
| 108 |
|
| 109 |
|
| 110 |
CSortedNegLinker<CConcept *> *getDomainConceptList(); |
| 111 |
CRole *setDomainConceptList(CSortedNegLinker<CConcept *> *domainConceptList); |
| 112 |
CRole *addDomainConceptLinker(CSortedNegLinker<CConcept *> *domainConceptLinker); |
| 113 |
bool hasDomainConceptTag(qint64 domainConceptTag); |
| 114 |
bool hasDomainConcept(CConcept* concept); |
| 115 |
|
| 116 |
bool hasDomainOrRangeConceptTag(qint64 conceptTag); |
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
// methods for super, inverse, equivalent roles |
| 121 |
CRole *setSuperRoleList(CSortedNegLinker<CRole *> *superRoleList); |
| 122 |
CRole *addSuperRoleLinker(CSortedNegLinker<CRole *> *superRoleLinker); |
| 123 |
CSortedNegLinker<CRole *> *getSuperRoleList(); |
| 124 |
bool hasSuperRoleTag(qint64 tag, bool negated); |
| 125 |
bool hasSuperRoleTag(qint64 tag); |
| 126 |
bool hasSuperRole(CRole* role); |
| 127 |
|
| 128 |
CRole *setIndirectSuperRoleLinker(CSortedNegLinker<CRole *> *superRoleList); |
| 129 |
CRole *addIndirectSuperRoleLinker(CSortedNegLinker<CRole *> *superRoleLinker); |
| 130 |
CSortedNegLinker<CRole *> *getIndirectSuperRoleList(); |
| 131 |
bool hasIndirectSuperRoleTag(qint64 tag, bool negated); |
| 132 |
bool hasIndirectSuperRoleTag(qint64 tag); |
| 133 |
bool hasIndirectSuperRole(CRole* role); |
| 134 |
|
| 135 |
|
| 136 |
bool hasInverseRoles(); |
| 137 |
CRole *addInverseRoleLinker(CSortedNegLinker<CRole *> *inverseRole); |
| 138 |
CSortedNegLinker<CRole *> *getInverseRoleList(); |
| 139 |
bool hasInverseRole(CRole* role); |
| 140 |
|
| 141 |
bool hasEquivalentRoles(); |
| 142 |
CRole *addEquivalentRoleLinker(CSortedNegLinker<CRole *> *equivalentRole); |
| 143 |
CSortedNegLinker<CRole *> *getEquivalentRoleList(); |
| 144 |
bool hasEquivalentRole(CRole* role); |
| 145 |
|
| 146 |
CRole *setInverseEquivalentRoleList(CSortedNegLinker<CRole *> *invEqRoleList); |
| 147 |
CSortedNegLinker<CRole *> *getInverseEquivalentRoleList(); |
| 148 |
|
| 149 |
|
| 150 |
bool hasDisjointRoles(); |
| 151 |
CRole *setDisjointRoleList(CSortedNegLinker<CRole *> *disRoleList); |
| 152 |
CRole *addDisjointRoleLinker(CSortedNegLinker<CRole *> *disjointRole); |
| 153 |
CSortedNegLinker<CRole *> *getDisjointRoleList(); |
| 154 |
bool hasDisjointRole(CRole* role); |
| 155 |
|
| 156 |
|
| 157 |
// methods for other role properties |
| 158 |
CRole *setTransitive(bool transetive); |
| 159 |
bool isTransitive(); |
| 160 |
bool getTransitive(); |
| 161 |
|
| 162 |
CRole *setFunctional(bool functional); |
| 163 |
bool isFunctional(); |
| 164 |
bool getFunctional(); |
| 165 |
|
| 166 |
CRole *setInverseFunctional(bool invFunctional); |
| 167 |
bool isInverseFunctional(); |
| 168 |
bool getInverseFunctional(); |
| 169 |
|
| 170 |
CRole *setAsymmetric(bool asymmetric); |
| 171 |
bool isAsymmetric(); |
| 172 |
bool getAsymmetric(); |
| 173 |
|
| 174 |
CRole *setSymmetric(bool symmetric); |
| 175 |
bool isSymmetric(); |
| 176 |
bool getSymmetric(); |
| 177 |
|
| 178 |
CRole *setReflexive(bool reflexive); |
| 179 |
bool isReflexive(); |
| 180 |
bool getReflexive(); |
| 181 |
|
| 182 |
CRole *setIrreflexive(bool irreflexive); |
| 183 |
bool isIrreflexive(); |
| 184 |
bool getIrreflexive(); |
| 185 |
|
| 186 |
|
| 187 |
CRole* setRoleComplexity(bool complexRole); |
| 188 |
bool isComplexRole(); |
| 189 |
bool isSimpleRole(); |
| 190 |
bool getRoleComplexity(); |
| 191 |
|
| 192 |
|
| 193 |
bool hasRoleChainSubSharing(); |
| 194 |
CRole *addRoleChainSubSharingLinker(CXLinker<CRoleChain*>* roleChainLinker); |
| 195 |
CXLinker<CRoleChain*>* getRoleChainSubSharingLinker(); |
| 196 |
bool hasRoleChainSubSharingLinker(CRoleChain* roleChain); |
| 197 |
|
| 198 |
bool hasRoleChainSuperSharing(); |
| 199 |
CRole *addRoleChainSuperSharingLinker(CXLinker<CRoleChain*>* roleChainLinker); |
| 200 |
CXLinker<CRoleChain*>* getRoleChainSuperSharingLinker(); |
| 201 |
bool hasRoleChainSuperSharingLinker(CRoleChain* roleChain); |
| 202 |
|
| 203 |
|
| 204 |
bool hasRoleData(); |
| 205 |
CRoleData* getRoleData(); |
| 206 |
CRole* setRoleData(CRoleData* roleData); |
| 207 |
|
| 208 |
|
| 209 |
// deprecated |
| 210 |
CRole *init(qint64 roleTag); |
| 211 |
CRole *init(CRole *role); |
| 212 |
|
| 213 |
bool operator<=(const CRole &role); |
| 214 |
bool operator==(const CRole &role); |
| 215 |
|
| 216 |
|
| 217 |
// protected methods |
| 218 |
protected: |
| 219 |
|
| 220 |
// private methods |
| 221 |
private: |
| 222 |
|
| 223 |
// private variables |
| 224 |
private: |
| 225 |
CRoleData* mRoleData; |
| 226 |
CTerminology *tax; |
| 227 |
bool mTransetive; |
| 228 |
bool mFunctional; |
| 229 |
bool mInvFunctional; |
| 230 |
bool mAsymmetric; |
| 231 |
bool mSymmetric; |
| 232 |
bool mReflexive; |
| 233 |
bool mIrreflexive; |
| 234 |
bool mComplexity; |
| 235 |
bool mDataRole; |
| 236 |
CRole* mInverseRole; |
| 237 |
|
| 238 |
CSortedNegLinker<CConcept *> *rangeLinker; |
| 239 |
CSortedNegLinker<CConcept *> *domainLinker; |
| 240 |
|
| 241 |
CSortedNegLinker<CRole*>* mInverseEquivalentRoles; |
| 242 |
|
| 243 |
CSortedNegLinker<CRole*>* mDisjointRoles; |
| 244 |
|
| 245 |
CSortedNegLinker<CRole *> *superRoles; |
| 246 |
CSortedNegLinker<CRole *> *indirectSuperRoles; |
| 247 |
|
| 248 |
CXLinker<CRoleChain*>* mRoleChainSuperSharingLinker; |
| 249 |
CXLinker<CRoleChain*>* mRoleChainSubSharingLinker; |
| 250 |
|
| 251 |
|
| 252 |
}; |
| 253 |
|
| 254 |
}; // end namespace Ontology |
| 255 |
|
| 256 |
}; // end namespace Reasoner |
| 257 |
|
| 258 |
}; // end namespace Konclude |
| 259 |
|
| 260 |
#endif // KONCLUDE_REASONER_ONTOLOGY_CROLE_H |