Debian Codegraph @

Source/Reasoner/Revision/Persistence/COntologyRevisionDirectoryFilePersistencerBase.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
21 #ifndef KONCLUDE_REASONER_REVISION_PERSISTENCE_CONTOLOGYREVISIONDIRECTORYFILEPERSISTENCERBASE_H
22 #define KONCLUDE_REASONER_REVISION_PERSISTENCE_CONTOLOGYREVISIONDIRECTORYFILEPERSISTENCERBASE_H
23
24 // Libraries includes
25 #include <QDir>
26 #include <QTemporaryFile>
27 #include <QFile>
28 #include <QDomDocument>
29
30 // Namespace includes
31 #include "PersistenceSettings.h"
32 #include "COntologyRevisionPersistencer.h"
33
34
35 // Other includes
36 #include "Config/CConfigDataReader.h"
37
38 #include "Reasoner/Revision/COntologyRevision.h"
39
40 #include "Reasoner/Generator/CConcreteOntologyUpdateCollectorBuilder.h"
41
42 #include "Parser/COWL2QtXMLOntologyStableStreamParser.h"
43 #include "Parser/COWL2QtXMLOntologyStreamParser.h"
44 #include "Parser/COntologyMultiAutoParsingLoader.h"
45
46 #include "Renderer/COntologyAxiomExpressionsRenderVisitor.h"
47 #include "Renderer/COntologyOWL2QtXMLRenderer.h"
48
49 #include "Control/Command/CCommandRecordRouter.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 Parser;
62 using namespace Control::Command;
63
64 namespace Reasoner {
65
66 using namespace Generator;
67
68 namespace Revision {
69
70 namespace Persistence {
71
72 /*!
73 *
74 * \class COntologyRevisionDirectoryFilePersistencerBase
75 * \author Andreas Steigmiller
76 * \version 0.1
77 * \brief TODO
78 *
79 */
80 class COntologyRevisionDirectoryFilePersistencerBase : public COntologyRevisionPersistencer, public CLogIdentifier {
81 // public methods
82 public:
83 //! Constructor
84 COntologyRevisionDirectoryFilePersistencerBase(CConfiguration* config);
85
86 //! Destructor
87 virtual ~COntologyRevisionDirectoryFilePersistencerBase();
88
89 virtual bool persistOntologyRevision(COntologyRevision* ontoRev, COntologyRevision* prevOntoRev);
90
91 virtual bool loadLatestOntologyRevision(const QString& ontologyName, COntologyRevision* ontoRev);
92
93 virtual bool hasNewOntologyRevision(const QString& ontologyName, COntologyRevision* ontoRev);
94
95 virtual bool hasOntologyPersisted(const QString& ontologyName);
96 virtual bool deletePersistedOntology(const QString& ontologyName);
97
98 // protected methods
99 protected:
100 QStringList getOntologyFileNameParts(const QString& ontologyName);
101
102 QString getNextPersistingOntologyRevisionString(const QString& ontologyName, const QStringList& pathSepStrings, COntologyRevision* ontoRev);
103
104
105
106 virtual bool writeOntologyToFile(QFile* file, COntologyRevision* ontoRev) = 0;
107
108 virtual bool loadOntologyFromFile(const QString& ontologyString, const QString& fileNameString, QFile* file, COntologyRevision* ontoRev, CConcreteOntologyUpdateCollectorBuilder *builder);
109
110
111 QStringList getPersistedOntologyVersionFilesSortedLatest(const QString& ontologyName);
112 bool deletePersistingLimitOntologyVersions(const QString& ontologyName);
113
114 // protected variables
115 protected:
116 QString mConfBaseDirectory;
117
118 QString mOWLNS;
119
120 CConfiguration* mConfig;
121
122 QHash<QString,QString> mOntologyNameLastFileHash;
123 QHash<COntologyRevision*,QString> mOntologyNameFileHash;
124
125 QString mFileEndingWritingName;
126 QString mFileEndingLoadingName;
127
128 cint64 mKeepingVersionLimit;
129
130 // private methods
131 private:
132
133 // private variables
134 private:
135
136 };
137
138 }; // end namespace Persistence
139
140 }; // end namespace Revision
141
142 }; // end namespace Reasoner
143
144 }; // end namespace Konclude
145
146 #endif // KONCLUDE_REASONER_REVISION_PERSISTENCE_CONTOLOGYREVISIONDIRECTORYFILEPERSISTENCERBASE_H