Welcome to the OPA Hub!


Category Archives: Determinations Server

The OPA Assess Method in Oracle Policy Automation Determinations #2

The OPA Assess Method in Oracle Policy Automation Determinations #2

Following from the first part of this tutorial about Oracle Policy Automation and the Determinations API, you finished the previous post with your system all ready to go for the initial use of the Web Service and the two methods. Firstly, you will use the ListGoals method to practice but also to learn an important step, then the Assess Method (Oracle Documentation). In the setup of the previous part, we deliberately ensured that anonymous access would not be possible. As a result, you will need to do some extra work before you can try out your Web Service.

Viewing the ListGoals Request

If you open the ListGoals folder in the SOAP UI interface and examine Request 1, you will see something very similar to the following:

The OPA Assess Method in Oracle Policy Automation Determinations - ListGoals

 

Notice that in the example, I have edited the “show-version” tag to read “true” instead of the “?” which was previously present. Many times in the following examples you will need to either edit such elements, or remove them completely if the information is not mandatory. Clicking the green triangle present in the top left hand corner of the window does not, however, get us any kind of useful response. Rather we have an error, telling us that the request we sent did not contain information sufficient to authenticate our request.

Adding the Header information for the SOAP Request

The following screenshot shows the editing you will need to do in your request (on the left hand pane) in order to proceed any further. The header information will be needed in any request you make (ListGoals or Assess methods) in this environment at the current time.

The OPA Assess Method in Oracle Policy Automation Determinations : Authentication

Once you have made these changes, save the header somewhere useful since you will need it all the time in the following examples.

Click the green triangle again. If you are still getting error messages in the right hand side pane, remember that the OPA Hub User you are authenticating with, must have permission to use the Determinations API. Check that by logging in to the Oracle Policy Automation Hub as a Hub Administrator, and viewing the details of the user in question. For ease of viewing, I have highlighted the setting that needs to be checked in order for the user to be allowed to perform the steps you are trying to do:

Viewing the Results

Hopefully, your next attempt at clicking the green triangle is more successful. Here is an example of the result you might have, if you are usin the same Project as I demonstrated in the first part of this post.

The OPA Assess Method in Oracle Policy Automation Determinations : ListGoals Response

The following annotations might be useful

  1. Notice the version information. If you set the request “show-version” to false, this section will not appear.
  2. The global entity is clearly marked.
  3. Notice this attribute does not have a readable Id. If you have forgotten to add names to your important attributes, you will see auto-generated Ids like this one. This should be your cue to go back to your Project, add a name, upload and deploy your new version.
  4. This entity has a name.
  5. The entity name, text and type are all clearly visible.

TIP : You will probably want to go back and add names for all of the attributes (race date, imminent race, and so on) and deploy that version.

What have you obtained?

The output has listed the top-level goals for the Project. In our case, there are Global and entity-level goals that can be inferred by providing the right information to perform an assessment. The ListGoals lists, as it’s name suggests, the goals you can obtain outcomes for.

Armed with this information you are ready to go further. Let’s suppose you are interested in the goal called “h_status” in my example. We can attempt to obtain some output.

Assess Method Initial Call

Our first call will be made using a very cut-down version of the complete request. Since our Project contains no Properties, no Change Points and since we are going to ask for the same level of information about all of our attributes and get a level pf outcome information that is the same, no matter whether we are receiving (whether the outcome is uncertain or certain), the request can be cut down to look like this;

The OPA Assess Method in Oracle Policy Automation Determinations : Assess Request 1

Notice the outcome section where we have asked for the values of the horse and the horse status, and the global attribute race_date which we have entered as our request input. The result, assuming you have been using the same Project, would be something like the response below.

The OPA Assess Method in Oracle Policy Automation Determinations : Assess Response 1

In this output, the following areas are highlighted :

  1. The race date is reiterated
  2. The entity instances of the horse entity are shown, each with the name and the status
  3. The attributes are inferred as you would expect

Outcome Styles and Assess Method

In this first request, you set outcome style to “value-only”. Two other choices are possible at this juncture.  Change the outcome style for the horse status to “base-attributes”, as in the example shown below.

The OPA Assess Method in Oracle Policy Automation Determinations : Assess Request 2

Upon executing the request, you will notice that the outcome has more detail. This information is very useful, since it highlights the base attributes that are needed to infer the horse status. In this case specifically, the date of the race.

The OPA Assess Method in Oracle Policy Automation Determinations : Assess Response 2

Finally, change the outcome style of the same attribute to “decision-report”. Now the output will include the tree of decisions that lead to the output:

The OPA Assess Method in Oracle Policy Automation Determinations : Assess Response 2

So far so good  – Assess Method

So it is clear that the outcome style can not only assist us in understanding which attributes are needed as input (base attributes) but also in understanding the decision that was made (decision report). In the next part of this series we will investigate other tags in the request and response.

The OPA Assess Method in Oracle Policy Automation Determinations #1

The OPA Assess Method in Oracle Policy Automation Determinations #1

In this short series we are going to walk through using your Oracle Policy Automation Hub, which you have set up perhaps using our step-by-step guide, to create and execute a Web Service call using the OPA Assess method. This will require you to have the following ready to hand

  1. SOAP UI for testing purposes
  2. An Oracle Policy Automation Hub in your self-study environment
  3. Word and Excel
  4. The correct version of the Oracle Policy Modelling application for your Oracle Policy Automation Hub

Let’s get started:

