<docbook><section><title>VirtCheckSvrVersionViaSparql</title><title> Interrogating attributes of a Virtuoso Server instance via SPARQL</title> Interrogating attributes of a Virtuoso Server instance via SPARQL
<para>Sometimes you need to know the version or other details about the Virtuoso instance you&#39;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.</para>
<para>You can leverage Virtuoso&#39;s built-in-functions, such as <ulink url="http://docs.openlinksw.com/virtuoso/fn_sys_stat/">sys_stat</ulink>, and the associated bif: SPARQL prefix, to interrogate the server for various details, such as -- </para>
<programlisting>SELECT
  ( bif:sys_stat(&#39;st_dbms_name&#39;)          AS ?name )
  ( bif:sys_stat(&#39;st_dbms_ver&#39;)           AS ?version )
  ( bif:sys_stat(&#39;st_build_thread_model&#39;) AS ?thread )
  ( bif:sys_stat(&#39;st_build_opsys_id&#39;)     AS ?opsys )
  ( bif:sys_stat(&#39;st_build_date&#39;)         AS ?date )
# ( bif:sys_stat(&#39;st_lic_owner&#39;)          AS ?owner )
# ( bif:sys_stat(&#39;st_lic_serial_number&#39;)  AS ?serial )

WHERE
  {  ?s  ?p  ?o  }
LIMIT 1
</programlisting><para>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</para>
<para> The <ulink url="http://lod.openlinksw.com/sparql?default-graph-uri=&amp;qtxt=SELECT%0D%0A++%28+bif%3Asys_stat%28%27st_dbms_name%27%29++++++++++AS+%3Fname+%29%0D%0A++%28+bif%3Asys_stat%28%27st_dbms_ver%27%29+++++++++++AS+%3Fversion+%29%0D%0A++%28+bif%3Asys_stat%28%27st_build_thread_model%27%29+AS+%3Fthread+%29%0D%0A++%28+bif%3Asys_stat%28%27st_build_opsys_id%27%29+++++AS+%3Fopsys+%29%0D%0A++%28+bif%3Asys_stat%28%27st_build_date%27%29+++++++++AS+%3Fdate+%29%0D%0A++%28+bif%3Asys_stat%28%27st_lic_owner%27%29++++++++++AS+%3Fowner+%29%0D%0A++%28+bif%3Asys_stat%28%27st_lic_serial_number%27%29++AS+%3Fserial+%29%0D%0A%0D%0AWHERE%0D%0A++%7B++%3Fs+%3Fp+%3Fo++%7D%0D%0ALIMIT+1&amp;format=text%2Fhtml&amp;CXML_redir_for_subjs=121&amp;CXML_redir_for_hrefs=&amp;timeout=30000&amp;debug=on">query above</ulink> will produce <ulink url="http://lod.openlinksw.com/sparql?default-graph-uri=&amp;query=SELECT%0D%0A++%28+bif%3Asys_stat%28%27st_dbms_name%27%29++++++++++AS+%3Fname+%29%0D%0A++%28+bif%3Asys_stat%28%27st_dbms_ver%27%29+++++++++++AS+%3Fversion+%29%0D%0A++%28+bif%3Asys_stat%28%27st_build_thread_model%27%29+AS+%3Fthread+%29%0D%0A++%28+bif%3Asys_stat%28%27st_build_opsys_id%27%29+++++AS+%3Fopsys+%29%0D%0A++%28+bif%3Asys_stat%28%27st_build_date%27%29+++++++++AS+%3Fdate+%29%0D%0A++%28+bif%3Asys_stat%28%27st_lic_owner%27%29++++++++++AS+%3Fowner+%29%0D%0A++%28+bif%3Asys_stat%28%27st_lic_serial_number%27%29++AS+%3Fserial+%29%0D%0A%0D%0AWHERE%0D%0A++%7B++%3Fs+%3Fp+%3Fo++%7D%0D%0ALIMIT+1&amp;format=text%2Fhtml&amp;CXML_redir_for_subjs=121&amp;CXML_redir_for_hrefs=&amp;timeout=30000&amp;debug=on">output akin to the following</ulink> -- </para>

<table><title /><tgroup><thead /><tbody>
<row />
<row><entry>  OpenLink Virtuoso  VDB Server      </entry><entry>      07.20.3217      </entry><entry>      -pthreads      </entry><entry>      Linux      </entry><entry>      May  8 2016      </entry><entry>      OpenLink Software Web Site      </entry><entry>      openlink-www      </entry></row>
</tbody></tgroup></table>
<para> </para>
</section></docbook>