| 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 |
#ifdef KONCLUDE_REDLAND_INTEGRATION |
| 21 |
|
| 22 |
#include "CRedlandStoredTriplesIndividualAssertionIndexCacheData.h" |
| 23 |
|
| 24 |
|
| 25 |
namespace Konclude { |
| 26 |
|
| 27 |
namespace Reasoner { |
| 28 |
|
| 29 |
namespace Triples { |
| 30 |
|
| 31 |
|
| 32 |
CRedlandStoredTriplesIndividualAssertionIndexCacheData::CRedlandStoredTriplesIndividualAssertionIndexCacheData(librdf_node* individualNode, cint64 indiviualId, CRedlandStoredTriplesIndividualAssertionIndexCacheDataUpdateHandler* releaser) { |
| 33 |
mReleaser = releaser; |
| 34 |
mIndividualId = indiviualId; |
| 35 |
mIndividualNode = individualNode; |
| 36 |
mCurrentRepresentativeIndividualAssertionsIndexData = nullptr; |
| 37 |
mStoredRepresentativeIndividualAssertionsIndexData = nullptr; |
| 38 |
mAnonymous = true; |
| 39 |
mNonAnonymityStored = false; |
| 40 |
} |
| 41 |
|
| 42 |
|
| 43 |
CRedlandStoredTriplesIndividualAssertionIndexCacheData::~CRedlandStoredTriplesIndividualAssertionIndexCacheData() { |
| 44 |
if (mReleaser) { |
| 45 |
mReleaser->releaseCacheData(this); |
| 46 |
} |
| 47 |
if (mExtensionData) { |
| 48 |
delete mExtensionData; |
| 49 |
} |
| 50 |
} |
| 51 |
|
| 52 |
|
| 53 |
librdf_node* CRedlandStoredTriplesIndividualAssertionIndexCacheData::getIndividualNode() { |
| 54 |
return mIndividualNode; |
| 55 |
} |
| 56 |
|
| 57 |
|
| 58 |
QString CRedlandStoredTriplesIndividualAssertionIndexCacheData::getIndividualName() { |
| 59 |
const char* indiNameCharPointer = nullptr; |
| 60 |
if (!librdf_node_is_blank(mIndividualNode)) { |
| 61 |
librdf_uri* uri = librdf_node_get_uri(mIndividualNode); |
| 62 |
indiNameCharPointer = (const char*)librdf_uri_as_string(uri); |
| 63 |
} else { |
| 64 |
indiNameCharPointer = (const char*)librdf_node_get_blank_identifier(mIndividualNode); |
| 65 |
} |
| 66 |
return QString::fromUtf8(indiNameCharPointer); |
| 67 |
} |
| 68 |
|
| 69 |
cint64 CRedlandStoredTriplesIndividualAssertionIndexCacheData::getIndividualId() { |
| 70 |
return mIndividualId; |
| 71 |
} |
| 72 |
|
| 73 |
|
| 74 |
bool CRedlandStoredTriplesIndividualAssertionIndexCacheData::isAnonymous() { |
| 75 |
return mAnonymous; |
| 76 |
} |
| 77 |
|
| 78 |
CRedlandStoredTriplesIndividualAssertionIndexCacheData* CRedlandStoredTriplesIndividualAssertionIndexCacheData::setAnonymous(bool anonymous) { |
| 79 |
mAnonymous = anonymous; |
| 80 |
return this; |
| 81 |
} |
| 82 |
|
| 83 |
|
| 84 |
CRedlandStoredTriplesRepresentativeIndividualAssertionsIndexData* CRedlandStoredTriplesIndividualAssertionIndexCacheData::getCurrentRepresentativeIndividualAssertionsIndexData() { |
| 85 |
return mCurrentRepresentativeIndividualAssertionsIndexData; |
| 86 |
} |
| 87 |
|
| 88 |
|
| 89 |
CRedlandStoredTriplesIndividualAssertionIndexCacheData* CRedlandStoredTriplesIndividualAssertionIndexCacheData::setCurrentRepresentativeIndividualAssertionsIndexData(CRedlandStoredTriplesRepresentativeIndividualAssertionsIndexData* repData) { |
| 90 |
mCurrentRepresentativeIndividualAssertionsIndexData = repData; |
| 91 |
return this; |
| 92 |
} |
| 93 |
|
| 94 |
|
| 95 |
CRedlandStoredTriplesRepresentativeIndividualAssertionsIndexData* CRedlandStoredTriplesIndividualAssertionIndexCacheData::getStoredRepresentativeIndividualAssertionsIndexData() { |
| 96 |
return mStoredRepresentativeIndividualAssertionsIndexData; |
| 97 |
} |
| 98 |
|
| 99 |
|
| 100 |
CRedlandStoredTriplesIndividualAssertionIndexCacheData* CRedlandStoredTriplesIndividualAssertionIndexCacheData::setStoredRepresentativeIndividualAssertionsIndexData(CRedlandStoredTriplesRepresentativeIndividualAssertionsIndexData* repData) { |
| 101 |
mStoredRepresentativeIndividualAssertionsIndexData = repData; |
| 102 |
return this; |
| 103 |
} |
| 104 |
|
| 105 |
CRedlandStoredTriplesIndividualAssertionIndexCacheExtensionData* CRedlandStoredTriplesIndividualAssertionIndexCacheData::getExtensionData(bool create) { |
| 106 |
if (!mExtensionData && create) { |
| 107 |
mExtensionData = new CRedlandStoredTriplesIndividualAssertionIndexCacheExtensionData(); |
| 108 |
} |
| 109 |
return mExtensionData; |
| 110 |
} |
| 111 |
|
| 112 |
CRedlandStoredTriplesIndividualAssertionIndexCacheData* CRedlandStoredTriplesIndividualAssertionIndexCacheData::clearExtensionData() { |
| 113 |
if (mExtensionData) { |
| 114 |
delete mExtensionData; |
| 115 |
mExtensionData = nullptr; |
| 116 |
} |
| 117 |
return this; |
| 118 |
} |
| 119 |
|
| 120 |
|
| 121 |
bool CRedlandStoredTriplesIndividualAssertionIndexCacheData::isIndividualIdStored() { |
| 122 |
return mIdStored; |
| 123 |
} |
| 124 |
|
| 125 |
CRedlandStoredTriplesIndividualAssertionIndexCacheData* CRedlandStoredTriplesIndividualAssertionIndexCacheData::setIndividualIdStored(bool stored) { |
| 126 |
mIdStored = stored; |
| 127 |
return this; |
| 128 |
} |
| 129 |
|
| 130 |
|
| 131 |
bool CRedlandStoredTriplesIndividualAssertionIndexCacheData::isIndividualNonAnonymityStored() { |
| 132 |
return mNonAnonymityStored; |
| 133 |
} |
| 134 |
|
| 135 |
CRedlandStoredTriplesIndividualAssertionIndexCacheData* CRedlandStoredTriplesIndividualAssertionIndexCacheData::setIndividualNonAnonymityStored(bool stored) { |
| 136 |
mNonAnonymityStored = stored; |
| 137 |
return this; |
| 138 |
} |
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
}; // end namespace Triples |
| 143 |
|
| 144 |
}; // end namespace Reasoner |
| 145 |
|
| 146 |
}; // end namespace Konclude |
| 147 |
|
| 148 |
#endif // !KONCLUDE_REDLAND_INTEGRATION |