Using the platform interpreter in the Notebooks
The platform includes, for the ANALYTICS role, a complete Notebook environment, or what is the same a web tool that allows Data Scientists to interactively analyze languages ​​and technologies such as Spark, R, Python, ...
With the Notebooks, a user can bring a file via shell and process it with Spark, e.g.:
and represent it via SQL:
But, in addition to this, the platform includes its own interpreter that allows working with the ontologies in this environment, allowing for example that the result of an algorithm can be saved in an ontology or represent the data of an ontology, or that an ontology serves as origin for an algorithm.
Let's see what we need to use this module and the interpreter.
- The first thing we need is to have an ANALYTICS Role. This role gives access to various tools, such as Notebooks and DataFlow. By default, this role can only be given by the Administrator user. Once you log on the platform with this Role, you will see an option of Menu ANALYTICS TOOLS that includes a tool set.
- Go to ANALYTICS TOOL> My Notebooks. From here, click and give a name to your Notebook. Once created, it will take you to a screen like this one:
The Notebook is made up of paragraphs. From you can access the options of each paragraph:
- For use the interpreter, start your paragraph with %onesaitplatform. The first thing you have to do is establish a connection with the platform (with the DigitalBroker). To do that, write something like this:
where the first parameter represents a Digital Client and the second its token.
Let's see how to create it. Access the menu:
Inside, press and select a name, description and the ontologies that you will handle from this Digital Client and the access you need. In this case: - After this, press
You will be returned to the list and see that your Digital Client (Client4Notebook) has been created,
If you select you can see the Token:
These are the two parameters that you must indicate in your connection: Client4Notebook and 674a6e05348a468787e5af4acdf5b3df
to execute the paragraph.
The remaining parts are much simpler .... - Once you have established the connection, you can make inquiries or inserts. Let's see a simple one:
- Or something more complex:
- This format of representing the output can be used as input to other processes ... but if you want to represent the data in a graphical component, then you must use the asZTable command that enables the representation:
Once inside, you can select the type of representation and, in Settings, what to paint. For example:
which will result in:
8. You can also insert in the ontology if you have permissions with the insert command that takes the ontology name as a parameter and a variable that could be created with another interpreter:
where instances is a variable put in context via Scala: