• Topic
  • Discussion
  • VOS.VirtCheckSvrVersionViaSparql(Last) -- DAVWikiAdmin? , 2018-07-30 15:27:11 Edit WebDAV System Administrator 2018-07-30 15:27:11

    Interrogating attributes of a Virtuoso Server instance via SPARQL

    Sometimes you need to know the version or other details about the Virtuoso instance you're running SPARQL queries against, and only have access to the SPARQL interface, possibly through a proxy page that strips out the server version information included on the default /sparql page.

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


    PREFIX  bif:  <bif:>
    
    SELECT
      ( bif:sys_stat('st_dbms_name')          AS ?name )
      ( bif:sys_stat('st_dbms_ver')           AS ?version )
      ( bif:sys_stat('st_build_date')         AS ?build_date )
    
    ##   The following line must be commented for execution on 
    ##   builds produced before the switch from `cvs` to `git`;
    ##   it only works on versions later than v6.1.5
    
    # ( bif:sys_stat('git_head')              AS ?git_head )   
    
      ( bif:sys_stat('st_build_thread_model') AS ?thread )
      ( bif:sys_stat('st_build_opsys_id')     AS ?opsys )
    
    ##   The following two lines must be commented for execution 
    ##   on VOS; these only work on Enterprise Edition
    
    # ( bif:sys_stat('st_lic_owner')          AS ?owner )
    # ( bif:sys_stat('st_lic_serial_number')  AS ?serial )
    
    WHERE
      {  ?s  ?p  ?o  }
    LIMIT 1
    

    As noted in the SPARQL above, 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. Similarly, the git_head argument is only valid on builds produced after source code management was switched from cvs to git, circa v6.1.5, in March, 2012.

    The query output will resemble the following --

    name version build_date git_head thread opsys Sort in descending order owner serial
    OpenLink Virtuoso VDB Server         07.20.3228         Apr 10 2018         7913e54         -pthreads         Linux         LOD operated by OpenLink Software         opl-lod