Virtuoso Facets Web Service CURL Example with search string "napoleon"


curl -H "Content-Type: text/xml" -d @post.xml  http://lod.openlinksw.com/fct/service

Where 'post.xml' document contains query document:


<?xml version="1.0"?>
<query xmlns="http://openlinksw.com/services/facets/1.0" inference="" same-as="">
  <text>napoleon</text>
  <view type="text" limit="5" offset=""/>
</query>

Produces the following response:


<fct:facets xmlns:fct="http://openlinksw.com/services/facets/1.0/">
<fct:sparql>
   SELECT  ?s1 AS ?c1,
           ( bif:search_excerpt 
             ( bif:vector 
               ( 'napoleon' ), 
               ?o1
             )
           ) AS ?c2, 
           ?sc, 
           ?rank 
     WHERE {
             {{ SELECT  ?s1, 
                        (?sc * 3e-1) AS ?sc, 
                        ?o1, 
                        (sql:rnk_scale (<LONG::IRI_RANK> (?s1))) AS ?rank  
                  WHERE { ?s1  ?s1textp      ?o1                             . 
                          ?o1  bif:contains  '"napoleon"'  
                               OPTION (score ?sc) 
                        }
                  ORDER BY  DESC (?sc * 3e-1 + sql:rnk_scale (<LONG::IRI_RANK> (?s1)))  
                  LIMIT     5
                  OFFSET    0 
              }}
            }
</fct:sparql>
<fct:time>3531</fct:time>
<fct:complete>yes</fct:complete>
<fct:timeout>0</fct:timeout>
<fct:db-activity>  23.1KR rnd  13.29KR seq  80.41KP disk  1.341MB /    472 messages</fct:db-activity>
 <fct:result type="text">
  <fct:row>
    <fct:column datatype="trank"><![CDATA[7.8]]></fct:column>
    <fct:column datatype="erank"><![CDATA[7.184050388930453]]></fct:column>
    <fct:column datatype="url" shortform="dbpedia:Napoleon_Dynamite"><![CDATA[http://dbpedia.org/resource/Napoleon_Dynamite]]></fct:column>
    <fct:column><![CDATA[Napoleon Wybuchowiec]]></fct:column>
    <fct:column><![CDATA[<span class="srch_xerpt"><b>Napoleon</b> Dynamite <b>Napoleon</b> Dynamite no original um filme de longa metragem de com dia baseado no curta...</span>]]></fct:column>
  </fct:row>
  <fct:row>
    <fct:column datatype="trank"><![CDATA[7.8]]></fct:column>
    <fct:column datatype="erank"><![CDATA[7.184050388930453]]></fct:column>
    <fct:column datatype="url" shortform="dbpedia:Napoleon_Dynamite"><![CDATA[http://dbpedia.org/resource/Napoleon_Dynamite]]></fct:column>
    <fct:column><![CDATA[Napoleon Wybuchowiec]]></fct:column>
    <fct:column><![CDATA[<span class="srch_xerpt"><b>Napoleon</b> Dynamite <b>Napoleon</b> Dynamite no original um filme de longa metragem de com dia baseado no curta...</span>]]></fct:column>
  </fct:row>
  <fct:row>
    <fct:column datatype="trank"><![CDATA[7.5]]></fct:column>
    <fct:column datatype="erank"><![CDATA[7.28072164871858]]></fct:column>
    <fct:column datatype="url" shortform="dbpedia:Charles_Napol%C3%A9on"><![CDATA[http://dbpedia.org/resource/Charles_Napol%C3%A9on]]></fct:column>
    <fct:column><![CDATA[Charles Napol???con Bonaparte, Duc de Montfort]]></fct:column>
    <fct:column><![CDATA[<span class="srch_xerpt">Charles <b>Napoleon</b> Bonaparte prins <b>Napoleon</b> f dd 19 oktober 1950 son till Louis <b>Napoleon</b> Bonaparte och...</span>]]></fct:column>
  </fct:row>
  <fct:row>
    <fct:column datatype="trank"><![CDATA[7.5]]></fct:column>
    <fct:column datatype="erank"><![CDATA[7.260916174007062]]></fct:column>
    <fct:column datatype="url" shortform="dbpedia:Napol%C3%A9o...%2C_Prince_Imperial"><![CDATA[http://dbpedia.org/resource/Napol%C3%A9on_Eug%C3%A8ne%2C_Prince_Imperial]]></fct:column>
    <fct:column><![CDATA[Napole????n Eugenio Luis Bonaparte]]></fct:column>
    <fct:column><![CDATA[<span class="srch_xerpt">Louis <b>Napoleon</b> Bonaparte <b>Napoleon</b> IV.</span>]]></fct:column>
  </fct:row>
  <fct:row>
    <fct:column datatype="trank"><![CDATA[6]]></fct:column>
    <fct:column datatype="erank"><![CDATA[8.727351287724161]]></fct:column>
    <fct:column datatype="url" shortform="dbpedia:1815"><![CDATA[http://dbpedia.org/resource/1815]]></fct:column>
    <fct:column><![CDATA[1815 ????????????]]></fct:column>
    <fct:column><![CDATA[<span class="srch_xerpt">... kes kuuta <b>Napoleon</b> Bonaparte julistautuu uudelleen Ranskan keisariksi. <b>Napoleon</b> Bonaparten satap iv inen keisarikunta Ranskassa Vuoden 1812 sota p ttyi Yhdysvaltain ja Ison...</span>]]></fct:column>
  </fct:row>
 </fct:result>
</fct:facets>

Related