From f463b652d49e5e5cfee0b64056d097d70d64e559 Mon Sep 17 00:00:00 2001 From: florian <f.spreckelsen@inidscale.com> Date: Wed, 16 Jun 2021 17:02:42 +0200 Subject: [PATCH] WIP: Move inheritance section --- src/doc/tutorials/Data-Insertion.rst | 52 ++++++++++++++-------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/doc/tutorials/Data-Insertion.rst b/src/doc/tutorials/Data-Insertion.rst index 2ead1cc2..22a5548b 100644 --- a/src/doc/tutorials/Data-Insertion.rst +++ b/src/doc/tutorials/Data-Insertion.rst @@ -35,6 +35,32 @@ two more Properties and a RecordType: container.extend([a, b, epsilon, recordtype]) container.insert() + +Inheritance of Properties +------------------------- + +Suppose you want to insert a new RecordType “2D_BarkleySimulation” +that denotes spatially extended Barkley simulations. + +.. code:: python + + rt = db.RecordType(name="2D_BarkleySimulation", + description="Spatially extended Barkley simulation") + # inherit all properties from the BarkleySimulation RecordType + rt.add_parent(name="BarkleySimulation", inheritance="all") + rt.insert() + + print(rt.get_property(name="epsilon").importance) ### rt has a "epsilon" property with the same importance as "BarkleySimulation" + +The parameter ``inheritance=(obligatory|recommended|fix|all|none)`` of +``add_parent`` tells the server to assign obligatory:: properties of the +parent to the child automatically, recommended:: properties of the +parent to the child automatically, fix:: properties of the parent to the +child automatically, all:: properties of the parent to the child +automatically, none:: of the properties of the parent to child +automatically, + + Insert Actual Data ~~~~~~~~~~~~~~~~~~ @@ -108,32 +134,6 @@ Useful is also, that you can insert directly tabular data. With this example file `test.csv <uploads/4f2c8756a26a3984c0af09d206d583e5/test.csv>`__. -Inheritance of Properties -------------------------- - -Given, you want to insert a new RecordType “Fridge temperatur -experiment” as a child of the existing RecordType “Experiment”. The -latter may have an obligatory Property “date” (since every experiment is -conducted at some time). It is a natural way of thinking, that every sub -type of “Experiment” also has this obligatory Property—in terms of -object oriented programing the “Fridge temperatur experiment” *inherits* -that Property. - -:: - - rt = h.RecordType(name="Fridge temperatur experiment", - description="RecordType which inherits all obligatory properties from Experiment" - ).add_parent(name="Experiment", inheritance="obligatory").insert() - - print(rt.get_property(name="date").importance) ### rt now has a "date"-property -> this line prints "obligatory" - -The parameter *``inheritance=(obligatory|recommended|fix|all|none)``* of -``add_parent`` tells the server to assign obligatory:: properties of the -parent to the child automatically, recommended:: properties of the -parent to the child automatically, fix:: properties of the parent to the -child automatically, all:: properties of the parent to the child -automatically, none:: of the properties of the parent to child -automatically, File Update ----------- -- GitLab