Debian Codegraph @

Source/Reasoner/Preprocess/CCoreOntologyCyclesExtractorPreProcess.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_PREPROCESS_CCOREONTOLOGYCYCLESEXTRACTORPREPROCESS_H
22 #define KONCLUDE_REASONER_PREPROCESS_CCOREONTOLOGYCYCLESEXTRACTORPREPROCESS_H
23
24 // Libraries includes
25
26
27 // Namespace includes
28 #include "CConcreteOntologyPreProcess.h"
29
30
31 // Other includes
32 #include "Reasoner/Ontology/OntologySettings.h"
33
34 // Logger includes
35 #include "Logger/CLogger.h"
36
37
38
39 namespace Konclude {
40
41 namespace Reasoner {
42
43 using namespace Ontology;
44
45 namespace Preprocess {
46
47
48 /*!
49 *
50 * \class CCoreOntologyCyclesExtractorPreProcess
51 * \author Andreas Steigmiller
52 * \version 0.1
53 * \brief TODO
54 *
55 */
56 class CCoreOntologyCyclesExtractorPreProcess : public CConcreteOntologyPreProcess {
57 // public methods
58 public:
59 //! Constructor
60 CCoreOntologyCyclesExtractorPreProcess();
61
62 //! Destructor
63 virtual ~CCoreOntologyCyclesExtractorPreProcess();
64
65 virtual CConcreteOntology* preprocess(CConcreteOntology* ontology, CPreProcessContext* context);
66
67 // protected methods
68 protected:
69 bool hasConceptCycle(CConcept* concept, bool negated, QSet<TConceptNegPair>* visitedConceptSet, QSet<TConceptNegPair>* cylceConceptSet);
70
71 bool addConceptsToList(CSortedNegLinker<CConcept*>* opLinker, bool negated, QList<TConceptNegPair>& nextTestingConceptList);
72
73 bool getConceptCycle(QSet<TConceptNegPair>* visitedConceptSet, QSet<TConceptNegPair>* cylceConceptSet, bool* cycleNominalConnection);
74
75 // protected variables
76 protected:
77 class CTestingItem {
78 public:
79 CTestingItem(CConcept* concept = nullptr, bool negated = false, cint64 searchingDepth = 0, CTestingItem* prevItem = nullptr) : mConNegPair(concept,negated),mSearchingDepth(searchingDepth),mPrevItem(prevItem) {
80 }
81 CTestingItem(const TConceptNegPair& conNegPair, cint64 searchingDepth = 0, CTestingItem* prevItem = nullptr) : mConNegPair(conNegPair),mSearchingDepth(searchingDepth),mPrevItem(prevItem) {
82 }
83 TConceptNegPair mConNegPair;
84 cint64 mSearchingDepth;
85 CTestingItem* mPrevItem;
86 };
87
88 cint64 mStatExtractedCyclesCount;
89 cint64 mStatCyclicConceptsCount;
90
91 QSet<TConceptNegPair> mCycleConceptSet;
92
93
94 // private methods
95 private:
96
97 // private variables
98 private:
99
100
101 };
102
103 }; // end namespace Preprocess
104
105 }; // end namespace Reasoner
106
107 }; // end namespace Konclude
108
109 #endif // KONCLUDE_REASONER_PREPROCESS_CCOREONTOLOGYCYCLESEXTRACTORPREPROCESS_H