Virtuoso Open-Source Edition

  • Topic
  • Discussion
  • VOS.VirtTipsAndTricksGuideBIFContainsOptions(Last) -- DAVWikiAdmin? , 2017-06-29 07:41:33 Edit WebDAV System Administrator 2017-06-29 07:41:33

    What free-text options can I use with bif:contains?

    Virtuoso supports use of several free-text options with bif:contains.

    OFFBAND

    See description for OFFBAND in this document.

    Note: OFFBAND is useful only if data comes via an Linked Data View and the source relational table uses this trick.

    SCORE

    SCORE is calculated as described in this document.
    SQL> SPARQL 
         SELECT ?s1 AS ?c1   , 
                       ?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  '"CNET"'  
                          OPTION ( SCORE ?sc )
                   } 
                 ORDER BY DESC (?sc * 3e-1 + sql:rnk_scale (<LONG::IRI_RANK> (?s1)))  
                 LIMIT 20  
                 OFFSET 0 
               }
             }
           };
    
    c1                                                sc      rank
    _________________________________________________________________________
    http://www.mixx.com/stories/45003360/justi...     3 	  5.881291583872891e-14
    http://www.mixx.com/stories/45099313/bing_...     2.7     5.881291583872891e-14
    http://dbpedia.org/resource/CBS_Interactive 	  1.5 	  5.881291583872891e-14
    http://dbpedia.org/resource/CBS_Interactive 	  1.5 	  5.881291583872891e-14
    
    
    4 Rows. -- 1 msec.
    

    View the results of the query execution on the LOD instance.

    SCORE_LIMIT

    SCORE_LIMIT works as it does in plain SQL free-text. See more details.
    SQL> SPARQL 
         SELECT  ?s   ,
                 ?sc 
         WHERE 
           { 
             ?s  ?p            ?o . 
             ?o  bif:contains  "tree" 
                 OPTION ( SCORE        ?sc , 
                          SCORE_LIMIT  20
                        )
           };
      
    s                                                                      sc
    VARCHAR                                                                INTEGER
    ________________________________________________________________________________   
    
                                                                          
    http://www.openlinksw.com/virtrdf-data-formats#default                 24
    http://www.openlinksw.com/virtrdf-data-formats#default                 24
    http://www.openlinksw.com/virtrdf-data-formats#sql-longvarbinary       21
    http://www.openlinksw.com/virtrdf-data-formats#sql-varchar-dt          20
    http://www.openlinksw.com/virtrdf-data-formats#sql-nvarchar-dt         20
    http://www.openlinksw.com/virtrdf-data-formats#sql-varchar-lang        20
    http://www.openlinksw.com/virtrdf-data-formats#sql-nvarchar-lang       20
    
    7 Rows. -- 2 msec.
    

    View the results of the query execution on the LOD instance.

    Related