| 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 |
#include "CConcreteOntologyQueryBasicBuilder.h" |
| 22 |
|
| 23 |
|
| 24 |
namespace Konclude { |
| 25 |
|
| 26 |
namespace Reasoner { |
| 27 |
|
| 28 |
namespace Generator { |
| 29 |
|
| 30 |
|
| 31 |
CConcreteOntologyQueryBasicBuilder::CConcreteOntologyQueryBasicBuilder(CConcreteOntology* ontology, CConfigurationBase *configuration) { |
| 32 |
config = configuration; |
| 33 |
mOntology = ontology; |
| 34 |
} |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
CConcreteOntologyQueryBasicBuilder::~CConcreteOntologyQueryBasicBuilder() { |
| 39 |
} |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
CQueryingTemporaryNamedIndividualExpression* CConcreteOntologyQueryBasicBuilder::getQueryingTemporaryNamedIndividual(const QString& indiName) { |
| 44 |
CQueryingTemporaryNamedIndividualExpression* tmpExp = new CQueryingTemporaryNamedIndividualExpression(indiName); |
| 45 |
container.append(tmpExp); |
| 46 |
return tmpExp; |
| 47 |
} |
| 48 |
|
| 49 |
CQueryingTemporaryInverseObjectPropertyOfExpression* CConcreteOntologyQueryBasicBuilder::getQueryingTemporaryInverseObjectProperty(CObjectPropertyTermExpression* expression) { |
| 50 |
CQueryingTemporaryInverseObjectPropertyOfExpression* tmpExp = new CQueryingTemporaryInverseObjectPropertyOfExpression(expression); |
| 51 |
container.append(tmpExp); |
| 52 |
return tmpExp; |
| 53 |
} |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
CQueryIsClassSatisfiableExpression* CConcreteOntologyQueryBasicBuilder::getIsClassSatisfiableQuery(const CEXPRESSIONLIST<CBuildExpression*>& testClassExpressions, const QString& queryName) { |
| 58 |
CQueryIsClassSatisfiableExpression* expression = nullptr; |
| 59 |
CExpressionSplitter expSplitter(testClassExpressions); |
| 60 |
if (expSplitter.testForExpressionComposition(1)) { |
| 61 |
expression = getIsClassSatisfiableQuery(expSplitter.getFirstClassTermExpression(),queryName); |
| 62 |
} else { |
| 63 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'IsClassSatisfiableQuery'-Expression."),this); |
| 64 |
} |
| 65 |
return expression; |
| 66 |
} |
| 67 |
|
| 68 |
CQueryAreClassesEquivalentExpression* CConcreteOntologyQueryBasicBuilder::getAreClassesEquivalenceQuery(const CEXPRESSIONLIST<CBuildExpression*>& testClassExpressions, const QString& queryName) { |
| 69 |
CQueryAreClassesEquivalentExpression* expression = nullptr; |
| 70 |
CExpressionSplitter expSplitter(testClassExpressions); |
| 71 |
if (expSplitter.testForExpressionComposition(2)) { |
| 72 |
expression = getAreClassesEquivalenceQuery(*expSplitter.getClassTermExpressionList(),queryName); |
| 73 |
} else { |
| 74 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'AreClassesEquivalentQuery'-Expression."),this); |
| 75 |
} |
| 76 |
return expression; |
| 77 |
} |
| 78 |
|
| 79 |
CQueryAreClassesDisjointExpression* CConcreteOntologyQueryBasicBuilder::getAreClassesDisjointQuery(const CEXPRESSIONLIST<CBuildExpression*>& testClassExpressions, const QString& queryName) { |
| 80 |
CQueryAreClassesDisjointExpression* expression = nullptr; |
| 81 |
CExpressionSplitter expSplitter(testClassExpressions); |
| 82 |
if (expSplitter.testForExpressionComposition(2)) { |
| 83 |
expression = getAreClassesDisjointQuery(*expSplitter.getClassTermExpressionList(),queryName); |
| 84 |
} else { |
| 85 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'AreClassesDisjointQuery'-Expression."),this); |
| 86 |
} |
| 87 |
return expression; |
| 88 |
} |
| 89 |
|
| 90 |
|
| 91 |
CQueryIsClassSubsumedByExpression* CConcreteOntologyQueryBasicBuilder::getIsClassSubsumedByQuery(const CEXPRESSIONLIST<CBuildExpression*>& testClassExpressions, const QString& queryName) { |
| 92 |
CQueryIsClassSubsumedByExpression* expression = nullptr; |
| 93 |
CExpressionSplitter expSplitter(testClassExpressions); |
| 94 |
if (expSplitter.testForExpressionComposition(2)) { |
| 95 |
expression = getIsClassSubsumedByQuery(expSplitter.getFirstClassTermExpression(),expSplitter.getSecondClassTermExpression(),queryName); |
| 96 |
} else { |
| 97 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'IsClassSubsumedByQuery'-Expression."),this); |
| 98 |
} |
| 99 |
return expression; |
| 100 |
} |
| 101 |
|
| 102 |
CQueryIsInstanceOfExpression* CConcreteOntologyQueryBasicBuilder::getIsInstanceOfQuery(const CEXPRESSIONLIST<CBuildExpression*>& testClassExpressions, const QString& queryName) { |
| 103 |
CQueryIsInstanceOfExpression* expression = nullptr; |
| 104 |
CExpressionSplitter expSplitter(testClassExpressions); |
| 105 |
if (expSplitter.testForExpressionComposition(1,0,1)) { |
| 106 |
expression = getIsInstanceOfQuery(expSplitter.getFirstIndividualTermExpression(),expSplitter.getFirstClassTermExpression(),queryName); |
| 107 |
} else { |
| 108 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'IsInstanceOfQuery'-Expression."),this); |
| 109 |
} |
| 110 |
return expression; |
| 111 |
} |
| 112 |
|
| 113 |
|
| 114 |
CQueryGetFlattenedTypesExpression* CConcreteOntologyQueryBasicBuilder::getGetFlattenedTypesQuery(const CEXPRESSIONLIST<CBuildExpression*>& testClassExpressions, bool direct, const QString& queryName) { |
| 115 |
CQueryGetFlattenedTypesExpression* expression = nullptr; |
| 116 |
CExpressionSplitter expSplitter(testClassExpressions); |
| 117 |
if (expSplitter.testForExpressionComposition(0,0,1)) { |
| 118 |
expression = getGetFlattenedTypesQuery(expSplitter.getFirstIndividualTermExpression(),direct,queryName); |
| 119 |
} else { |
| 120 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'GetFlattenedTypesQuery'-Expression."),this); |
| 121 |
} |
| 122 |
return expression; |
| 123 |
} |
| 124 |
|
| 125 |
CQueryGetFlattenedInstancesExpression* CConcreteOntologyQueryBasicBuilder::getGetFlattenedInstancesQuery(const CEXPRESSIONLIST<CBuildExpression*>& testClassExpressions, bool direct, const QString& queryName) { |
| 126 |
CQueryGetFlattenedInstancesExpression* expression = nullptr; |
| 127 |
CExpressionSplitter expSplitter(testClassExpressions); |
| 128 |
if (expSplitter.testForExpressionComposition(1,0,0)) { |
| 129 |
expression = getGetFlattenedInstancesQuery(expSplitter.getFirstClassTermExpression(),direct,queryName); |
| 130 |
} else { |
| 131 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'GetFlattenedInstancesQuery'-Expression."),this); |
| 132 |
} |
| 133 |
return expression; |
| 134 |
} |
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
CQueryGetTypesExpression* CConcreteOntologyQueryBasicBuilder::getGetTypesQuery(const CEXPRESSIONLIST<CBuildExpression*>& testClassExpressions, bool direct, const QString& queryName) { |
| 139 |
CQueryGetTypesExpression* expression = nullptr; |
| 140 |
CExpressionSplitter expSplitter(testClassExpressions); |
| 141 |
if (expSplitter.testForExpressionComposition(0,0,1)) { |
| 142 |
expression = getGetTypesQuery(expSplitter.getFirstIndividualTermExpression(),direct,queryName); |
| 143 |
} else { |
| 144 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'GetTypesQuery'-Expression."),this); |
| 145 |
} |
| 146 |
return expression; |
| 147 |
} |
| 148 |
|
| 149 |
CQueryGetSameIndividualsExpression* CConcreteOntologyQueryBasicBuilder::getGetSameIndividualsQuery(const CEXPRESSIONLIST<CBuildExpression*>& testClassExpressions, const QString& queryName) { |
| 150 |
CQueryGetSameIndividualsExpression* expression = nullptr; |
| 151 |
CExpressionSplitter expSplitter(testClassExpressions); |
| 152 |
if (expSplitter.testForExpressionComposition(0,0,1)) { |
| 153 |
expression = getGetSameIndividualsQuery(expSplitter.getFirstIndividualTermExpression(),queryName); |
| 154 |
} else { |
| 155 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'GetSameIndividualsQuery'-Expression."),this); |
| 156 |
} |
| 157 |
return expression; |
| 158 |
} |
| 159 |
|
| 160 |
CQueryGetInstancesExpression* CConcreteOntologyQueryBasicBuilder::getGetInstancesQuery(const CEXPRESSIONLIST<CBuildExpression*>& testClassExpressions, bool direct, const QString& queryName) { |
| 161 |
CQueryGetInstancesExpression* expression = nullptr; |
| 162 |
CExpressionSplitter expSplitter(testClassExpressions); |
| 163 |
if (expSplitter.testForExpressionComposition(1,0,0)) { |
| 164 |
expression = getGetInstancesQuery(expSplitter.getFirstClassTermExpression(),direct,queryName); |
| 165 |
} else { |
| 166 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'GetInstancesQuery'-Expression."),this); |
| 167 |
} |
| 168 |
return expression; |
| 169 |
} |
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
CQueryGetObjectPropertyTargetsExpression* CConcreteOntologyQueryBasicBuilder::getGetObjectPropertyTargetsQuery(const CEXPRESSIONLIST<CBuildExpression*>& testClassExpressions, const QString& queryName) { |
| 180 |
CQueryGetObjectPropertyTargetsExpression* expression = nullptr; |
| 181 |
CExpressionSplitter expSplitter(testClassExpressions); |
| 182 |
if (expSplitter.testForExpressionComposition(0,1,1)) { |
| 183 |
expression = getGetObjectPropertyTargetsQuery(expSplitter.getFirstObjectPropertyTermExpression(),expSplitter.getFirstIndividualTermExpression(),queryName); |
| 184 |
} else { |
| 185 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'GetObjectPropertyTargets'-Expression."),this); |
| 186 |
} |
| 187 |
return expression; |
| 188 |
} |
| 189 |
|
| 190 |
|
| 191 |
CQueryGetFlattenedObjectPropertyTargetsExpression* CConcreteOntologyQueryBasicBuilder::getGetFlattenedObjectPropertyTargetsQuery(const CEXPRESSIONLIST<CBuildExpression*>& testClassExpressions, const QString& queryName) { |
| 192 |
CQueryGetFlattenedObjectPropertyTargetsExpression* expression = nullptr; |
| 193 |
CExpressionSplitter expSplitter(testClassExpressions); |
| 194 |
if (expSplitter.testForExpressionComposition(0,1,1)) { |
| 195 |
expression = getGetFlattenedObjectPropertyTargetsQuery(expSplitter.getFirstObjectPropertyTermExpression(),expSplitter.getFirstIndividualTermExpression(),queryName); |
| 196 |
} else { |
| 197 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'GetFlattenedObjectPropertyTargets'-Expression."),this); |
| 198 |
} |
| 199 |
return expression; |
| 200 |
} |
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
CQueryGetObjectPropertySourcesExpression* CConcreteOntologyQueryBasicBuilder::getGetObjectPropertySourcesQuery(const CEXPRESSIONLIST<CBuildExpression*>& testClassExpressions, const QString& queryName) { |
| 208 |
CQueryGetObjectPropertySourcesExpression* expression = nullptr; |
| 209 |
CExpressionSplitter expSplitter(testClassExpressions); |
| 210 |
if (expSplitter.testForExpressionComposition(0,1,1)) { |
| 211 |
expression = getGetObjectPropertySourcesQuery(expSplitter.getFirstObjectPropertyTermExpression(),expSplitter.getFirstIndividualTermExpression(),queryName); |
| 212 |
} else { |
| 213 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'GetObjectPropertySources'-Expression."),this); |
| 214 |
} |
| 215 |
return expression; |
| 216 |
} |
| 217 |
|
| 218 |
|
| 219 |
CQueryGetFlattenedObjectPropertySourcesExpression* CConcreteOntologyQueryBasicBuilder::getGetFlattenedObjectPropertySourcesQuery(const CEXPRESSIONLIST<CBuildExpression*>& testClassExpressions, const QString& queryName) { |
| 220 |
CQueryGetFlattenedObjectPropertySourcesExpression* expression = nullptr; |
| 221 |
CExpressionSplitter expSplitter(testClassExpressions); |
| 222 |
if (expSplitter.testForExpressionComposition(0,1,1)) { |
| 223 |
expression = getGetFlattenedObjectPropertySourcesQuery(expSplitter.getFirstObjectPropertyTermExpression(),expSplitter.getFirstIndividualTermExpression(),queryName); |
| 224 |
} else { |
| 225 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'GetFlattenedObjectPropertySources'-Expression."),this); |
| 226 |
} |
| 227 |
return expression; |
| 228 |
} |
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
CQueryGetObjectPropertiesOfSourceExpression* CConcreteOntologyQueryBasicBuilder::getGetObjectPropertiesOfSourceQuery(const CEXPRESSIONLIST<CBuildExpression*>& testClassExpressions, const QString& queryName) { |
| 244 |
CQueryGetObjectPropertiesOfSourceExpression* expression = nullptr; |
| 245 |
CExpressionSplitter expSplitter(testClassExpressions); |
| 246 |
if (expSplitter.testForExpressionComposition(0,0,1)) { |
| 247 |
expression = getGetObjectPropertiesOfSourceQuery(expSplitter.getFirstIndividualTermExpression(),queryName); |
| 248 |
} else { |
| 249 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'GetObjectPropertiesOfSource'-Expression."),this); |
| 250 |
} |
| 251 |
return expression; |
| 252 |
} |
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
CQueryGetObjectPropertiesOfTargetExpression* CConcreteOntologyQueryBasicBuilder::getGetObjectPropertiesOfTargetQuery(const CEXPRESSIONLIST<CBuildExpression*>& testClassExpressions, const QString& queryName) { |
| 257 |
CQueryGetObjectPropertiesOfTargetExpression* expression = nullptr; |
| 258 |
CExpressionSplitter expSplitter(testClassExpressions); |
| 259 |
if (expSplitter.testForExpressionComposition(0,0,1)) { |
| 260 |
expression = getGetObjectPropertiesOfTargetQuery(expSplitter.getFirstIndividualTermExpression(),queryName); |
| 261 |
} else { |
| 262 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'GetObjectPropertiesOfTarget'-Expression."),this); |
| 263 |
} |
| 264 |
return expression; |
| 265 |
} |
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
CQueryGetObjectPropertiesBetweenExpression* CConcreteOntologyQueryBasicBuilder::getGetObjectPropertiesBetweenQuery(const CEXPRESSIONLIST<CBuildExpression*>& testClassExpressions, const QString& queryName) { |
| 270 |
CQueryGetObjectPropertiesBetweenExpression* expression = nullptr; |
| 271 |
CExpressionSplitter expSplitter(testClassExpressions); |
| 272 |
if (expSplitter.testForExpressionComposition(0,0,2)) { |
| 273 |
expression = getGetObjectPropertiesBetweenQuery(expSplitter.getFirstIndividualTermExpression(),expSplitter.getSecondIndividualTermExpression(),queryName); |
| 274 |
} else { |
| 275 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'GetObjectPropertiesOfSource'-Expression."),this); |
| 276 |
} |
| 277 |
return expression; |
| 278 |
} |
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
|
| 284 |
|
| 285 |
|
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
|
| 292 |
CQueryGetSubClassesExpression* CConcreteOntologyQueryBasicBuilder::getGetSubClassesQuery(const CEXPRESSIONLIST<CBuildExpression*>& testClassExpressions, bool direct, const QString& queryName) { |
| 293 |
CQueryGetSubClassesExpression* expression = nullptr; |
| 294 |
CExpressionSplitter expSplitter(testClassExpressions); |
| 295 |
if (expSplitter.testForExpressionComposition(1,0,0)) { |
| 296 |
expression = getGetSubClassesQuery(expSplitter.getFirstClassTermExpression(),direct,queryName); |
| 297 |
} else { |
| 298 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'GetSubClassesQuery'-Expression."),this); |
| 299 |
} |
| 300 |
return expression; |
| 301 |
} |
| 302 |
|
| 303 |
CQueryGetSuperClassesExpression* CConcreteOntologyQueryBasicBuilder::getGetSuperClassesQuery(const CEXPRESSIONLIST<CBuildExpression*>& testClassExpressions, bool direct, const QString& queryName) { |
| 304 |
CQueryGetSuperClassesExpression* expression = nullptr; |
| 305 |
CExpressionSplitter expSplitter(testClassExpressions); |
| 306 |
if (expSplitter.testForExpressionComposition(1,0,0)) { |
| 307 |
expression = getGetSuperClassesQuery(expSplitter.getFirstClassTermExpression(),direct,queryName); |
| 308 |
} else { |
| 309 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'GetSuperClassesQuery'-Expression."),this); |
| 310 |
} |
| 311 |
return expression; |
| 312 |
} |
| 313 |
|
| 314 |
CQueryGetEquivalentClassesExpression* CConcreteOntologyQueryBasicBuilder::getGetEquivalentClassesQuery(const CEXPRESSIONLIST<CBuildExpression*>& testClassExpressions, const QString& queryName) { |
| 315 |
CQueryGetEquivalentClassesExpression* expression = nullptr; |
| 316 |
CExpressionSplitter expSplitter(testClassExpressions); |
| 317 |
if (expSplitter.testForExpressionComposition(1,0,0)) { |
| 318 |
expression = getGetEquivalentClassesQuery(expSplitter.getFirstClassTermExpression(),queryName); |
| 319 |
} else { |
| 320 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'GetEquivalentClassesQuery'-Expression."),this); |
| 321 |
} |
| 322 |
return expression; |
| 323 |
} |
| 324 |
|
| 325 |
|
| 326 |
|
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
CQueryGetSubObjectPropertiesExpression* CConcreteOntologyQueryBasicBuilder::getGetSubObjectPropertiesQuery(const CEXPRESSIONLIST<CBuildExpression*>& testObjectPropertyExpressions, bool direct, const QString& queryName) { |
| 332 |
CQueryGetSubObjectPropertiesExpression* expression = nullptr; |
| 333 |
CExpressionSplitter expSplitter(testObjectPropertyExpressions); |
| 334 |
if (expSplitter.testForExpressionComposition(0,1,0)) { |
| 335 |
expression = getGetSubObjectPropertiesQuery(expSplitter.getFirstObjectPropertyTermExpression(),direct,queryName); |
| 336 |
} else { |
| 337 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'GetSubObjectPropertiesQuery'-Expression."),this); |
| 338 |
} |
| 339 |
return expression; |
| 340 |
} |
| 341 |
|
| 342 |
CQueryGetSuperObjectPropertiesExpression* CConcreteOntologyQueryBasicBuilder::getGetSuperObjectPropertiesQuery(const CEXPRESSIONLIST<CBuildExpression*>& testObjectPropertyExpressions, bool direct, const QString& queryName) { |
| 343 |
CQueryGetSuperObjectPropertiesExpression* expression = nullptr; |
| 344 |
CExpressionSplitter expSplitter(testObjectPropertyExpressions); |
| 345 |
if (expSplitter.testForExpressionComposition(0,1,0)) { |
| 346 |
expression = getGetSuperObjectPropertiesQuery(expSplitter.getFirstObjectPropertyTermExpression(),direct,queryName); |
| 347 |
} else { |
| 348 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'GetSuperObjectPropertiesQuery'-Expression."),this); |
| 349 |
} |
| 350 |
return expression; |
| 351 |
} |
| 352 |
|
| 353 |
CQueryGetEquivalentObjectPropertiesExpression* CConcreteOntologyQueryBasicBuilder::getGetEquivalentObjectPropertiesQuery(const CEXPRESSIONLIST<CBuildExpression*>& testObjectPropertyExpressions, const QString& queryName) { |
| 354 |
CQueryGetEquivalentObjectPropertiesExpression* expression = nullptr; |
| 355 |
CExpressionSplitter expSplitter(testObjectPropertyExpressions); |
| 356 |
if (expSplitter.testForExpressionComposition(0,1,0)) { |
| 357 |
expression = getGetEquivalentObjectPropertiesQuery(expSplitter.getFirstObjectPropertyTermExpression(),queryName); |
| 358 |
} else { |
| 359 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'GetEquivalentObjectPropertiesQuery'-Expression."),this); |
| 360 |
} |
| 361 |
return expression; |
| 362 |
} |
| 363 |
|
| 364 |
CQueryGetSubObjectPropertyHierarchyExpression* CConcreteOntologyQueryBasicBuilder::getGetSubObjectPropertyHierarchyQuery(const CEXPRESSIONLIST<CBuildExpression*>& testObjectPropertyExpressions, const QString& queryName) { |
| 365 |
CQueryGetSubObjectPropertyHierarchyExpression* expression = nullptr; |
| 366 |
CExpressionSplitter expSplitter(testObjectPropertyExpressions); |
| 367 |
if (expSplitter.testForExpressionComposition(0,1,0)) { |
| 368 |
expression = getGetSubObjectPropertyHierarchyQuery(expSplitter.getFirstObjectPropertyTermExpression(),queryName); |
| 369 |
} else { |
| 370 |
expression = getGetSubObjectPropertyHierarchyQuery(nullptr,queryName); |
| 371 |
} |
| 372 |
return expression; |
| 373 |
} |
| 374 |
|
| 375 |
|
| 376 |
CQueryIsObjectPropertySatisfiableExpression* CConcreteOntologyQueryBasicBuilder::getIsObjectPropertySatisfiableQuery(const CEXPRESSIONLIST<CBuildExpression*>& testObjectPropertyExpressions, const QString& queryName) { |
| 377 |
CQueryIsObjectPropertySatisfiableExpression* expression = nullptr; |
| 378 |
CExpressionSplitter expSplitter(testObjectPropertyExpressions); |
| 379 |
if (expSplitter.testForExpressionComposition(0,1,0)) { |
| 380 |
expression = getIsObjectPropertySatisfiableQuery(expSplitter.getFirstObjectPropertyTermExpression(),queryName); |
| 381 |
} else { |
| 382 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'IsObjectPropertySatisfiableQuery'-Expression."),this); |
| 383 |
} |
| 384 |
return expression; |
| 385 |
} |
| 386 |
|
| 387 |
|
| 388 |
|
| 389 |
CQueryGetSubDataPropertiesExpression* CConcreteOntologyQueryBasicBuilder::getGetSubDataPropertiesQuery(const CEXPRESSIONLIST<CBuildExpression*>& testDataPropertyExpressions, bool direct, const QString& queryName) { |
| 390 |
CQueryGetSubDataPropertiesExpression* expression = nullptr; |
| 391 |
CExpressionSplitter expSplitter(testDataPropertyExpressions); |
| 392 |
if (expSplitter.testForExpressionComposition(0,0,0,0,1)) { |
| 393 |
expression = getGetSubDataPropertiesQuery(expSplitter.getFirstDataPropertyTermExpression(),direct,queryName); |
| 394 |
} else { |
| 395 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'GetSubDataPropertiesQuery'-Expression."),this); |
| 396 |
} |
| 397 |
return expression; |
| 398 |
} |
| 399 |
|
| 400 |
CQueryGetSuperDataPropertiesExpression* CConcreteOntologyQueryBasicBuilder::getGetSuperDataPropertiesQuery(const CEXPRESSIONLIST<CBuildExpression*>& testDataPropertyExpressions, bool direct, const QString& queryName) { |
| 401 |
CQueryGetSuperDataPropertiesExpression* expression = nullptr; |
| 402 |
CExpressionSplitter expSplitter(testDataPropertyExpressions); |
| 403 |
if (expSplitter.testForExpressionComposition(0,0,0,0,1)) { |
| 404 |
expression = getGetSuperDataPropertiesQuery(expSplitter.getFirstDataPropertyTermExpression(),direct,queryName); |
| 405 |
} else { |
| 406 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'GetSuperDataPropertiesQuery'-Expression."),this); |
| 407 |
} |
| 408 |
return expression; |
| 409 |
} |
| 410 |
|
| 411 |
CQueryGetEquivalentDataPropertiesExpression* CConcreteOntologyQueryBasicBuilder::getGetEquivalentDataPropertiesQuery(const CEXPRESSIONLIST<CBuildExpression*>& testDataPropertyExpressions, const QString& queryName) { |
| 412 |
CQueryGetEquivalentDataPropertiesExpression* expression = nullptr; |
| 413 |
CExpressionSplitter expSplitter(testDataPropertyExpressions); |
| 414 |
if (expSplitter.testForExpressionComposition(0,0,0,0,1)) { |
| 415 |
expression = getGetEquivalentDataPropertiesQuery(expSplitter.getFirstDataPropertyTermExpression(),queryName); |
| 416 |
} else { |
| 417 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'GetEquivalentDataPropertiesQuery'-Expression."),this); |
| 418 |
} |
| 419 |
return expression; |
| 420 |
} |
| 421 |
|
| 422 |
|
| 423 |
CQueryGetSubDataPropertyHierarchyExpression* CConcreteOntologyQueryBasicBuilder::getGetSubDataPropertyHierarchyQuery(const CEXPRESSIONLIST<CBuildExpression*>& testDataPropertyExpressions, const QString& queryName) { |
| 424 |
CQueryGetSubDataPropertyHierarchyExpression* expression = nullptr; |
| 425 |
CExpressionSplitter expSplitter(testDataPropertyExpressions); |
| 426 |
if (expSplitter.testForExpressionComposition(0,0,0,0,1)) { |
| 427 |
expression = getGetSubDataPropertyHierarchyQuery(expSplitter.getFirstDataPropertyTermExpression(),queryName); |
| 428 |
} else { |
| 429 |
expression = getGetSubDataPropertyHierarchyQuery(nullptr,queryName); |
| 430 |
} |
| 431 |
return expression; |
| 432 |
} |
| 433 |
|
| 434 |
|
| 435 |
CQueryIsDataPropertySatisfiableExpression* CConcreteOntologyQueryBasicBuilder::getIsDataPropertySatisfiableQuery(const CEXPRESSIONLIST<CBuildExpression*>& testDataPropertyExpressions, const QString& queryName) { |
| 436 |
CQueryIsDataPropertySatisfiableExpression* expression = nullptr; |
| 437 |
CExpressionSplitter expSplitter(testDataPropertyExpressions); |
| 438 |
if (expSplitter.testForExpressionComposition(0,0,0,0,1)) { |
| 439 |
expression = getIsDataPropertySatisfiableQuery(expSplitter.getFirstDataPropertyTermExpression(),queryName); |
| 440 |
} else { |
| 441 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'IsDataPropertySatisfiableQuery'-Expression."),this); |
| 442 |
} |
| 443 |
return expression; |
| 444 |
} |
| 445 |
|
| 446 |
|
| 447 |
|
| 448 |
|
| 449 |
|
| 450 |
|
| 451 |
|
| 452 |
|
| 453 |
|
| 454 |
|
| 455 |
CQueryGetDeterministicIndividualsExpression* CConcreteOntologyQueryBasicBuilder::getGetDeterministicIndividualsQuery(const CEXPRESSIONLIST<CBuildExpression*>& expressions, const QString& queryName) { |
| 456 |
CQueryGetDeterministicIndividualsExpression* expression = nullptr; |
| 457 |
CExpressionSplitter expSplitter(expressions); |
| 458 |
expression = getGetDeterministicIndividualsQuery(*expSplitter.getIndividualTermExpressionList(),queryName); |
| 459 |
return expression; |
| 460 |
} |
| 461 |
|
| 462 |
CQueryGetNondeterministicIndividualsExpression* CConcreteOntologyQueryBasicBuilder::getGetNondeterministicIndividualsQuery(const CEXPRESSIONLIST<CBuildExpression*>& expressions, const QString& queryName) { |
| 463 |
CQueryGetNondeterministicIndividualsExpression* expression = nullptr; |
| 464 |
CExpressionSplitter expSplitter(expressions); |
| 465 |
expression = getGetNondeterministicIndividualsQuery(*expSplitter.getIndividualTermExpressionList(),queryName); |
| 466 |
return expression; |
| 467 |
} |
| 468 |
|
| 469 |
CQueryGetDeterministicClassAssertionsExpression* CConcreteOntologyQueryBasicBuilder::getGetDeterministicClassAssertionsQuery(const CEXPRESSIONLIST<CBuildExpression*>& expressions, const QString& queryName) { |
| 470 |
CQueryGetDeterministicClassAssertionsExpression* expression = nullptr; |
| 471 |
CExpressionSplitter expSplitter(expressions); |
| 472 |
expression = getGetDeterministicClassAssertionsQuery(*expSplitter.getIndividualTermExpressionList(),queryName); |
| 473 |
return expression; |
| 474 |
} |
| 475 |
|
| 476 |
CQueryGetNondeterministicClassAssertionsExpression* CConcreteOntologyQueryBasicBuilder::getGetNondeterministicClassAssertionsQuery(const CEXPRESSIONLIST<CBuildExpression*>& expressions, const QString& queryName) { |
| 477 |
CQueryGetNondeterministicClassAssertionsExpression* expression = nullptr; |
| 478 |
CExpressionSplitter expSplitter(expressions); |
| 479 |
expression = getGetNondeterministicClassAssertionsQuery(*expSplitter.getIndividualTermExpressionList(),queryName); |
| 480 |
return expression; |
| 481 |
} |
| 482 |
|
| 483 |
|
| 484 |
|
| 485 |
|
| 486 |
|
| 487 |
CQueryIsEntailedExpression* CConcreteOntologyQueryBasicBuilder::getIsEntailedQuery(const CEXPRESSIONLIST<CBuildExpression*>& testClassExpressions, const QString& queryName) { |
| 488 |
CQueryIsEntailedExpression* expression = nullptr; |
| 489 |
CEXPRESSIONLIST<CAxiomExpression*> axiomExpressionList; |
| 490 |
for (CEXPRESSIONLIST<CBuildExpression*>::const_iterator it = testClassExpressions.constBegin(), itEnd = testClassExpressions.constEnd(); it != itEnd; ++it) { |
| 491 |
CAxiomExpression* axiomExpression = dynamic_cast<CAxiomExpression*>(*it); |
| 492 |
if (axiomExpression) { |
| 493 |
axiomExpressionList.append(axiomExpression); |
| 494 |
} |
| 495 |
} |
| 496 |
if (!axiomExpressionList.isEmpty()) { |
| 497 |
expression = getIsEntailedQuery(axiomExpressionList,queryName); |
| 498 |
} else { |
| 499 |
LOG(ERROR,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Couldn't match parameters for 'IsEntailedQuery'-Expression."),this); |
| 500 |
} |
| 501 |
return expression; |
| 502 |
} |
| 503 |
|
| 504 |
|
| 505 |
CQueryIsClassSatisfiableExpression *CConcreteOntologyQueryBasicBuilder::getIsClassSatisfiableQuery(CClassTermExpression* testClassExpressions, const QString& queryName) { |
| 506 |
CQueryIsClassSatisfiableExpression *classSatExp = new CQueryIsClassSatisfiableExpression(queryName,testClassExpressions); |
| 507 |
container.append(classSatExp); |
| 508 |
classSatExpList.append(classSatExp); |
| 509 |
return classSatExp; |
| 510 |
} |
| 511 |
|
| 512 |
|
| 513 |
CQueryIsInstanceOfExpression *CConcreteOntologyQueryBasicBuilder::getIsInstanceOfQuery(CIndividualTermExpression* individualTermExpression, CClassTermExpression* classExpression, const QString& queryName) { |
| 514 |
CQueryIsInstanceOfExpression *instanceQExp = 0; |
| 515 |
instanceQExp = new CQueryIsInstanceOfExpression(queryName,individualTermExpression,classExpression); |
| 516 |
instanceExpList.append(instanceQExp); |
| 517 |
container.append(instanceQExp); |
| 518 |
return instanceQExp; |
| 519 |
} |
| 520 |
|
| 521 |
|
| 522 |
CQueryGetFlattenedTypesExpression* CConcreteOntologyQueryBasicBuilder::getGetFlattenedTypesQuery(CIndividualTermExpression* individualTermExpression, bool direct, const QString& queryName) { |
| 523 |
CQueryGetFlattenedTypesExpression* flattenedTypes = 0; |
| 524 |
flattenedTypes = new CQueryGetFlattenedTypesExpression(queryName,direct,individualTermExpression); |
| 525 |
flattenedTypesExpList.append(flattenedTypes); |
| 526 |
container.append(flattenedTypes); |
| 527 |
return flattenedTypes; |
| 528 |
} |
| 529 |
|
| 530 |
|
| 531 |
CQueryGetFlattenedInstancesExpression* CConcreteOntologyQueryBasicBuilder::getGetFlattenedInstancesQuery(CClassTermExpression* classTermExpression, bool direct, const QString& queryName) { |
| 532 |
CQueryGetFlattenedInstancesExpression* flattenedInstances = 0; |
| 533 |
flattenedInstances = new CQueryGetFlattenedInstancesExpression(queryName,direct,classTermExpression); |
| 534 |
flattenedInstancesExpList.append(flattenedInstances); |
| 535 |
container.append(flattenedInstances); |
| 536 |
return flattenedInstances; |
| 537 |
} |
| 538 |
|
| 539 |
|
| 540 |
CQueryGetTypesExpression* CConcreteOntologyQueryBasicBuilder::getGetTypesQuery(CIndividualTermExpression* individualTermExpression, bool direct, const QString& queryName) { |
| 541 |
CQueryGetTypesExpression* types = 0; |
| 542 |
types = new CQueryGetTypesExpression(queryName,direct,individualTermExpression); |
| 543 |
typesExpList.append(types); |
| 544 |
container.append(types); |
| 545 |
return types; |
| 546 |
} |
| 547 |
|
| 548 |
|
| 549 |
CQueryGetSameIndividualsExpression* CConcreteOntologyQueryBasicBuilder::getGetSameIndividualsQuery(CIndividualTermExpression* individualTermExpression, const QString& queryName) { |
| 550 |
CQueryGetSameIndividualsExpression* types = 0; |
| 551 |
types = new CQueryGetSameIndividualsExpression(queryName,individualTermExpression); |
| 552 |
sameIndiExpList.append(types); |
| 553 |
container.append(types); |
| 554 |
return types; |
| 555 |
} |
| 556 |
|
| 557 |
CQueryGetInstancesExpression* CConcreteOntologyQueryBasicBuilder::getGetInstancesQuery(CClassTermExpression* classTermExpression, bool direct, const QString& queryName) { |
| 558 |
CQueryGetInstancesExpression* instances = 0; |
| 559 |
instances = new CQueryGetInstancesExpression(queryName,direct,classTermExpression); |
| 560 |
instancesExpList.append(instances); |
| 561 |
container.append(instances); |
| 562 |
return instances; |
| 563 |
} |
| 564 |
|
| 565 |
|
| 566 |
CQueryGetObjectPropertyTargetsExpression* CConcreteOntologyQueryBasicBuilder::getGetObjectPropertyTargetsQuery(CObjectPropertyTermExpression* objectPropertyExpression, CIndividualTermExpression* individualExpression, const QString& queryName) { |
| 567 |
CQueryGetObjectPropertyTargetsExpression* instances = 0; |
| 568 |
instances = new CQueryGetObjectPropertyTargetsExpression(queryName,objectPropertyExpression,individualExpression); |
| 569 |
mObjectPropTargetsExpList.append(instances); |
| 570 |
container.append(instances); |
| 571 |
return instances; |
| 572 |
} |
| 573 |
|
| 574 |
CQueryGetFlattenedObjectPropertyTargetsExpression* CConcreteOntologyQueryBasicBuilder::getGetFlattenedObjectPropertyTargetsQuery(CObjectPropertyTermExpression* objectPropertyExpression, CIndividualTermExpression* individualExpression, const QString& queryName) { |
| 575 |
CQueryGetFlattenedObjectPropertyTargetsExpression* instances = 0; |
| 576 |
instances = new CQueryGetFlattenedObjectPropertyTargetsExpression(queryName,objectPropertyExpression,individualExpression); |
| 577 |
mObjectFlattenedPropTargetsExpList.append(instances); |
| 578 |
container.append(instances); |
| 579 |
return instances; |
| 580 |
} |
| 581 |
|
| 582 |
CQueryGetObjectPropertySourcesExpression* CConcreteOntologyQueryBasicBuilder::getGetObjectPropertySourcesQuery(CObjectPropertyTermExpression* objectPropertyExpression, CIndividualTermExpression* individualExpression, const QString& queryName) { |
| 583 |
CQueryGetObjectPropertySourcesExpression* instances = 0; |
| 584 |
instances = new CQueryGetObjectPropertySourcesExpression(queryName,objectPropertyExpression,individualExpression); |
| 585 |
mObjectPropSourcesExpList.append(instances); |
| 586 |
container.append(instances); |
| 587 |
return instances; |
| 588 |
} |
| 589 |
|
| 590 |
CQueryGetFlattenedObjectPropertySourcesExpression* CConcreteOntologyQueryBasicBuilder::getGetFlattenedObjectPropertySourcesQuery(CObjectPropertyTermExpression* objectPropertyExpression, CIndividualTermExpression* individualExpression, const QString& queryName) { |
| 591 |
CQueryGetFlattenedObjectPropertySourcesExpression* instances = 0; |
| 592 |
instances = new CQueryGetFlattenedObjectPropertySourcesExpression(queryName,objectPropertyExpression,individualExpression); |
| 593 |
mObjectFlattenedPropSourcesExpList.append(instances); |
| 594 |
container.append(instances); |
| 595 |
return instances; |
| 596 |
} |
| 597 |
|
| 598 |
|
| 599 |
|
| 600 |
|
| 601 |
|
| 602 |
|
| 603 |
|
| 604 |
|
| 605 |
CQueryGetObjectPropertiesOfSourceExpression* CConcreteOntologyQueryBasicBuilder::getGetObjectPropertiesOfSourceQuery(CIndividualTermExpression* individualExpression, const QString& queryName) { |
| 606 |
CQueryGetObjectPropertiesOfSourceExpression* instances = 0; |
| 607 |
instances = new CQueryGetObjectPropertiesOfSourceExpression(queryName,individualExpression); |
| 608 |
mObjectPropsOfSourceExpList.append(instances); |
| 609 |
container.append(instances); |
| 610 |
return instances; |
| 611 |
} |
| 612 |
|
| 613 |
|
| 614 |
|
| 615 |
CQueryGetObjectPropertiesOfTargetExpression* CConcreteOntologyQueryBasicBuilder::getGetObjectPropertiesOfTargetQuery(CIndividualTermExpression* individualExpression, const QString& queryName) { |
| 616 |
CQueryGetObjectPropertiesOfTargetExpression* instances = 0; |
| 617 |
instances = new CQueryGetObjectPropertiesOfTargetExpression(queryName,individualExpression); |
| 618 |
mObjectPropsOfTargetExpList.append(instances); |
| 619 |
container.append(instances); |
| 620 |
return instances; |
| 621 |
} |
| 622 |
|
| 623 |
|
| 624 |
|
| 625 |
CQueryGetObjectPropertiesBetweenExpression* CConcreteOntologyQueryBasicBuilder::getGetObjectPropertiesBetweenQuery(CIndividualTermExpression* sourceIndividualExpression, CIndividualTermExpression* targetIndividualExpression, const QString& queryName) { |
| 626 |
CQueryGetObjectPropertiesBetweenExpression* instances = 0; |
| 627 |
instances = new CQueryGetObjectPropertiesBetweenExpression(queryName,sourceIndividualExpression,targetIndividualExpression); |
| 628 |
mObjectPropsBetweenExpList.append(instances); |
| 629 |
container.append(instances); |
| 630 |
return instances; |
| 631 |
} |
| 632 |
|
| 633 |
|
| 634 |
|
| 635 |
|
| 636 |
|
| 637 |
|
| 638 |
|
| 639 |
CQueryGetSubClassesExpression* CConcreteOntologyQueryBasicBuilder::getGetSubClassesQuery(CClassTermExpression* classTermExpression, bool direct, const QString& queryName) { |
| 640 |
CQueryGetSubClassesExpression* instances = 0; |
| 641 |
instances = new CQueryGetSubClassesExpression(queryName,direct,classTermExpression); |
| 642 |
mSubClassesExpList.append(instances); |
| 643 |
container.append(instances); |
| 644 |
return instances; |
| 645 |
} |
| 646 |
|
| 647 |
|
| 648 |
CQueryGetSuperClassesExpression* CConcreteOntologyQueryBasicBuilder::getGetSuperClassesQuery(CClassTermExpression* classTermExpression, bool direct, const QString& queryName) { |
| 649 |
CQueryGetSuperClassesExpression* instances = 0; |
| 650 |
instances = new CQueryGetSuperClassesExpression(queryName,direct,classTermExpression); |
| 651 |
mSuperClassesExpList.append(instances); |
| 652 |
container.append(instances); |
| 653 |
return instances; |
| 654 |
} |
| 655 |
|
| 656 |
CQueryGetEquivalentClassesExpression* CConcreteOntologyQueryBasicBuilder::getGetEquivalentClassesQuery(CClassTermExpression* classTermExpression, const QString& queryName) { |
| 657 |
CQueryGetEquivalentClassesExpression* instances = 0; |
| 658 |
instances = new CQueryGetEquivalentClassesExpression(queryName,classTermExpression); |
| 659 |
mEquivClassesExpList.append(instances); |
| 660 |
container.append(instances); |
| 661 |
return instances; |
| 662 |
} |
| 663 |
|
| 664 |
|
| 665 |
|
| 666 |
|
| 667 |
|
| 668 |
|
| 669 |
|
| 670 |
|
| 671 |
CQueryGetSubObjectPropertiesExpression* CConcreteOntologyQueryBasicBuilder::getGetSubObjectPropertiesQuery(CObjectPropertyTermExpression* objectPropertyTermExpression, bool direct, const QString& queryName) { |
| 672 |
CQueryGetSubObjectPropertiesExpression* instances = 0; |
| 673 |
instances = new CQueryGetSubObjectPropertiesExpression(queryName,direct,objectPropertyTermExpression); |
| 674 |
mSubObjectPropertiesExpList.append(instances); |
| 675 |
container.append(instances); |
| 676 |
return instances; |
| 677 |
} |
| 678 |
|
| 679 |
|
| 680 |
CQueryGetSuperObjectPropertiesExpression* CConcreteOntologyQueryBasicBuilder::getGetSuperObjectPropertiesQuery(CObjectPropertyTermExpression* objectPropertyTermExpression, bool direct, const QString& queryName) { |
| 681 |
CQueryGetSuperObjectPropertiesExpression* instances = 0; |
| 682 |
instances = new CQueryGetSuperObjectPropertiesExpression(queryName,direct,objectPropertyTermExpression); |
| 683 |
mSuperObjectPropertiesExpList.append(instances); |
| 684 |
container.append(instances); |
| 685 |
return instances; |
| 686 |
} |
| 687 |
|
| 688 |
CQueryGetEquivalentObjectPropertiesExpression* CConcreteOntologyQueryBasicBuilder::getGetEquivalentObjectPropertiesQuery(CObjectPropertyTermExpression* objectPropertyTermExpression, const QString& queryName) { |
| 689 |
CQueryGetEquivalentObjectPropertiesExpression* instances = 0; |
| 690 |
instances = new CQueryGetEquivalentObjectPropertiesExpression(queryName,objectPropertyTermExpression); |
| 691 |
mEquivObjectPropertiesExpList.append(instances); |
| 692 |
container.append(instances); |
| 693 |
return instances; |
| 694 |
} |
| 695 |
|
| 696 |
CQueryGetSubObjectPropertyHierarchyExpression* CConcreteOntologyQueryBasicBuilder::getGetSubObjectPropertyHierarchyQuery(CObjectPropertyTermExpression* objectPropertyTermExpression, const QString& queryName) { |
| 697 |
CQueryGetSubObjectPropertyHierarchyExpression* instances = 0; |
| 698 |
instances = new CQueryGetSubObjectPropertyHierarchyExpression(queryName,objectPropertyTermExpression); |
| 699 |
mSubObjectPropertyHierarchyExpList.append(instances); |
| 700 |
container.append(instances); |
| 701 |
return instances; |
| 702 |
} |
| 703 |
|
| 704 |
|
| 705 |
|
| 706 |
CQueryIsObjectPropertySatisfiableExpression* CConcreteOntologyQueryBasicBuilder::getIsObjectPropertySatisfiableQuery(CObjectPropertyTermExpression* objectPropertyTermExpression, const QString& queryName) { |
| 707 |
CQueryIsObjectPropertySatisfiableExpression* instances = 0; |
| 708 |
instances = new CQueryIsObjectPropertySatisfiableExpression(queryName,objectPropertyTermExpression); |
| 709 |
mObjectPropertySatExpList.append(instances); |
| 710 |
container.append(instances); |
| 711 |
return instances; |
| 712 |
} |
| 713 |
|
| 714 |
|
| 715 |
|
| 716 |
|
| 717 |
CQueryGetSubDataPropertiesExpression* CConcreteOntologyQueryBasicBuilder::getGetSubDataPropertiesQuery(CDataPropertyTermExpression* dataPropertyTermExpression, bool direct, const QString& queryName) { |
| 718 |
CQueryGetSubDataPropertiesExpression* instances = 0; |
| 719 |
instances = new CQueryGetSubDataPropertiesExpression(queryName,direct,dataPropertyTermExpression); |
| 720 |
mSubDataPropertiesExpList.append(instances); |
| 721 |
container.append(instances); |
| 722 |
return instances; |
| 723 |
} |
| 724 |
|
| 725 |
|
| 726 |
CQueryGetSuperDataPropertiesExpression* CConcreteOntologyQueryBasicBuilder::getGetSuperDataPropertiesQuery(CDataPropertyTermExpression* dataPropertyTermExpression, bool direct, const QString& queryName) { |
| 727 |
CQueryGetSuperDataPropertiesExpression* instances = 0; |
| 728 |
instances = new CQueryGetSuperDataPropertiesExpression(queryName,direct,dataPropertyTermExpression); |
| 729 |
mSuperDataPropertiesExpList.append(instances); |
| 730 |
container.append(instances); |
| 731 |
return instances; |
| 732 |
} |
| 733 |
|
| 734 |
CQueryGetEquivalentDataPropertiesExpression* CConcreteOntologyQueryBasicBuilder::getGetEquivalentDataPropertiesQuery(CDataPropertyTermExpression* dataPropertyTermExpression, const QString& queryName) { |
| 735 |
CQueryGetEquivalentDataPropertiesExpression* instances = 0; |
| 736 |
instances = new CQueryGetEquivalentDataPropertiesExpression(queryName,dataPropertyTermExpression); |
| 737 |
mEquivDataPropertiesExpList.append(instances); |
| 738 |
container.append(instances); |
| 739 |
return instances; |
| 740 |
} |
| 741 |
|
| 742 |
CQueryGetSubDataPropertyHierarchyExpression* CConcreteOntologyQueryBasicBuilder::getGetSubDataPropertyHierarchyQuery(CDataPropertyTermExpression* dataPropertyTermExpression, const QString& queryName) { |
| 743 |
CQueryGetSubDataPropertyHierarchyExpression* instances = 0; |
| 744 |
instances = new CQueryGetSubDataPropertyHierarchyExpression(queryName,dataPropertyTermExpression); |
| 745 |
mSubDataPropertyHierarchyExpList.append(instances); |
| 746 |
container.append(instances); |
| 747 |
return instances; |
| 748 |
} |
| 749 |
|
| 750 |
|
| 751 |
|
| 752 |
CQueryIsDataPropertySatisfiableExpression* CConcreteOntologyQueryBasicBuilder::getIsDataPropertySatisfiableQuery(CDataPropertyTermExpression* dataPropertyTermExpression, const QString& queryName) { |
| 753 |
CQueryIsDataPropertySatisfiableExpression* instances = 0; |
| 754 |
instances = new CQueryIsDataPropertySatisfiableExpression(queryName,dataPropertyTermExpression); |
| 755 |
mDataPropertySatExpList.append(instances); |
| 756 |
container.append(instances); |
| 757 |
return instances; |
| 758 |
} |
| 759 |
|
| 760 |
|
| 761 |
|
| 762 |
|
| 763 |
|
| 764 |
|
| 765 |
|
| 766 |
|
| 767 |
|
| 768 |
|
| 769 |
CQueryGetDeterministicIndividualsExpression* CConcreteOntologyQueryBasicBuilder::getGetDeterministicIndividualsQuery(const CEXPRESSIONLIST<CIndividualTermExpression*>& indiExpressions, const QString& queryName) { |
| 770 |
CQueryGetDeterministicIndividualsExpression* queryExpression = nullptr; |
| 771 |
queryExpression = new CQueryGetDeterministicIndividualsExpression(queryName,indiExpressions); |
| 772 |
mDetIndisExpList.append(queryExpression); |
| 773 |
container.append(queryExpression); |
| 774 |
return queryExpression; |
| 775 |
} |
| 776 |
|
| 777 |
|
| 778 |
CQueryGetNondeterministicIndividualsExpression* CConcreteOntologyQueryBasicBuilder::getGetNondeterministicIndividualsQuery(const CEXPRESSIONLIST<CIndividualTermExpression*>& indiExpressions, const QString& queryName) { |
| 779 |
CQueryGetNondeterministicIndividualsExpression* queryExpression = nullptr; |
| 780 |
queryExpression = new CQueryGetNondeterministicIndividualsExpression(queryName,indiExpressions); |
| 781 |
mNdetIndisExpList.append(queryExpression); |
| 782 |
container.append(queryExpression); |
| 783 |
return queryExpression; |
| 784 |
} |
| 785 |
|
| 786 |
|
| 787 |
CQueryGetDeterministicClassAssertionsExpression* CConcreteOntologyQueryBasicBuilder::getGetDeterministicClassAssertionsQuery(const CEXPRESSIONLIST<CIndividualTermExpression*>& indiExpressions, const QString& queryName) { |
| 788 |
CQueryGetDeterministicClassAssertionsExpression* queryExpression = nullptr; |
| 789 |
queryExpression = new CQueryGetDeterministicClassAssertionsExpression(queryName,indiExpressions); |
| 790 |
mDetClassAssExpList.append(queryExpression); |
| 791 |
container.append(queryExpression); |
| 792 |
return queryExpression; |
| 793 |
} |
| 794 |
|
| 795 |
|
| 796 |
CQueryGetNondeterministicClassAssertionsExpression* CConcreteOntologyQueryBasicBuilder::getGetNondeterministicClassAssertionsQuery(const CEXPRESSIONLIST<CIndividualTermExpression*>& indiExpressions, const QString& queryName) { |
| 797 |
CQueryGetNondeterministicClassAssertionsExpression* queryExpression = nullptr; |
| 798 |
queryExpression = new CQueryGetNondeterministicClassAssertionsExpression(queryName,indiExpressions); |
| 799 |
mNdetClassAssExpList.append(queryExpression); |
| 800 |
container.append(queryExpression); |
| 801 |
return queryExpression; |
| 802 |
} |
| 803 |
|
| 804 |
|
| 805 |
|
| 806 |
|
| 807 |
QString CConcreteOntologyQueryBasicBuilder::getStringFromConcept(CConcept *concept) { |
| 808 |
QString className; |
| 809 |
if (concept) { |
| 810 |
if (concept->hasClassName()) { |
| 811 |
QString iriClassNameString = CIRIName::getRecentIRIName(concept->getClassNameLinker()); |
| 812 |
className = iriClassNameString; |
| 813 |
} else { |
| 814 |
className = CConceptTextFormater::getConceptString(concept,false); |
| 815 |
} |
| 816 |
} |
| 817 |
return className; |
| 818 |
} |
| 819 |
|
| 820 |
|
| 821 |
CConcept *CConcreteOntologyQueryBasicBuilder::getConceptFromBuildExpression(CClassTermExpression *buildExp) { |
| 822 |
CConcept *concept = mOntology->getDataBoxes()->getExpressionDataBoxMapping()->getClassTermConceptMappingHash()->value(buildExp,nullptr); |
| 823 |
return concept; |
| 824 |
} |
| 825 |
|
| 826 |
|
| 827 |
CRole *CConcreteOntologyQueryBasicBuilder::getRoleFromBuildExpression(CObjectPropertyTermExpression *buildExp) { |
| 828 |
CRole* role = mOntology->getDataBoxes()->getExpressionDataBoxMapping()->getObjectPropertyTermRoleMappingHash()->value(buildExp,nullptr); |
| 829 |
return role; |
| 830 |
} |
| 831 |
|
| 832 |
CRole *CConcreteOntologyQueryBasicBuilder::getRoleFromBuildExpression(CDataPropertyTermExpression *buildExp) { |
| 833 |
CRole* role = mOntology->getDataBoxes()->getExpressionDataBoxMapping()->getDataPropertyTermRoleMappingHash()->value(buildExp,nullptr); |
| 834 |
return role; |
| 835 |
} |
| 836 |
|
| 837 |
CIndividual *CConcreteOntologyQueryBasicBuilder::getIndividualFromBuildExpression(CIndividualTermExpression *buildExp) { |
| 838 |
CIndividual *indi = mOntology->getDataBoxes()->getExpressionDataBoxMapping()->getIndividulTermIndiMappingHash()->value(buildExp,nullptr); |
| 839 |
return indi; |
| 840 |
} |
| 841 |
|
| 842 |
|
| 843 |
CIndividualReference CConcreteOntologyQueryBasicBuilder::getIndividualReferenceFromBuildExpression(CIndividualTermExpression *buildExp) { |
| 844 |
if (buildExp->getType() == CBuildExpression::BETNAMEDINDIVIDUAL) { |
| 845 |
CIndividual *indi = mOntology->getDataBoxes()->getExpressionDataBoxMapping()->getIndividulTermIndiMappingHash()->value(buildExp, nullptr); |
| 846 |
return CIndividualReference(indi); |
| 847 |
} else if (buildExp->getType() == CBuildExpression::BET_QUERYING_TEMPORARY_NAMED_INDIVIDUAL) { |
| 848 |
CQueryingTemporaryNamedIndividualExpression* tmpNamedIndiExp = (CQueryingTemporaryNamedIndividualExpression*)buildExp; |
| 849 |
QString indiName = tmpNamedIndiExp->getName(); |
| 850 |
|
| 851 |
if (mOntology->getOntologyTriplesData()->getTripleAssertionAccessor()) { |
| 852 |
// TODO: check existence of individual |
| 853 |
cint64 resolvedIndiId = -1; |
| 854 |
mOntology->getOntologyTriplesData()->getTripleAssertionAccessor()->visitIndividualId(indiName, [&](cint64 indiId)->bool { |
| 855 |
resolvedIndiId = indiId; |
| 856 |
return true; |
| 857 |
}); |
| 858 |
|
| 859 |
return CIndividualReference(resolvedIndiId); |
| 860 |
} |
| 861 |
|
| 862 |
} |
| 863 |
return CIndividualReference(); |
| 864 |
} |
| 865 |
|
| 866 |
|
| 867 |
QString CConcreteOntologyQueryBasicBuilder::getIndividualNameFromBuildExpression(CIndividualTermExpression *buildExp) { |
| 868 |
QString indiName; |
| 869 |
if (buildExp->getType() == CBuildExpression::BETNAMEDINDIVIDUAL) { |
| 870 |
CIndividual *indi = mOntology->getDataBoxes()->getExpressionDataBoxMapping()->getIndividulTermIndiMappingHash()->value(buildExp, nullptr); |
| 871 |
indiName = CIRIName::getRecentIRIName(indi->getIndividualNameLinker()); |
| 872 |
} else if (buildExp->getType() == CBuildExpression::BET_QUERYING_TEMPORARY_NAMED_INDIVIDUAL) { |
| 873 |
CQueryingTemporaryNamedIndividualExpression* tmpNamedIndiExp = (CQueryingTemporaryNamedIndividualExpression*)buildExp; |
| 874 |
indiName = tmpNamedIndiExp->getName(); |
| 875 |
} |
| 876 |
return indiName; |
| 877 |
} |
| 878 |
|
| 879 |
|
| 880 |
|
| 881 |
|
| 882 |
QList<CQuery*> CConcreteOntologyQueryBasicBuilder::generateQuerys() { |
| 883 |
QList<CQuery*> queryList; |
| 884 |
|
| 885 |
CSatisfiableCalculationJobGenerator* satCalcJobGenerator = new CSatisfiableCalculationJobGenerator(mOntology); |
| 886 |
|
| 887 |
bool confBuildQueryStats = CConfigDataReader::readConfigBoolean(config,"Konclude.Query.Statistics.CollectStatistics",false); |
| 888 |
|
| 889 |
foreach (CQueryIsClassSatisfiableExpression *classSatExp, classSatExpList) { |
| 890 |
QString queryName = classSatExp->getName(); |
| 891 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 892 |
CClassTermExpression *satBuildExp = classSatExp->getClassTermExpression(); |
| 893 |
CConcept *concept = getConceptFromBuildExpression(satBuildExp); |
| 894 |
if (concept) { |
| 895 |
QString className = getStringFromConcept(concept); |
| 896 |
|
| 897 |
CIsClassSatisfiableQuery *query = new CIsClassSatisfiableQuery(className,queryName); |
| 898 |
CSatisfiableCalculationJob* satCalcJob = satCalcJobGenerator->getSatisfiableCalculationJob(concept); |
| 899 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 900 |
if (confBuildQueryStats) { |
| 901 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 902 |
satCalcJob->setCalclulationStatisticsCollector(queryStats->createCalculationStatisticsCollection()); |
| 903 |
} |
| 904 |
query->setCalculationConfiguration(calcConfig); |
| 905 |
satCalcJob->setCalculationConfiguration(calcConfig); |
| 906 |
query->addTestSatisfiableCalculationJob(satCalcJob,true); |
| 907 |
query->setQueryStatistics(queryStats); |
| 908 |
|
| 909 |
queryList.append(query); |
| 910 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated IsClassSatisfiable-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 911 |
} |
| 912 |
delete classSatExp; |
| 913 |
} |
| 914 |
|
| 915 |
|
| 916 |
|
| 917 |
|
| 918 |
foreach (CQueryIsInstanceOfExpression *instanceExp, instanceExpList) { |
| 919 |
QString queryName = instanceExp->getName(); |
| 920 |
|
| 921 |
CIndividualTermExpression *indiExp = instanceExp->getIndividualTermExpression(); |
| 922 |
CClassTermExpression *classExp = instanceExp->getClassTermExpression(); |
| 923 |
|
| 924 |
if (indiExp && classExp) { |
| 925 |
|
| 926 |
CIndividualReference indiRef = getIndividualReferenceFromBuildExpression(indiExp); |
| 927 |
CConcept *concept = getConceptFromBuildExpression(classExp); |
| 928 |
|
| 929 |
QString indiString = getIndividualNameFromBuildExpression(indiExp); |
| 930 |
QString conceptString = getStringFromConcept(concept); |
| 931 |
|
| 932 |
CIsInstanceOfQuery *query = new CIsInstanceOfQuery(indiString,conceptString,queryName); |
| 933 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 934 |
|
| 935 |
CSatisfiableCalculationJob* satCalcJob = satCalcJobGenerator->getSatisfiableCalculationJob(concept,true, indiRef); |
| 936 |
|
| 937 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 938 |
if (confBuildQueryStats) { |
| 939 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 940 |
satCalcJob->setCalclulationStatisticsCollector(queryStats->createCalculationStatisticsCollection()); |
| 941 |
} |
| 942 |
query->setQueryStatistics(queryStats); |
| 943 |
query->setCalculationConfiguration(calcConfig); |
| 944 |
|
| 945 |
|
| 946 |
satCalcJob->setCalculationConfiguration(calcConfig); |
| 947 |
query->addTestSatisfiableCalculationJob(satCalcJob,false); |
| 948 |
|
| 949 |
queryList.append(query); |
| 950 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated IsIstanceOf-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 951 |
} |
| 952 |
delete instanceExp; |
| 953 |
} |
| 954 |
|
| 955 |
|
| 956 |
foreach (CQueryGetFlattenedTypesExpression* flattenedTypes, flattenedTypesExpList) { |
| 957 |
QString queryName = flattenedTypes->getName(); |
| 958 |
CIndividualTermExpression *indiExp = flattenedTypes->getIndividualTermExpression(); |
| 959 |
|
| 960 |
if (indiExp) { |
| 961 |
CIndividualReference indiRef = getIndividualReferenceFromBuildExpression(indiExp); |
| 962 |
QString indiString = getIndividualNameFromBuildExpression(indiExp);; |
| 963 |
|
| 964 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 965 |
CFlattenedTypesQuery *query = new CFlattenedTypesQuery(mOntology,calcConfig, indiRef,flattenedTypes->isDirect(),indiString,queryName); |
| 966 |
|
| 967 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 968 |
if (confBuildQueryStats) { |
| 969 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 970 |
} |
| 971 |
query->setQueryStatistics(queryStats); |
| 972 |
|
| 973 |
queryList.append(query); |
| 974 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated FlattenedTypes-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 975 |
} |
| 976 |
delete flattenedTypes; |
| 977 |
} |
| 978 |
|
| 979 |
|
| 980 |
foreach (CQueryGetFlattenedInstancesExpression* flattenedInstances, flattenedInstancesExpList) { |
| 981 |
QString queryName = flattenedInstances->getName(); |
| 982 |
CClassTermExpression* classExp = flattenedInstances->getClassTermExpression(); |
| 983 |
|
| 984 |
if (classExp) { |
| 985 |
CConcept* concept = getConceptFromBuildExpression(classExp); |
| 986 |
|
| 987 |
QString iriClassNameString = CIRIName::getRecentIRIName(concept->getClassNameLinker()); |
| 988 |
QString classString = iriClassNameString; |
| 989 |
|
| 990 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 991 |
CFlattenedInstancesQuery *query = new CFlattenedInstancesQuery(mOntology,calcConfig,concept,flattenedInstances->isDirect(),classString,queryName); |
| 992 |
|
| 993 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 994 |
if (confBuildQueryStats) { |
| 995 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 996 |
} |
| 997 |
query->setQueryStatistics(queryStats); |
| 998 |
|
| 999 |
queryList.append(query); |
| 1000 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated FlattenedInstances-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1001 |
} |
| 1002 |
delete flattenedInstances; |
| 1003 |
} |
| 1004 |
|
| 1005 |
|
| 1006 |
|
| 1007 |
foreach (CQueryGetTypesExpression* typesExp, typesExpList) { |
| 1008 |
QString queryName = typesExp->getName(); |
| 1009 |
CIndividualTermExpression *indiExp = typesExp->getIndividualTermExpression(); |
| 1010 |
|
| 1011 |
if (indiExp) { |
| 1012 |
CIndividualReference indiRef = getIndividualReferenceFromBuildExpression(indiExp); |
| 1013 |
QString indiString = getIndividualNameFromBuildExpression(indiExp);; |
| 1014 |
|
| 1015 |
|
| 1016 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 1017 |
CTypesQuery *query = new CTypesQuery(mOntology,calcConfig, indiRef,typesExp->isDirect(),indiString,queryName); |
| 1018 |
|
| 1019 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 1020 |
if (confBuildQueryStats) { |
| 1021 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 1022 |
} |
| 1023 |
query->setQueryStatistics(queryStats); |
| 1024 |
|
| 1025 |
queryList.append(query); |
| 1026 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated Types-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1027 |
} |
| 1028 |
delete typesExp; |
| 1029 |
} |
| 1030 |
|
| 1031 |
|
| 1032 |
|
| 1033 |
foreach (CQueryGetSameIndividualsExpression* sameIndExp, sameIndiExpList) { |
| 1034 |
QString queryName = sameIndExp->getName(); |
| 1035 |
CIndividualTermExpression *indiExp = sameIndExp->getIndividualTermExpression(); |
| 1036 |
|
| 1037 |
if (indiExp) { |
| 1038 |
CIndividualReference indiRef = getIndividualReferenceFromBuildExpression(indiExp); |
| 1039 |
QString indiString = getIndividualNameFromBuildExpression(indiExp);; |
| 1040 |
|
| 1041 |
|
| 1042 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 1043 |
CSameIndividualsQuery *query = new CSameIndividualsQuery(mOntology,calcConfig, indiRef,indiString,queryName); |
| 1044 |
|
| 1045 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 1046 |
if (confBuildQueryStats) { |
| 1047 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 1048 |
} |
| 1049 |
query->setQueryStatistics(queryStats); |
| 1050 |
|
| 1051 |
queryList.append(query); |
| 1052 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated Same-Individuals-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1053 |
} |
| 1054 |
delete sameIndExp; |
| 1055 |
} |
| 1056 |
|
| 1057 |
|
| 1058 |
foreach (CQueryGetInstancesExpression* instancesExp, instancesExpList) { |
| 1059 |
QString queryName = instancesExp->getName(); |
| 1060 |
CClassTermExpression* classExp = instancesExp->getClassTermExpression(); |
| 1061 |
|
| 1062 |
if (classExp) { |
| 1063 |
CConcept* concept = getConceptFromBuildExpression(classExp); |
| 1064 |
|
| 1065 |
QString iriClassNameString = CIRIName::getRecentIRIName(concept->getClassNameLinker()); |
| 1066 |
QString classString = iriClassNameString; |
| 1067 |
|
| 1068 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 1069 |
CInstancesQuery *query = new CInstancesQuery(mOntology,calcConfig,concept,instancesExp->isDirect(),classString,queryName); |
| 1070 |
|
| 1071 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 1072 |
if (confBuildQueryStats) { |
| 1073 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 1074 |
} |
| 1075 |
query->setQueryStatistics(queryStats); |
| 1076 |
|
| 1077 |
queryList.append(query); |
| 1078 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated Instances-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1079 |
} |
| 1080 |
} |
| 1081 |
|
| 1082 |
|
| 1083 |
foreach (CQueryGetSubClassesExpression* subClassesExp, mSubClassesExpList) { |
| 1084 |
QString queryName = subClassesExp->getName(); |
| 1085 |
CClassTermExpression* classExp = subClassesExp->getClassTermExpression(); |
| 1086 |
|
| 1087 |
if (classExp) { |
| 1088 |
CConcept* concept = getConceptFromBuildExpression(classExp); |
| 1089 |
|
| 1090 |
if (concept) { |
| 1091 |
QString iriClassNameString = CIRIName::getRecentIRIName(concept->getClassNameLinker()); |
| 1092 |
QString classString = iriClassNameString; |
| 1093 |
|
| 1094 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 1095 |
CSubClassesQuery *query = new CSubClassesQuery(mOntology,calcConfig,concept,subClassesExp->isDirect(),classString,queryName); |
| 1096 |
|
| 1097 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 1098 |
if (confBuildQueryStats) { |
| 1099 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 1100 |
} |
| 1101 |
query->setQueryStatistics(queryStats); |
| 1102 |
|
| 1103 |
queryList.append(query); |
| 1104 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated GetSubClasses-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1105 |
} |
| 1106 |
} |
| 1107 |
delete subClassesExp; |
| 1108 |
} |
| 1109 |
|
| 1110 |
|
| 1111 |
|
| 1112 |
foreach (CQueryGetSuperClassesExpression* superClassesExp, mSuperClassesExpList) { |
| 1113 |
QString queryName = superClassesExp->getName(); |
| 1114 |
CClassTermExpression* classExp = superClassesExp->getClassTermExpression(); |
| 1115 |
|
| 1116 |
if (classExp) { |
| 1117 |
CConcept* concept = getConceptFromBuildExpression(classExp); |
| 1118 |
|
| 1119 |
if (concept) { |
| 1120 |
QString iriClassNameString = CIRIName::getRecentIRIName(concept->getClassNameLinker()); |
| 1121 |
QString classString = iriClassNameString; |
| 1122 |
|
| 1123 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 1124 |
CSuperClassesQuery *query = new CSuperClassesQuery(mOntology,calcConfig,concept,superClassesExp->isDirect(),classString,queryName); |
| 1125 |
|
| 1126 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 1127 |
if (confBuildQueryStats) { |
| 1128 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 1129 |
} |
| 1130 |
query->setQueryStatistics(queryStats); |
| 1131 |
|
| 1132 |
queryList.append(query); |
| 1133 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated GetSuperClasses-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1134 |
} |
| 1135 |
} |
| 1136 |
delete superClassesExp; |
| 1137 |
} |
| 1138 |
|
| 1139 |
|
| 1140 |
|
| 1141 |
foreach (CQueryGetEquivalentClassesExpression* equivClassesExp, mEquivClassesExpList) { |
| 1142 |
QString queryName = equivClassesExp->getName(); |
| 1143 |
CClassTermExpression* classExp = equivClassesExp->getClassTermExpression(); |
| 1144 |
|
| 1145 |
if (classExp) { |
| 1146 |
CConcept* concept = getConceptFromBuildExpression(classExp); |
| 1147 |
|
| 1148 |
if (concept) { |
| 1149 |
QString iriClassNameString = CIRIName::getRecentIRIName(concept->getClassNameLinker()); |
| 1150 |
QString classString = iriClassNameString; |
| 1151 |
|
| 1152 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 1153 |
CEquivalentClassesQuery *query = new CEquivalentClassesQuery(mOntology,calcConfig,concept,classString,queryName); |
| 1154 |
|
| 1155 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 1156 |
if (confBuildQueryStats) { |
| 1157 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 1158 |
} |
| 1159 |
query->setQueryStatistics(queryStats); |
| 1160 |
|
| 1161 |
queryList.append(query); |
| 1162 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated GetEquivalentClasses-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1163 |
} |
| 1164 |
} |
| 1165 |
delete equivClassesExp; |
| 1166 |
} |
| 1167 |
|
| 1168 |
|
| 1169 |
|
| 1170 |
|
| 1171 |
|
| 1172 |
|
| 1173 |
|
| 1174 |
|
| 1175 |
|
| 1176 |
|
| 1177 |
|
| 1178 |
|
| 1179 |
|
| 1180 |
foreach (CQueryGetSubObjectPropertiesExpression* subObjectPropertiesExp, mSubObjectPropertiesExpList) { |
| 1181 |
QString queryName = subObjectPropertiesExp->getName(); |
| 1182 |
CObjectPropertyTermExpression* objectPropertyExp = subObjectPropertiesExp->getObjectPropertyTermExpression(); |
| 1183 |
|
| 1184 |
if (objectPropertyExp) { |
| 1185 |
CRole* role = getRoleFromBuildExpression(objectPropertyExp); |
| 1186 |
|
| 1187 |
if (role) { |
| 1188 |
QString iriObjectPropertyNameString = CIRIName::getRecentIRIName(role->getPropertyNameLinker()); |
| 1189 |
QString objectPropertyString = iriObjectPropertyNameString; |
| 1190 |
|
| 1191 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 1192 |
CSubPropertiesQuery *query = new CSubPropertiesQuery(mOntology,calcConfig,subObjectPropertiesExp->isDirect(),role,objectPropertyString,false,queryName); |
| 1193 |
|
| 1194 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 1195 |
if (confBuildQueryStats) { |
| 1196 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 1197 |
} |
| 1198 |
query->setQueryStatistics(queryStats); |
| 1199 |
|
| 1200 |
queryList.append(query); |
| 1201 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated GetSubObjectProperties-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1202 |
} |
| 1203 |
} |
| 1204 |
delete subObjectPropertiesExp; |
| 1205 |
} |
| 1206 |
|
| 1207 |
|
| 1208 |
|
| 1209 |
foreach (CQueryGetSuperObjectPropertiesExpression* superObjectPropertiesExp, mSuperObjectPropertiesExpList) { |
| 1210 |
QString queryName = superObjectPropertiesExp->getName(); |
| 1211 |
CObjectPropertyTermExpression* objectPropertyExp = superObjectPropertiesExp->getObjectPropertyTermExpression(); |
| 1212 |
|
| 1213 |
if (objectPropertyExp) { |
| 1214 |
CRole* role = getRoleFromBuildExpression(objectPropertyExp); |
| 1215 |
|
| 1216 |
if (role) { |
| 1217 |
QString iriObjectPropertyNameString = CIRIName::getRecentIRIName(role->getPropertyNameLinker()); |
| 1218 |
QString objectPropertyString = iriObjectPropertyNameString; |
| 1219 |
|
| 1220 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 1221 |
CSuperPropertiesQuery *query = new CSuperPropertiesQuery(mOntology,calcConfig,superObjectPropertiesExp->isDirect(),role,objectPropertyString,false,queryName); |
| 1222 |
|
| 1223 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 1224 |
if (confBuildQueryStats) { |
| 1225 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 1226 |
} |
| 1227 |
query->setQueryStatistics(queryStats); |
| 1228 |
|
| 1229 |
queryList.append(query); |
| 1230 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated GetSuperObjectProperties-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1231 |
} |
| 1232 |
} |
| 1233 |
delete superObjectPropertiesExp; |
| 1234 |
} |
| 1235 |
|
| 1236 |
|
| 1237 |
|
| 1238 |
foreach (CQueryGetEquivalentObjectPropertiesExpression* equivObjectPropertiesExp, mEquivObjectPropertiesExpList) { |
| 1239 |
QString queryName = equivObjectPropertiesExp->getName(); |
| 1240 |
CObjectPropertyTermExpression* objectPropertyExp = equivObjectPropertiesExp->getObjectPropertyTermExpression(); |
| 1241 |
|
| 1242 |
if (objectPropertyExp) { |
| 1243 |
CRole* role = getRoleFromBuildExpression(objectPropertyExp); |
| 1244 |
|
| 1245 |
if (role) { |
| 1246 |
QString iriObjectPropertyNameString = CIRIName::getRecentIRIName(role->getPropertyNameLinker()); |
| 1247 |
QString objectPropertyString = iriObjectPropertyNameString; |
| 1248 |
|
| 1249 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 1250 |
CEquivalentPropertiesQuery *query = new CEquivalentPropertiesQuery(mOntology,calcConfig,role,objectPropertyString,false,queryName); |
| 1251 |
|
| 1252 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 1253 |
if (confBuildQueryStats) { |
| 1254 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 1255 |
} |
| 1256 |
query->setQueryStatistics(queryStats); |
| 1257 |
|
| 1258 |
queryList.append(query); |
| 1259 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated GetEquivalentObjectProperties-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1260 |
} |
| 1261 |
} |
| 1262 |
delete equivObjectPropertiesExp; |
| 1263 |
} |
| 1264 |
|
| 1265 |
|
| 1266 |
foreach (CQueryGetSubObjectPropertyHierarchyExpression* subObjectPropertyHierarchyExp, mSubObjectPropertyHierarchyExpList) { |
| 1267 |
QString queryName = subObjectPropertyHierarchyExp->getName(); |
| 1268 |
CObjectPropertyTermExpression* objectPropertyExp = subObjectPropertyHierarchyExp->getObjectPropertyTermExpression(); |
| 1269 |
|
| 1270 |
CRole* role = nullptr; |
| 1271 |
QString objectPropertyString; |
| 1272 |
if (objectPropertyExp) { |
| 1273 |
role = getRoleFromBuildExpression(objectPropertyExp); |
| 1274 |
objectPropertyString = CIRIName::getRecentIRIName(role->getPropertyNameLinker()); |
| 1275 |
} |
| 1276 |
|
| 1277 |
|
| 1278 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 1279 |
CSubPropertyHierarchyQuery *query = new CSubPropertyHierarchyQuery(mOntology,calcConfig,role,false,objectPropertyString,queryName); |
| 1280 |
|
| 1281 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 1282 |
if (confBuildQueryStats) { |
| 1283 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 1284 |
} |
| 1285 |
query->setQueryStatistics(queryStats); |
| 1286 |
|
| 1287 |
queryList.append(query); |
| 1288 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated GetSubObjectPropertyHierarchy-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1289 |
delete subObjectPropertyHierarchyExp; |
| 1290 |
} |
| 1291 |
|
| 1292 |
|
| 1293 |
|
| 1294 |
foreach (CQueryIsObjectPropertySatisfiableExpression* objectPropertySatExp, mObjectPropertySatExpList) { |
| 1295 |
QString queryName = objectPropertySatExp->getName(); |
| 1296 |
CObjectPropertyTermExpression* objectPropertyExp = objectPropertySatExp->getObjectPropertyTermExpression(); |
| 1297 |
|
| 1298 |
if (objectPropertyExp) { |
| 1299 |
CRole* role = getRoleFromBuildExpression(objectPropertyExp); |
| 1300 |
|
| 1301 |
if (role) { |
| 1302 |
QString iriObjectPropertyNameString = CIRIName::getRecentIRIName(role->getPropertyNameLinker()); |
| 1303 |
QString objectPropertyString = iriObjectPropertyNameString; |
| 1304 |
|
| 1305 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 1306 |
CIsPropertySatisfiableQuery *query = new CIsPropertySatisfiableQuery(mOntology,calcConfig,role,objectPropertyString,false,queryName); |
| 1307 |
|
| 1308 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 1309 |
if (confBuildQueryStats) { |
| 1310 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 1311 |
} |
| 1312 |
query->setQueryStatistics(queryStats); |
| 1313 |
|
| 1314 |
queryList.append(query); |
| 1315 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated IsPropertySatisfiableQuery-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1316 |
} |
| 1317 |
} |
| 1318 |
delete objectPropertySatExp; |
| 1319 |
} |
| 1320 |
|
| 1321 |
|
| 1322 |
|
| 1323 |
|
| 1324 |
|
| 1325 |
|
| 1326 |
|
| 1327 |
foreach (CQueryGetSubDataPropertiesExpression* subDataPropertiesExp, mSubDataPropertiesExpList) { |
| 1328 |
QString queryName = subDataPropertiesExp->getName(); |
| 1329 |
CDataPropertyTermExpression* dataPropertyExp = subDataPropertiesExp->getDataPropertyTermExpression(); |
| 1330 |
|
| 1331 |
if (dataPropertyExp) { |
| 1332 |
CRole* role = getRoleFromBuildExpression(dataPropertyExp); |
| 1333 |
|
| 1334 |
if (role) { |
| 1335 |
QString iriDataPropertyNameString = CIRIName::getRecentIRIName(role->getPropertyNameLinker()); |
| 1336 |
QString dataPropertyString = iriDataPropertyNameString; |
| 1337 |
|
| 1338 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 1339 |
CSubPropertiesQuery *query = new CSubPropertiesQuery(mOntology,calcConfig,subDataPropertiesExp->isDirect(),role,dataPropertyString,true,queryName); |
| 1340 |
|
| 1341 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 1342 |
if (confBuildQueryStats) { |
| 1343 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 1344 |
} |
| 1345 |
query->setQueryStatistics(queryStats); |
| 1346 |
|
| 1347 |
queryList.append(query); |
| 1348 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated GetSubDataProperties-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1349 |
} |
| 1350 |
} |
| 1351 |
delete subDataPropertiesExp; |
| 1352 |
} |
| 1353 |
|
| 1354 |
|
| 1355 |
|
| 1356 |
foreach (CQueryGetSuperDataPropertiesExpression* superDataPropertiesExp, mSuperDataPropertiesExpList) { |
| 1357 |
QString queryName = superDataPropertiesExp->getName(); |
| 1358 |
CDataPropertyTermExpression* dataPropertyExp = superDataPropertiesExp->getDataPropertyTermExpression(); |
| 1359 |
|
| 1360 |
if (dataPropertyExp) { |
| 1361 |
CRole* role = getRoleFromBuildExpression(dataPropertyExp); |
| 1362 |
|
| 1363 |
if (role) { |
| 1364 |
QString iriDataPropertyNameString = CIRIName::getRecentIRIName(role->getPropertyNameLinker()); |
| 1365 |
QString dataPropertyString = iriDataPropertyNameString; |
| 1366 |
|
| 1367 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 1368 |
CSuperPropertiesQuery *query = new CSuperPropertiesQuery(mOntology,calcConfig,superDataPropertiesExp->isDirect(),role,dataPropertyString,true,queryName); |
| 1369 |
|
| 1370 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 1371 |
if (confBuildQueryStats) { |
| 1372 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 1373 |
} |
| 1374 |
query->setQueryStatistics(queryStats); |
| 1375 |
|
| 1376 |
queryList.append(query); |
| 1377 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated GetSuperDataProperties-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1378 |
} |
| 1379 |
} |
| 1380 |
delete superDataPropertiesExp; |
| 1381 |
} |
| 1382 |
|
| 1383 |
|
| 1384 |
|
| 1385 |
foreach (CQueryGetEquivalentDataPropertiesExpression* equivDataPropertiesExp, mEquivDataPropertiesExpList) { |
| 1386 |
QString queryName = equivDataPropertiesExp->getName(); |
| 1387 |
CDataPropertyTermExpression* dataPropertyExp = equivDataPropertiesExp->getDataPropertyTermExpression(); |
| 1388 |
|
| 1389 |
if (dataPropertyExp) { |
| 1390 |
CRole* role = getRoleFromBuildExpression(dataPropertyExp); |
| 1391 |
|
| 1392 |
if (role) { |
| 1393 |
QString iriDataPropertyNameString = CIRIName::getRecentIRIName(role->getPropertyNameLinker()); |
| 1394 |
QString dataPropertyString = iriDataPropertyNameString; |
| 1395 |
|
| 1396 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 1397 |
CEquivalentPropertiesQuery *query = new CEquivalentPropertiesQuery(mOntology,calcConfig,role,dataPropertyString,true,queryName); |
| 1398 |
|
| 1399 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 1400 |
if (confBuildQueryStats) { |
| 1401 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 1402 |
} |
| 1403 |
query->setQueryStatistics(queryStats); |
| 1404 |
|
| 1405 |
queryList.append(query); |
| 1406 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated GetEquivalentDataProperties-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1407 |
} |
| 1408 |
} |
| 1409 |
delete equivDataPropertiesExp; |
| 1410 |
} |
| 1411 |
|
| 1412 |
foreach (CQueryGetSubDataPropertyHierarchyExpression* subDataPropertyHierarchyExp, mSubDataPropertyHierarchyExpList) { |
| 1413 |
QString queryName = subDataPropertyHierarchyExp->getName(); |
| 1414 |
CDataPropertyTermExpression* dataPropertyExp = subDataPropertyHierarchyExp->getDataPropertyTermExpression(); |
| 1415 |
|
| 1416 |
CRole* role = nullptr; |
| 1417 |
if (dataPropertyExp) { |
| 1418 |
role = getRoleFromBuildExpression(dataPropertyExp); |
| 1419 |
} |
| 1420 |
|
| 1421 |
QString dataPropertyString; |
| 1422 |
if (role && role->getPropertyNameLinker()) { |
| 1423 |
dataPropertyString = CIRIName::getRecentIRIName(role->getPropertyNameLinker()); |
| 1424 |
} |
| 1425 |
|
| 1426 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 1427 |
CSubPropertyHierarchyQuery *query = new CSubPropertyHierarchyQuery(mOntology,calcConfig,role,true,dataPropertyString,queryName); |
| 1428 |
|
| 1429 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 1430 |
if (confBuildQueryStats) { |
| 1431 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 1432 |
} |
| 1433 |
query->setQueryStatistics(queryStats); |
| 1434 |
|
| 1435 |
queryList.append(query); |
| 1436 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated GetSubDataPropertyHierarchy-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1437 |
delete subDataPropertyHierarchyExp; |
| 1438 |
} |
| 1439 |
|
| 1440 |
|
| 1441 |
|
| 1442 |
foreach (CQueryIsDataPropertySatisfiableExpression* dataPropertySatExp, mDataPropertySatExpList) { |
| 1443 |
QString queryName = dataPropertySatExp->getName(); |
| 1444 |
CDataPropertyTermExpression* dataPropertyExp = dataPropertySatExp->getDataPropertyTermExpression(); |
| 1445 |
|
| 1446 |
if (dataPropertyExp) { |
| 1447 |
CRole* role = getRoleFromBuildExpression(dataPropertyExp); |
| 1448 |
|
| 1449 |
if (role) { |
| 1450 |
QString iriDataPropertyNameString = CIRIName::getRecentIRIName(role->getPropertyNameLinker()); |
| 1451 |
QString dataPropertyString = iriDataPropertyNameString; |
| 1452 |
|
| 1453 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 1454 |
CIsPropertySatisfiableQuery *query = new CIsPropertySatisfiableQuery(mOntology,calcConfig,role,dataPropertyString,false,queryName); |
| 1455 |
|
| 1456 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 1457 |
if (confBuildQueryStats) { |
| 1458 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 1459 |
} |
| 1460 |
query->setQueryStatistics(queryStats); |
| 1461 |
|
| 1462 |
queryList.append(query); |
| 1463 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated IsPropertySatisfiableQuery-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1464 |
} |
| 1465 |
} |
| 1466 |
delete dataPropertySatExp; |
| 1467 |
} |
| 1468 |
|
| 1469 |
|
| 1470 |
|
| 1471 |
|
| 1472 |
|
| 1473 |
|
| 1474 |
|
| 1475 |
|
| 1476 |
|
| 1477 |
|
| 1478 |
|
| 1479 |
|
| 1480 |
|
| 1481 |
|
| 1482 |
foreach (CQueryGetObjectPropertiesOfTargetExpression* objPropTargetsExp, mObjectPropsOfTargetExpList) { |
| 1483 |
QString queryName = objPropTargetsExp->getName(); |
| 1484 |
CIndividualTermExpression* indiTermExp = objPropTargetsExp->getIndividualTermExpression(); |
| 1485 |
|
| 1486 |
if (indiTermExp) { |
| 1487 |
CIndividualReference individualReference = getIndividualReferenceFromBuildExpression(indiTermExp); |
| 1488 |
QString indiNameString = getIndividualNameFromBuildExpression(indiTermExp); |
| 1489 |
|
| 1490 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 1491 |
CTargetPropertiesQuery *query = new CTargetPropertiesQuery(mOntology,calcConfig, individualReference,indiNameString,queryName); |
| 1492 |
|
| 1493 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 1494 |
if (confBuildQueryStats) { |
| 1495 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 1496 |
} |
| 1497 |
query->setQueryStatistics(queryStats); |
| 1498 |
|
| 1499 |
queryList.append(query); |
| 1500 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated TargetObjectProperties-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1501 |
} |
| 1502 |
} |
| 1503 |
|
| 1504 |
|
| 1505 |
|
| 1506 |
foreach (CQueryGetObjectPropertiesOfSourceExpression* objPropSourcesExp, mObjectPropsOfSourceExpList) { |
| 1507 |
QString queryName = objPropSourcesExp->getName(); |
| 1508 |
CIndividualTermExpression* indiTermExp = objPropSourcesExp->getIndividualTermExpression(); |
| 1509 |
|
| 1510 |
if (indiTermExp) { |
| 1511 |
CIndividualReference individualReference = getIndividualReferenceFromBuildExpression(indiTermExp); |
| 1512 |
QString indiNameString = getIndividualNameFromBuildExpression(indiTermExp); |
| 1513 |
|
| 1514 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 1515 |
CSourcePropertiesQuery *query = new CSourcePropertiesQuery(mOntology,calcConfig, individualReference,indiNameString,queryName); |
| 1516 |
|
| 1517 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 1518 |
if (confBuildQueryStats) { |
| 1519 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 1520 |
} |
| 1521 |
query->setQueryStatistics(queryStats); |
| 1522 |
|
| 1523 |
queryList.append(query); |
| 1524 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated SourceObjectProperties-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1525 |
} |
| 1526 |
} |
| 1527 |
|
| 1528 |
|
| 1529 |
|
| 1530 |
foreach (CQueryGetObjectPropertiesBetweenExpression* objPropBetweenExp, mObjectPropsBetweenExpList) { |
| 1531 |
QString queryName = objPropBetweenExp->getName(); |
| 1532 |
CIndividualTermExpression* sourceIndiTermExp = objPropBetweenExp->getSourceIndividualTermExpression(); |
| 1533 |
CIndividualTermExpression* targetIndiTermExp = objPropBetweenExp->getTargetIndividualTermExpression(); |
| 1534 |
|
| 1535 |
if (sourceIndiTermExp && targetIndiTermExp) { |
| 1536 |
|
| 1537 |
CIndividualReference sourceIndividualReference = getIndividualReferenceFromBuildExpression(sourceIndiTermExp); |
| 1538 |
QString sourceIndiNameString = getIndividualNameFromBuildExpression(sourceIndiTermExp); |
| 1539 |
|
| 1540 |
CIndividualReference targetIndividualReference = getIndividualReferenceFromBuildExpression(targetIndiTermExp); |
| 1541 |
QString targetIndiNameString = getIndividualNameFromBuildExpression(targetIndiTermExp); |
| 1542 |
|
| 1543 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 1544 |
CBetweenPropertiesQuery *query = new CBetweenPropertiesQuery(mOntology,calcConfig, sourceIndividualReference,sourceIndiNameString, targetIndividualReference,targetIndiNameString,queryName); |
| 1545 |
|
| 1546 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 1547 |
if (confBuildQueryStats) { |
| 1548 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 1549 |
} |
| 1550 |
query->setQueryStatistics(queryStats); |
| 1551 |
|
| 1552 |
queryList.append(query); |
| 1553 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated BetweenObjectProperties-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1554 |
} |
| 1555 |
} |
| 1556 |
|
| 1557 |
|
| 1558 |
|
| 1559 |
|
| 1560 |
|
| 1561 |
|
| 1562 |
|
| 1563 |
|
| 1564 |
|
| 1565 |
|
| 1566 |
|
| 1567 |
|
| 1568 |
|
| 1569 |
|
| 1570 |
|
| 1571 |
|
| 1572 |
|
| 1573 |
|
| 1574 |
|
| 1575 |
|
| 1576 |
foreach (CQueryGetObjectPropertyTargetsExpression* objPropTargetsExp, mObjectPropTargetsExpList) { |
| 1577 |
QString queryName = objPropTargetsExp->getName(); |
| 1578 |
CObjectPropertyTermExpression* objPropTermExp = objPropTargetsExp->getObjectPropertyTermExpression(); |
| 1579 |
CIndividualTermExpression* indiTermExp = objPropTargetsExp->getIndividualTermExpression(); |
| 1580 |
|
| 1581 |
if (objPropTermExp && indiTermExp) { |
| 1582 |
CRole* role = getRoleFromBuildExpression(objPropTermExp); |
| 1583 |
CIndividualReference individualReference = getIndividualReferenceFromBuildExpression(indiTermExp); |
| 1584 |
QString individualName = getIndividualNameFromBuildExpression(indiTermExp); |
| 1585 |
|
| 1586 |
|
| 1587 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 1588 |
CObjectPropertyTargetsQuery *query = new CObjectPropertyTargetsQuery(mOntology,calcConfig, individualReference, individualName,role,queryName); |
| 1589 |
|
| 1590 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 1591 |
if (confBuildQueryStats) { |
| 1592 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 1593 |
} |
| 1594 |
query->setQueryStatistics(queryStats); |
| 1595 |
|
| 1596 |
queryList.append(query); |
| 1597 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated ObjectPropertyTargets-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1598 |
} |
| 1599 |
} |
| 1600 |
|
| 1601 |
foreach (CQueryGetFlattenedObjectPropertyTargetsExpression* objPropTargetsExp, mObjectFlattenedPropTargetsExpList) { |
| 1602 |
QString queryName = objPropTargetsExp->getName(); |
| 1603 |
CObjectPropertyTermExpression* objPropTermExp = objPropTargetsExp->getObjectPropertyTermExpression(); |
| 1604 |
CIndividualTermExpression* indiTermExp = objPropTargetsExp->getIndividualTermExpression(); |
| 1605 |
|
| 1606 |
if (objPropTermExp && indiTermExp) { |
| 1607 |
CRole* role = getRoleFromBuildExpression(objPropTermExp); |
| 1608 |
|
| 1609 |
CIndividualReference individualReference = getIndividualReferenceFromBuildExpression(indiTermExp); |
| 1610 |
QString individualName = getIndividualNameFromBuildExpression(indiTermExp); |
| 1611 |
|
| 1612 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 1613 |
CFlattenedObjectPropertyTargetsQuery *query = new CFlattenedObjectPropertyTargetsQuery(mOntology,calcConfig, individualReference, individualName,role,queryName); |
| 1614 |
|
| 1615 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 1616 |
if (confBuildQueryStats) { |
| 1617 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 1618 |
} |
| 1619 |
query->setQueryStatistics(queryStats); |
| 1620 |
|
| 1621 |
queryList.append(query); |
| 1622 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated FlattenedObjectPropertyTargets-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1623 |
} |
| 1624 |
} |
| 1625 |
|
| 1626 |
|
| 1627 |
|
| 1628 |
|
| 1629 |
|
| 1630 |
foreach (CQueryGetObjectPropertySourcesExpression* objPropSourcesExp, mObjectPropSourcesExpList) { |
| 1631 |
QString queryName = objPropSourcesExp->getName(); |
| 1632 |
CObjectPropertyTermExpression* objPropTermExp = objPropSourcesExp->getObjectPropertyTermExpression(); |
| 1633 |
CIndividualTermExpression* indiTermExp = objPropSourcesExp->getIndividualTermExpression(); |
| 1634 |
|
| 1635 |
if (objPropTermExp && indiTermExp) { |
| 1636 |
CRole* role = getRoleFromBuildExpression(objPropTermExp); |
| 1637 |
CIndividualReference individualReference = getIndividualReferenceFromBuildExpression(indiTermExp); |
| 1638 |
QString individualName = getIndividualNameFromBuildExpression(indiTermExp); |
| 1639 |
|
| 1640 |
|
| 1641 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 1642 |
CObjectPropertySourcesQuery *query = new CObjectPropertySourcesQuery(mOntology,calcConfig, individualReference, individualName, role,queryName); |
| 1643 |
|
| 1644 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 1645 |
if (confBuildQueryStats) { |
| 1646 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 1647 |
} |
| 1648 |
query->setQueryStatistics(queryStats); |
| 1649 |
|
| 1650 |
queryList.append(query); |
| 1651 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated ObjectPropertySources-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1652 |
} |
| 1653 |
} |
| 1654 |
|
| 1655 |
foreach (CQueryGetFlattenedObjectPropertySourcesExpression* objPropSourcesExp, mObjectFlattenedPropSourcesExpList) { |
| 1656 |
QString queryName = objPropSourcesExp->getName(); |
| 1657 |
CObjectPropertyTermExpression* objPropTermExp = objPropSourcesExp->getObjectPropertyTermExpression(); |
| 1658 |
CIndividualTermExpression* indiTermExp = objPropSourcesExp->getIndividualTermExpression(); |
| 1659 |
|
| 1660 |
if (objPropTermExp && indiTermExp) { |
| 1661 |
CRole* role = getRoleFromBuildExpression(objPropTermExp); |
| 1662 |
CIndividualReference individualReference = getIndividualReferenceFromBuildExpression(indiTermExp); |
| 1663 |
QString individualName = getIndividualNameFromBuildExpression(indiTermExp); |
| 1664 |
|
| 1665 |
|
| 1666 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 1667 |
CFlattenedObjectPropertySourcesQuery *query = new CFlattenedObjectPropertySourcesQuery(mOntology,calcConfig, individualReference, individualName,role,queryName); |
| 1668 |
|
| 1669 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 1670 |
if (confBuildQueryStats) { |
| 1671 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 1672 |
} |
| 1673 |
query->setQueryStatistics(queryStats); |
| 1674 |
|
| 1675 |
queryList.append(query); |
| 1676 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated FlattenedObjectPropertySources-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1677 |
} |
| 1678 |
} |
| 1679 |
|
| 1680 |
|
| 1681 |
|
| 1682 |
foreach (CQueryGetDeterministicIndividualsExpression* indiQueryExp, mDetIndisExpList) { |
| 1683 |
QString queryName = indiQueryExp->getName(); |
| 1684 |
CEXPRESSIONLIST<CIndividualTermExpression*>* indiExpList = indiQueryExp->getIndividualTermExpressionList(); |
| 1685 |
|
| 1686 |
if (indiExpList) { |
| 1687 |
QSet<CIndividual*> individualSet; |
| 1688 |
for (CEXPRESSIONLIST<CIndividualTermExpression*>::const_iterator it = indiExpList->constBegin(), itEnd = indiExpList->constEnd(); it != itEnd; ++it) { |
| 1689 |
CIndividualTermExpression* indiTermExp(*it); |
| 1690 |
CIndividual* individual = getIndividualFromBuildExpression(indiTermExp); |
| 1691 |
individualSet.insert(individual); |
| 1692 |
} |
| 1693 |
|
| 1694 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 1695 |
CDeterministicIndividualsQuery *query = new CDeterministicIndividualsQuery(mOntology,calcConfig,individualSet,queryName); |
| 1696 |
|
| 1697 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 1698 |
if (confBuildQueryStats) { |
| 1699 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 1700 |
} |
| 1701 |
query->setQueryStatistics(queryStats); |
| 1702 |
|
| 1703 |
queryList.append(query); |
| 1704 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated DeterministicIndividuals-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1705 |
} |
| 1706 |
} |
| 1707 |
|
| 1708 |
|
| 1709 |
|
| 1710 |
|
| 1711 |
foreach (CQueryGetNondeterministicIndividualsExpression* indiQueryExp, mNdetIndisExpList) { |
| 1712 |
QString queryName = indiQueryExp->getName(); |
| 1713 |
CEXPRESSIONLIST<CIndividualTermExpression*>* indiExpList = indiQueryExp->getIndividualTermExpressionList(); |
| 1714 |
|
| 1715 |
if (indiExpList) { |
| 1716 |
QSet<CIndividual*> individualSet; |
| 1717 |
for (CEXPRESSIONLIST<CIndividualTermExpression*>::const_iterator it = indiExpList->constBegin(), itEnd = indiExpList->constEnd(); it != itEnd; ++it) { |
| 1718 |
CIndividualTermExpression* indiTermExp(*it); |
| 1719 |
CIndividual* individual = getIndividualFromBuildExpression(indiTermExp); |
| 1720 |
individualSet.insert(individual); |
| 1721 |
} |
| 1722 |
|
| 1723 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 1724 |
CNondeterministicIndividualsQuery *query = new CNondeterministicIndividualsQuery(mOntology,calcConfig,individualSet,queryName); |
| 1725 |
|
| 1726 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 1727 |
if (confBuildQueryStats) { |
| 1728 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 1729 |
} |
| 1730 |
query->setQueryStatistics(queryStats); |
| 1731 |
|
| 1732 |
queryList.append(query); |
| 1733 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated NondeterministicIndividuals-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1734 |
} |
| 1735 |
} |
| 1736 |
|
| 1737 |
|
| 1738 |
|
| 1739 |
|
| 1740 |
foreach (CQueryGetDeterministicClassAssertionsExpression* indiQueryExp, mDetClassAssExpList) { |
| 1741 |
QString queryName = indiQueryExp->getName(); |
| 1742 |
CEXPRESSIONLIST<CIndividualTermExpression*>* indiExpList = indiQueryExp->getIndividualTermExpressionList(); |
| 1743 |
|
| 1744 |
if (indiExpList) { |
| 1745 |
QSet<CIndividual*> individualSet; |
| 1746 |
for (CEXPRESSIONLIST<CIndividualTermExpression*>::const_iterator it = indiExpList->constBegin(), itEnd = indiExpList->constEnd(); it != itEnd; ++it) { |
| 1747 |
CIndividualTermExpression* indiTermExp(*it); |
| 1748 |
CIndividual* individual = getIndividualFromBuildExpression(indiTermExp); |
| 1749 |
individualSet.insert(individual); |
| 1750 |
} |
| 1751 |
|
| 1752 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 1753 |
CDeterministicClassAssertionQuery *query = new CDeterministicClassAssertionQuery(mOntology,calcConfig,individualSet,queryName); |
| 1754 |
|
| 1755 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 1756 |
if (confBuildQueryStats) { |
| 1757 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 1758 |
} |
| 1759 |
query->setQueryStatistics(queryStats); |
| 1760 |
|
| 1761 |
queryList.append(query); |
| 1762 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated DeterministicClassAssertions-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1763 |
} |
| 1764 |
} |
| 1765 |
|
| 1766 |
|
| 1767 |
|
| 1768 |
|
| 1769 |
foreach (CQueryGetNondeterministicClassAssertionsExpression* indiQueryExp, mNdetClassAssExpList) { |
| 1770 |
QString queryName = indiQueryExp->getName(); |
| 1771 |
CEXPRESSIONLIST<CIndividualTermExpression*>* indiExpList = indiQueryExp->getIndividualTermExpressionList(); |
| 1772 |
|
| 1773 |
if (indiExpList) { |
| 1774 |
QSet<CIndividual*> individualSet; |
| 1775 |
for (CEXPRESSIONLIST<CIndividualTermExpression*>::const_iterator it = indiExpList->constBegin(), itEnd = indiExpList->constEnd(); it != itEnd; ++it) { |
| 1776 |
CIndividualTermExpression* indiTermExp(*it); |
| 1777 |
CIndividual* individual = getIndividualFromBuildExpression(indiTermExp); |
| 1778 |
individualSet.insert(individual); |
| 1779 |
} |
| 1780 |
|
| 1781 |
CCalculationConfigurationExtension *calcConfig = new CCalculationConfigurationExtension(config,0); |
| 1782 |
CNondeterministicClassAssertionQuery *query = new CNondeterministicClassAssertionQuery(mOntology,calcConfig,individualSet,queryName); |
| 1783 |
|
| 1784 |
CQueryStatisticsCollectionStrings* queryStats = nullptr; |
| 1785 |
if (confBuildQueryStats) { |
| 1786 |
queryStats = new CQueryStatisticsCollectionStrings(); |
| 1787 |
} |
| 1788 |
query->setQueryStatistics(queryStats); |
| 1789 |
|
| 1790 |
queryList.append(query); |
| 1791 |
LOG(NOTICE,"::Konclude::Reasoner::Generator::ConcreteOntologyQueryBuilder",logTr("Generated NondeterministicClassAssertions-Query '%1' with question '%2'.").arg(query->getQueryName()).arg(query->getQueryString()),this); |
| 1792 |
} |
| 1793 |
} |
| 1794 |
|
| 1795 |
|
| 1796 |
delete satCalcJobGenerator; |
| 1797 |
|
| 1798 |
|
| 1799 |
return queryList; |
| 1800 |
} |
| 1801 |
|
| 1802 |
|
| 1803 |
|
| 1804 |
}; // end namespace Generator |
| 1805 |
|
| 1806 |
}; // end namespace Reasoner |
| 1807 |
|
| 1808 |
}; // end namespace Konclude |