How to leverage Machine Learning, Spatial and Graph in APEX applications – no license required

Michael Pickering May 26, 2020 3:59:42 PM

As of December 2019, Oracle has made Machine Learning, Spatial and Graph features available without the need for extra licenses. This also means that these features are now available to developers in the ‘Always Free’ ATP service. These features are all natively exposed and accessible to developers.


Put simply, spatial data is data that relates in some form to a location. One piece of spatial data can be used in conjunction with another to give useful intel about geometric features, perhaps the distance between two locations, the size of a given geographic area or simply whether a postcode exists within a defined area.

Spatial Data in APEX Applications

For a pithy, high-level description of Oracle Spatial, I can’t do better than the start of the Oracle Spatial User Guide:

‘Oracle Spatial is an integrated set of functions and procedures that enables spatial data to be stored, accessed, and analyzed quickly and efficiently in an Oracle database.’

In other words, Spatial lets you store data via geometric datatypes (e.g. co-ordinates), query that data (using specific procedures) and use it in a meaningful way (e.g. via graphical representation in tools such as APEX).

I recently attended a free Oracle hosted training course in London, which showcased some of the capabilities of Spatial and Machine Learning, and how these can be utilised by APEX. The Spatial example we worked though involved querying geometric data to determine whether an address appeared in a restricted airspace area. This simple example demonstrated the ability to store geometric data (fly zone info), query against address info and return a meaningful result – in this case via a plug-in.

As an APEX developer I am mainly interested in how to translate spatial data into something useful/interesting in an APEX application. Other than accessing the packages and tables directly, you can use a set of plugins to interface between APEX and spatial data, which I found on in the ‘Sample Geolocation Showcase’ app. The app contains a number of interesting features, using various plug-ins, mostly in combination with the Oracle HTML5 map plug-in to provide a visual representation of the data. For example, one nice feature is the ability to draw an ‘Area of Interest’ manually on the html5 map using polygons, the geometric data of which is then stored and retrievable for analysis.

Spatial Data in APEX Applications (1)

Clearly, the ability to custom define geographic areas and then analyse against some form of transactional data carries the potential for some useful data analytics.

Oracle Graph

‘Spatial and Graph’ is bundled together by Oracle as a concept and as such is referred to as if it is a single entity, however, most of the literature I can find on the subject seems to focus on the spatial element. The ‘graph’ part is actually a fairly definable and separate entity. Essentially, it is a set of analytical functionality that allow hitherto unknown patterns in data to be identified and represented in a highly visual format. There are two broad graph types, Property Graph and RDF (Resource Description Framework) Graph. Like spatial, Graph allows for a set of data types that support these graph types.

Machine Learning

Oracle Machine Learning is a set of APIs and functions that are used to analyse data, in order to draw insight into patterns of behaviour. Rather than use traditional programmed steps to reach a conclusion, ML will take a learned algorithm and apply it to a potentially vast pool of variables in order to answer a specific problem.

ML is accessible in your Cloud ATP account, in development tools, under Machine Learning Notebooks. This is where the creation and maintenance of the algorithms takes place.

Machine Learning in APEX Applications

To go back to the Oracle course I attended, the example we looked at involved a games company, who sought to answer the question ‘who is likely to buy our games’. This company has a database with a large amount of demographic data based on previous purchases. It would pretty simply to analyse the data to find out buying patterns based on a few variables (e.g. age, gender, education level). However, it order to draw real insight and predict which customer might buy which game, ML will allow you to ‘train’ an algorithm by using a set of sample data, where the patterns or results are already known. Once set, this can be applied to a large data set to predict buying patterns with a high level of accuracy, based on subtle associations. In this example therefore, the marketing can be targeted accordingly.

The link to APEX is fairly obvious – you can take these predictions and build them into sql queries and display as desired in APEX. In the example I looked at, this was as simply as a column in a view which displayed a Y or N depending on whether the customer was likely to purchase a game. Obviously underpinning this is a lot of complexity in terms of percentage and tolerance etc.

One key point around Machine Learning is how it could be applied to all sorts of organisation’s existing data to glean insight, there is no need to format the data specifically to just utilise ML going forward. In a previous life, I was an Oracle Forms developer for a construction company, which had a database of material purchase and labour data going back for decades, I can only imagine the value of insights that could be gleaned about supply chain behaviour if a data scientist were to examine it using ML!

For a more technical look at ML and APEX, see


The fact that Machine Learning, Spatial and Graph are now free and easily accessible via a free cloud ATP account means that there is an excellent opportunity for organisations to explore what benefits these technologies may give them, without having to commit too much up-front in terms of cost.




Author: Michael Pickering

Job Title: Oracle Development Consultant

Bio: Michael is a Development Consultant at DSP-Explorer. Having attained an MSc in Computer Based Information Systems, he began his career developing health-care reporting solutions, before moving to specialise in Oracle Forms and Reports in the construction industry. Here at DSP-Explorer he is part of a highly skilled development team providing APEX development solutions and training to both UK and international businesses.