Skip to content
Snippets Groups Projects
Commit 0d20f45b authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

MAINT: further tests and docs

parent 5fc3e1c1
No related branches found
No related tags found
2 merge requests!22Release 0.3,!19MAINT: further tests and docs
Pipeline #14833 failed
...@@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
h5py is now an optional dependency h5py is now an optional dependency
- table importer implementations for csv and tsv - table importer implementations for csv and tsv
- string-in-list check for table imports - string-in-list check for table imports
- Documentation and test for the `extern` keyword used by the YAML interface
### Changed ### ### Changed ###
......
...@@ -5,6 +5,10 @@ from caosadvancedtools.cfoods.h5 import H5CFood ...@@ -5,6 +5,10 @@ from caosadvancedtools.cfoods.h5 import H5CFood
from caosadvancedtools.models.data_model import DataModel from caosadvancedtools.models.data_model import DataModel
from caosadvancedtools.models.parser import parse_model_from_yaml from caosadvancedtools.models.parser import parse_model_from_yaml
# for teseting existing data model parts for the YANL Interface
db.RecordType(name="TestRT1", datatype=db.TEXT).insert()
db.Property(name="TestP1", datatype=db.TEXT).insert()
model = parse_model_from_yaml("model.yml") model = parse_model_from_yaml("model.yml")
model.sync_data_model(noquestion=True) model.sync_data_model(noquestion=True)
......
...@@ -69,3 +69,6 @@ Report: ...@@ -69,3 +69,6 @@ Report:
- Publication - Publication
hdf5File: hdf5File:
datatype: REFERENCE datatype: REFERENCE
extern:
- TestRT1
- TestP1
...@@ -39,6 +39,9 @@ Let's start with an example taken from https://gitlab.indiscale.com/caosdb/src/c ...@@ -39,6 +39,9 @@ Let's start with an example taken from https://gitlab.indiscale.com/caosdb/src/c
table: table:
datatype: FILE datatype: FILE
description: 'A table document associated with this recording' description: 'A table document associated with this recording'
extern:
- Textfile
This example defines 3 ``RecordType``s: This example defines 3 ``RecordType``s:
...@@ -46,6 +49,9 @@ This example defines 3 ``RecordType``s: ...@@ -46,6 +49,9 @@ This example defines 3 ``RecordType``s:
- 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)
- A ``LabbookEntry`` with multiple recommended properties of different data types - A ``LabbookEntry`` with multiple recommended properties of different data types
- It is assumed that the server knows a RecordType or Property with the name
"Textfile".
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: 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:
...@@ -60,6 +66,8 @@ Note the difference between the three property declarations of ``LabbookEntry``: ...@@ -60,6 +66,8 @@ Note the difference between the three property declarations of ``LabbookEntry``:
- ``responsible``: This defines and adds a property with name "responsible" to ``LabbookEntry`, which has a datatype ``Person``. ``Person`` is defined above. - ``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``. - ``firstName``: This defines and adds a property with the standard data type ``TEXT`` to record type ``Person``.
If the data model depends on already existing parts, those can be added using the ``extern`` keyword.
Datatypes Datatypes
--------- ---------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment