sparqlvirtuoso

Checking Virtuoso version via SPARQL


Is there any way to check the version of Virtuoso in SPARQL, not by going to the server as an admin? Sort of like in Postgres, you would do select version().


Solution

  • As documented on OpenLink's website --

    You can leverage Virtuoso's built-in-functions, such as sys_stat, and the associated bif: SPARQL prefix, to use SPARQL to interrogate the server for various details, such as --

    SELECT
          ( bif:sys_stat('st_dbms_name')          AS ?name )
          ( bif:sys_stat('st_dbms_ver')           AS ?version )
          ( bif:sys_stat('st_build_thread_model') AS ?thread )
          ( bif:sys_stat('st_build_opsys_id')     AS ?opsys )
          ( bif:sys_stat('st_build_date')         AS ?date )
          ( bif:sys_stat('git_head')              AS ?git_head )   
        # ( bif:sys_stat('st_lic_owner')          AS ?owner )
        # ( bif:sys_stat('st_lic_serial_number')  AS ?serial )
        
    WHERE
          {  ?s  ?p  ?o  }
    LIMIT 1
    

    The st_lic_owner and st_lic_serial_number arguments are only valid on the Commercial Edition, and will produce a SPARQL error on the Open Source Edition; hence, they're commented out here.

    The git_head argument is necessary to nail down the specific codebase revision from which the binary was built. It is not available if the binary was built from a ZIP or TGZ archive downloaded from GitHub; a git clone or similar must have been used.

    The above SPARQL query can also be run through an SQL interface (iSQL, ODBC, JDBC, etc.) by prepending the SPARQL keyword, and appending the ; SQL query terminator, as below --

    SPARQL
    SELECT
          ( bif:sys_stat('st_dbms_name')          AS ?name )
          ( bif:sys_stat('st_dbms_ver')           AS ?version )
          ( bif:sys_stat('st_build_thread_model') AS ?thread )
          ( bif:sys_stat('st_build_opsys_id')     AS ?opsys )
          ( bif:sys_stat('st_build_date')         AS ?date )
          ( bif:sys_stat('git_head')              AS ?git_head )   
        # ( bif:sys_stat('st_lic_owner')          AS ?owner )
        # ( bif:sys_stat('st_lic_serial_number')  AS ?serial )
        
    WHERE
          {  ?s  ?p  ?o  }
    LIMIT 1 ;