Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-advanced-user-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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-advanced-user-tools
Merge requests
!8
F h5 cfood
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Expand sidebar
Merged
F h5 cfood
f-h5-cfood
into
dev
Overview
1
Commits
137
Pipelines
22
Changes
1
Merged
Henrik tom Wörden
requested to merge
f-h5-cfood
into
dev
4 years ago
Overview
1
Commits
137
Pipelines
22
Changes
1
https://gitlab.com/caosdb/caosdb-advanced-user-tools/-/merge_requests/78
0
0
Merge request reports
Viewing commit
c7fd4550
Prev
Next
Show latest version
1 file
+
0
−
55
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
c7fd4550
move
· c7fd4550
Henrik tom Wörden
authored
4 years ago
src/caosadvancedtools/cfoods/h5.py
+
0
−
55
View file @ c7fd4550
Edit in single-file editor
Open in Web IDE
Show full file
@@ -301,58 +301,3 @@ class H5CFood(AbstractFileCFood):
for
prop
in
target_structure
.
get_properties
():
if
is_reference
(
prop
):
self
.
insert_missing_structure
(
prop
.
value
)
def
update_structure
(
self
,
target_structure
:
db
.
Record
):
"""
compare the existing records with the target record tree created
from the h5 object
params
------
existing_structure:
retrieved entity; e.g. the top level identifiable
target_structure: db.Record
A record which may have references to other records. Must be a DAG.
"""
if
target_structure
.
_cuid
in
self
.
em
.
to_existing
:
self
.
update_matched_entity
(
target_structure
,
self
.
em
.
to_existing
[
target_structure
.
_cuid
])
for
prop
in
target_structure
.
get_properties
():
if
is_reference
(
prop
):
self
.
update_structure
(
prop
.
value
)
# TODO this can be moved to the general lib; it is the general case that
# two Records are compared and Properties of one are mapped to the other
# (unidirectional!)
def
update_matched_entity
(
self
,
target_record
,
existing_record
):
"""
update the Record existing in the server according to the Record
supplied as target_record
"""
for
parent
in
target_record
.
get_parents
():
if
parent
.
name
==
""
:
# TODO there should not be such a parent!!!
continue
assure_has_parent
(
existing_record
,
parent
.
name
,
force
=
True
)
if
target_record
.
description
is
not
None
:
# check whether description is equal
assure_has_description
(
existing_record
,
target_record
.
description
,
to_be_updated
=
self
.
to_be_updated
)
for
prop
in
target_record
.
get_properties
():
# check for remaining property types
if
isinstance
(
prop
.
value
,
db
.
Entity
):
if
prop
.
value
.
_cuid
in
self
.
em
.
to_existing
:
value
=
self
.
em
.
to_existing
[
prop
.
value
.
_cuid
].
id
else
:
value
=
prop
.
value
.
id
else
:
value
=
prop
.
value
assure_property_is
(
existing_record
,
prop
.
name
,
value
,
to_be_updated
=
self
.
to_be_updated
)
Loading