| 1 | /* This file is part of the FaCT++ DL reasoner |
| 2 | Copyright (C) 2006-2015 Dmitry Tsarkov and The University of Manchester |
| 3 | Copyright (C) 2015-2017 Dmitry Tsarkov |
| 4 | |
| 5 | This library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2.1 of the License, or (at your option) any later version. |
| 9 | |
| 10 | This library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with this library; if not, write to the Free Software |
| 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | // this file contains implementation of DL query-related methods of FaCT++ JNI interface |
| 21 | |
| 22 | #include "uk_ac_manchester_cs_factplusplus_FaCTPlusPlus.h" |
| 23 | #include "Kernel.h" |
| 24 | #include "tJNICache.h" |
| 25 | #include "JNIActor.h" |
| 26 | #include "eFPPTimeout.h" |
| 27 | #include "MemoryStat.h" |
| 28 | |
| 29 | #ifdef __cplusplus |
| 30 | extern "C" { |
| 31 | #endif |
| 32 | |
| 33 | //------------------------------------------------------------- |
| 34 | // minimal query language (ASK languages) |
| 35 | //------------------------------------------------------------- |
| 36 | |
| 37 | #define ASK_START do { try { |
| 38 | #define ASK_END } \ |
| 39 | catch ( const EFPPInconsistentKB& ) \ |
| 40 | { ThrowICO(env); } \ |
| 41 | catch ( const EFPPNonSimpleRole& nsr ) \ |
| 42 | { ThrowNSR ( env, nsr.getRoleName() ); } \ |
| 43 | catch ( const EFPPCycleInRIA& cir ) \ |
| 44 | { ThrowRIC ( env, cir.getRoleName() ); } \ |
| 45 | catch ( const EFPPTimeout& ) \ |
| 46 | { ThrowTO(env); } \ |
| 47 | catch ( const EFaCTPlusPlus& fpp ) \ |
| 48 | { Throw ( env, fpp.what() ); } \ |
| 49 | catch ( const std::exception& ex ) \ |
| 50 | { Throw ( env, ex.what() ); } } while (false) |
| 51 | |
| 52 | #define PROCESS_QUERY(Action) ASK_START Action; ASK_END |
| 53 | #define PROCESS_SIMPLE_QUERY(Action) ASK_START TJNICache* J = getJ(env,obj); Action; ASK_END |
| 54 | /* |
| 55 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 56 | * Method: isKBConsistent |
| 57 | * Signature: ()Z |
| 58 | */ |
| 59 | JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_isKBConsistent |
| 60 | (JNIEnv * env, jobject obj) |
| 61 | { |
| 62 | MemoryStatistics MS("Consistency Checking"); |
| 63 | TRACE_JNI("isKBConsistent"); |
| 64 | bool ret = false; |
| 65 | PROCESS_QUERY ( ret=getK(env,obj)->isKBConsistent() ); |
| 66 | return ret; |
| 67 | } |
| 68 | |
| 69 | /* |
| 70 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 71 | * Method: classify |
| 72 | * Signature: ()V |
| 73 | */ |
| 74 | JNIEXPORT void JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_classify |
| 75 | (JNIEnv * env, jobject obj) |
| 76 | { |
| 77 | MemoryStatistics MS("Classification"); |
| 78 | TRACE_JNI("classify"); |
| 79 | PROCESS_QUERY ( getK(env,obj)->classifyKB() ); |
| 80 | } |
| 81 | |
| 82 | /* |
| 83 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 84 | * Method: realise |
| 85 | * Signature: ()V |
| 86 | */ |
| 87 | JNIEXPORT void JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_realise |
| 88 | (JNIEnv * env, jobject obj) |
| 89 | { |
| 90 | MemoryStatistics MS("Realization"); |
| 91 | TRACE_JNI("realise"); |
| 92 | PROCESS_QUERY ( getK(env,obj)->realiseKB() ); |
| 93 | } |
| 94 | |
| 95 | /* |
| 96 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 97 | * Method: isRealised |
| 98 | * Signature: ()Z |
| 99 | */ |
| 100 | JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_isRealised |
| 101 | (JNIEnv * env, jobject obj) |
| 102 | { |
| 103 | TRACE_JNI("isRealised"); |
| 104 | return getK(env,obj)->isKBRealised(); |
| 105 | } |
| 106 | |
| 107 | |
| 108 | /* |
| 109 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 110 | * Method: isClassSatisfiable |
| 111 | * Signature: (Luk/ac/manchester/cs/factplusplus/ClassPointer;)Z |
| 112 | */ |
| 113 | JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_isClassSatisfiable |
| 114 | (JNIEnv * env, jobject obj, jobject arg) |
| 115 | { |
| 116 | MemoryStatistics MS("isClassSatisfiable"); |
| 117 | TRACE_JNI("isClassSatisfiable"); |
| 118 | TRACE_ARG(env,obj,arg); |
| 119 | bool ret = false; |
| 120 | PROCESS_SIMPLE_QUERY ( ret=J->K->isSatisfiable(getROConceptExpr(env,arg)) ); |
| 121 | return ret; |
| 122 | } |
| 123 | |
| 124 | /* |
| 125 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 126 | * Method: isClassSubsumedBy |
| 127 | * Signature: (Luk/ac/manchester/cs/factplusplus/ClassPointer;Luk/ac/manchester/cs/factplusplus/ClassPointer;)Z |
| 128 | */ |
| 129 | JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_isClassSubsumedBy |
| 130 | (JNIEnv * env, jobject obj, jobject arg1, jobject arg2) |
| 131 | { |
| 132 | MemoryStatistics MS("isClassSubsumedBy"); |
| 133 | TRACE_JNI("isClassSubsumedBy"); |
| 134 | TRACE_ARG(env,obj,arg1); |
| 135 | TRACE_ARG(env,obj,arg2); |
| 136 | bool ret = false; |
| 137 | PROCESS_SIMPLE_QUERY ( ret=J->K->isSubsumedBy ( getROConceptExpr(env,arg1), getROConceptExpr(env,arg2) ) ); |
| 138 | return ret; |
| 139 | } |
| 140 | |
| 141 | /* |
| 142 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 143 | * Method: isClassEquivalentTo |
| 144 | * Signature: (Luk/ac/manchester/cs/factplusplus/ClassPointer;Luk/ac/manchester/cs/factplusplus/ClassPointer;)Z |
| 145 | */ |
| 146 | JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_isClassEquivalentTo |
| 147 | (JNIEnv * env, jobject obj, jobject arg1, jobject arg2) |
| 148 | { |
| 149 | TRACE_JNI("isClassEquivalentTo"); |
| 150 | TRACE_ARG(env,obj,arg1); |
| 151 | TRACE_ARG(env,obj,arg2); |
| 152 | bool ret = false; |
| 153 | PROCESS_SIMPLE_QUERY ( ret=J->K->isEquivalent ( getROConceptExpr(env,arg1), getROConceptExpr(env,arg2) ) ); |
| 154 | return ret; |
| 155 | } |
| 156 | |
| 157 | /* |
| 158 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 159 | * Method: isClassDisjointWith |
| 160 | * Signature: (Luk/ac/manchester/cs/factplusplus/ClassPointer;Luk/ac/manchester/cs/factplusplus/ClassPointer;)Z |
| 161 | */ |
| 162 | JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_isClassDisjointWith |
| 163 | (JNIEnv * env, jobject obj, jobject arg1, jobject arg2) |
| 164 | { |
| 165 | TRACE_JNI("isClassDisjointWith"); |
| 166 | TRACE_ARG(env,obj,arg1); |
| 167 | TRACE_ARG(env,obj,arg2); |
| 168 | bool ret = false; |
| 169 | PROCESS_SIMPLE_QUERY ( ret=J->K->isDisjoint ( getROConceptExpr(env,arg1), getROConceptExpr(env,arg2) ) ); |
| 170 | return ret; |
| 171 | } |
| 172 | |
| 173 | /* |
| 174 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 175 | * Method: askSubClasses |
| 176 | * Signature: (Luk/ac/manchester/cs/factplusplus/ClassPointer;Z)[[Luk/ac/manchester/cs/factplusplus/ClassPointer; |
| 177 | */ |
| 178 | JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askSubClasses |
| 179 | (JNIEnv * env, jobject obj, jobject arg, jboolean direct) |
| 180 | { |
| 181 | MemoryStatistics MS("getSubClasses"); |
| 182 | TRACE_JNI("askSubClasses"); |
| 183 | TRACE_ARG(env,obj,arg); |
| 184 | TJNICache* J = getJ(env,obj); |
| 185 | JTaxonomyActor<ClassPolicy> actor(J); |
| 186 | const TConceptExpr* p = getROConceptExpr(env,arg); |
| 187 | PROCESS_QUERY ( J->K->getSubConcepts(p,direct,actor) ); |
| 188 | return actor.getElements(); |
| 189 | } |
| 190 | |
| 191 | /* |
| 192 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 193 | * Method: askSuperClasses |
| 194 | * Signature: (Luk/ac/manchester/cs/factplusplus/ClassPointer;Z)[[Luk/ac/manchester/cs/factplusplus/ClassPointer; |
| 195 | */ |
| 196 | JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askSuperClasses |
| 197 | (JNIEnv * env, jobject obj, jobject arg, jboolean direct) |
| 198 | { |
| 199 | MemoryStatistics MS("getSuperClasses"); |
| 200 | TRACE_JNI("askSuperClasses"); |
| 201 | TRACE_ARG(env,obj,arg); |
| 202 | TJNICache* J = getJ(env,obj); |
| 203 | JTaxonomyActor<ClassPolicy> actor(J); |
| 204 | const TConceptExpr* p = getROConceptExpr(env,arg); |
| 205 | PROCESS_QUERY ( J->K->getSupConcepts(p,direct,actor) ); |
| 206 | return actor.getElements(); |
| 207 | } |
| 208 | |
| 209 | /* |
| 210 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 211 | * Method: askEquivalentClasses |
| 212 | * Signature: (Luk/ac/manchester/cs/factplusplus/ClassPointer;)[Luk/ac/manchester/cs/factplusplus/ClassPointer; |
| 213 | */ |
| 214 | JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askEquivalentClasses |
| 215 | (JNIEnv * env, jobject obj, jobject arg) |
| 216 | { |
| 217 | TRACE_JNI("askEquivalentClasses"); |
| 218 | TRACE_ARG(env,obj,arg); |
| 219 | TJNICache* J = getJ(env,obj); |
| 220 | JTaxonomyActor<ClassPolicy> actor(J); |
| 221 | PROCESS_QUERY ( J->K->getEquivalentConcepts ( getROConceptExpr(env,arg), actor ) ); |
| 222 | return actor.getSynonyms(); |
| 223 | } |
| 224 | |
| 225 | /* |
| 226 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 227 | * Method: askDisjointClasses |
| 228 | * Signature: (Luk/ac/manchester/cs/factplusplus/ClassPointer;)[[Luk/ac/manchester/cs/factplusplus/ClassPointer; |
| 229 | */ |
| 230 | JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askDisjointClasses |
| 231 | (JNIEnv * env, jobject obj, jobject arg) |
| 232 | { |
| 233 | TRACE_JNI("askDisjointClasses"); |
| 234 | TRACE_ARG(env,obj,arg); |
| 235 | TJNICache* J = getJ(env,obj); |
| 236 | JTaxonomyActor<ClassPolicy> actor(J); |
| 237 | const TConceptExpr* p = getROConceptExpr(env,arg); |
| 238 | PROCESS_QUERY ( J->K->getDisjointConcepts(p,actor) ); |
| 239 | return actor.getElements(); |
| 240 | } |
| 241 | |
| 242 | /* |
| 243 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 244 | * Method: askSuperObjectProperties |
| 245 | * Signature: (Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer;Z)[[Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer; |
| 246 | */ |
| 247 | JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askSuperObjectProperties |
| 248 | (JNIEnv * env, jobject obj, jobject arg, jboolean direct) |
| 249 | { |
| 250 | TRACE_JNI("askSuperObjectProperties"); |
| 251 | TRACE_ARG(env,obj,arg); |
| 252 | TJNICache* J = getJ(env,obj); |
| 253 | JTaxonomyActor<ObjectPropertyPolicy> actor(J); |
| 254 | const TORoleExpr* p = getROORoleExpr(env,arg); |
| 255 | PROCESS_QUERY ( J->K->getSupRoles(p,direct,actor) ); |
| 256 | return actor.getElements(); |
| 257 | } |
| 258 | |
| 259 | /* |
| 260 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 261 | * Method: askSubObjectProperties |
| 262 | * Signature: (Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer;Z)[[Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer; |
| 263 | */ |
| 264 | JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askSubObjectProperties |
| 265 | (JNIEnv * env, jobject obj, jobject arg, jboolean direct) |
| 266 | { |
| 267 | TRACE_JNI("askSubObjectProperties"); |
| 268 | TRACE_ARG(env,obj,arg); |
| 269 | TJNICache* J = getJ(env,obj); |
| 270 | JTaxonomyActor<ObjectPropertyPolicy> actor(J); |
| 271 | const TORoleExpr* p = getROORoleExpr(env,arg); |
| 272 | PROCESS_QUERY ( J->K->getSubRoles(p,direct,actor) ); |
| 273 | return actor.getElements(); |
| 274 | } |
| 275 | |
| 276 | /* |
| 277 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 278 | * Method: askEquivalentObjectProperties |
| 279 | * Signature: (Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer;)[Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer; |
| 280 | */ |
| 281 | JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askEquivalentObjectProperties |
| 282 | (JNIEnv * env, jobject obj, jobject arg) |
| 283 | { |
| 284 | TRACE_JNI("askEquivalentObjectProperties"); |
| 285 | TRACE_ARG(env,obj,arg); |
| 286 | TJNICache* J = getJ(env,obj); |
| 287 | JTaxonomyActor<ObjectPropertyPolicy> actor(J); |
| 288 | PROCESS_QUERY ( J->K->getEquivalentRoles ( getROORoleExpr(env,arg), actor ) ); |
| 289 | return actor.getSynonyms(); |
| 290 | } |
| 291 | |
| 292 | /* |
| 293 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 294 | * Method: askObjectPropertyDomain |
| 295 | * Signature: (Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer;Z)[[Luk/ac/manchester/cs/factplusplus/ClassPointer; |
| 296 | */ |
| 297 | JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askObjectPropertyDomain |
| 298 | (JNIEnv * env, jobject obj, jobject arg, jboolean direct) |
| 299 | { |
| 300 | TRACE_JNI("askObjectPropertyDomain"); |
| 301 | TRACE_ARG(env,obj,arg); |
| 302 | TJNICache* J = getJ(env,obj); |
| 303 | JTaxonomyActor<ClassPolicy> actor(J); |
| 304 | PROCESS_QUERY ( J->K->getORoleDomain ( getROORoleExpr(env,arg), direct, actor ) ); |
| 305 | return actor.getElements(); |
| 306 | } |
| 307 | |
| 308 | /* |
| 309 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 310 | * Method: askObjectPropertyRange |
| 311 | * Signature: (Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer;Z)[[Luk/ac/manchester/cs/factplusplus/ClassPointer; |
| 312 | */ |
| 313 | JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askObjectPropertyRange |
| 314 | (JNIEnv * env, jobject obj, jobject arg, jboolean direct) |
| 315 | { |
| 316 | TRACE_JNI("askObjectPropertyRange"); |
| 317 | TRACE_ARG(env,obj,arg); |
| 318 | TJNICache* J = getJ(env,obj); |
| 319 | JTaxonomyActor<ClassPolicy> actor(J); |
| 320 | PROCESS_QUERY ( J->K->getRoleRange ( getROORoleExpr(env,arg), direct, actor ) ); |
| 321 | return actor.getElements(); |
| 322 | } |
| 323 | |
| 324 | /* |
| 325 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 326 | * Method: isObjectPropertyFunctional |
| 327 | * Signature: (Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer;)Z |
| 328 | */ |
| 329 | JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_isObjectPropertyFunctional |
| 330 | (JNIEnv * env, jobject obj, jobject arg) |
| 331 | { |
| 332 | TRACE_JNI("isObjectPropertyFunctional"); |
| 333 | TRACE_ARG(env,obj,arg); |
| 334 | bool ret = false; |
| 335 | PROCESS_SIMPLE_QUERY ( ret=J->K->isFunctional(getROORoleExpr(env,arg)) ); |
| 336 | return ret; |
| 337 | } |
| 338 | |
| 339 | /* |
| 340 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 341 | * Method: isObjectPropertyInverseFunctional |
| 342 | * Signature: (Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer;)Z |
| 343 | */ |
| 344 | JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_isObjectPropertyInverseFunctional |
| 345 | (JNIEnv * env, jobject obj, jobject arg) |
| 346 | { |
| 347 | TRACE_JNI("isObjectPropertyInverseFunctional"); |
| 348 | TRACE_ARG(env,obj,arg); |
| 349 | bool ret = false; |
| 350 | PROCESS_SIMPLE_QUERY ( ret=J->K->isInverseFunctional(getROORoleExpr(env,arg)) ); |
| 351 | return ret; |
| 352 | } |
| 353 | |
| 354 | /* |
| 355 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 356 | * Method: isObjectPropertySymmetric |
| 357 | * Signature: (Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer;)Z |
| 358 | */ |
| 359 | JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_isObjectPropertySymmetric |
| 360 | (JNIEnv * env, jobject obj, jobject arg) |
| 361 | { |
| 362 | TRACE_JNI("isObjectPropertySymmetric"); |
| 363 | TRACE_ARG(env,obj,arg); |
| 364 | bool ret = false; |
| 365 | PROCESS_SIMPLE_QUERY ( ret=J->K->isSymmetric(getROORoleExpr(env,arg)) ); |
| 366 | return ret; |
| 367 | } |
| 368 | |
| 369 | /* |
| 370 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 371 | * Method: isObjectPropertyAsymmetric |
| 372 | * Signature: (Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer;)Z |
| 373 | */ |
| 374 | JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_isObjectPropertyAsymmetric |
| 375 | (JNIEnv * env, jobject obj, jobject arg) |
| 376 | { |
| 377 | TRACE_JNI("isObjectPropertyAsymmetric"); |
| 378 | TRACE_ARG(env,obj,arg); |
| 379 | bool ret = false; |
| 380 | PROCESS_SIMPLE_QUERY ( ret=J->K->isAsymmetric(getROORoleExpr(env,arg)) ); |
| 381 | return ret; |
| 382 | } |
| 383 | |
| 384 | /* |
| 385 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 386 | * Method: isObjectPropertyTransitive |
| 387 | * Signature: (Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer;)Z |
| 388 | */ |
| 389 | JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_isObjectPropertyTransitive |
| 390 | (JNIEnv * env, jobject obj, jobject arg) |
| 391 | { |
| 392 | TRACE_JNI("isObjectPropertyTransitive"); |
| 393 | TRACE_ARG(env,obj,arg); |
| 394 | bool ret = false; |
| 395 | PROCESS_SIMPLE_QUERY ( ret=J->K->isTransitive(getROORoleExpr(env,arg)) ); |
| 396 | return ret; |
| 397 | } |
| 398 | |
| 399 | /* |
| 400 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 401 | * Method: isObjectPropertyReflexive |
| 402 | * Signature: (Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer;)Z |
| 403 | */ |
| 404 | JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_isObjectPropertyReflexive |
| 405 | (JNIEnv * env, jobject obj, jobject arg) |
| 406 | { |
| 407 | TRACE_JNI("isObjectPropertyReflexive"); |
| 408 | TRACE_ARG(env,obj,arg); |
| 409 | bool ret = false; |
| 410 | PROCESS_SIMPLE_QUERY ( ret=J->K->isReflexive(getROORoleExpr(env,arg)) ); |
| 411 | return ret; |
| 412 | } |
| 413 | |
| 414 | /* |
| 415 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 416 | * Method: isObjectPropertyIrreflexive |
| 417 | * Signature: (Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer;)Z |
| 418 | */ |
| 419 | JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_isObjectPropertyIrreflexive |
| 420 | (JNIEnv * env, jobject obj, jobject arg) |
| 421 | { |
| 422 | TRACE_JNI("isObjectPropertyIrreflexive"); |
| 423 | TRACE_ARG(env,obj,arg); |
| 424 | bool ret = false; |
| 425 | PROCESS_SIMPLE_QUERY ( ret=J->K->isIrreflexive(getROORoleExpr(env,arg)) ); |
| 426 | return ret; |
| 427 | } |
| 428 | |
| 429 | /* |
| 430 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 431 | * Method: isObjectSubPropertyOf |
| 432 | * Signature: (Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer;Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer;)Z |
| 433 | */ |
| 434 | JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_isObjectSubPropertyOf |
| 435 | (JNIEnv * env, jobject obj, jobject arg1, jobject arg2) |
| 436 | { |
| 437 | TRACE_JNI("isObjectSubPropertyOf"); |
| 438 | TRACE_ARG(env,obj,arg1); |
| 439 | TRACE_ARG(env,obj,arg2); |
| 440 | bool ret = false; |
| 441 | PROCESS_SIMPLE_QUERY ( ret=J->K->isSubRoles ( getROORoleExpr(env,arg1), getROORoleExpr(env,arg2) ) ); |
| 442 | return ret; |
| 443 | } |
| 444 | /* |
| 445 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 446 | * Method: isObjectPropertyDisjointWith |
| 447 | * Signature: (Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer;Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer;)Z |
| 448 | */ |
| 449 | JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_isObjectPropertyDisjointWith |
| 450 | (JNIEnv * env, jobject obj, jobject arg1, jobject arg2) |
| 451 | { |
| 452 | TRACE_JNI("isObjectPropertyDisjointWith"); |
| 453 | TRACE_ARG(env,obj,arg1); |
| 454 | TRACE_ARG(env,obj,arg2); |
| 455 | bool ret = false; |
| 456 | PROCESS_SIMPLE_QUERY ( ret=J->K->isDisjointRoles ( getROORoleExpr(env,arg1), getROORoleExpr(env,arg2) ) ); |
| 457 | return ret; |
| 458 | } |
| 459 | |
| 460 | /* |
| 461 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 462 | * Method: isSubPropertyChainOf |
| 463 | * Signature: (Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer;)Z |
| 464 | */ |
| 465 | JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_isSubPropertyChainOf |
| 466 | (JNIEnv * env, jobject obj, jobject arg) |
| 467 | { |
| 468 | TRACE_JNI("isSubPropertyChainOf"); |
| 469 | TRACE_ARG(env,obj,arg); |
| 470 | bool ret = false; |
| 471 | PROCESS_SIMPLE_QUERY ( ret=J->K->isSubChain(getROORoleExpr(env,arg)) ); |
| 472 | return ret; |
| 473 | } |
| 474 | |
| 475 | /* |
| 476 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 477 | * Method: arePropertiesDisjoint |
| 478 | * Signature: ()Z |
| 479 | */ |
| 480 | JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_arePropertiesDisjoint |
| 481 | (JNIEnv * env, jobject obj) |
| 482 | { |
| 483 | TRACE_JNI("arePropertiesDisjoint"); |
| 484 | bool ret = false; |
| 485 | PROCESS_SIMPLE_QUERY ( ret=J->K->isDisjointRoles() ); |
| 486 | return ret; |
| 487 | } |
| 488 | |
| 489 | /* |
| 490 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 491 | * Method: askSuperDataProperties |
| 492 | * Signature: (Luk/ac/manchester/cs/factplusplus/DataPropertyPointer;Z)[[Luk/ac/manchester/cs/factplusplus/DataPropertyPointer; |
| 493 | */ |
| 494 | JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askSuperDataProperties |
| 495 | (JNIEnv * env, jobject obj, jobject arg, jboolean direct) |
| 496 | { |
| 497 | TRACE_JNI("askSuperDataProperties"); |
| 498 | TRACE_ARG(env,obj,arg); |
| 499 | TJNICache* J = getJ(env,obj); |
| 500 | JTaxonomyActor<DataPropertyPolicy> actor(J); |
| 501 | const TDRoleExpr* p = getRODRoleExpr(env,arg); |
| 502 | PROCESS_QUERY ( J->K->getSupRoles(p,direct,actor) ); |
| 503 | return actor.getElements(); |
| 504 | } |
| 505 | |
| 506 | /* |
| 507 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 508 | * Method: askSubDataProperties |
| 509 | * Signature: (Luk/ac/manchester/cs/factplusplus/DataPropertyPointer;Z)[[Luk/ac/manchester/cs/factplusplus/DataPropertyPointer; |
| 510 | */ |
| 511 | JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askSubDataProperties |
| 512 | (JNIEnv * env, jobject obj, jobject arg, jboolean direct) |
| 513 | { |
| 514 | TRACE_JNI("askSubDataProperties"); |
| 515 | TRACE_ARG(env,obj,arg); |
| 516 | TJNICache* J = getJ(env,obj); |
| 517 | JTaxonomyActor<DataPropertyPolicy> actor(J); |
| 518 | const TDRoleExpr* p = getRODRoleExpr(env,arg); |
| 519 | PROCESS_QUERY ( J->K->getSubRoles(p,direct,actor) ); |
| 520 | return actor.getElements(); |
| 521 | } |
| 522 | |
| 523 | /* |
| 524 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 525 | * Method: askEquivalentDataProperties |
| 526 | * Signature: (Luk/ac/manchester/cs/factplusplus/DataPropertyPointer;)[Luk/ac/manchester/cs/factplusplus/DataPropertyPointer; |
| 527 | */ |
| 528 | JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askEquivalentDataProperties |
| 529 | (JNIEnv * env, jobject obj, jobject arg) |
| 530 | { |
| 531 | TRACE_JNI("askEquivalentDataProperties"); |
| 532 | TRACE_ARG(env,obj,arg); |
| 533 | TJNICache* J = getJ(env,obj); |
| 534 | JTaxonomyActor<DataPropertyPolicy> actor(J); |
| 535 | PROCESS_QUERY ( J->K->getEquivalentRoles ( getRODRoleExpr(env,arg), actor ) ); |
| 536 | return actor.getSynonyms(); |
| 537 | } |
| 538 | |
| 539 | /* |
| 540 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 541 | * Method: askDataPropertyDomain |
| 542 | * Signature: (Luk/ac/manchester/cs/factplusplus/DataPropertyPointer;Z)[[Luk/ac/manchester/cs/factplusplus/ClassPointer; |
| 543 | */ |
| 544 | JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askDataPropertyDomain |
| 545 | (JNIEnv * env, jobject obj, jobject arg, jboolean direct) |
| 546 | { |
| 547 | TRACE_JNI("askDataPropertyDomain"); |
| 548 | TRACE_ARG(env,obj,arg); |
| 549 | TJNICache* J = getJ(env,obj); |
| 550 | JTaxonomyActor<ClassPolicy> actor(J); |
| 551 | PROCESS_QUERY ( J->K->getDRoleDomain ( getRODRoleExpr(env,arg), direct, actor ) ); |
| 552 | return actor.getElements(); |
| 553 | } |
| 554 | |
| 555 | /* |
| 556 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 557 | * Method: isDataPropertyFunctional |
| 558 | * Signature: (Luk/ac/manchester/cs/factplusplus/DataPropertyPointer;)Z |
| 559 | */ |
| 560 | JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_isDataPropertyFunctional |
| 561 | (JNIEnv * env, jobject obj, jobject arg) |
| 562 | { |
| 563 | TRACE_JNI("isDataPropertyFunctional"); |
| 564 | TRACE_ARG(env,obj,arg); |
| 565 | bool ret = false; |
| 566 | PROCESS_SIMPLE_QUERY ( ret=J->K->isFunctional(getRODRoleExpr(env,arg)) ); |
| 567 | return ret; |
| 568 | } |
| 569 | |
| 570 | /* |
| 571 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 572 | * Method: isDataSubPropertyOf |
| 573 | * Signature: (Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer;Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer;)Z |
| 574 | */ |
| 575 | JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_isDataSubPropertyOf |
| 576 | (JNIEnv * env, jobject obj, jobject arg1, jobject arg2) |
| 577 | { |
| 578 | TRACE_JNI("isDataSubPropertyOf"); |
| 579 | TRACE_ARG(env,obj,arg1); |
| 580 | TRACE_ARG(env,obj,arg2); |
| 581 | bool ret = false; |
| 582 | PROCESS_SIMPLE_QUERY ( ret=J->K->isSubRoles ( getRODRoleExpr(env,arg1), getRODRoleExpr(env,arg2) ) ); |
| 583 | return ret; |
| 584 | } |
| 585 | |
| 586 | /* |
| 587 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 588 | * Method: isObjectPropertyDisjointWith |
| 589 | * Signature: (Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer;Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer;)Z |
| 590 | */ |
| 591 | JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_isDataPropertyDisjointWith |
| 592 | (JNIEnv * env, jobject obj, jobject arg1, jobject arg2) |
| 593 | { |
| 594 | TRACE_JNI("isDataPropertyDisjointWith"); |
| 595 | TRACE_ARG(env,obj,arg1); |
| 596 | TRACE_ARG(env,obj,arg2); |
| 597 | bool ret = false; |
| 598 | PROCESS_SIMPLE_QUERY ( ret=J->K->isDisjointRoles ( getRODRoleExpr(env,arg1), getRODRoleExpr(env,arg2) ) ); |
| 599 | return ret; |
| 600 | } |
| 601 | |
| 602 | /* |
| 603 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 604 | * Method: askIndividualTypes |
| 605 | * Signature: (Luk/ac/manchester/cs/factplusplus/IndividualPointer;Z)[[Luk/ac/manchester/cs/factplusplus/ClassPointer; |
| 606 | */ |
| 607 | JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askIndividualTypes |
| 608 | (JNIEnv * env, jobject obj, jobject arg, jboolean direct) |
| 609 | { |
| 610 | TRACE_JNI("askIndividualTypes"); |
| 611 | TRACE_ARG(env,obj,arg); |
| 612 | TJNICache* J = getJ(env,obj); |
| 613 | JTaxonomyActor<ClassPolicy> actor(J); |
| 614 | const TIndividualExpr* p = getROIndividualExpr(env,arg); |
| 615 | PROCESS_QUERY ( J->K->getTypes(p,direct,actor) ); |
| 616 | return actor.getElements(); |
| 617 | } |
| 618 | |
| 619 | /* |
| 620 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 621 | * Method: askObjectProperties |
| 622 | * Signature: (Luk/ac/manchester/cs/factplusplus/IndividualPointer;)[Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer; |
| 623 | */ |
| 624 | JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askObjectProperties |
| 625 | (JNIEnv * env, jobject obj, jobject arg) |
| 626 | { |
| 627 | TRACE_JNI("askObjectProperties"); |
| 628 | TRACE_ARG(env,obj,arg); |
| 629 | TJNICache* J = getJ(env,obj); |
| 630 | ReasoningKernel::NamesVector Rs; |
| 631 | PROCESS_QUERY ( J->K->getRelatedRoles ( getROIndividualExpr(env,arg), Rs, /*data=*/false, /*needI=*/false ) ); |
| 632 | std::vector<TExpr*> acc; |
| 633 | for ( ReasoningKernel::NamesVector::const_iterator p = Rs.begin(), p_end = Rs.end(); p < p_end; ++p ) |
| 634 | acc.push_back(J->getOName((*p)->getName())); |
| 635 | return J->buildArray ( acc, J->ObjectPropertyPointer ); |
| 636 | } |
| 637 | |
| 638 | /* |
| 639 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 640 | * Method: askRelatedIndividuals |
| 641 | * Signature: (Luk/ac/manchester/cs/factplusplus/IndividualPointer;Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer;)[Luk/ac/manchester/cs/factplusplus/IndividualPointer; |
| 642 | */ |
| 643 | JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askRelatedIndividuals |
| 644 | (JNIEnv * env, jobject obj, jobject arg1, jobject arg2) |
| 645 | { |
| 646 | TRACE_JNI("askRelatedIndividuals"); |
| 647 | TRACE_ARG(env,obj,arg1); |
| 648 | TRACE_ARG(env,obj,arg2); |
| 649 | TJNICache* J = getJ(env,obj); |
| 650 | ReasoningKernel::NamesVector Js; |
| 651 | PROCESS_QUERY ( J->K->getRoleFillers ( getROIndividualExpr(env,arg1), getROORoleExpr(env,arg2), Js ) ); |
| 652 | std::vector<TExpr*> acc; |
| 653 | for ( ReasoningKernel::NamesVector::const_iterator p = Js.begin(), p_end = Js.end(); p < p_end; ++p ) |
| 654 | acc.push_back(J->getIName((*p)->getName())); |
| 655 | return J->buildArray ( acc, J->IndividualPointer ); |
| 656 | } |
| 657 | |
| 658 | /* |
| 659 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 660 | * Method: askDataProperties |
| 661 | * Signature: (Luk/ac/manchester/cs/factplusplus/IndividualPointer;)[Luk/ac/manchester/cs/factplusplus/DataPropertyPointer; |
| 662 | */ |
| 663 | JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askDataProperties |
| 664 | (JNIEnv * env, jobject obj, jobject arg) |
| 665 | { |
| 666 | TRACE_JNI("askDataProperties"); |
| 667 | TRACE_ARG(env,obj,arg); |
| 668 | TJNICache* J = getJ(env,obj); |
| 669 | ReasoningKernel::NamesVector Rs; |
| 670 | PROCESS_QUERY ( J->K->getRelatedRoles ( getROIndividualExpr(env,arg), Rs, /*data=*/true, /*needI=*/false ) ); |
| 671 | std::vector<TExpr*> acc; |
| 672 | for ( ReasoningKernel::NamesVector::const_iterator p = Rs.begin(), p_end = Rs.end(); p < p_end; ++p ) |
| 673 | acc.push_back(J->getDName((*p)->getName())); |
| 674 | return J->buildArray ( acc, J->DataPropertyPointer ); |
| 675 | } |
| 676 | |
| 677 | /* |
| 678 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 679 | * Method: askRelatedValues |
| 680 | * Signature: (Luk/ac/manchester/cs/factplusplus/IndividualPointer;Luk/ac/manchester/cs/factplusplus/DataPropertyPointer;)[Luk/ac/manchester/cs/factplusplus/DataValuePointer; |
| 681 | */ |
| 682 | JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askRelatedValues |
| 683 | (JNIEnv * env, jobject obj ATTR_UNUSED, jobject arg1 ATTR_UNUSED, jobject arg2 ATTR_UNUSED) |
| 684 | { |
| 685 | TRACE_JNI("askRelatedValues"); |
| 686 | TRACE_ARG(env,obj,arg1); |
| 687 | TRACE_ARG(env,obj,arg2); |
| 688 | Throw ( env, "FaCT++ Kernel: unsupported operation 'askRelatedValues'" ); |
| 689 | return nullptr; |
| 690 | #if 0 |
| 691 | ReasoningKernel::NamesVector Js; |
| 692 | PROCESS_SIMPLE_QUERY ( J->K->getRoleFillers ( getROIndividualExpr(env,arg1), getRODRoleExpr(env,arg2), Js ) ); |
| 693 | std::vector<TExpr*> acc; |
| 694 | for ( ReasoningKernel::NamesVector::const_iterator p = Js.begin(), p_end = Js.end(); p < p_end; ++p ) |
| 695 | acc.push_back(new TExpr(TLexeme(DATAEXPR,const_cast<TNamedEntry*>(*p)))); |
| 696 | return J->buildArray ( acc, J->DataValuePointer ); |
| 697 | #endif |
| 698 | } |
| 699 | |
| 700 | /* |
| 701 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 702 | * Method: hasDataPropertyRelationship |
| 703 | * Signature: (Luk/ac/manchester/cs/factplusplus/IndividualPointer;Luk/ac/manchester/cs/factplusplus/DataPropertyPointer;Luk/ac/manchester/cs/factplusplus/DataValuePointer;)Z |
| 704 | */ |
| 705 | JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_hasDataPropertyRelationship |
| 706 | (JNIEnv * env, jobject obj ATTR_UNUSED, jobject arg1 ATTR_UNUSED, jobject arg2 ATTR_UNUSED, jobject arg3 ATTR_UNUSED) |
| 707 | { |
| 708 | TRACE_JNI("hasDataPropertyRelationship"); |
| 709 | TRACE_ARG(env,obj,arg1); |
| 710 | TRACE_ARG(env,obj,arg2); |
| 711 | TRACE_ARG(env,obj,arg3); |
| 712 | bool ret = false; |
| 713 | PROCESS_SIMPLE_QUERY ( ret=J->K->isRelated ( getROIndividualExpr(env,arg1), getRODRoleExpr(env,arg2), getRODataValueExpr(env,arg3) ) ); |
| 714 | return ret; |
| 715 | } |
| 716 | |
| 717 | /* |
| 718 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 719 | * Method: hasObjectPropertyRelationship |
| 720 | * Signature: (Luk/ac/manchester/cs/factplusplus/IndividualPointer;Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer;Luk/ac/manchester/cs/factplusplus/IndividualPointer;)Z |
| 721 | */ |
| 722 | JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_hasObjectPropertyRelationship |
| 723 | (JNIEnv * env, jobject obj, jobject arg1, jobject arg2, jobject arg3) |
| 724 | { |
| 725 | TRACE_JNI("hasObjectPropertyRelationship"); |
| 726 | TRACE_ARG(env,obj,arg1); |
| 727 | TRACE_ARG(env,obj,arg2); |
| 728 | TRACE_ARG(env,obj,arg3); |
| 729 | bool ret = false; |
| 730 | PROCESS_SIMPLE_QUERY ( ret=J->K->isRelated ( getROIndividualExpr(env,arg1), getROORoleExpr(env,arg2), getROIndividualExpr(env,arg3) ) ); |
| 731 | return ret; |
| 732 | } |
| 733 | |
| 734 | /* |
| 735 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 736 | * Method: isInstanceOf |
| 737 | * Signature: (Luk/ac/manchester/cs/factplusplus/IndividualPointer;Luk/ac/manchester/cs/factplusplus/ClassPointer;)Z |
| 738 | */ |
| 739 | JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_isInstanceOf |
| 740 | (JNIEnv * env, jobject obj, jobject arg1, jobject arg2) |
| 741 | { |
| 742 | TRACE_JNI("isInstanceOf"); |
| 743 | TRACE_ARG(env,obj,arg1); |
| 744 | TRACE_ARG(env,obj,arg2); |
| 745 | bool ret = false; |
| 746 | PROCESS_SIMPLE_QUERY ( ret=J->K->isInstance ( getROIndividualExpr(env,arg1), getROConceptExpr(env,arg2) ) ); |
| 747 | return ret; |
| 748 | } |
| 749 | |
| 750 | /* |
| 751 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 752 | * Method: askInstances |
| 753 | * Signature: (Luk/ac/manchester/cs/factplusplus/ClassPointer;Z)[Luk/ac/manchester/cs/factplusplus/IndividualPointer; |
| 754 | */ |
| 755 | JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askInstances |
| 756 | (JNIEnv * env, jobject obj, jobject arg, jboolean direct) |
| 757 | { |
| 758 | TRACE_JNI("askInstances"); |
| 759 | TRACE_ARG(env,obj,arg); |
| 760 | TJNICache* J = getJ(env,obj); |
| 761 | JTaxonomyActor<IndividualPolicy</*plain=*/true> > actor(J); |
| 762 | const TConceptExpr* p = getROConceptExpr(env,arg); |
| 763 | PROCESS_QUERY ( direct ? J->K->getDirectInstances(p,actor) : J->K->getInstances(p,actor) ); |
| 764 | return actor.getElements(); |
| 765 | } |
| 766 | |
| 767 | /* |
| 768 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 769 | * Method: askInstancesGrouped |
| 770 | * Signature: (Luk/ac/manchester/cs/factplusplus/ClassPointer;Z)[[Luk/ac/manchester/cs/factplusplus/IndividualPointer; |
| 771 | */ |
| 772 | JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askInstancesGrouped |
| 773 | (JNIEnv * env, jobject obj, jobject arg, jboolean direct) |
| 774 | { |
| 775 | TRACE_JNI("askInstancesGrouped"); |
| 776 | TRACE_ARG(env,obj,arg); |
| 777 | TJNICache* J = getJ(env,obj); |
| 778 | JTaxonomyActor<IndividualPolicy</*plain=*/false> > actor(J); |
| 779 | const TConceptExpr* p = getROConceptExpr(env,arg); |
| 780 | PROCESS_QUERY ( direct ? J->K->getDirectInstances(p,actor) : J->K->getInstances(p,actor) ); |
| 781 | return actor.getElements(); |
| 782 | } |
| 783 | |
| 784 | /* |
| 785 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 786 | * Method: askSameAs |
| 787 | * Signature: (Luk/ac/manchester/cs/factplusplus/IndividualPointer;)[Luk/ac/manchester/cs/factplusplus/IndividualPointer; |
| 788 | */ |
| 789 | JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askSameAs |
| 790 | (JNIEnv * env, jobject obj, jobject arg) |
| 791 | { |
| 792 | TRACE_JNI("askSameAs"); |
| 793 | TRACE_ARG(env,obj,arg); |
| 794 | TJNICache* J = getJ(env,obj); |
| 795 | JTaxonomyActor<IndividualPolicy</*plain=*/true> > actor(J); |
| 796 | PROCESS_QUERY ( J->K->getSameAs ( getROIndividualExpr(env,arg), actor ) ); |
| 797 | return actor.getSynonyms(); |
| 798 | } |
| 799 | |
| 800 | /* |
| 801 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 802 | * Method: isSameAs |
| 803 | * Signature: (Luk/ac/manchester/cs/factplusplus/IndividualPointer;Luk/ac/manchester/cs/factplusplus/IndividualPointer;)Z |
| 804 | */ |
| 805 | JNIEXPORT jboolean JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_isSameAs |
| 806 | (JNIEnv * env, jobject obj, jobject arg1, jobject arg2) |
| 807 | { |
| 808 | TRACE_JNI("isSameAs"); |
| 809 | TRACE_ARG(env,obj,arg1); |
| 810 | TRACE_ARG(env,obj,arg2); |
| 811 | bool ret = false; |
| 812 | PROCESS_SIMPLE_QUERY ( ret=J->K->isSameIndividuals ( getROIndividualExpr(env,arg1), getROIndividualExpr(env,arg2) ) ); |
| 813 | return ret; |
| 814 | } |
| 815 | |
| 816 | /* |
| 817 | * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus |
| 818 | * Method: getDataRelatedIndividuals |
| 819 | * Signature: (Luk/ac/manchester/cs/factplusplus/DataPropertyPointer;Luk/ac/manchester/cs/factplusplus/DataPropertyPointer;I)[Luk/ac/manchester/cs/factplusplus/IndividualPointer; |
| 820 | */ |
| 821 | JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_getDataRelatedIndividuals |
| 822 | (JNIEnv * env, jobject obj, jobject arg1, jobject arg2, jint op) |
| 823 | { |
| 824 | TRACE_JNI("getDataRelatedIndividuals"); |
| 825 | TRACE_ARG(env,obj,arg1); |
| 826 | TRACE_ARG(env,obj,arg2); |
| 827 | TJNICache* J = getJ(env,obj); |
| 828 | ReasoningKernel::NamesVector Js; |
| 829 | PROCESS_QUERY ( J->K->getDataRelatedIndividuals ( getRODRoleExpr(env,arg1), getRODRoleExpr(env,arg2), op, Js ) ); |
| 830 | std::vector<TExpr*> acc; |
| 831 | for ( ReasoningKernel::NamesVector::const_iterator p = Js.begin(), p_end = Js.end(); p < p_end; ++p ) |
| 832 | acc.push_back(J->getIName((*p)->getName())); |
| 833 | return J->buildArray ( acc, J->IndividualPointer ); |
| 834 | |
| 835 | } |
| 836 | |
| 837 | |
| 838 | #undef PROCESS_QUERY |
| 839 | #undef PROCESS_SIMPLE_QUERY |
| 840 | |
| 841 | #ifdef __cplusplus |
| 842 | } |
| 843 | #endif |