예제 #1
0
/*
 * Class:     uk_ac_manchester_cs_factplusplus_FaCTPlusPlus
 * Method:    askRelatedIndividuals
 * Signature: (Luk/ac/manchester/cs/factplusplus/IndividualPointer;Luk/ac/manchester/cs/factplusplus/ObjectPropertyPointer;)[Luk/ac/manchester/cs/factplusplus/IndividualPointer;
 */
JNIEXPORT jobjectArray JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_askRelatedIndividuals
(JNIEnv * env, jobject obj, jobject arg1, jobject arg2)
{
    TRACE_JNI("askRelatedIndividuals");
    TRACE_ARG(env,obj,arg1);
    TRACE_ARG(env,obj,arg2);
    TJNICache* J = getJ(env,obj);
    ReasoningKernel::NamesVector Js;
    PROCESS_QUERY ( J->K->getRoleFillers ( getROIndividualExpr(env,arg1), getROORoleExpr(env,arg2), Js ) );
    std::vector<TExpr*> acc;
    for ( ReasoningKernel::NamesVector::const_iterator p = Js.begin(), p_end = Js.end(); p < p_end; ++p )
        acc.push_back(J->getIName((*p)->getName()));
    return J->buildArray ( acc, J->IndividualPointer );
}
예제 #2
0
/*
 * Class:     uk_ac_manchester_cs_factplusplus_FaCTPlusPlus
 * Method:    getIndividual
 * Signature: (Ljava/lang/String;)Luk/ac/manchester/cs/factplusplus/IndividualPointer;
 */
JNIEXPORT jobject JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_getIndividual
  (JNIEnv * env, jobject obj, jstring str)
{
	TRACE_JNI("getIndividual");
	TRACE_STR(env,str);
	TJNICache* J = getJ(env,obj);
	JString name(env,str);
	jobject ret = (jobject)0;
	try
	{
		ret = J->Individual(J->getIName(name()));
	}
	catch (const EFPPCantRegName&)
	{
		Throw ( env, "FaCT++ Kernel: Can not register new individual name" );
	}
	return ret;
}