Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

There 's is a new functionality that allows allowing you to export and delete old data of from an ontology from the realtime real-time databases. In this tutorial, we are going to explain how to configure an ontology to achieve it, as well as and how to consult the files created by that this process creates.

Ontology configuration

Create/Update an ontology, and go to the 'Advanced Settings' tab.


As you can see, there 's is an option called 'Delete from realtimedb'. If you check it, you will have to choose a time threshold (1 month by default) from which the data will be deleted.

...

We strongly recommend the use of GridFS, as it uses a distributed storage system, while directory files don'tdoes not.


Retrieving exported files

Whether you selected GridFS or Directory as storage, you will be able to access (CRUD) those exported files, either through the binary repository page in controlpanel or using the REST service exposed for the binary repository.

1. Controlpanel binary files management

If you go to the path /controlpanel/files/list, you will se a list of files belonging to your user. 

Those files that are named with name the following pattern as follows: (ontology)_(timestamp).json, will be become exported files created by the deletion process.

As explained in this tutorial, binary files can be shared with users of the platform, and can also can be made public. If the file is public, you can access it (read only) without any kind of authentication, from anywhere, for example from a notebook (example at the end of this tutorial).

The 'copy url to clipboard' copies the external url for accessing the file.

...

Notebook example

In this example, we will illustrate how we can retrieve an exported file within a notebook and load its data.

1. The file is public

In case that If the file is public, we won't you do not need any kind of authentication, we you just need to make a simple wget request:

If the public file is not public, we this will get give a 403 response:


2. The file is not public

Whether the file is shared or not, being if the file private, we will need to provide an authentication header:

  • Authentication: Bearer {token}

If we you were previously authenticated via Oauth2 in the platform, then we you can use this header

  • X-OP-APIKey: {user token}

Otherwise, we you need to provide a user token header. This token is the same you used for authentication through the Api Manager of the platform. You can retrieve it in the path /controlpanel/apimanager/token/list.

Here is the example:

-X-OP-APIKey

...

In this case, the file contains instances of the Ontology 'Ticket'.

With Spark, we can read, load and print JSON data.

...