| 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_CWRITEINDIVIDUALFLATTENEDTYPESQUERY_H |
| 22 |
#define KONCLUDE_REASONER_QUERY_CWRITEINDIVIDUALFLATTENEDTYPESQUERY_H |
| 23 |
|
| 24 |
// Libraries includes |
| 25 |
#include <QString> |
| 26 |
#include <QDir> |
| 27 |
#include <QStringList> |
| 28 |
#include <QXmlStreamWriter> |
| 29 |
|
| 30 |
|
| 31 |
// Namespace includes |
| 32 |
#include "CQuery.h" |
| 33 |
#include "CRealizationPremisingQuery.h" |
| 34 |
#include "CQueryUnspecifiedStringError.h" |
| 35 |
#include "CQueryInconsitentOntologyError.h" |
| 36 |
#include "CWriteQuery.h" |
| 37 |
|
| 38 |
#include "Reasoner/Realization/CConceptRealizationInstantiatedToConceptVisitor.h" |
| 39 |
|
| 40 |
|
| 41 |
#include "Config/CConfigDataReader.h" |
| 42 |
|
| 43 |
// Other includes |
| 44 |
|
| 45 |
// Logger includes |
| 46 |
#include "Logger/CLogger.h" |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
namespace Konclude { |
| 51 |
|
| 52 |
using namespace Config; |
| 53 |
|
| 54 |
namespace Reasoner { |
| 55 |
|
| 56 |
using namespace Realization; |
| 57 |
|
| 58 |
namespace Query { |
| 59 |
|
| 60 |
/*! |
| 61 |
* |
| 62 |
* \class CWriteIndividualFlattenedTypesQuery |
| 63 |
* \author Andreas Steigmiller |
| 64 |
* \version 0.1 |
| 65 |
* \brief TODO |
| 66 |
* |
| 67 |
*/ |
| 68 |
class CWriteIndividualFlattenedTypesQuery : public CRealizationPremisingQuery, public CConceptRealizationInstantiatedToConceptVisitor, public CWriteQuery { |
| 69 |
// public methods |
| 70 |
public: |
| 71 |
//! Constructor |
| 72 |
CWriteIndividualFlattenedTypesQuery(CConcreteOntology* ontology, CConfigurationBase *configuration, const QString& outputFileString, const QString& individualNameString = QString(""), const QString &subClassHierarchyQueryName = QString("UnnamedWriteIndividualTypesQuery")); |
| 73 |
|
| 74 |
virtual CQueryResult* constructResult(CRealization* realization); |
| 75 |
|
| 76 |
virtual WRITEQUERYTYPE getWriteQueryType(); |
| 77 |
|
| 78 |
virtual QString getQueryName(); |
| 79 |
virtual QString getQueryString(); |
| 80 |
virtual bool hasAnswer(); |
| 81 |
virtual QString getAnswerString(); |
| 82 |
|
| 83 |
virtual CQueryResult *getQueryResult(); |
| 84 |
|
| 85 |
virtual bool hasError(); |
| 86 |
|
| 87 |
virtual CQuery* addQueryError(CQueryError* queryError); |
| 88 |
|
| 89 |
// protected methods |
| 90 |
protected: |
| 91 |
bool writeInconsistentIndividualTypes(); |
| 92 |
bool writeIndividualTypesResult(CRealization* realization); |
| 93 |
|
| 94 |
virtual void writeIndividualDeclaration(const QString& individualName, bool anonymous) = 0; |
| 95 |
virtual void writeNamedIndividualDeclaration(const QString& individualName) = 0; |
| 96 |
virtual void writeAnonymousIndividualDeclaration(const QString& className) = 0; |
| 97 |
virtual void writeClassDeclaration(const QString& className) = 0; |
| 98 |
|
| 99 |
virtual void writeIndividualType(const QString& individualName, bool anonymous, const QString& className) = 0; |
| 100 |
virtual void writeNamedIndividualType(const QString& individualName, const QString& className) = 0; |
| 101 |
virtual void writeAnonymousIndividualType(const QString& individualName, const QString& className) = 0; |
| 102 |
virtual void writeSubClassRelation(const QString& subClassName, const QString& superClassName) = 0; |
| 103 |
|
| 104 |
virtual void writeOntologyStart() = 0; |
| 105 |
virtual void writeOntologyEnd() = 0; |
| 106 |
virtual void writeOntologyPrefix(const QString& prefixName, const QString& prefixIRI) = 0; |
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
virtual bool visitConcept(CConcept* concept, CConceptRealization* conRealization); |
| 111 |
|
| 112 |
|
| 113 |
virtual bool startWritingOutput() = 0; |
| 114 |
virtual bool endWritingOutput() = 0; |
| 115 |
|
| 116 |
|
| 117 |
bool visitIndividuals(function<bool(const CIndividualReference& indiRef)> visitFunc); |
| 118 |
|
| 119 |
|
| 120 |
// protected variables |
| 121 |
protected: |
| 122 |
QString mClassName; |
| 123 |
QString mQueryName; |
| 124 |
QString mQueryString; |
| 125 |
|
| 126 |
QString mIndividualNameString; |
| 127 |
|
| 128 |
|
| 129 |
QString mOutputFileNameString; |
| 130 |
QString mBottomClassNameString; |
| 131 |
QString mTopClassNameString; |
| 132 |
|
| 133 |
QSet<CConcept*> mDeclaratedConceptSet; |
| 134 |
QString mCurrentIndividualName; |
| 135 |
bool mCurrentIndividualAnonymous; |
| 136 |
|
| 137 |
bool mUseAbbreviatedIRIs; |
| 138 |
bool mWriteDeclarations; |
| 139 |
bool mWriteOnlyDirectTypes; |
| 140 |
bool mWriteSubClassOfInconsistency; |
| 141 |
bool mWriteAnonymousIndividuals; |
| 142 |
|
| 143 |
bool mQueryAnswered; |
| 144 |
bool mQueryConstructError; |
| 145 |
bool mRealizationCalcError; |
| 146 |
|
| 147 |
|
| 148 |
// private methods |
| 149 |
private: |
| 150 |
|
| 151 |
// private variables |
| 152 |
private: |
| 153 |
|
| 154 |
}; |
| 155 |
|
| 156 |
}; // end namespace Query |
| 157 |
|
| 158 |
}; // end namespace Reasoner |
| 159 |
|
| 160 |
}; // end namespace Konclude |
| 161 |
|
| 162 |
#endif // KONCLUDE_REASONER_QUERY_CWRITEINDIVIDUALFLATTENEDTYPESQUERY_H |