Category: Version 10

Visualize the Data Model in Oracle Policy Automation 12

Visualize the Data Model in Oracle Policy Automation 12

One of the very few areas where I feel that Oracle Policy Automation 10 is slightly better than Oracle Policy Automation 12 is in the area of visualisations. You may remember that in version 10, getting a visual representation for the data model was very easy. To visualize the Data Model in Oracle Policy Automation 12 is not so easy!

Visualize the Data Model in Oracle Policy Automation 12 - Data Model

And what was particularly useful was that it could be copied and pasted into Word or PowerPoint or any other productivity tool.

So the other day I was stuck on a plane and I began to think about this from an Oracle Policy Automation 12 perspective. The data model is stored, as you probably are aware, in the file called projectDataModel.xml which is in the Project folder. It is updated live as you add things to the data model via the Data tab of the Oracle Policy Modeller.

In this file there are, simply put, three sections. Entities and Attributes and Relationships.  There are other sections but these are not of interest today.

Visualize the Data Model in Oracle Policy Automation 12 XML

Oracle Policy Modeller 10 used a third-party component family, Mind Fusions – notably the Diagram Control (from to do a lot of the heavy graphical lifting in the old interface. That component is not, to my knowledge, used in Oracle Policy Modelling 12.

So what if we decided to use it again? The Mind Fusion controls are available as a free trial download. so I popped them into my free Visual Studio 17 and began to think about how to get this up and running. Remember, that this is not professional code because that is not what I do. It’s supposed to be interesting and valuable but you will have to do it properly yourselves.

Firstly, the XML structure is very simple indeed, so loading it into a DataGrid was a matter of a few lines of code. Create a DataSet, load the XML and display it as the data source of the DataGrid.

Private Sub btnLoad_Click(sender As Object, e As EventArgs) Handles btnLoad.Click
        Dim fileDialog As OpenFileDialog = New OpenFileDialog()

        fileDialog.Title = "Open File Dialog"
        fileDialog.InitialDirectory = "C:\Users\SADMIN\Desktop"
        fileDialog.Filter = "XML files (*.xml)|*.xml|All files (*.*)|*.*"
        fileDialog.FilterIndex = 1
        fileDialog.RestoreDirectory = True

        If fileDialog.ShowDialog() = DialogResult.OK Then

            FileNameAndPath = fileDialog.FileName

            dataGrid.DataSource = dataProject
        dataGrid.DataMember = "entity"
        dataGrid2.DataSource = dataProject
            dataGrid2.DataMember = "relationship"
        End If
    End Sub

So now we can display the data in a Grid. Boring, but useful.

OPA 12 - Data Model Visualisation Load DataGrid

The next step is to find out how to display the data in a Diagram. Since the Mind Fusion Diagram control is thoroughly modern, we need to add both a Diagram and a DiagramView to our Project. Then we can load the data into the Diagram, creating Nodes (boxes) and Links (connections) as we go.

I broke it into three steps : Global and it’s attributes, Child Entities and Attributes, and finally Relationships. All Nodes can have a tag so it is a good idea to store the unique identifier in there, which makes it easier to find the correct “source” or “target” for anything you want to do with your Nodes.

Here is a snippet from the initial build up of Child Entities:

    Private Sub CreateFirstLevelChildren(ByVal parentDiagNode As DiagramNode, ByVal parentXmlNode As XmlNode)
        ' Create a loop for all the entities in the XML
        For Each element As XmlElement In parentXmlNode.SelectNodes("entity")

            If element.GetAttribute("ref") <> "global" And element.GetAttribute("containment-parent-id") = "global" Then
                ' find all the first level children and add a new shape
                Dim node As ShapeNode = Diagram1.Factory.CreateShapeNode(nodeBounds)
                node.Brush = New MindFusion.Drawing.LinearGradientBrush(Color.Yellow, Color.BurlyWood, 20)
                node.Text = element.GetAttribute("name")
                node.Tag = element.GetAttribute("id")
                node.Shape = Shape.FromId("DividedProcess")
                'draw a line between parent and child
                Diagram1.Factory.CreateDiagramLink(parentDiagNode, node)
                'get the attributes
                CreateAttributes(node, element, element.GetAttribute("id"))
                'get the children of the child
                CreateChildren(node, element, element.GetAttribute("id"))
            End If

    End Sub

Given that the Mind Fusion Diagram supports Printing, Zooming and Saving to SVG or Visio, this means that you can be up and running in no time. I experimented with different viewers hooked in to some simple XPath-based searches of the XML file:

Standard Viewer

OPA 12 - Data Model Visualisation Load Viewer

The standard viewer let’s me move things around and generally get a good view of the data model. In addition, as I mentioned you can output to PDF, SVG or Visio. Pretty neat! I experimented with the relationships loaded on top of the data model and it can get pretty crowded, but now we can visualize the Data Model in Oracle Policy Automation 12.

OPA 12 - Data Model Visualisation Load Viewer Crowded

3D Viewer

Less flexible and probably misused in this case, the 3D Viewer looked good but didn’t really offer anything over and above the standard Viewer.

OPA 12 - Data Model Visualisation Load 3D Viewer

It just looked neat, I grant you!

Given that Office 2016 supports SVG Vector files – and for that matter PDF files – it was then a simple task to copy my data model into PowerPoint just by Saving As.

  If SaveFileDialog.ShowDialog() = DialogResult.OK Then
            Dim svgExp As MindFusion.Diagramming.Export.SvgExporter = New MindFusion.Diagramming.Export.SvgExporter()
            svgExp.ExternalImages = False
            svgExp.Export(DiagramView1.Diagram, SaveFileDialog.FileName)
        End If

See how easy it is! I really save time when creating slides and documents.

OPA 12 - Data Model Visualisation Load Viewer PPT

Visualize the Data Model in Oracle Policy Automation 12

That’s enough for now. If you are interested and want a copy of my kindergarten code just leave a comment and I will pass it on. My next job is to add a few options (Show / Hide attributes and the like, to make the content a little more customizable), and to investigate the Visual Browser concept that we had in Oracle Policy Modeller 10. That, on the other hand will be much more difficult!

Oracle Policy Automation 10 and 12 Differences in Architecture

Oracle Policy Automation 10 and 12 Differences in Architecture

Oracle Policy Automation 10 and 12 Differences in Architecture

Looking once again into our virtual postbag, this question comes from our reader Deepanshu working in India. Like many people out there, he is wondering about the migration from OPA 10 to OPA 12. He asks some very important questions. Here is the content of his query, and hopefully we can answer it in this post about Oracle Policy Automation 10 and 12 Differences. If you have a question, you can ask it on LinkedIn too: click here.

“I have 3 doubts regarding the upgrade from version 10 to 12.

  • 1. Do we need to use Oracle Policy Automation Hub as mandatory. Can’t we deploy without the Oracle Policy Automation Hub?
  • 2. After deployment, our project package are stored in a Database? Wont that make database too heavy.
  • 3. Most importantly, How to promote code from lower environment to higher environment for example. (DEV to SIT) or ( UAT to PROD)”

Firstly thanks very much to Deepanshu – his questions are very clear and are obviously of interest to many. So let’s try and find  the answers!

To begin, sometimes a picture is more effective than words. Here is an architectural overview of an on-premise Oracle Policy Automation instance.

Oracle Policy Automation 10 and 12 Differences Architecture Diagram with Bullet Points

Let’s run through the different bullet points of this Oracle Policy Automation 10 and 12 Differences post:

  1. The Oracle Policy Modelling experience is much enhanced, but similar to the version 10 application in principle. Collaboration between developers is much better, as is sharing of content (like modules in version 10 but much better, called inclusions).
  2. The development of a rulebase and compilation (or validation as it is now called) produces a Zip file. Just like version 10.
  3. Unlike version 10, to deploy the Zip file you do not deploy it manually. The Oracle Policy Modelling application does it for you, when you click to deploy the rulebase.
  4. The Oracle Policy Automation Hub application automatically logs the version of your Project you have deployed and keeps a history of your Deployments and whether they are deployed to Web Determinations or Determination Server or both. You can also set up users, manage permissions, log development versions (without deploying them – called uploading to the Repository) and set up shared data sources called Connections.
  5. The Web Determinations server is still present.
  6. The Determination server is still present.
  7. The Document Generation server is still present.
  8. The Hub uses either Oracle or MySQL as a database to store administrative and history information only. The Hub web application uses a very small database to store user, permissions and history data about your deployments. Your rulebases are not executed from this database. They are executed as in version 10.
  9. Users consume your Web Determinations as usual in a Browser
  10. Or they consume your Determination Server rulebase as a Web Service, as usual
  11. They can also, if they are authorised, use the Mobile App and work on a device-specific App.

So not much has changed, really. But the real big improvements are pretty obvious.

Oracle Policy Automation 10 and 12 Differences

  • Built in version tracking, deployment tracking and collaboration tools : no more messing to integrate (poorly) with external tools.
  • Much better control of users, access to developing rulebases, integrations and so on.
  • Much more modern interface for the Oracle Policy Modelling tool.

Finally, how to manage the fact that you will probably have a Development , a Test and a Production environment? (at least). Version 12 Private Cloud provides a command-line toolset to perform the following tasks without having to open Oracle Policy Modelling. These are big improvements and part of the Oracle Policy Automation 10 and 12 Differences that I really appreciate :

  • Creating a new OPA project
  • Exporting data model and mapping information from an OPA project
  • Running test cases for a policy rulebase
  • Integrating policy model deployment into continuous integration and testing cycles
  • Automating the process of moving policy models between testing, development and production environments
  • Changing the news information shown when users login to Policy Automation Hub
  • Changing the logging level for OPA applications to assist in troubleshooting application issues
  • Configuring the settings that OPA should use to communicate with a private cloud memcached instance

Faced with all this, the Oracle Policy Automation Hub is clearly a massive benefit, and the fact that you deploy projects using a Hub as a central repository and management tool is actually a big advantage. Technically speaking, could you deploy without an Oracle Policy Automation Hub? Possibly, but you would lose all the benefits. And the Oracle Policy Automation Hub is installed as part of the setup and installation routine so there is not much extra work involved.

Find out more online at the Oracle website or in Getting Started with Oracle Policy Automation.

Back to Basics 1 – Text in Oracle Policy Modeler

Back to Basics 1 – Text in Oracle Policy Modeler

Back to Basics 1 – Text in Oracle Policy Modeler

As the supermarkets are busy selling back to school themed items (actually they already seem to have moved on to Christmas!), I thought it would be appropriate to go over some basic but very key  Oracle Policy Modeler points that are not always made very clear to would-be Policy Modelers before they actually start writing. Over the next few days I hope to put some of these common traps in the refuse bin.

Basic  Idea #1

You can write using any verbs you like.

No you cannot. And although the thought of truly natural language might be a great idea, in practice we need constraints. And that is especially true when we work as a team. Just as developers have coding styles, writers of blog posts have writing styles, so Policy Modelers need writing styles too. The predefined list of verbs in your Oracle Policy Modeler can be found on the Project Tab, in the Language Pane – in version 12. In version 10 it is in the main menu under File, if my memory serves me well.

Oracle Policy Modeler - Verb List

What verbs can I use?

As the screenshot shows, the Custom Verbs… button – which you need to click to see the dialog box displayed here – lets you review both the standard (in English that means 392 verbs) and custom verbs if you have added any using the Add… button, which you can also see in the popup dialog on the right. Of course adding verbs sounds great, and can provide for a richer, domain-specific vocabulary, for example if you need to use the verb to allocate repeatedly in your world, then you will probably need to add it. But remember that this verb is added to the Project you are working on, so if there are multiple projects you will need to manage the addition of the verb to each of them.

PS : My Getting Started with Oracle Policy Automation book is now available in PDF!

OPA 10 – Missing “It is currently known”

OPA 10 – Missing “It is currently known” in a non-English language

This is an old one but it comes up now and again. Discussing with an Oracle Policy Modeler user (that was running Policy Automation in version 10.3) the other day, she remarked upon the lack of support for “it is currently known” or “it is currently unknown” in the rule language of choice of the user and how something that worked fine in another project (using a later version) did not compile at all in 10.3.  The solutions was to modify the relevant template file to provide the French mapping for the relevant English phrase.

In the installation folders of the relevant Oracle Policy Modeler, the templates.xml file can be located : choose the file relevant to the language needed (in this case for example the folder was “C:\….Policy Modeling\language\French\templates.xml”).

In this file we can see the different template of english phrases (for example, “currently known” or “currently unknown”) mappings to their non-English translations. If necessary, add the relevant Statement Operators and Variable Operators to the file, and restart Oracle Policy Modeler.

Check the existence of, or add t the following in the “statement operator” section of the file:

OPA 10 - Statement Operators

And the following  to the “variable operators” section of the same file:

OPA 10 -Variable Operators

These modifications allowed the documents in French to compile and be used. There are quite a few similar posts hanging around on the Internet, for example here is one involving Swedish.

Of course one should pay close attention to the XML file structure, and where possible use an existing language XML to help model the correct elements in your chosen language to create a valid XML structure for your templates.xml. In this case the easiest approach was to search for “currently known” in an existing file and work from there.

Logo by Southpaw Projects LLC