我正在通过JENA运行一个非常简单的sparql查询。但是我得到了如下所述的错误:
我的查询在dbpedia.org中有效。另外我放了所有需要的JAR文件。
当我调试代码时,我发现错误来自RESULTSET行。
有什么建议吗?
提前致谢....
我的代码:
package connectingurl;
import com.hp.hpl.jena.query.*;
public class DBpediaQuery {
public static void main( String[] args ) {
String s2 = "PREFIX yago: <http://dbpedia.org/class/yago/>\n" +
"PREFIX onto: <http://dbpedia.org/ontology/>\n" +
"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +
"PREFIX dbpedia: <http://dbpedia.org/>\n" +
"PREFIX owl: <http://www.w3.org/2002/07/owl#>\n" +
"PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>\n" +
"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n" +
"PREFIX dbpprop: <http://dbpedia.org/property/>\n" +
"PREFIX foaf: <http://xmlns.com/foaf/0.1/>\n" +
"SELECT DISTINCT *\n" +
"WHERE {\n" +
"?city rdf:type dbpedia-owl:PopulatedPlace .\n" +
"?city rdfs:label ?label.\n" +
"?city dbpedia-owl:country ?country .\n" +
"?country dbpprop:commonName ?country_name.\n" +
"OPTIONAL { ?city foaf:isPrimaryTopicOf ?web }.\n" +
"FILTER ( lang(?label) = 'en' && regex(?country, 'Germany') && regex(?label, 'Homburg')) \n" +
"} \n" +
"";
Query query = QueryFactory.create(s2); //s2 = the query above
QueryExecution qExe = QueryExecutionFactory.sparqlService( "http://dbpedia.org/snorql", query );
ResultSet results = qExe.execSelect();
ResultSetFormatter.out(System.out, results, query) ;
}
}
错误:
log4j:WARN No appenders could be found for logger
(org.apache.jena.riot.stream.JenaIOEnvironment).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" org.apache.http.conn.ssl.SSLInitializationException: Failure
initializing default system SSL context
...
Caused by: java.io.IOException: Keystore was tampered with, or password was incorrect
...
Caused by: java.security.UnrecoverableKeyException: Password verification failed
...