Debian Codegraph @

Source/Reasoner/Preprocess/CNominalSchemaTemplateExtractionPreProcess.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_CNominalSchemaTemplateExtractionPreProcess_H
22 #define KONCLUDE_REASONER_PREPROCESS_CNominalSchemaTemplateExtractionPreProcess_H
23
24 // Libraries includes
25 #include <QSet>
26
27 // Namespace includes
28 #include "CConcreteOntologyPreProcess.h"
29 #include "CConceptRoleIndividualLocator.h"
30 #include "CConceptTriggerLinker.h"
31
32
33 // Other includes
34 #include "Utilities/Container/CNegLinker.h"
35
36 #include "Config/CConfigDataReader.h"
37
38 #include "Reasoner/Generator/CConcreteOntologyInverseRoleBuilder.h"
39
40 #include "Reasoner/Ontology/CConceptTextFormater.h"
41 #include "Reasoner/Ontology/COntologyTextFormater.h"
42 #include "Reasoner/Ontology/CNominalSchemaTemplateVector.h"
43
44 // Logger includes
45 #include "Logger/CLogger.h"
46
47
48
49 namespace Konclude {
50
51 using namespace Config;
52 using namespace Utilities::Container;
53
54 namespace Reasoner {
55
56 using namespace Generator;
57 using namespace Ontology;
58
59 namespace Preprocess {
60
61 /*!
62 *
63 * \class CNominalSchemaTemplateExtractionPreProcess
64 * \author Andreas Steigmiller
65 * \version 0.1
66 * \brief TODO
67 *
68 */
69 class CNominalSchemaTemplateExtractionPreProcess : public CConcreteOntologyPreProcess {
70 // public methods
71 public:
72 //! Constructor
73 CNominalSchemaTemplateExtractionPreProcess();
74
75 //! Destructor
76 virtual ~CNominalSchemaTemplateExtractionPreProcess();
77
78 virtual CConcreteOntology *preprocess(CConcreteOntology *ontology, CPreProcessContext* context);
79
80
81 // protected methods
82 protected:
83 bool findAbsorbableNominalSchemas(CConcept* concept, bool negation, QSet<CConcept*>* absorbableNominalVariableSet);
84 void countNominalSchemaConcepts(CConcept* concept, QHash<CConcept*,cint64>* nominalSchemaConceptCountHash);
85 void replaceNominalSchemasConcepts(CConcept* concept, CConcept* replacingConcept, const QSet<CConcept*>& removeNominalVariableSet);
86 bool removeSingleAbsorbableNominalSchemaConcepts(CConcept* concept, bool negation);
87
88 bool hasNominalSchemaConcept(CConcept* concept);
89
90 bool hasNominalSchemaConceptFillHash(CConcept* concept, CBOXHASH<CConcept*,CConcept*>* conceptNominalSchemaConceptHash, CConcept* nominalSchemaConcept, QSet<CConcept*>* testedConceptSet);
91 bool hasNominalSchemaAbsorbableConceptFillHash(CConcept* concept, bool negation, CBOXHASH<CConcept*,CConcept*>* absorbableConceptNominalSchemaConceptHash, CConcept* nominalSchemaConcept, QSet<CConcept*>* testedConceptSet);
92
93 void collectNominalSchemaConcepts(CConcept* concept, CBOXSET<CConcept*>* nominalSchemaConceptSet);
94 void createTemplateConceptNominalSchemaConceptMap(CConcept* concept, CBOXHASH<CConcept*,CConcept*>* conceptNominalSchemaConceptHash, CConcept* nominalSchemaConcept);
95
96 CNominalSchemaTemplate* getNominalSchemaTemplate(CConcept* concept, bool negation);
97
98 CConcept* createNominalSchemaTemplateReferenceConcept(CNominalSchemaTemplate* nsTemplate);
99 CConcept* transformEquivalentConceptToGCI(CConcept* eqConcept);
100
101 void addConceptOperand(CConcept* concept, CConcept* opConcept, bool negated);
102
103 CConcept* createNewConcept();
104
105 // protected variables
106 protected:
107 CMemoryAllocationManager* mMemMan;
108
109 CConceptVector* mConceptVec;
110 CRoleVector* mRolesVec;
111 CConcept* mBottomConcept;
112 CConcept* mTopConcept;
113 cint64 mConceptCount;
114 cint64 mRoleCount;
115 CConcreteOntology* mOnto;
116 CMBox* mMBox;
117 CTBox* mTBox;
118 CIndividualVector* mIndividualVector;
119 cint64 mIndividualCount;
120
121 CNominalSchemaTemplateVector* mNomSchTemplVec;
122
123
124 QHash<CConcept*,bool> mConceptNominalSchemaHash;
125 QHash<CConcept*,CNominalSchemaTemplate*> mConceptNominalSchemaTemplateHash;
126
127
128 cint64 mStatCreatedTemplateCount;
129 cint64 mStatReplacedConceptCount;
130
131
132 // private methods
133 private:
134
135 // private variables
136 private:
137
138
139 };
140
141 }; // end namespace Preprocess
142
143 }; // end namespace Reasoner
144
145 }; // end namespace Konclude
146
147 #endif // KONCLUDE_REASONER_PREPROCESS_CNominalSchemaTemplateExtractionPreProcess_H