3 Replies Latest reply on Jul 21, 2010 4:38 PM by alwu-Oracle

    Function in Rule

    673499
      I would like to calculate the difference between two times in rule ? is it possible? how?

      Edited by: user1632059 [koharudin] on Jul 16, 2010 6:47 AM
        • 1. Re: Function in Rule
          alwu-Oracle
          Please clarify a bit more. Do you want to calculate the difference between two times and then use the delta in an inferred triple?

          Thanks,

          Zhe Wu
          • 2. Re: Function in Rule
            673499
            yes, that is. in SWRL it's easy to write the rule

            Event(?e) ∧
            hasStartTime(?e, ?t1) ∧
            hasEndTime(?e, ?t2) ∧
            temporal:duration(?d, ?t1, ?t2, temporal:Minutes)
            → hasDuration(?e, ?d)

            ?d is return value in a minute .
            • 3. Re: Function in Rule
              alwu-Oracle
              For this kind of rules that generate new URIs or literals, there is no direct support yet. However, you can do the following.

              Assume you have a model named A, let's create a new empty model called B.

              1) Now run OWLPrime (or RDFS etc) inference using A and B together.

              2) Insert into model B with the results, (e hasDuration d), coming from a SEM_MATCH based SQL that implements your rule. Depending on your application logic, you may want to repeat 1) and 2) till a closure
              is reached.

              You may also be able to leverage the incremental inference feature as an optimization.

              Thanks,

              Zhe Wu