Skip to content
Snippets Groups Projects

DOC: Fix and extend documentation on inheritance

Merged Florian Spreckelsen requested to merge f-doc-inheritance into dev
All threads resolved!
1 file
+ 26
26
Compare changes
  • Side-by-side
  • Inline
+ 26
26
@@ -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
-----------
Loading