org.apache.stanbol.commons.web.sparql.resource
Class SparqlEndpointResource

java.lang.Object
  extended by org.apache.stanbol.commons.web.base.resource.BaseStanbolResource
      extended by org.apache.stanbol.commons.web.sparql.resource.SparqlEndpointResource

public class SparqlEndpointResource
extends org.apache.stanbol.commons.web.base.resource.BaseStanbolResource

This is the SPARQL endpoint which is used throughout the Stanbol. It uses BundleContext to retrive TripleCollection s registered to OSGi environment. To be able to execute SPARQL queries on triple collections, they should be registered to the OSGi environment with the following parameters:

If a uri is not specified, the graph having highest service.ranking value will be chosen.


Nested Class Summary
 class SparqlEndpointResource.TripleCollectionInfo
           
 
Nested classes/interfaces inherited from class org.apache.stanbol.commons.web.base.resource.BaseStanbolResource
org.apache.stanbol.commons.web.base.resource.BaseStanbolResource.MenuItem
 
Field Summary
protected  org.apache.clerezza.rdf.core.access.TcManager tcManager
           
 
Fields inherited from class org.apache.stanbol.commons.web.base.resource.BaseStanbolResource
LINK_RESOURCES, NAVIGATION_LINKS, ROOT_URL, SCRIPT_RESOURCES, STATIC_RESOURCES_ROOT_URL, SYSTEM_CONSOLE, uriInfo
 
Constructor Summary
SparqlEndpointResource(javax.servlet.ServletContext servletContext)
           
 
Method Summary
 List<SparqlEndpointResource.TripleCollectionInfo> getTripleCollectionList()
           
 javax.ws.rs.core.Response handleCorsPreflight(javax.ws.rs.core.HttpHeaders headers)
           
 javax.ws.rs.core.Response postSparql(String graphUri, String sparqlQuery, javax.ws.rs.core.HttpHeaders headers)
          HTTP GET service to execute SPARQL queries on TripleCollections registered to OSGi environment.
 javax.ws.rs.core.Response sparql(String graphUri, String sparqlQuery, javax.ws.rs.core.HttpHeaders headers)
          HTTP GET service to execute SPARQL queries on TripleCollections registered to OSGi environment.
 
Methods inherited from class org.apache.stanbol.commons.web.base.resource.BaseStanbolResource
getConsoleBaseUri, getMainMenuItems, getNavigationLinks, getPublicBaseUri, getRegisteredLinkResources, getRegisteredScriptResources, getRequestUri, getRootUrl, getStaticRootUrl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tcManager

protected org.apache.clerezza.rdf.core.access.TcManager tcManager
Constructor Detail

SparqlEndpointResource

public SparqlEndpointResource(@Context
                              javax.servlet.ServletContext servletContext)
Method Detail

handleCorsPreflight

public javax.ws.rs.core.Response handleCorsPreflight(@Context
                                                     javax.ws.rs.core.HttpHeaders headers)

sparql

public javax.ws.rs.core.Response sparql(String graphUri,
                                        String sparqlQuery,
                                        @Context
                                        javax.ws.rs.core.HttpHeaders headers)
                                 throws org.apache.clerezza.rdf.core.sparql.ParseException,
                                        org.osgi.framework.InvalidSyntaxException
HTTP GET service to execute SPARQL queries on TripleCollections registered to OSGi environment. If a null, it is assumed that the request is coming from the HTML interface of SPARQL endpoint. Otherwise the query is executed on the triple collection specified by graphUri. But, if no graph uri is passed, then the triple collection having highest service.ranking value is chosen. Type of the result is determined according to type of the query such that if the specified query is either a describe query or construct query, results are returned in application/rdf+xml format, otherwise in pplication/sparql-results+xml format.

Parameters:
graphUri - the URI of the graph on which the SPARQL query will be executed.
sparqlQuery - SPARQL query to be executed
Returns:
Throws:
org.apache.clerezza.rdf.core.sparql.ParseException
org.osgi.framework.InvalidSyntaxException

postSparql

public javax.ws.rs.core.Response postSparql(String graphUri,
                                            String sparqlQuery,
                                            @Context
                                            javax.ws.rs.core.HttpHeaders headers)
                                     throws org.apache.clerezza.rdf.core.sparql.ParseException,
                                            org.osgi.framework.InvalidSyntaxException
HTTP GET service to execute SPARQL queries on TripleCollections registered to OSGi environment. For details, see sparql(String, String, HttpHeaders)

Throws:
org.apache.clerezza.rdf.core.sparql.ParseException
org.osgi.framework.InvalidSyntaxException

getTripleCollectionList

public List<SparqlEndpointResource.TripleCollectionInfo> getTripleCollectionList()


Copyright © 2010-2013 The Apache Software Foundation. All Rights Reserved.