Description:
A TWC LOGD service that help users to proxy SPARQL endpoint access, cache SPARQL query results, and convert SPARQL query results into many different formats.
Source Code and Resources
SparqlProxy is a TWC LOGD service:
RESTful Service Interface Description
Parameter | Status | Description |
service-uri | stable | URI of SPARQL service. |
query | stable | SPARQL query string |
query-uri | stable | URI of SPARQL query. Note you can only use one of "query-uri" and "query" because they are mutually exclusive. |
output | stable (optional) | the output format. Default is xml. All values a listed as below: - xml => SPARQL/XML
- sparqljson => SPARQL/JSON
- exhibit => EXHIBIT/JSON
- gvds => GoogleViz/JSON
- csv => CSV
- html => HTML
- tablerow => Table(Row)
- tablecol => Table(Col)
To keep backward comparability, both "sparqljosn" and "sparql" can be used to output SPARQL/JOSN format. |
callback | experimental (optional) | callback function name. This param is only applicable to two output formats: exhibit, sparqljson |
tqx | experimental (optional) | for google visluziation api only. e.g. version:0.6;reqId:1;responseHandler:myQueryHandler |
refresh-cache | experimental (optional) | SparqlProxy use a cache by default. User may opt out (avoid caching) by setting "refresh-cache=on" in service request |
textoutput | experimental (optional) | set "text/plain" as content-type in HTTP response header, so users can view the result in browser. To enable it, add "textoutput=yes" in service request |
ui-option | experimental (optional) | SparqlProxy allow users to show the query of SPARQL query result. To enable it, add "ui-option=query" in service request |
Example Usage
- Example 1: Standard SPARQL protocol. Use string value for "query" parameter. It will output XML by default. "service-uri" is set to DBPedia.
- Example 2: Use online SPARQL query. Use the URL of SPARQL file for "query-uri" parameter, and use "gvds" for "output" to output Google Visualization Compatable JSON ).
- Example 3: Generate HTML fragment. Use the URL of SPARQL file for "query-uri" parameter, and use "tablecol" for "output" to output a fragment of html table to be embedded in dynamic HTML page).
- Example 4: refresh cache. Since query results may be cached to improve performance, users may add "refresh-cache=on" to refresh query results
Discussion
Q: Why use cache in sparqlproxy.
A: The use of cache in LOGD sparql endpoint has historical reasons. The cache capability is used specifically reduce load on repetitive queries over LOGD server (e.g. load dynamically generated web pages). The cache will automatically expire, or you may use "refresh-cache=on" option in RESTful request to bypass the cache.
Q: Why two sparqlproxy instances?
A: We maintain two sparqlproxy instances on LOGD server: http://logd.tw.rpi.edu/sparql dedicates to the LOGD sparql endpoint, and http://logd.tw.rpi.edu/ws/sparqlproxy.php allows users to access other sparql endpoints. Users may download the sparqlproxy code and install an instance on their own computer, allowing external users to access their internal triplestores.