Virtuoso Open-Source Wiki
Virtuoso Open-Source, OpenLink Data Spaces, and OpenLink Ajax Toolkit
Advanced Search
Help?
Location: / Dashboard / Main / VirtCustomizeSPARQLEndpoint

Customizing the Virtuoso SPARQL Endpoint

This page will guide you through changing the SPARQL endpoint web page. You can create different variants of the page for different IRIs:

  1. The default SPARQL endpoint page is found in the procedure named WS.WS."/!sparql/", which is built from source code found in libsrc/Wi/sparql_io.sql.
  2. Copy the code from the above procedure, and load it to a different name, e.g., WS.WS."/!sparql_new/", through iSQL --

    SQL> CREATE PROCEDURE WS.WS."/!sparql_new/" ( INOUT path VARCHAR, INOUT params ANY, INOUT lines ANY ) {... http(' <p>TEST This query page is designed to help you test OpenLink Virtuoso</p> ... }; Done. -- 60 msec. SQL>

  3. Remove the VHost definition targeting the original page --

    SQL> DB.DBA.VHOST_REMOVE (lpath=>'/sparql');

  4. Add a VHost definition targeting your new page. The command follows this form --

    SQL> DB.DBA.VHOST_DEFINE ( lpath=>'/sparql/', ppath => '/your-function-name/', is_dav => 1, vsp_user => 'dba', opts => vector('noinherit', 1) );

    -- so, for this example --

    SQL> DB.DBA.VHOST_DEFINE ( lpath=>'/sparql/', ppath => '/!sparql_new/', is_dav => 1, vsp_user => 'dba', opts => vector('noinherit', 1) );

  5. Give the SPARQL user permission to execute your new page, following this form --

    SQL> GRANT EXECUTE ON WS.WS."your-function" TO "SPARQL" ;

    -- so, for this example --

    SQL> GRANT EXECUTE ON WS.WS."/!sparql_new/" TO "SPARQL" ;

    Note: you should use double quotes around name of "SPARQL" user and the upper case, to avoid confusion with the SPARQL keyword, you should always use double-quote wrappers and upper-case to refer to the "SPARQL" user.

  6. Set attributes on your new page, such that Virtuoso's HTTP server component will not treat it as a physical path (DAV or filesystem) to be read and compiled as a procedure, following the command form --

    SQL> registry_set ( '/your-function-name/', 'no_vsp_recompile' );

    -- so, for this example --

    SQL> registry_set ( '/!sparql_new/', 'no_vsp_recompile' );

  7. Access the new SPARQL endpoint, which should show your changes --



Powered By Virtuoso