fct_exec API Example

The following example shows how to use the fct_exec APi in vsp page to perform a "text" search for the word "Mike" assuming that exists in your Virtuoso RDF store (if not amend the query in the fct_example.vsp code sample below to search for text known to exist).

  1. The service can be used in the following sample fct_example.vsp:

    <?vsp declare txt, reply, tree any; declare timeout int; tree := xtree_doc (' <query> <text>Mike</text> <view type="text"/> </query> '); timeout := 3000; reply := fct_exec (tree, timeout); txt := string_output (); http_value (xslt ('virt://WS.WS.SYS_DAV_RES.RES_FULL_PATH.RES_CONTENT:/DAV/fct_example.xsl', reply, vector ()), null, txt); http (txt); ?>

  2. The xsl can be viewed here.
  3. The result of executing the fct_example.vsp should be: