Skip to content

Commit

Permalink
rename mapping-notes and make its purpose clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
elichad committed Jun 28, 2024
1 parent 42eae2f commit 5c847f1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ After verifying and adjusting the DataCite file, use the `-d` option to tell the

The project aims at decoupling the definition of the mapping between RO-Crates and DataCite from code. This means, that users can quickly change/add/remove mapping rules without code changes.

For more information, see [Mapping](docs/mapping.md).
To find out how each piece of RO-Crate metadata is converted to DataCite, see [How RO-Crate metadata is mapped to DataCite](docs/all-mappings.md).

For technical details on the implementation, see [Mapping](docs/mapping.md).

## Results

Expand Down
8 changes: 6 additions & 2 deletions docs/mapping-notes.md → docs/all-mappings.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Notes on Mapping
# How RO-Crate metadata is mapped to DataCite

DataCite is the data format used by InvenioRDM when uploading a record through the API. This document describes how different parts of the RO-Crate metadata are converted into the DataCite format.

Note that RO-Crate and DataCite each contain features that the other does not have, so it is difficult to create a fully accurate mapping and some information may be lost along the way. You should always check the outputs to ensure their accuracy before publishing your record.

## Mapping of resource type

Expand All @@ -23,7 +27,7 @@
- in case `name` does not exist, it falls back to using the value of `@alternativeName`
- in case neither of those exist, `title` is assigned `:unkn`

## Mapping of additional title
## Mapping of additional title

- `@alternativeName` is mapped to `additional_titles`
- a new array entry in `additional_titles` is added
Expand Down
8 changes: 4 additions & 4 deletions docs/mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The project aims at decoupling the definition of the mapping between RO-Crates a

Relative to the root folder of the package `src/rocrate_inveniordm/`, the mapping is implemented in `mapping/converter.py`. The mapping rules are defined in `mapping/mapping.json`. Processing functions and condition functions are defined in `mapping/processing_functions.py` and `condition_functions.py`, respectively.

A textual description including shortcomings and assumptions of the mapping can be found in [mapping-notes.md](./mapping-notes.md).
A human-friendly description of all mappings implemented, including shortcomings and assumptions, can be found in [all-mappings.md](./all-mappings.md).

## Mapping format

Expand Down Expand Up @@ -89,7 +89,7 @@ Specifying the DataCite field is done in a similar fashion.

### Processing functions

Processing functions are functions that are applied to the raw source value extracted from the RO-Crates metadata file. When a processing function wants to be applied to a mapping rule, the `processing` entry is assigned the value `$<function_name>`. The function then needs to be implemented in `/mapping/processing_functions.py`.
Processing functions are functions that are applied to the raw source value extracted from the RO-Crates metadata file. When a processing function wants to be applied to a mapping rule, the `processing` entry is assigned the value `$<function_name>`. The function then needs to be implemented in `mapping/processing_functions.py`.

**Example**

Expand All @@ -103,7 +103,7 @@ Given is the following mapping of the author type:
}
```

The value `Person` in the RO-Crates metadata file should be mapped to the value `personal`. Also, the value `Organization` should be mapped to the value `organizational`. The function `authorProcessing` can now be implemented in `/mapping/processing_functions.py` to achieve this logic. Note that the value of the `processing` key in the mapping rule and the function name need to coincide:
The value `Person` in the RO-Crates metadata file should be mapped to the value `personal`. Also, the value `Organization` should be mapped to the value `organizational`. The function `authorProcessing` can now be implemented in `mapping/processing_functions.py` to achieve this logic. Note that the value of the `processing` key in the mapping rule and the function name need to coincide:

```py
def authorProcessing(value):
Expand Down Expand Up @@ -137,7 +137,7 @@ The mapping of DOI identifiers looks as follows:
}
```

The mapping should only be executed, if the value in the `identifier` field in the RO-Crates metadata file is indeed a DOI identifier. This check can be achieved by defining the `doi` function in `/mapping/condition_functions.py`. Note that the value of the `onlyIf` key in the mapping rule and the function name need to coincide:
The mapping should only be executed, if the value in the `identifier` field in the RO-Crates metadata file is indeed a DOI identifier. This check can be achieved by defining the `doi` function in `mapping/condition_functions.py`. Note that the value of the `onlyIf` key in the mapping rule and the function name need to coincide:

```py
def doi(value):
Expand Down

0 comments on commit 5c847f1

Please sign in to comment.