For the purposes of this example, I created a simple Project that uses the following attributes. The details are not really important, but here is the rundown and the explanation.

  1. An entity named “the horse” and another called “the jockey”
  2. A relationship of type 1:1 between the horse and the jockey whose text is “the horse’s jockey”
  3. An attribute called “the jockey’s number” in addition to the default identifier attribute “jockey” which is automatically created
  4. An attribute called “the horse’s status”
  5. A Global attribute called “the date of the race”
  6. Make sure “all the instances of the horse” and “all the instances of the jockey” are changed to “the horses” and “the jockeys”
  7. Make sure that all attributes, entities and relationships have names specified. In my case for the relationships I used contracted versions of the actual text, such as “thehorsesjockey” and “thehorses” and “thejockeys”. You can use whatever you would like.

The following “rules” were added. In Excel, the horses are instantiated. The logic is puerile and not important.

OPA Assess Method

Then a couple of extra goals are set up in a Word document.

OPA Assess Method - Word RulesThe main reason for having this silly structure is to be able to demonstrate handling the following :

  1. Passing Global attributes and Entity attributes in the Request
  2. Returning Inferred Instances in the Response as well as other goals

Now you can upload your version to the Repository and Deploy the Project. Once deployed, log in to the Oracle Policy Automation Hub and make the following changes for the Project in question, in the Deployments section: change the available access methods:

OPA Assess Method Setup

This ensures that for testing purposes, your Project is only available through Determinations API.

Verify that in the Permissions section, the username and password is required for Determinations API calls.

OPA Assess Method Permissions

Next, ensure that the user that you intend to use for the Web Service access, has the Determinations API access as part of their permissions:

OPA Assess Method

Finally, click the Web Service URL in the Deployment details for your Project and save the resulting file to a suitable location, ready for use in SOAP UI. This takes a couple of steps.

You will have to enter your username and password. If you are unable to proceed past this point, check that your user has the permissions shown in the previous screenshot. Now download the most recent (in terms of version) Web Service definition by clicking the link shown. This is the file that you need in SOAP UI.

Open Soap UI and create a New SOAP Project for the OPA Assess Method. The dialog box for the New Project will look a little like this. The items marked are as follows:

  1. The file you just saved
  2. A name you want to give to this series of tests

OPA Assess Method Soap UI Setup

Once the Web Service definition has been imported you should be looking at something like this, in the SOAP UI window:

OPA Assess Method

Well done on getting this far, you are now ready to test and investigate your Web Service. In part two, you will configure both of the available methods (Assess and ListGoals) in order to complete your work. Onward to part two!

OPA – Entities Adventures – Setting up Entities

Entities in Policy Automation

One of the funnest parts of the Oracle Policy Automation Training which I regularly deliver are the “Entity” chapters. These chapters (sadly rather short, and positioned right at the end of the week, limiting the time we can spend on them) introduce something that most students have already guessed at long before we get there: There must be more than just creating attributes and writing rules – what happens when I have two members of the same family, or three cars, or five Service Requests….

You can insert any typical Enterprise Software entity model in the end of the phrase above. Since this is such an interesting and sometimes challenging part of the course, I thought we could have some fun looking at entity functions, attributes and so on in a series of posts.

Getting Started

So let’s set the scene : consider the following entity diagram:

OPA Cars Workshops Model Start

We will build it in the next few posts, and then extend and manipulate it in various ways to demonstrate Entity Functions and more.

So starting from scratch, let’s look at a couple of common traps to begin with.

Creating the Entities

Beginning with a new Project and a new Properties File, create two new Entities that are children of the Global Entity.

Common trap 1 : There is, in this model, no need to create a “singleton” Entity for the workshop. Any atttribute that belongs to the “workshop” can be added to the Global Entity.

 

OPA - Car and Mechanic Entities

 

 

Common trap 2 : As soon as you create the Entities, remember to edit the “Containment Relationship” text. If you want to create rules to count or sum mechanics or cars, then you probably want to be writing rules like this :

OPA - Total Number of Cars Long Text

OPA - Total Number of Cars Short Text

 

 

 

But if you go ahead and try it now, the only thing that will work is the following text, or the long version of it. The problem is the default Containment Relationshop text is something like “All instances of XXX” (where XXX is the Entity name).

OPA - Total Number of Cars with Containment Relationship Text Demonstration

 

 

So you would in this case be advised to change the Containment Relationship Text from the default as shown above, to something a little more friendly.

OPA - Containment Relationship Text Edited

 

 

Doing this right now has many advantages, not least readability, but also avoiding common build errors such as “Entity XXX is defined twice”.

If you are writing your Rulebase and rules in another language, watch out for more of the same. For example, the same Entities built in French would give us the following basic grammatical error in the standard Containment Relationship text:

 

OPA - Entity Model French Grammar

“Toutes les instances du mécanicien” would at least be grammatically correct, although as in English this would be unfriendly for business users. So we would change the Containment Relationship text to “toutes les voitures” and “tous les mécaniciens” –  then we could write the following rule without hindrance.

OPA - French Rule with Containment Relationship Text Edited Short Version

 

 

Common trap 3 – Never assume that in two different languages, the syntax will be correctly shown in the Function Reference. A close look in the French Function Reference gives us two versions of the InstanceCount, one long and one short, as is often the case:

OPA - Error in Function Reference FR and EN

 

 

For the purposes of comparison I have put the English and French side by side. There is an error in the French Function Reference mentioning that the Entity (ent) is the required input argument for the function, when in fact it is the Relationship Text (relationship) that is required, as correctly stated in the English version.

In the next post we will continue to work with our Entities and add some attributes and rules to the mix. Until next time.

Entities Adventures 1