0

I have a question:

I have read on the Web that SPARQL endpoint is a Web service that answers SPARQL queries for some dataset.

I have read also that I can realize a Web Service which has a method that queries the data on triple store and so I have a SPARQL endpoint. It's right?

I'm using a Jena TDB Triple Store and my question is:

How I can realize a SPARQL Endpoint public (like dbpedia.org/sparql) if I use only Web Service?

I'm using Netbeans with Glassfish4.0 and this is my code:

@WebService(serviceName = "query_ws")
@Stateless()
public class query_ws {

    String directory = "C:\\jena\\tdb";

    @WebMethod(operationName = "query")
    public String query(@WebParam(name = "strquery") String strquery){

        String results = queryTDB(strquery, directory);
        return results;
    }

public String queryTDB(String queryStr, String directory) {

        Dataset dataset = TDBFactory.createDataset(directory);

        Query query = QueryFactory.create(queryStr);
        QueryExecution qexec = QueryExecutionFactory.create(query, dataset);
        qexec.getContext().set(TDB.symUnionDefaultGraph, true);
        ResultSet results = qexec.execSelect();
        String strings = ResultSetFormatter.asText(results);
        qexec.close();
        return strings;
    }
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Musich87
  • 562
  • 1
  • 12
  • 31

1 Answers1

1

Apache Jena Fuseki is the Jena project's SPARQL server.

You can use that as a standalone server, or you can use it as a library of servlets, or you can extract the code you want from the source.

AndyS
  • 16,345
  • 17
  • 21
  • Yes, I know it. My question is: How I can realize a SPARQL Endpoint public (like dbpedia.org/sparql) if I use only Web Service? – Musich87 Sep 05 '14 at 09:41
  • @Musich87 There may be a language barrier here, I'm not sure. At any rate, it's not clear what you mean by "realize a SPARQL Endpoint public (like dbpedia.org/sparql) if I use only Web Service?" You don't have to use the HTTP/webpage interface to dbpedia.org/sparql; you can send queries to it programmatically, too. – Joshua Taylor Sep 05 '14 at 12:34
  • OK. I did this question because a SPARQL endpoint accepts queries and replies with the query result. I then created a Web Service using Netbeans that does just that in order to work as a SPARQL endpoint without using Fuseki or another. Now, I want to make public my SPARQL endpoint. Therefore, I was wondering how it is possible to reach this Web Service as if it were a SPARQL Endpoint (as dbpedia.org/sparql). Just open only the ports on the firewall? Or something else? – Musich87 Sep 05 '14 at 13:07