diff --git a/src/doc/index.rst b/src/doc/index.rst index ee266598cd6cfbcfaa6f54b8e39aa32e4c2b6915..9aa045349ab05d3f5130a7f33b38c7eca0c4f32e 100644 --- a/src/doc/index.rst +++ b/src/doc/index.rst @@ -15,6 +15,7 @@ This documentation helps you to :doc:`get started<getting_started>`, explains th Concepts <concepts> tutorials Caosdb-Crawler <crawler> + YAML Interface <yaml_interface> _apidoc/modules diff --git a/src/doc/yaml_interface.rst b/src/doc/yaml_interface.rst index d0ec15af9244082111b1e9289c71046bbde03a55..165e0814764e259b2e9257f3311008fa6a5a231a 100644 --- a/src/doc/yaml_interface.rst +++ b/src/doc/yaml_interface.rst @@ -6,7 +6,7 @@ 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. -.. highlight:: yaml +.. code-block:: yaml Project: obligatory_properties: @@ -40,18 +40,22 @@ Let's start with an example taken from https://gitlab.indiscale.com/caosdb/src/c datatype: FILE description: 'A table document associated with this recording' + This example defines 3 RecordTypes: + - A Project with one obligatory property "datatype" - A Person with a "firstName" and a "lastName" (as recommended properties) - A LabbookEntry with multiple recommended properties of different data types One major advantage of using this interface (in contrast to the standard python interface) is that properties can be defined and added to record types "on-the-fly". E.g. the three lines for "firstName" as sub entries of Person have two effects on CaosDB: + - A new property with name "firstName", datatype "TEXT" and description 'first name' is inserted (or updated, if already present) into CaosDB. - The new property is added as a recommended property to record type Person. Any furhter occurrences of "firstName" in the yaml file will reuse the definition provided for Person. Note the difference between the three property declarations of LabbookEntry: + - "Project": This record type is added directly as a property of LabbookEntry. Therefore it does not specify any further attributes. Compare to the original declaration of record type "Project". - "responsible": This defines and adds a property with name "responsible" to LabbookEntry which has a datatype "Person. Person is defined above. - "firstName": This defines and adds a property with the standard data type "TEXT" to record type Person. @@ -63,13 +67,13 @@ You can use any data type understood by CaosDB as datatype attribute in the yaml List attributes are a bit special: -.. highlight::yaml +.. code-block:: yaml datatype: LIST(DOUBLE) would declare a list datatype of DOUBLE elements. -.. highlight::yaml +.. code-block:: yaml datatype: LIST(Project) @@ -79,14 +83,14 @@ would declare a list of elements with datatype Project. Keywords -------- -- parent: Parent of this entity. -- importance: Importance of this entity. -- datatype: The datatpye of this property, e.g. TEXT, INTEGER or Project. -- unit: The unit of the property, e.g. "m/s". -- description: A description for this entity. -- recommended_properties: Add properties to this entity with importance "recommended". -- obligatory_properties: Add properties to this entity with importance "obligatory". -- suggested_properties: Add properties to this entity with importance "suggested". -- inherit_from_recommended: Inherit from another entity using the specified importance level including the higher importance level "obligatory". This would add a corresponding parent and add all obligatory and recommended properties from the parent. -- inherit_from_suggested including higher importance levels: Inherit from another entity using the specified importance level. This would add a corresponding parent and add all obligatory, recommended and suggested 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. +- **parent**: Parent of this entity. +- **importance**: Importance of this entity. +- **datatype**: The datatpye of this property, e.g. TEXT, INTEGER or Project. +- **unit**: The unit of the property, e.g. "m/s". +- **description**: A description for this entity. +- **recommended_properties**: Add properties to this entity with importance "recommended". +- **obligatory_properties**: Add properties to this entity with importance "obligatory". +- **suggested_properties**: Add properties to this entity with importance "suggested". +- **inherit_from_recommended**: Inherit from another entity using the specified importance level including the higher importance level "obligatory". This would add a corresponding parent and add all obligatory and recommended properties from the parent. +- **inherit_from_suggested including higher importance levels**: Inherit from another entity using the specified importance level. This would add a corresponding parent and add all obligatory, recommended and suggested 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.