Debian Codegraph @

Source/Reasoner/Query/CStringHierarchyResult.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_QUERY_CSTRINGHIERARCHYRESULT_H
22 #define KONCLUDE_REASONER_QUERY_CSTRINGHIERARCHYRESULT_H
23
24 // Libraries includes
25 #include <QHash>
26
27 // Namespace includes
28 #include "CStringSubStringsRelationResult.h"
29 #include "CQueryResult.h"
30 #include "CStringSynsetResult.h"
31
32 // Other includes
33 #include "Reasoner/Taxonomy/CTaxonomy.h"
34
35 #include "Reasoner/Ontology/CConcreteOntology.h"
36
37
38 // Logger includes
39 #include "Logger/CLogger.h"
40
41
42
43 namespace Konclude {
44
45 namespace Reasoner {
46
47 using namespace Taxonomy;
48 using namespace Ontology;
49
50 namespace Query {
51
52 /*!
53 *
54 * \class CStringHierarchyResult
55 * \author Andreas Steigmiller
56 * \version 0.1
57 * \brief TODO
58 *
59 */
60 template<class T, class R, class E>
61 class CStringHierarchyResult : public CQueryResult {
62 // public methods
63 public:
64 //! Constructor
65 CStringHierarchyResult();
66 CStringHierarchyResult(const QString &bottomHierarchyString, const QString &topHierarchyString);
67 CStringHierarchyResult(const QStringList &bottomHierarchyStrings, const QStringList &topHierarchyStrings);
68 CStringHierarchyResult(E *takeBottomStringSynset, E *takeTopStringSynset);
69 CStringHierarchyResult(E *takeBottomStringSynset);
70
71 //! Destructor
72 virtual ~CStringHierarchyResult();
73
74 virtual QString getQueryResultString();
75 virtual bool isResultEquivalentTo(CQueryResult *otherQueryResult);
76
77 E* getStringSynset(const QString &stringName, bool create = true);
78 E* getStringSynset(const QStringList &stringNames, bool create = true);
79 E* addStringSynset(E *takeStringSynset);
80
81 E* setTopStringSynset(E *stringSynset);
82
83
84 E* getBottomStringSynset();
85 E* getTopStringSynset();
86
87 R* addSubStringRelation(E *superStringSynset, E *anySubStringSynset);
88 R* getSubStringRelation(E *superStringSynset, bool create = true);
89
90 virtual CTaxonomy *fillTaxonomy(CConcreteOntology *ontology, Reasoner::Taxonomy::CTaxonomy *taxonomy);
91
92 // protected methods
93 protected:
94 void collectSubsumerStringSynsets(CStringHierarchyResult *otherStringHierarchy, QHash<QString,QString>* subsumHash, QSet< QPair<QString,QString> >* subsumSet = nullptr);
95 void compareSubsumersCount(QHash<QString,QString>* subsumHash1, QHash<QString,QString>* subsumHash2);
96
97 // protected variables
98 protected:
99 E *mBottomString;
100 E *mTopString;
101
102 QList<R *> mSubStringRelationContainer;
103 QList<E *> mStringSynsetContainer;
104
105 QHash<QString,E *> mStringStringSynsetHash;
106 QHash<E *,R *> mStringSynsetSubStringHash;
107
108 // private methods
109 private:
110
111 // private variables
112 private:
113
114 };
115
116 }; // end namespace Query
117
118 }; // end namespace Reasoner
119
120 }; // end namespace Konclude
121
122 #include "CStringHierarchyResult.cpp"
123
124 #endif // KONCLUDE_REASONER_QUERY_CSTRINGHIERARCHYRESULT_H