有什么方法可以验证/检查 SparQL 查询?
我要求一种类似于oneClass.validateSparqlQuery(expectedSparQL)
.
并且在创建 SparQL 时不强制异常“QueryException”,这样:
import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.query.QueryException;
import com.hp.hpl.jena.query.QueryFactory;
public class myClass {
public static void generic(String expectedSparQL) {
try {
Query q = QueryFactory.create(expectedSparQL);
} catch (QueryException qe) {
//do something if the expectedSparQL is not correct
}
}
}
javadoc:https ://jena.apache.org/documentation/javadoc/arq/index.html