Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-pylib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-pylib
Commits
f463b652
Commit
f463b652
authored
4 years ago
by
florian
Browse files
Options
Downloads
Patches
Plain Diff
WIP: Move inheritance section
parent
0f771986
No related branches found
No related tags found
1 merge request
!12
DOC: Fix and extend documentation on inheritance
Pipeline
#8854
passed with warnings
4 years ago
Stage: code_style
Stage: linting
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/doc/tutorials/Data-Insertion.rst
+26
-26
26 additions, 26 deletions
src/doc/tutorials/Data-Insertion.rst
with
26 additions
and
26 deletions
src/doc/tutorials/Data-Insertion.rst
+
26
−
26
View file @
f463b652
...
@@ -35,6 +35,32 @@ two more Properties and a RecordType:
...
@@ -35,6 +35,32 @@ two more Properties and a RecordType:
container.extend([a, b, epsilon, recordtype])
container.extend([a, b, epsilon, recordtype])
container.insert()
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
Insert Actual Data
~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~
...
@@ -108,32 +134,6 @@ Useful is also, that you can insert directly tabular data.
...
@@ -108,32 +134,6 @@ Useful is also, that you can insert directly tabular data.
With this example file
With this example file
`test.csv <uploads/4f2c8756a26a3984c0af09d206d583e5/test.csv>`__.
`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
File Update
-----------
-----------
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment