How to configure entities import file - RISCOSS/riscoss-corporate GitHub Wiki
RISCOSS allow importing entities from an Excel file (XLST), the content of the file cointaining the information to be included can be customised. This customisation is done using an XML file. This file should be uploaded to the sytem and will be used when the user import entities from a file.
The configuration file must be uploaded to the system by administrators from the Import configuration page in the Admin section.
The current configuration file can be downloaded by clicking the anchor. It is also possible to replace the current file by uploading a new one.
There are two main sections which need to be configure in the import configuration file: Relationships and Entities.
The relationships block defines the layer hierarchy of the layers to be imported and how they are displayed in the XLSX file (defining the column where the information is placed). The layers hierarchy must correspond to the hierarchy defined in RISCOSS.
We need to define:
- The
<sheet_name>
where the entities are defined - The hierarchy of layers, using nested
<layer>
tags for each layer and adding a entity_column for each one attribute to define at which hierarchy level references each entity
An example of this configuration with a two level hierarchy:
<relationships>
<sheet_name>IPR Registry</sheet_name>
<layer entity_column="2">
<layer entity_column="6"/>
</layer>
</relationships>
The columns defined in this section correspond to the name of the Entity to be imported. For example, in this case, in column 2 there are the names of the entities corresponding to the root layer and in column 6 the names of the entities corresponding to the leaf layer.
Notice that this configuration allows any number of hierarchy levels.
The entities block defines, for every entity in every row, which information needs to be imported and how it is displayed in the xlsx file. Important: The row for the first entity to be imported cannot be customised, the first entity must be placed in row number 7 (being the first row numbered as 1).
Every information is defined as a <custom_field>
which has three elements:
- The id of the information. This can be configured in two different ways:
- Providing a
<id_column>
tag, which defines the column where the id is defined - Providing a
<id>
tag, which defines the id itself
- Providing a
- The value of the information. This can be configured in two different ways:
- Providing a
<value>
tag, which defines the value itself - Providing a
<value_column>
tag, which defines the column where the value is defined
- Providing a
- The
<prefix>
of the id, especially useful when using a<id_column>
tag
An example of a custom field:
<custom_field>
<id_column>4</id_column>
<value>1</value>
<prefix>#target:</prefix>
</custom_field>
Several custom fields can be defined per entity. To configure all the information of an <imported_entity>
element, it is necessary to provide:
- The
<sheet_name>
where the information is defined - The
<name_column>
, that is the column where the entity name is defined - The
<custom_information>
, which consists in a nested array of<custom_field>
tags
An example of an imported entity:
<imported_entity>
<sheet_name>IPR Registry</sheet_name>
<name_column>2</name_column>
<custom_information>
<custom_field>
<id_column>4</id_column>
<value>1</value>
<prefix>#parent:</prefix>
</custom_field>
<custom_field>
<id>Technology</id>
<value_column>3</value_column>
<prefix/>
</custom_field>
</custom_information>
</imported_entity>
Finally all imported entities are nested in a <entities>
tag, and both <relationships>
and <entities>
are nested in the root <config>
tag.
Here is an example of a possible complete configuration file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<config>
<relationships>
<sheet_name>IPR Registry</sheet_name>
<layer entity_column="2">
<layer entity_column="6"/>
</layer>
</relationships>
<entities>
<imported_entity>
<sheet_name>IPR Registry</sheet_name>
<name_column>2</name_column>
<custom_information>
<custom_field>
<id_column>4</id_column>
<value>1</value>
<prefix>#parent:</prefix>
</custom_field>
<custom_field>
<id>Technology</id>
<value_column>3</value_column>
<prefix/>
</custom_field>
</custom_information>
</imported_entity>
<imported_entity>
<sheet_name>IPR Registry</sheet_name>
<name_column>6</name_column>
<custom_information>
<custom_field>
<id_column>8</id_column>
<value>1</value>
<prefix>#</prefix>
</custom_field>
<custom_field>
<id>linking</id>
<value_column>9</value_column>
<prefix/>
</custom_field>
</custom_information>
</imported_entity>
</entities>
</config>
It is important to have a properly configuration file that fits with the information displayed in the XLSX file. If the configuration is not properly setted, the entities importation may not work.
For the example configuration file above, it is possible define a XLSX importation file which will look like the following:
In this example, we observe two hierarchy levels of entities, where entities' names are defined in columns 2 and 6 - as defined in the <relationships>
tag in the XML file.
For parent entities, there are two custom fields defined in <custom_information>
. One with a pre-defined id - in this case Technology and linking values are setted in columns 3 and 9 with the <value_column>
tag - and one with a pre-defined value - in this case, referring to columns 4 and 8.
Notice that it is not necessary to add redundant information, such as repeat for each row in the XLSX file the license of a parent once it has been defined before.