Skip to content

Commit eaf2852

Browse files
committed
[tutorial] Add cardinality note
1 parent 8ee5bb8 commit eaf2852

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

doc/tutorial.rst

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -983,12 +983,14 @@ A cardinality is set via its convenience method:
983983
>>> # or
984984
>>> prop.val_cardinality = None
985985

986+
Please note that a set cardinality is not enforced. Users can set less or more entities than are specified allowed via a cardinality. Instead whenever a cardinality is not met, a warning message is displayed and any unment cardinality will show up as a Validation warning message whenever a document is saved or loaded.
987+
986988
Working with Validations
987989
------------------------
988990

989991
odML Validations are a set of pre-defined checks that are run against an odML document automatically when it is saved or loaded. A document cannot be saved, if a Validation fails a check that is classified as an Error. Most validation checks are Warnings that are supposed to raise the overall data quality of the odml Document.
990992

991-
When an odML document is saved or loaded, tha automatic validation will print a short report of encountered Validation Warnings and it is up to the user whether they want to resolve the Warnings. The odML document provides the ``validate`` method to gain easy access to the default validations. A Validation in turn provides not only a specific description of all encountered warnings or errors within an odML document, but it also provides direct access to each and every odML entity i.e. an odml.Section or an odml.Property where am issue has been found. This enables the user to quickly access and fix an encountered issue.
993+
When an odML document is saved or loaded, tha automatic validation will print a short report of encountered Validation Warnings and it is up to the user whether they want to resolve the Warnings. The odML document provides the ``validate`` method to gain easy access to the default validations. A Validation in turn provides not only a specific description of all encountered warnings or errors within an odML document, but it also provides direct access to each and every odML entity i.e. an ``odml.Section`` or an ``odml.Property`` where an issue has been found. This enables the user to quickly access and fix an encountered issue.
992994

993995
A minimal example shows how a workflow using default validations might look like:
994996

@@ -1013,7 +1015,7 @@ This will show that the validation has encountered two Warnings and also display
10131015
>>> ValidationWarning: Section[73f29acd-16ae-47af-afc7-371d57898e28] 'Section type not specified'
10141016
>>> ValidationWarning: Section[73f29acd-16ae-47af-afc7-371d57898e28] 'Name not assigned'
10151017

1016-
To fix the "Name not assigned" warning the Section can be accessed via the validation entry and used to directly assign a human readable name to Section in the original document. Re-running the validation will show, that the warning has been removed.
1018+
To fix the "Name not assigned" warning the Section can be accessed via the validation entry and used to directly assign a human readable name to the Section in the original document. Re-running the validation will show, that the warning has been removed.
10171019

10181020
>>> validation.errors[1].obj.name = "validation_example_section"
10191021
>>> # Check that the section name has been changed in the document
@@ -1025,7 +1027,7 @@ To fix the "Name not assigned" warning the Section can be accessed via the valid
10251027

10261028
Similarly the second validation warning can be resolved before saving the document again.
10271029

1028-
Please note that the automatic validation is run whenever a document is saved or loaded using the ``odml.save`` and ``odml.load`` functions as well as the ``ODMLWriter`` or the ``ODMLReader``. The validation is not run when using any of the lower level ``xmlparser``, ``dict_parser`` or ``rdf_converter`` classes.
1030+
Please note that the automatic validation is run whenever a document is saved or loaded using the ``odml.save`` and ``odml.load`` functions as well as the ``ODMLWriter`` or the ``ODMLReader`` class. The validation is not run when using any of the lower level ``xmlparser``, ``dict_parser`` or ``rdf_converter`` classes.
10291031

10301032
List of available default validations
10311033
*************************************
@@ -1114,7 +1116,7 @@ Users can write their own validation and register them either with the default v
11141116

11151117
A custom validation handler needs to ``yield`` a ``ValidationError``. See the ``validation.ValidationError`` class for details.
11161118

1117-
Custom validation handlers can be registered to be applied on ``odML`` (the odml Document), ``section`` or ``property``.
1119+
Custom validation handlers can be registered to be applied on "odML" (the odml Document), "section" or "property".
11181120

11191121
>>> import odml
11201122
>>> import odml.validation as oval
@@ -1141,8 +1143,8 @@ Custom validation handlers can be registered to be applied on ``odML`` (the odml
11411143
>>> # Display the errors reported by the validation
11421144
>>> print(custom_validation.errors)
11431145

1144-
Advanced knowledge on Values
1145-
----------------------------
1146+
Advanced Value features
1147+
-----------------------
11461148

11471149
Data type conversions
11481150
*********************
@@ -1178,8 +1180,6 @@ converted to integer and then back to float::
11781180

11791181
Links & Includes
11801182
****************
1181-
Please note, that this section is outdated but still valid.
1182-
11831183
Sections can be linked to other Sections, so that they include their defined
11841184
attributes. A link can be within the document (``link`` property) or to an
11851185
external one (``include`` property).
@@ -1211,8 +1211,6 @@ then set merge with the new object.
12111211

12121212
Terminologies
12131213
*************
1214-
Please note, that this section is outdated but still valid.
1215-
12161214
odML supports terminologies that are data structure templates for typical use cases.
12171215
Sections can have a ``repository`` attribute. As repositories can be inherited,
12181216
the current applicable one can be obtained using the

0 commit comments

Comments
 (0)