- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
亲爱的 friend 们,我正在使用 Jena 框架和 virtuoso 的 RDF 数据库模型在我的项目中。我的 jena 版本是 jena-core2.7.2 和 jena-arq-2.9.2
这是我的代码,它给我错误
public JsonArray getCountryAutoSuggestData()
{
JsonArray countryArray = new JsonArray();
Model model = DataModel.getModel();
String mystr = " PREFIX plcontologyurl:<http://www.plcontology.com/#> "
+ " PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
+ "select ?cn"
+ " where "
+ " { "
+ " ?d plcontologyurl:Country_Name ?cn . "
+ "}";
Query query = QueryFactory.create(mystr);
QueryExecution qe = QueryExecutionFactory.create(query, model);
QuerySolutionMap qMap = new QuerySolutionMap();
qe.setInitialBinding(qMap);
ResultSet rs = qe.execSelect();
while(rs.hasNext())
{
qMap = (QuerySolutionMap)rs.next();
countryArray.add(new JsonPrimitive(qMap.getLiteral("cn").getString()));
}
return countryArray;
}
错误是java.lang.InstantiationError: com.hp.hpl.jena.sparql.engine.binding.BindingMap 在线while(rs.hasNext())
我尝试查找问题并找到一个 relevant discussion
他们说现在 com.hp.hpl.jena.sparql.engine.binding.BindingMap 不是一个简单的这个版本现在是类,但现在是一个接口(interface)。
如果是这样,那么如何在当前版本中运行 sparql 查询。请根据我分享的代码举一个例子。提前致谢。
最佳答案
您在类路径上混合了多个版本。
您链接到的信息是正确的 - BindingMap 成为一个接口(interface),因此如果您看到 java.lang.InstantiationError,则表示调用代码来自早期版本的 ARQ。
检查您在类路径中没有超过一份 Jena 代码副本,并且在 JVM 认可的目录中没有副本。
关于在 jena 中运行 sparql 查询时出现 java.lang.InstantiationError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12036674/
我正在尝试创建一个实用方法,该方法应该能够深度克隆任何对象。(Object.clone() 仅适用于实现 Cloneable 的对象,而且我听说它无论如何都有缺陷。) 我正在使用Objenesis不使
亲爱的 friend 们,我正在使用 Jena 框架和 virtuoso 的 RDF 数据库模型在我的项目中。我的 jena 版本是 jena-core2.7.2 和 jena-arq-2.9.2 这
我正在使用ElasticSearch 6并尝试通过使用以下代码创建客户端 当我尝试传输地址时遇到错误java.lang.instantiationerror org.elasticsearch.com
我正在尝试按照此处的说明让 Guice 与 RESTEasy 配合使用:https://docs.jboss.org/resteasy/docs/3.0.21.Final/userguide/html
我正在尝试从 Android 中的遗留 java Activity 启动新的 kotlin Activity ,并且需要传递一个枚举(在 kotlin 中定义)作为 intent extra。从第一个
新增中 org.eclipse.jetty jetty-util 9.2.3.v20140905 org.eclipse.jetty jetty-io 9.2.3.v20
我有一个在 spring 4 上开发并在 tomcat 7(使用 jdk8)中运行的 restful api 应用程序现在我尝试将它部署到 tomcat 9(使用 jdk8 构建和运行),构建的 wa
我在我的项目中使用 primefaces 7。我必须将其更新为 primefaces 8 才能使用多个文件上传。我用新的更新了 jar 文件。当我尝试在 wildfly 上运行我的项目时,出现了这个错
我是一名优秀的程序员,十分优秀!