Debian Codegraph @

Source/Reasoner/Triples/CRedlandStoredTriplesSimpleABoxAssertionsAccessor.h

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 #ifdef KONCLUDE_REDLAND_INTEGRATION
21
22 #ifndef KONCLUDE_REASONER_GENERATOR_CREDLANDSTOREDTRIPLESSIMPLEABOXASSERTIONSACCESSOR_H
23 #define KONCLUDE_REASONER_GENERATOR_CREDLANDSTOREDTRIPLESSIMPLEABOXASSERTIONSACCESSOR_H
24
25
26 // Libraries includes
27 #include <QHash>
28 #include <QCache>
29
30
31 // Namespace includes
32 #include "TriplesSettings.h"
33 #include "CRedlandUriHasher.h"
34 #include "CRedlandStoredTriplesIndividualAssertionIndexCache.h"
35
36
37 // Other includes
38 #include "Reasoner/Ontology/CConcreteOntology.h"
39 #include "Reasoner/Ontology/COntologyTriplesAssertionsAccessor.h"
40 #include "Reasoner/Ontology/CIRIName.h"
41
42 #include "Reasoner/Triples/CRedlandStoredTriplesData.h"
43
44 #include "Utilities/Container/CLinker.h"
45
46
47 // Logger includes
48 #include "Logger/CLogger.h"
49
50
51
52
53
54 namespace Konclude {
55
56 using namespace Utilities;
57 using namespace Utilities::Memory;
58 using namespace Utilities::Container;
59 using namespace Parser;
60
61 namespace Reasoner {
62
63 using namespace Ontology;
64
65 namespace Triples {
66
67
68 /*!
69 *
70 * \class CRedlandStoredTriplesSimpleABoxAssertionsAccessor
71 * \author Andreas Steigmiller
72 * \version 0.1
73 * \brief TODO
74 *
75 */
76 class CRedlandStoredTriplesSimpleABoxAssertionsAccessor : public COntologyTriplesAssertionsAccessor {
77 // public methods
78 public:
79 CRedlandStoredTriplesSimpleABoxAssertionsAccessor(CConcreteOntology* ontology, CRedlandStoredTriplesIndividualAssertionIndexCache* individualAssertionIndexCache, CRedlandStoredTriplesData* tripleData);
80 virtual ~CRedlandStoredTriplesSimpleABoxAssertionsAccessor();
81
82
83 virtual bool visitIndividualAssertions(cint64 individualId, COntologyTriplesIndividualAssertionsVisitor* visitor, bool visitConceptAssertions = true, bool visitRoleAssertions = true, bool visitReverseRoleAssertions = true, bool visitDataAssertions = true);
84
85 virtual bool visitIndividualName(cint64 individualId, COntologyTriplesIndividualNamesVisitor* visitor);
86 virtual bool visitIndividualName(cint64 individualId, function<bool(const QString& indiName)> visitFunc);
87
88 virtual bool visitIndividualAnonymity(cint64 individualId, function<bool(bool anonymous)> visitFunc);
89
90
91
92 virtual bool visitIndividualId(const QString& indiName, function<bool(cint64 indiId)> visitFunc);
93 virtual bool hasIndividualId(const QString& indiName);
94
95
96 virtual bool visitAllAssertedConcepts(COntologyTriplesAssertedTypesVisitor* visitor);
97 virtual bool visitAllAssertedObjectRoles(COntologyTriplesAssertedTypesVisitor* visitor);
98 virtual bool visitAllAssertedDataRoles(COntologyTriplesAssertedTypesVisitor* visitor);
99
100
101 virtual cint64 getMaxIndexedIndividualId();
102 virtual cint64 getIndexedIndividualCount();
103
104
105
106 virtual bool visitDataValueIndividuals(CRole* dataRole, CDataLiteral* dataLiteral, function<bool(cint64 indiId)> visitFunc);
107
108
109
110 // protected functions
111 protected:
112 librdf_node* getRolePredicateNode(CRole* role);
113 CDatatype* getDatatypeFromDatatypeUri(librdf_uri* uri);
114 librdf_uri* getDatatypeUriFromDatatype(CDatatype* datatype);
115
116 bool initializeDatatypeMaps();
117
118 QString getAnonymousResolvedIndividualName(CRedlandStoredTriplesIndividualAssertionIndexCacheData* indiCacheData);
119
120 // protected variables
121 protected:
122 CConcreteOntology* mOntology;
123 CRedlandStoredTriplesData* mTripleData;
124 CRedlandStoredTriplesIndividualAssertionIndexCache* mIndividualAssertionIndexCache;
125
126 QHash<CRole*, librdf_node*> mRolePredicateNodeHash;
127 QHash<CRedlandUriHasher, CDatatype*> mDatatypeIriDatatypeHash;
128 QHash<CDatatype*, librdf_uri*> mDatatypeDatatypeIriHash;
129 bool mDatatypeHashInitialized = false;
130
131 CDatatype* mDefaultDatatype;
132 librdf_uri* mDefaultDatatypeUri;
133
134 QString mAnonymousOntologyIdentifier;
135
136 };
137
138
139
140 }; // end namespace Triples
141
142 }; // end namespace Reasoner
143
144 }; // end namespace Konclude
145
146 #endif // end KONCLUDE_REASONER_GENERATOR_CREDLANDSTOREDTRIPLESSIMPLEABOXASSERTIONSACCESSOR_H
147
148 #endif // !KONCLUDE_REDLAND_INTEGRATION