Fun with Aliases and Strings

Fun with Aliases and Strings

This subject comes up quite a lot both in my workshops and on the Internet in general (in as much as we can say that Oracle Policy Automation occupies space on the Internet). Recently a reader (and a visitor to the Oracle Policy Automation Focus Group) and I discussed this. So we decided to use the opportunity to put up a simple example involving Aliases and Strings.

Many of you may know that there is already an example in the sample Projects,but it is perhaps too terse and complicated for new starters. So here goes. Consider the following. You have a bunch of entity instances – let us say, for the purpose of this demonstration, that they represent strings of text telling us about something important – a little bit like a ticker tape, or an old-fashioned messaging system.

  • Comments 01 : The Door Has Been Opened , 2019/01/01 09:00:00
  • Comments 02 : The Door Has Been Closed , 2019/01/01 09:01:00
  • Comments 03 : The Door Has Been Deactivated , 2019/01/01 09:05:00
  • Comments 04 : The Door Has Been Activated, 2019/01/01 09:06:00
  • Comments 05 : The Door Has Been Opened , 2019/01/01 09:11:00
  • etc.

And you need to concatenate the instances into one single text string, perhaps to be manipulated in some way, and presented to the user in a single label or text box. Perhaps you want something like this:

“Latest News:  1: Door Opened 01/01/2019 09:00, 2: Door Closed 02/01/2019…” (and so on).

At first it sounds quite easy : but then you find yourself remembering your Oracle Policy Training : this is not a typical language for programming, you cannot just do a for…each loop across the collection, nor can you do a for…next loop or indeed anything like that.

So having remembered all of that, where do we go?

Firstly, lets think about the data we have, in an Entity. For example:

Fun with Aliases and Strings

So what have we got here? Obviously an entity, with a bunch of attributes. And a couple of self-referencing relationships (the next ticker tapes and the closest ticker tape) whose source and target the ticker tape. These will be useful in building our little string, as we will see.

Don’t worry, it’s all on tape!

Let’s take a look at some Word rules and start to piece together what is going on.

The first rule is just an opportunity to get a numeric value from the original string. That’s very handy indeed.

The second rule establishes the relationship between any ticker tape item (let’s say 01, for example) and any others. If they have a number greater than 1, then they are considered to be next ticker tapes. “is a member of” is the long version of …”IsMemberOf”.

He said there would be fun with Aliases and Strings

The thing that throws learners is the other ticker tape. Is it another entity, or something else? It’s an alias. Firstly, prove it to yourself.

Go into Word and once you have written out that rule, put your cursor right in the middle of the other ticker tape. Then click Go To from the Ribbon. Oracle Policy Modeling will tell you “There is no attribute or relationship at the cursor position“.

Compare the…what now?

Think about it this way.

If I come to you and say, your job is to compare these ticker tapes with these ticker tapes, you might say…hang on, I’m confused – compare which ones with which ones?

But if I say, compare this ticker tape with these other ticker tapes ambiguity is removed. And that’s what an alias helps us do here.

What we are saying, in a roundabout way, is:  compare each ticker tape with the others. And organize them so for each one we know which are the “next ones in line” with our “is member of” rule. With four or so, this is what we might have:

And from the above you can see

  1. Comment number 02
  2. Is followed by Comments 03 and 04 as the next comments

From the official online help:

An alias is used as an alternative name to refer to an entity instance in rules. This is used to remove ambiguity when you want to reason with more than one instance of the same entity, to make it clear which entity instances the rules are referring to.

Check it out. And then we’ll move on to the next part shortly.


Richard Napier

Author: Richard Napier

Richard Napier joined Siebel Systems in 1999 and took up the role of managing the nascent Siebel University in Southern Europe. He subsequently was Director of Business Development and Education for InFact Group (now part of Business & Decisions) for 8 years. He now runs his Consulting and mentoring company, On Demand Consulting & Education Ltd and has run ODCE since 2010. Owner of the OPA Hub, he also is Co-Founder of the Siebel Hub.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Logo by Southpaw Projects LLC