Skip to content
Snippets Groups Projects
Verified Commit ed0e3126 authored by Daniel Hornung's avatar Daniel Hornung
Browse files

DOC: Some small changes to the YAML documentation.

parent a3a77458
No related branches found
No related tags found
2 merge requests!54REL: Release 0.5.0,!51Some small changes to the YAML documentation.
Pipeline #27062 passed with warnings
...@@ -13,9 +13,8 @@ This documentation helps you to :doc:`get started<getting_started>`, explains th ...@@ -13,9 +13,8 @@ This documentation helps you to :doc:`get started<getting_started>`, explains th
Getting started <README_SETUP> Getting started <README_SETUP>
Concepts <concepts> Concepts <concepts>
tutorials The Caosdb Crawler <crawler>
Caosdb-Crawler <crawler> YAML data model specification <yaml_interface>
YAML Interface <yaml_interface>
_apidoc/modules _apidoc/modules
......
YAML-Interface
--------------
The yaml interface is a module in caosdb-pylib that can be used to create and update ===============================
YAML data model specification
===============================
The ``caosadvancedtools`` library features the possibility to create and update
CaosDB models using a simplified definition in YAML format. CaosDB models using a simplified definition in YAML format.
Let's start with an example taken from https://gitlab.indiscale.com/caosdb/src/caosdb-advanced-user-tools/-/blob/dev/unittests/model.yml. Let's start with an example taken from `model.yml
<https://gitlab.indiscale.com/caosdb/src/caosdb-advanced-user-tools/-/blob/dev/unittests/model.yml>`__
in the library sources.
.. code-block:: yaml .. code-block:: yaml
...@@ -44,7 +48,7 @@ Let's start with an example taken from https://gitlab.indiscale.com/caosdb/src/c ...@@ -44,7 +48,7 @@ Let's start with an example taken from https://gitlab.indiscale.com/caosdb/src/c
This example defines 3 ``RecordType``s: This example defines 3 ``RecordTypes``:
- A ``Project`` with one obligatory property ``datatype`` - A ``Project`` with one obligatory property ``datatype``
- A Person with a ``firstName`` and a ``lastName`` (as recommended properties) - A Person with a ``firstName`` and a ``lastName`` (as recommended properties)
...@@ -69,8 +73,10 @@ Note the difference between the three property declarations of ``LabbookEntry``: ...@@ -69,8 +73,10 @@ Note the difference between the three property declarations of ``LabbookEntry``:
If the data model depends on record types or properties which already exist in CaosDB, those can be If the data model depends on record types or properties which already exist in CaosDB, those can be
added using the ``extern`` keyword: ``extern`` takes a list of previously defined names. added using the ``extern`` keyword: ``extern`` takes a list of previously defined names.
Datatypes Datatypes
--------- =========
You can use any data type understood by CaosDB as datatype attribute in the yaml model. You can use any data type understood by CaosDB as datatype attribute in the yaml model.
...@@ -90,7 +96,7 @@ would declare a list of elements with datatype Project. ...@@ -90,7 +96,7 @@ would declare a list of elements with datatype Project.
Keywords Keywords
-------- ========
- **parent**: Parent of this entity. - **parent**: Parent of this entity.
- **importance**: Importance of this entity. Possible values: "recommended", "obligatory", "suggested" - **importance**: Importance of this entity. Possible values: "recommended", "obligatory", "suggested"
...@@ -105,7 +111,7 @@ Keywords ...@@ -105,7 +111,7 @@ Keywords
- **inherit_from_obligatory**: Inherit from another entity using the specified importance level. This would add a corresponding parent and add all obligatory properties from the parent. - **inherit_from_obligatory**: Inherit from another entity using the specified importance level. This would add a corresponding parent and add all obligatory properties from the parent.
Usage Usage
----- =====
You can use the yaml parser directly in python as follows: You can use the yaml parser directly in python as follows:
...@@ -124,3 +130,6 @@ the model with a CaosDB instance, e.g.: ...@@ -124,3 +130,6 @@ the model with a CaosDB instance, e.g.:
.. code-block:: python .. code-block:: python
model.sync_data_model() model.sync_data_model()
.. LocalWords: yml projectId UID firstName lastName LabbookEntry entryId textElement labbook
.. LocalWords: associatedFile extern Textfile DataModel
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment