Hi All I am using Jena to hopefully query the DBPEDIA ontology for data about a specific person I am using the following query * * *PREFIX foaf: <http://xmlns.com/foaf/0.1/>* *SELECT ?name ?uri* *WHERE {* * ?uri a foaf:Person.* * ?uri foaf:name ?name.* * FILTER (langMatches(lang(?name), "en")).* * FILTER( regex(?name, '^Paula Creamer', 'i') ) * *}*
The code I am using is as follows, am I right in thinking that because I do not have a local ontology their is no need for a model to be present? I just wish to query the data. *out.println("<p>QUERYBUILDER</p>");* * // retrieve parameters* * String param = request.getParameter("param");* * out.println("<p>THIS IS THE PARAMETER PASSSED IN: " + param + "</p>");* * Query query = null;* * * * // set query string* * String queryString =* * "PREFIX rdf: < http://www.w3.org/1999/02/22-rdf-syntax-ns#>"* * + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema# >"* * + "PREFIX foaf: <http://xmlns.com/foaf/0.1/>"* * + "SELECT DISTINCT ?name ?uri "* * + "WHERE{"* * + "?uri a foaf:Person."* * + "?uri foaf:name ?name."* * + "FILTER(langMatches(lang(?name),'en'))."* * + "FILTER(regex(?name,'^" + param + "','i') )}";* * * * query = QueryFactory.create(queryString);* * out.println("<p>query created</p>");* * * * QueryExecution qexec = QueryExecutionFactory.sparqlService(" http://dbpedia.org/sparql", query);* * out.println("<p>query executed</p>");* * * * ResultSet results = qexec.execSelect();* * out.println("<p>iterator executed</p>");* * try {* * while(results.hasNext()){* * int x = 0;* * QuerySolution soln = results.nextSolution();* * Resource r = soln.getResource("uri");* * out.println("result: " + x);* * x ++;* * }* * } catch (Exception e) {* * out.println(e.getCause());* * } finally {* * qexec.close();* * }* This code is all ran through a very basic servlet at the moment (trying to keep it simple for experimentation purposes), when I run the code and pass in someone's name that I know is available such as 'Angelina Jolie' I get an * * *HttpException: 500 SPARQL Request Failed* error does anyone see where I am going wrong, thanks in advance. -- Regards Mark
------------------------------------------------------------------------------ Gaining the trust of online customers is vital for the success of any company that requires sensitive data to be transmitted over the Web. Learn how to best implement a security strategy that keeps consumers' information secure and instills the confidence they need to proceed with transactions. http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________ Dbpedia-discussion mailing list Dbpedia-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dbpedia-discussion