Debian Codegraph @

FaCT++.JNI/KnowledgeExploration.cpp

raw symbols SCIP
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 knowledge exploration methods of FaCT++ JNI interface
21
22 #include "uk_ac_manchester_cs_factplusplus_FaCTPlusPlus.h"
23 #include "Kernel.h"
24 #include "tJNICache.h"
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 /*
31 * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus
32 * Method: buildCompletionTree
33 * Signature: (Luk/ac/manchester/cs/factplusplus/ClassPointer;)Luk/ac/manchester/cs/factplusplus/NodePointer;
34 */
35 JNIEXPORT jobject JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_buildCompletionTree
36 (JNIEnv * env, jobject obj, jobject arg)
37 {
38 TRACE_JNI("buildCompletionTree");
39 TRACE_ARG(env,obj,arg);
40 TJNICache* J = getJ(env,obj);
41 return J->Node(J->K->buildCompletionTree(getROConceptExpr(env,arg)));
42 }
43
44 /*
45 * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus
46 * Method: getObjectNeighbours
47 * Signature: (Luk/ac/manchester/cs/factplusplus/NodePointer;Z)[Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer;
48 */
49 JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_getObjectNeighbours__Luk_ac_manchester_cs_factplusplus_NodePointer_2Z
50 (JNIEnv * env, jobject obj, jobject arg, jboolean flag)
51 {
52 TRACE_JNI("getObjectNeighbours");
53 TRACE_ARG(env,obj,arg);
54 TJNICache* J = getJ(env,obj);
55 ReasoningKernel::TCGRoleSet Set;
56 J->K->getObjectRoles ( getRONode(env,arg), Set, /*onlyDet=*/flag, /*needIncoming=*/false );
57 std::vector<TORoleExpr*> ret;
58 for (const TDLRoleExpression* role : Set)
59 ret.push_back(dynamic_cast<TORoleExpr*>(role));
60 return J->buildArray ( ret, J->ObjectPropertyPointer );
61 }
62
63 /*
64 * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus
65 * Method: getDataNeighbours
66 * Signature: (Luk/ac/manchester/cs/factplusplus/NodePointer;Z)[Luk/ac/manchester/cs/factplusplus/DataPropertyPointer;
67 */
68 JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_getDataNeighbours__Luk_ac_manchester_cs_factplusplus_NodePointer_2Z
69 (JNIEnv * env, jobject obj, jobject arg, jboolean flag)
70 {
71 TRACE_JNI("getDataNeighbours");
72 TRACE_ARG(env,obj,arg);
73 TJNICache* J = getJ(env,obj);
74 ReasoningKernel::TCGRoleSet Set;
75 J->K->getDataRoles ( getRONode(env,arg), Set, /*onlyDet=*/flag );
76 std::vector<TDRoleExpr*> ret;
77 for (const TDLRoleExpression* role : Set)
78 ret.push_back(dynamic_cast<TDRoleExpr*>(role));
79 return J->buildArray ( ret, J->DataPropertyPointer );
80 }
81
82 /*
83 * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus
84 * Method: getObjectNeighbours
85 * Signature: (Luk/ac/manchester/cs/factplusplus/NodePointer;Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer;)[Luk/ac/manchester/cs/factplusplus/NodePointer;
86 */
87 JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_getObjectNeighbours__Luk_ac_manchester_cs_factplusplus_NodePointer_2Luk_ac_manchester_cs_factplusplus_ObjectPropertyPointer_2
88 (JNIEnv * env, jobject obj, jobject arg1, jobject arg2 )
89 {
90 TRACE_JNI("getObjectNeighbours");
91 TRACE_ARG(env,obj,arg1);
92 TRACE_ARG(env,obj,arg2);
93 TJNICache* J = getJ(env,obj);
94 ReasoningKernel::TCGNodeVec Vec;
95 J->K->getNeighbours ( getRONode(env,arg1), getROORoleExpr(env,arg2), Vec );
96 return J->buildArray ( Vec, J->NodePointer );
97 }
98
99 /*
100 * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus
101 * Method: getDataNeighbours
102 * Signature: (Luk/ac/manchester/cs/factplusplus/NodePointer;Luk/ac/manchester/cs/factplusplus/DataPropertyPointer;)[Luk/ac/manchester/cs/factplusplus/NodePointer;
103 */
104 JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_getDataNeighbours__Luk_ac_manchester_cs_factplusplus_NodePointer_2Luk_ac_manchester_cs_factplusplus_DataPropertyPointer_2
105 (JNIEnv * env, jobject obj, jobject arg1, jobject arg2 )
106 {
107 TRACE_JNI("getDataNeighbours");
108 TRACE_ARG(env,obj,arg1);
109 TRACE_ARG(env,obj,arg2);
110 TJNICache* J = getJ(env,obj);
111 ReasoningKernel::TCGNodeVec Vec;
112 J->K->getNeighbours ( getRONode(env,arg1), getRODRoleExpr(env,arg2), Vec );
113 return J->buildArray ( Vec, J->NodePointer );
114 }
115
116 /*
117 * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus
118 * Method: getObjectLabel
119 * Signature: (Luk/ac/manchester/cs/factplusplus/NodePointer;Z)[Luk/ac/manchester/cs/factplusplus/ClassPointer;
120 */
121 JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_getObjectLabel
122 (JNIEnv * env, jobject obj, jobject arg, jboolean flag)
123 {
124 TRACE_JNI("getObjectLabel");
125 TRACE_ARG(env,obj,arg);
126 TJNICache* J = getJ(env,obj);
127 ReasoningKernel::TCGItemVec Vec;
128 J->K->getLabel ( getRONode(env,arg), Vec, /*onlyDet=*/flag );
129 return J->buildArray ( Vec, J->ClassPointer );
130 }
131
132 /*
133 * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus
134 * Method: getDataLabel
135 * Signature: (Luk/ac/manchester/cs/factplusplus/NodePointer;Z)[Luk/ac/manchester/cs/factplusplus/DataTypePointer;
136 */
137 JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_getDataLabel
138 (JNIEnv * env, jobject obj, jobject arg, jboolean flag)
139 {
140 TRACE_JNI("getDataLabel");
141 TRACE_ARG(env,obj,arg);
142 TJNICache* J = getJ(env,obj);
143 ReasoningKernel::TCGItemVec Vec;
144 J->K->getLabel ( getRONode(env,arg), Vec, /*onlyDet=*/flag );
145 return J->buildArray ( Vec, J->DataTypeExpressionPointer );
146 }
147
148 /*
149 * Class: uk_ac_manchester_cs_factplusplus_FaCTPlusPlus
150 * Method: getBlocker
151 * Signature: (Luk/ac/manchester/cs/factplusplus/NodePointer;)Luk/ac/manchester/cs/factplusplus/NodePointer;
152 */
153 JNIEXPORT jobject JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_getBlocker
154 (JNIEnv * env, jobject obj, jobject arg)
155 {
156 TRACE_JNI("getBlocker");
157 TRACE_ARG(env,obj,arg);
158 TJNICache* J = getJ(env,obj);
159 return J->Node(J->K->getBlocker(getRONode(env,arg)));
160 }
161
162 #ifdef __cplusplus
163 }
164 #endif