Hi,

I'm using JENA TDB Joseki in my work. I need to query multiple datasets and I know that the SPARQL 1.1 allow it, but when I submit any query nothing is returned. Someone can help me please.

I read all FAQs about federated query and none is the same problem.

This is my code:

/ * To change this template, choose Tools | Templates * and open the template in the editor. / package src;

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.ResultSet; import com.hp.hpl.jena.query.ResultSetFormatter;

/ * @author nusa / public class FederatedQuery {

    final static String esquemaMediacao = "http://127.0.0.1:2020/esquemamediacao";

    public static void main(String[] args) {

          String queryString =  
                    "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> "  
                    "PREFIX akt: <http://www.aktors.org/ontology/portal#> "  
                    "SELECT * WHERE {  "  
                    "SERVICE <http://127.0.0.1:2020/dblp> {?s ?p ?o}" 
                    "}" 
                    "LIMIT 10";

            //executando a consulta em cada um dos SPARQL endpoints:

    Query query = QueryFactory.create(queryString);  // exception happens here
    QueryExecution qexec = QueryExecutionFactory.sparqlService(esquemaMediacao,query);

try {
    ResultSet rs = qexec.execSelect();
    if ( rs.hasNext() ) {
        // show the result, more can be done here
        System.out.println(ResultSetFormatter.asText(rs));
    }
} 
catch(Exception e) { 
    System.out.println(e.getMessage());
}
finally {
    qexec.close();
}
System.out.println("\nall done.");

} }

asked 26 Nov '12, 08:54

Danusa%20Ribeiro's gravatar image

Danusa Ribeiro
111
accept rate: 0%


You will need Fuseki, which replaces Joseki.

If you are using Fuseki: the query endpoint will, if configured correctly, be http://127.0.0.1:2020/dblp/query -- note the /query on the end

  1. Which version?
  2. What happens?
  3. What's the config file?
link

answered 26 Nov '12, 10:48

AndyS's gravatar image

AndyS ♦
12.4k27
accept rate: 31%

Joseki doesn't support federated queries (or Fuseki for that case). Jena, doesn't to my knowledge, include a federated SPARQL query processor on the client and is dependent on support from the SPARQL endpoint itself.

link

answered 26 Nov '12, 09:01

William%20Greenly's gravatar image

William Greenly
5.1k412
accept rate: 13%

Fuseki does support SERVICE.

(26 Nov '12, 10:44) AndyS ♦ AndyS's gravatar image

Thats good to know. Is that everything from SPARQL Fed. Made the assumption based on http://jena.apache.org/documentation/serving_data/index.html

(26 Nov '12, 15:52) William Greenly William%20Greenly's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×28

Asked: 26 Nov '12, 08:54

Seen: 574 times

Last updated: 26 Nov '12, 15:52