Пример #1
0
/*
 * Class:     uk_ac_manchester_cs_factplusplus_FaCTPlusPlus
 * Method:    getDataTop
 * Signature: ()Luk/ac/manchester/cs/factplusplus/DataTypePointer;
 */
JNIEXPORT jobject JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_getDataTop
  (JNIEnv * env, jobject obj)
{
	TRACE_JNI("getDataTop");
	TJNICache* J = getJ(env,obj);
	return J->DataType(J->EM->DataTop());
}
Пример #2
0
/*
 * Class:     uk_ac_manchester_cs_factplusplus_FaCTPlusPlus
 * Method:    getBuiltInDataType
 * Signature: (Ljava/lang/String;)Luk/ac/manchester/cs/factplusplus/DataTypePointer;
 */
JNIEXPORT jobject JNICALL Java_uk_ac_manchester_cs_factplusplus_FaCTPlusPlus_getBuiltInDataType
  (JNIEnv * env, jobject obj, jstring str)
{
	TRACE_JNI("getBuiltInDataType");
	TRACE_STR(env,str);
	TJNICache* J = getJ(env,obj);
	JString name(env,str);
	std::string DTName(name());
	if ( DTName == "http://www.w3.org/2000/01/rdf-schema#Literal" ||
		 DTName == "http://www.w3.org/2000/01/rdf-schema#anySimpleType" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#anyType" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#anySimpleType" )
		return J->DataType(J->EM->DataTop());

	if ( DTName == "http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral" ||
		 DTName == "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#string" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#anyURI" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#ID" )
		return J->DataType(J->EM->getStrDataType());

	if ( DTName == "http://www.w3.org/2001/XMLSchema#integer" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#int" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#long" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#nonNegativeInteger" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#positiveInteger" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#negativeInteger" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#short" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#byte" )
		return J->DataType(J->EM->getIntDataType());

	if ( DTName == "http://www.w3.org/2001/XMLSchema#float" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#double" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#real" ||
		 DTName == "http://www.w3.org/2001/XMLSchema#decimal" )
		return J->DataType(J->EM->getRealDataType());

	if ( DTName == "http://www.w3.org/2001/XMLSchema#boolean" )
		return J->DataType(J->EM->getBoolDataType());

	if ( DTName == "http://www.w3.org/2001/XMLSchema#dateTimeAsLong" )
		return J->DataType(J->EM->getTimeDataType());

	std::stringstream err;
	err << "Unsupported datatype '" << DTName.c_str() << "'";
	Throw ( env, err.str().c_str() );
	return (jobject)0;
}