求牛人看看~~代码:package pl.jena;import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.query.QueryExecution;
import com.hp.hpl.jena.query.QueryExecutionFactory;
import com.hp.hpl.jena.query.QueryFactory;
import com.hp.hpl.jena.query.QuerySolution;
import com.hp.hpl.jena.query.ResultSet;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.util.FileManager;public class JenaSample { public static void main(String args[]) throws IOException {
getVulnerabilityInfo("C:/jena/jvndb.rdf");
} public static void getVulnerabilityInfo(String fileName) {
InputStream in = null;
try {
OntModel ontModel = ModelFactory.createOntologyModel(); in = FileManager.get().open(fileName);
if (in == null) {
throw new FileNotFoundException(fileName);
} ontModel.read(in, ""); //这里报NullPointerException String queryString = "PREFIX rss:   <http://purl.org/rss/1.0/> "
+ " SELECT ?item_title ?item_link" + " WHERE "
+ "{ ?item rss:title ?item_title "
+ " FILTER regex(?item_title, \"Android\", \"i\" ) ."
+ "?item rss:link ?item_link }";

Query query = QueryFactory.create(queryString);
QueryExecution qe = QueryExecutionFactory.create(query, ontModel);
ResultSet results = qe.execSelect(); while (results.hasNext()) {
QuerySolution qs = results.next();
 System.out.println(qs.get("item_title"));
 System.out.println(qs.get("item_link"));
} // ResultSetFormatter.out(System.out, results, query);
qe.close(); } catch (Exception e) {
e.printStackTrace();
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
}
}
}
}}C:/jena/jvndb.rdf这个文件的下载地址
http://jvndb.jvn.jp/en/rss/jvndb.rdfjena库的下载地址。
http://www.apache.org/dist/jena/binaries/