2 Replies Latest reply on Mar 10, 2016 1:00 PM by yenier

    Score Oracle Text using orardf:textContains

    yenier

      Hi:

       

      I need to know if Oracle Text returned score value when the orardf:textContains function is used.

       

      For example, I'm running, and it works, the following SPARQL query:

       

      SELECT s, o

      FROM TABLE(SEM_MATCH('select ?s ?o

      WHERE

      { ?s <http://myhost.com.br/CITY#NAME>|

      <http://myhost.com.br/CITY#LOCALIZATION>|

      ?o FILTER (orardf:textContains(?o, "fuzzy(York, 70, 1, weight)") ).

      }', SEM_Models('rdf_model'), NULL, NULL, NULL));

       

      But, I want to know (if it's possible) the score of match with the above query, I'll hope and/or like something like this:


      SELECT s, o, scr

      FROM TABLE(SEM_MATCH('select ?s ?o (score(1) as ?scr)

      WHERE

      { ?s <http://myhost.com.br/CITY#NAME>|

      <http://myhost.com.br/CITY#LOCALIZATION>|

      ?o FILTER (orardf:textContains(?o, "fuzzy(York, 70, 1, weight)",1) ).

      }', SEM_Models('rdf_model'), NULL, NULL, NULL));

       

      With the following rows as results:

       

      soscr
      http://myhost.com.br/CITY/287 York100
      http://myhost.com.br/CITY/31York100
      http://myhost.com.br/CITY/563New York94

       

      Thanks a lot,


      ytor

        • 1. Re: Score Oracle Text using orardf:textContains
          Matperry-Oracle

          Hi ytor,

           

          An orardf:textScore() function is available but is not officially supported at the moment due to some table function limitations. You have the right idea. The query below should work

           

          SELECT s, o, scr

          FROM TABLE(SEM_MATCH('select ?s ?o (orardf:textScore(1) as ?scr)

          WHERE

          { ?s <http://myhost.com.br/CITY#NAME>|

          <http://myhost.com.br/CITY#LOCALIZATION>|

          ?o FILTER (orardf:textContains(?o, "fuzzy(York, 70, 1, weight)",1) ).

          }', SEM_Models('rdf_model'), NULL, NULL, NULL,NULL,' REWRITE=F DISABLE_NO_MERGE '));

           

          Depending on the query, you may see "ORA-29908: missing primary invocation for ancillary operator."

          Note the query hints in the SEM_MATCH options argument. REWRITE=F is needed because score only works with the start-fetch-close table function interface, and DISABLE_NO_MERGE will reduce the number of ORA-29908 errors, but in some cases the ORA-29908 errors are unavoidable.

           

          Thanks,
          Matt

          1 person found this helpful
          • 2. Re: Score Oracle Text using orardf:textContains
            yenier

            Hello Matperry-Oracle:

             


            Thank you very much for answering to my problem. Truly this solution is very helpful for my project.


            It would be interesting that some features of the orardf: textScore() function are described in the documentation even if they are in testing phase, which it could also be clarified in the documentation.


            Thanks again,


            ytor