Package org.fundacionctic.su4j.endpoint

Examples of org.fundacionctic.su4j.endpoint.SparqlEndpoint


  private static final Logger logger = Logger.getLogger(SparqlServlet.class);
  public static final String GRAPH = "http://example.org/graph";
 
  @Override
  public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException {   
    SparqlEndpoint endpoint = EndpointFactory.createDefaultSparqlEndpoint();
    Model model = (Model)this.getServletContext().getAttribute(StartupServlet.MODEL);
    endpoint.setDefaultNamedGraph(model);
    endpoint.setRequest(req);
    endpoint.setResponse(res);
    if (endpoint.isQuery()) {
      try {
        logger.info("Executing SPARQL query...");
        endpoint.query();
      } catch (Exception e) {
        logger.error(e.getMessage());
        endpoint.renderError(e);
      }
    } else {
      logger.info("Showing SPARQL form");
      endpoint.renderForm("SU4J SPARQL end-point example", "SELECT * WHERE { ?s ?p ?o }");
    }
  }
View Full Code Here

TOP

Related Classes of org.fundacionctic.su4j.endpoint.SparqlEndpoint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.