Temporal Reasoning in Oracle Policy Automation #1 : Time Travel

A while ago I was asking a friend what was the most frustrating and complicated thing when they started working with Oracle Policy Automation. Temporal reasoning came up pretty quickly, and after speaking with other friends and colleagues it definitely ranks highly on the list of most people’s bugbears. There have been lots of excellent articles and posts about this subject on other sites, and in the final part of the series I will share a set of useful links. But we are going to examine the topic over the course of the next few posts on the OPA Hub Website.

But now, into the subject. Let’s first of all consider some of the basics. What is all this about. Consider the following situation: I ask you for your date of birth, so that I can find out how old you are.

If I ask you the question this time next year, then the answer will be of course, different. But nothing has changed in my input data. You still have the same date of birth. But the nature of the response is that it changes over time. If that didn’t make sense, then my favourite is definitely the most obvious one for many people. How much money do you have in your bank account? And did you have the same amount in there last week?

This bank account example usually does it for most people! And what is more, the bank account example allows us to consider the next part of the temporal puzzle. Open a new Project in Oracle Policy Automation and create a new attribute called the temporal bank balance, of type Currency. Start the Debugger. Enter a value of 1200 for the bank balance.

Temporal Reasoning in Oracle Policy Automation Introduction

But what does that value actually mean? When did you have that money in your account?

Let’s add some more data to our Debugger session. Open the Change points >> dialog and add three lines. This is where the magic happens. This data will help us begin to see the concept of temporal reasoning.

Temporal Reasoning in Oracle Policy Automation Change Points Debugger

Add three change points, for the first, second and third of July (1000, 1100, 1500) . Looking at the data, we can use some Oracle Policy Automation Functions to understand how this data is actually represented.

In a Word document, enter the following rules (note that the dates are based on the ones I suggested):

Temporal Reasoning in Oracle Policy Automation Rules 1

Return to the Debugger and let’s look at the values.

Temporal Reasoning in Oracle Policy Automation Debug Result

Observe the values for the  three days in July are perhaps exactly what you are expecting. The ValueAt function has provided you the value on the date you specified. The surprises perhaps are from the other two. The bank balance today (assuming today is a date after the third of July and that you used the same data as my example ) is listed as 1500. In this case, Oracle Policy Automation has found that the last change point was July 3rd, and gives you that value. In summary – according to the data you entered, there was no change after the 3rd. Finally, the amount on June 30th, outside the data points you gave, is the amount you entered in the debugger right at the beginning.

If you right-click the temporal bank balance, and select Temporal Visualisation, then click the Temporal Visualisation tab on the left, the data is displayed visually:

Temporal Reasoning in Oracle Policy Automation Final

So in this first post, we have learned how to enter temporal data, and we have used a new temporal reasoning function to get the value on a specific date. In the second part of the post series, we will look at some more typical cases using temporal data and some more functions. More details can be found online of course.

Thanks for reading and see you soon!