Skip to content

Commit 660d57b

Browse files
jnussbaumirinaschubert
andauthored
docs: add explanation how an Excel file for list creation must be structured (DEV-533) (#159)
* explanation how to structure an excel list for dsp-tools excel command * add reviewer's feedback Co-authored-by: irinaschubert <irina.schubert@dasch.swiss> * improve the "Complete example": - add xmlns - correct mistake Co-authored-by: irinaschubert <irina.schubert@dasch.swiss>
1 parent e0ddbe2 commit 660d57b

7 files changed

Lines changed: 58 additions & 42 deletions

File tree

247 KB
Loading
-83.2 KB
Binary file not shown.
260 KB
Loading
10 KB
Binary file not shown.
9.67 KB
Binary file not shown.

‎docs/dsp-tools-excel.md‎

Lines changed: 49 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -74,72 +74,82 @@ For further information about properties, see [here](./dsp-tools-create-ontologi
7474

7575
[not yet implemented]
7676

77+
78+
79+
80+
7781
## Create a list from one or several Excel files
7882

83+
With dsp-tools, a JSON list can be created from one or several Excel files. The list can then be inserted into a JSON
84+
ontology and uploaded to a DSP server. It is possible to create multilingual lists. In this case, a separate
85+
Excel file has to be created for each language. The data must be in the first worksheet of each Excel file.
86+
It is important that all the Excel lists have the same structure. So, the translation of a label in one Excel
87+
sheet has to be in the exact same cell than the original was in the other Excel sheet (i.e. same cell index).
88+
89+
**It is recommended to work from the following templates:
90+
[description_en.xlsx](assets/templates/description_en.xlsx): The English list "description"
91+
[Beschreibung_de.xlsx](assets/templates/Beschreibung_de.xlsx): Its German counterpart "Beschreibung"**
7992

80-
With dsp-tools a JSON list can be created from one or several Excel files. The list can then be inserted into a JSON
81-
ontology and uploaded to a DSP server. The expected structure of the Excel files is described
82-
[here](./dsp-tools-create.md#lists-from-excel). It is possible to create multilingual lists. In this case, a separate
83-
Excel file has to be created for each language. The data has to be in the first worksheet of the Excel file(s).
84-
It is important that all the Excel lists have the same structure. So, the translation(s) of a label in one Excel
85-
sheet has to be in the exact same cell (i.e. with the same cell index) in its own Excel sheet.
93+
The Excel sheets must have the following structure:
94+
![img-list-english-example.png](assets/images/img-list-english-example.png)
95+
![img-list-german-example.png](assets/images/img-list-german-example.png)
8696

8797
Only Excel files with file extension `.xlsx` are considered. All Excel files have to be located in the same directory.
8898
When calling the `excel` command, this folder is provided as an argument to the call. The language of the labels has
89-
to be provided in the Excel file's file name after an underline and before the file extension, p.ex. `liste_de.xlsx`
90-
would be considered a list with German (`de`) labels, `list_en.xlsx` a list with English (`en`) labels. The language
91-
has to be a valid ISO 639-1 or ISO 639-2 language code.
99+
to be provided in the Excel file's file name after an underline and before the file extension, e.g.
100+
`Beschreibung_de.xlsx` would be considered a list with German (`de`) labels, `description_en.xlsx` a list with
101+
English (`en`) labels. The language has to be one of {de, en, fr, it}.
92102

93-
The following example shows how to create a JSON list from two Excel files which are in a directory called `lists`.
103+
The following example shows how to create a JSON list from two Excel files which are in a directory called `listfolder`.
94104
The output is written to the file `list.json`.
95105

96106
```bash
97-
dsp-tools excel lists list.json
107+
dsp-tools excel listfolder list.json
98108
```
99109

100-
The two Excel files `liste_de.xlsx` and `list_en.xlsx` are located in a folder called `lists`. `liste_de.xlsx`
101-
contains German labels for the list, `list_en.xlsx` contains the English labels.
110+
The two Excel files `Beschreibung_de.xlsx` and `description_en.xlsx` are located in a folder called `listfolder`.
102111

103112
```
104-
lists
105-
|__ liste_de.xlsx
106-
|__ list_en.xlsx
113+
listfolder
114+
|__ Beschreibung_de.xlsx
115+
|__ description_en.xlsx
107116
```
108117

109-
For each list node, the `label`s are read from the Excel files. The language code, provided in the file name, is then
110-
used for the labels. As node `name`, a simplified version of the English label is taken if English is one of the
118+
For each list node, the labels are read from the Excel files. The language code, provided in the file name, is then
119+
used for the labels. As node name, a simplified version of the English label is taken if English is one of the
111120
available languages. If English is not available, one of the other languages is chosen (which one depends on the
112121
representation of the file order). If there are two node names with the same name, an incrementing number is appended to
113122
the `name`.
114123

115124
```JSON
116125
{
117-
"name": "sand",
126+
"name": "description",
118127
"labels": {
119-
"de": "Sand",
120-
"en": "sand"
128+
"de": "Beschreibung",
129+
"en": "description"
121130
},
122131
"nodes": [
123132
{
124-
"name": "fine-sand",
125-
"labels": {
126-
"de": "Feinsand",
127-
"en": "fine sand"
128-
}
129-
},
130-
{
131-
"name": "medium-sand",
132-
"labels": {
133-
"de": "Mittelsand",
134-
"en": "medium sand"
135-
}
136-
},
137-
{
138-
"name": "coarse-sand",
133+
"name": "first-sublist",
139134
"labels": {
140-
"de": "Grobsand",
141-
"en": "coarse sand"
142-
}
135+
"de": "erste Unterliste",
136+
"en": "first sublist"
137+
},
138+
"nodes": [
139+
{
140+
"name": "first-subnode",
141+
"labels": {
142+
"de": "erster Listenknoten",
143+
"en": "first subnode"
144+
},
145+
"nodes": [
146+
{
147+
...
148+
}
149+
]
150+
},
151+
...
152+
]
143153
}
144154
]
145155
}

‎docs/dsp-tools-xmlupload.md‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -768,8 +768,14 @@ To do an incremental XML upload, one of the following procedures is recommended.
768768

769769
```xml
770770
<?xml version='1.0' encoding='utf-8'?>
771-
<knora xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
772-
shortcode="0001" default-ontology="anything">
771+
<knora
772+
xmlns="https://dasch.swiss/schema"
773+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
774+
xsi:schemaLocation="https://dasch.swiss/schema https://raw.githubusercontent.com/dasch-swiss/dsp-tools/main/knora/dsplib/schemas/data.xsd"
775+
shortcode="0001"
776+
default-ontology="anything">
777+
778+
<!-- permissions: see https://docs.dasch.swiss/DSP-API/05-internals/design/api-admin/administration/#permissions -->
773779
<permissions id="res-default">
774780
<allow group="UnknownUser">RV</allow>
775781
<allow group="KnownUser">V</allow>
@@ -978,7 +984,7 @@ To do an incremental XML upload, one of the following procedures is recommended.
978984
restype=":ThingPicture"
979985
id="obj_0004"
980986
permissions="res-default">
981-
<image>gaga.tif</image>
987+
<bitstream>gaga.tif</bitstream>
982988
<text-prop name=":hasPictureTitle">
983989
<text permissions="prop-default" encoding="utf8">This is the famous Lena</text>
984990
</text-prop>

0 commit comments

Comments
 (0)