Debian Codegraph @

Source/Reasoner/Revision/Persistence/COntologyRevisionRedlandExternalTriplesSPARQLServicePersistencer.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_REVISION_PERSISTENCE_CONTOLOGYREVISIONREDLANDEXTERNALTRIPLESSPARQLSERVICEPERSISTENCER_H
23 #define KONCLUDE_REASONER_REVISION_PERSISTENCE_CONTOLOGYREVISIONREDLANDEXTERNALTRIPLESSPARQLSERVICEPERSISTENCER_H
24
25 // Libraries includes
26 #include <QUrl>
27 #include <QUrlQuery>
28
29 // Namespace includes
30 #include "PersistenceSettings.h"
31 #include "COntologyRevisionPersistencer.h"
32 #include "COntologyRevisionRedlandExternalStoredTriplesConnectionData.h"
33
34
35 // Other includes
36 #include "Config/CConfigDataReader.h"
37
38 #include "Reasoner/Revision/COntologyRevision.h"
39
40 #include "Renderer/COntologyAxiomExpressionsRenderVisitor.h"
41 #include "Renderer/COntologyRedlandRDFRenderer.h"
42
43 #include "Control/Command/CCommandRecordRouter.h"
44
45 #include "Reasoner/Generator/CConcreteOntologyRedlandTriplesDataExpressionMapper.h"
46 #include "Reasoner/Generator/CConcreteOntologyUpdateCollectorBuilder.h"
47
48
49 #include "Network/HTTP/CQtHttpTransactionManager.h"
50
51 // Logger includes
52 #include "Logger/CLogger.h"
53 #include "Logger/CLogIdentifier.h"
54
55
56 namespace Konclude {
57
58 using namespace Logger;
59 using namespace Renderer;
60 using namespace Config;
61 using namespace Control::Command;
62 using namespace Network::HTTP;
63
64 namespace Reasoner {
65
66 using namespace Generator;
67
68 namespace Revision {
69
70 namespace Persistence {
71
72 /*!
73 *
74 * \class COntologyRevisionRedlandExternalTriplesSPARQLServicePersistencer
75 * \author Andreas Steigmiller
76 * \version 0.1
77 * \brief TODO
78 *
79 */
80 class COntologyRevisionRedlandExternalTriplesSPARQLServicePersistencer : public COntologyRevisionPersistencer, public CLogIdentifier {
81 // public methods
82 public:
83 //! Constructor
84 COntologyRevisionRedlandExternalTriplesSPARQLServicePersistencer(CConfiguration* config);
85
86 //! Destructor
87 virtual ~COntologyRevisionRedlandExternalTriplesSPARQLServicePersistencer();
88
89 virtual bool persistOntologyRevision(COntologyRevision* ontoRev, COntologyRevision* prevOntoRev);
90
91
92 virtual bool loadLatestOntologyRevision(const QString& ontologyName, COntologyRevision* ontoRev);
93
94
95 virtual bool hasNewOntologyRevision(const QString& ontologyName, COntologyRevision* ontoRev);
96
97 virtual bool hasOntologyPersisted(const QString& ontologyName);
98 virtual bool deletePersistedOntology(const QString& ontologyName);
99 virtual bool createPersistingOntology(const QString& ontologyName);
100
101 // protected methods
102 protected:
103
104 QString replaceQueryStringVariables(QString string, const QString& ontologyName, bool doublePercentageEncoding = false);
105
106 rasqal_service* getRasqalService(librdf_world* world, const QString& ontologyName, QByteArray &queryData);
107
108 COntologyRevisionRedlandExternalStoredTriplesConnectionData* getOntologyPersistingTriplesData(const QString& ontName);
109
110 CRedlandStoredTriplesData* getUpdatingTripleData();
111
112 librdf_node* createIRIResourceNode(const QString& iri, librdf_world* world);
113 librdf_node* createBlankNode(const QString& identifier, librdf_world* world);
114 librdf_node* createBlankNode(cint64 id, librdf_world* world);
115 librdf_node* createLiteralNode(const QString& literal, const QString& datatype, librdf_world* world);
116
117 virtual bool sendPersistingRedlandClientRequest(const QString &persistQueryString, const QString& ontName);
118 virtual bool sendPersistingHTTPPostFormEncodedRequest(const QString &persistQueryString, const QString& ontName);
119
120 // protected variables
121 protected:
122 CConfiguration* mConfig;
123
124 QHash<COntologyRevision*, QString> mOntologyNameFileHash;
125
126
127 bool mConfInitialLoading;
128 bool mConfDirectFullLoading;
129
130 QHash<QString, COntologyRevisionRedlandExternalStoredTriplesConnectionData*> mOntologyTriplesDataHash;
131
132 QByteArray mServiceUriData;
133 QString mLoadingQueryString;
134 QString mPersistQueryString;
135 QString mCheckingQueryString;
136 QString mDeletingQueryString;
137 QString mCreatingQueryString;
138 QString mDatabaseNameString;
139
140 QString mDefaultDatatypeString;
141 QString mBlankNodeIdentifierPrefix;
142
143 QString mRDFSerializingFormat;
144
145 cint64 mLoadingLimit;
146 cint64 mPersistingStepSize;
147
148 bool mConfPersistPostBatchFormEncoded;
149 CQtHttpTransactionManager* mHttpManager;
150
151
152 // private methods
153 private:
154
155 // private variables
156 private:
157
158 };
159
160 }; // end namespace Persistence
161
162 }; // end namespace Revision
163
164 }; // end namespace Reasoner
165
166 }; // end namespace Konclude
167
168 #endif // KONCLUDE_REASONER_REVISION_PERSISTENCE_CONTOLOGYREVISIONREDLANDEXTERNALTRIPLESSPARQLSERVICEPERSISTENCER_H
169
170 #endif // !KONCLUDE_REDLAND_INTEGRATION