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
Commits
c7fd4550
Commit
c7fd4550
authored
Jul 12, 2021
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
move
parent
16e70da9
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!8
F h5 cfood
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/caosadvancedtools/cfoods/h5.py
+0
-55
0 additions, 55 deletions
src/caosadvancedtools/cfoods/h5.py
with
0 additions
and
55 deletions
src/caosadvancedtools/cfoods/h5.py
+
0
−
55
View file @
c7fd4550
...
@@ -301,58 +301,3 @@ class H5CFood(AbstractFileCFood):
...
@@ -301,58 +301,3 @@ class H5CFood(AbstractFileCFood):
for
prop
in
target_structure
.
get_properties
():
for
prop
in
target_structure
.
get_properties
():
if
is_reference
(
prop
):
if
is_reference
(
prop
):
self
.
insert_missing_structure
(
prop
.
value
)
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
)
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