Hello everyone...


I´m Walter a master student on UFPE - Brazil. I´m really need some help on
ARQ Jena.



Recentelly I discoverd the functions on ARQ but I ´m having a little
dificult to use these functions. I´m trying to query the DBpedia using de
function afn:namespaces to find the namespaces of some resources. Here is my
code:



      public static void main(String[] args) {

            String URI = "http://dbpedia.org/sparql/";;



            String query =

                        "PREFIX afn:
<http://jena.hpl.hp.com/ARQ/function#>"+



                        "select  distinct ?s ?p ?namespace " +

                        "where {?s ?p ?o ." +

                        "filter (isURI(?s)) " +

                        "filter (isURI(?o))" +

                        "filter (afn:namespace(?s) = (afn:namespace(?o))  )}
limit 10";





            QuerySPARQL(query, URI);



      }



      private static void QuerySPARQL(String query, String uri) {

            Query queryformed = QueryFactory.create(query);

            QueryExecution qe = QueryExecutionFactory.sparqlService(uri,
queryformed);



            System.out.println("Pesquisando...");

            String resposta = "sem resposta :(";

            try {



ResultSet results = qe.execSelect();

                   resposta = ResultSetFormatter.asText(results,
queryformed);

            }

            catch (Exception e) {

                  e.printStackTrace();

            }

            finally {

                  qe.close();

            }

            System.out.println(resposta);





      }





But I always recieve the error 500. Anyone could help me on this? Thanks a
lot.



Att



Walter Travassos





---
Este email está limpo de vírus e malwares porque a proteção do avast! Antivírus 
está ativa.
http://www.avast.com

Reply via email to