1 Reply Latest reply on Aug 24, 2009 1:33 PM by Matperry-Oracle



      Two questions:

      1. We need to filter queries based on some simple arithmetic on date values, e.g., date_diff(dt1, dt2) > 7 days
      Is there a way we can extend filter functions (adding application spesific functions)?

      2. We need to filter sub-query results based on the number of triples that satisfy a given pattern, e.g.,
      count (?x  ws:phone_call  "david") > 10 {this is part of a larger query}
      Can we do this without using surrounding SQL?

        • 1. Re: Hello,

          For question 1, you can extend the filter functionality of SEM_MATCH by creating user-defined SQL functions and using these in the filter expression or a surrounding SQL WHERE clause. For example, you could create a date_diff function that uses to_timestamp to get Oracle timestamp values and then does arithmetic with these timestamp values.

          SELECT dt1, dt2
          FROM TABLE (SEM_MATCH(....))
          WHERE date_diff(dt1, dt2) > INTERVAL '7' DAY;

          For question 2, you will need to use surrounding SQL to do this, e.g.

          SELECT x
          FROM TABLE(SEM_MATCH(....))
          GROUP BY x HAVING COUNT(*) > 10;