dsp-tools is able to process Excel files and output the appropriate JSON or XML file. The JSON/XML file can then be used to create the ontology on the DSP server or import data to the DSP repository. dsp-tools can also be used to create a list from an Excel file.
With dsp-tools the resources
section used in a data model (JSON) can be created from an Excel file. Only the first
worksheet of the Excel file is considered and only XLSX
files are allowed. The resources
section can be inserted
into the ontology file and then be uploaded onto a DSP server.
The Excel sheet must have the following format:
The expected columns are:
name
: The name of the resourcesuper
: The base resource of the resourceen
,de
,fr
,it
: The labels of the resource in different languages, at least one language has to be provided
For further information about resources, see here.
With dsp-tools the properties
section used in a data model (JSON) can be created from an Excel file. Only the first
worksheet of the Excel file is considered and only XLSX files are allowed. The properties
section can be inserted into
the ontology file and then be uploaded onto a DSP server.
The Excel sheet must have the following format:
The expected columns are:
name
: The name of the propertysuper
: The base property of the propertyobject
: The resource the property refers to if it is a link property (property derived fromhasLinkTo
)en
,de
,fr
,it
: The labels of the property in different languages, at least one language has to be providedgui_element
: The GUI element for the propertyhlist
: In case of list values the according list
For further information about properties, see here.
[not yet implemented]
With dsp-tools a JSON list can be created from one or several Excel files. The list can then be inserted into a JSON ontology and uploaded to a DSP server. The expected format of the Excel files is described here. It is possible to create multilingual lists. In this case, a separate Excel file has to be created for each language. The data has to be in the first worksheet of the Excel file(s). It is important that all the Excel lists have the same structure. So, the translation(s) of a label in one Excel sheet has to be in the exact same cell (i.e. with the same cell index) in its own Excel sheet.
Only Excel files with file extension .xlsx
are considered. All Excel files have to be located in the same directory.
When calling the excel
command, this folder is provided as an argument to the call. The language of the labels has to
be provided in the Excel file's file name after an underline and before the file extension, p.ex. liste_de.xlsx
would
be considered a list with German (de
) labels, list_en.xlsx
a list with English (en
) labels. The language has to be
a valid ISO 639-1 or ISO 639-2 language code.
The following example shows how to create a JSON list from two Excel files which are in a directory called lists
. The
output is written to the file list.json
.
dsp-tools excel lists list.json
The two Excel files liste_de.xlsx
and list_en.xlsx
are located in a folder called lists
. liste_de.xlsx
contains
German labels for the list, list_en.xlsx
contains the English labels.
lists
|__ liste_de.xlsx
|__ list_en.xlsx
For each list node, the label
s are read from the Excel files. The language code, provided in the file name, is then
used for the labels. As node name
, a simplified version of the English label is taken if English is one of the
available languages. If English is not available, one of the other languages is chosen (which one depends on the
representation of the file order). If there are two node names with the same name, an incrementing number is appended to
the name
.
{
"name": "sand",
"labels": {
"de": "Sand",
"en": "sand"
},
"nodes": [
{
"name": "fine-sand",
"labels": {
"de": "Feinsand",
"en": "fine sand"
}
},
{
"name": "medium-sand",
"labels": {
"de": "Mittelsand",
"en": "medium sand"
}
},
{
"name": "coarse-sand",
"labels": {
"de": "Grobsand",
"en": "coarse sand"
}
}
]
}, ...
After the creation of the list, a validation against the JSON schema for lists is performed. An error message ist printed out if the list is not valid. Furthermore, it is checked that no two nodes are the same.