Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CaosDB Crawler
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
CaosDB Crawler
Commits
ba7dc1e1
Commit
ba7dc1e1
authored
1 year ago
by
Alexander Schlemmer
Browse files
Options
Downloads
Patches
Plain Diff
DOC: added a few source code comments to the sync graph
parent
5384dcdc
No related branches found
No related tags found
2 merge requests
!178
FIX: #96 Better error output for crawl.py script.
,
!167
Sync Graph
Pipeline
#51237
failed
1 year ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/caoscrawler/sync_graph.py
+8
-3
8 additions, 3 deletions
src/caoscrawler/sync_graph.py
with
8 additions
and
3 deletions
src/caoscrawler/sync_graph.py
+
8
−
3
View file @
ba7dc1e1
...
@@ -62,6 +62,8 @@ def _for_each_scalar_value(node: SyncNode, condition: Callable[[Any], bool], kin
...
@@ -62,6 +62,8 @@ def _for_each_scalar_value(node: SyncNode, condition: Callable[[Any], bool], kin
it returns True for the property value, the action is executed.
it returns True for the property value, the action is executed.
kind (str): Either
"
remove
"
or
"
set
"
depending on whether you want to remove the property or replace the property.
kind (str): Either
"
remove
"
or
"
set
"
depending on whether you want to remove the property or replace the property.
value (Callable): A function returning a new value that is set as the property value. This function receives the old value as the single argument.
value (Callable): A function returning a new value that is set as the property value. This function receives the old value as the single argument.
Last review by Alexander Schlemmer on 2024-05-24.
"""
"""
for
p
in
node
.
properties
:
for
p
in
node
.
properties
:
if
isinstance
(
p
.
value
,
list
):
if
isinstance
(
p
.
value
,
list
):
...
@@ -122,7 +124,7 @@ class SyncGraph():
...
@@ -122,7 +124,7 @@ class SyncGraph():
Usage:
Usage:
- Initialize the Graph with a list of entities. Those will be converted to the SyncNodes of the
- Initialize the Graph with a list of entities. Those will be converted to the SyncNodes of the
graph.
graph.
- SyncNodes that can be merged are automatically merged and SyncNodes where the exist
a
nce can
- SyncNodes that can be merged are automatically merged and SyncNodes where the exist
e
nce can
be determined are automatically removed from the list of unchecked SyncNodes:
be determined are automatically removed from the list of unchecked SyncNodes:
graph.unchecked.
graph.unchecked.
- You manipulate the graph by setting the ID of a SyncNode (either to a valid ID or to None).
- You manipulate the graph by setting the ID of a SyncNode (either to a valid ID or to None).
...
@@ -132,6 +134,8 @@ class SyncGraph():
...
@@ -132,6 +134,8 @@ class SyncGraph():
- Ideally, the unchecked list is empty after some manipulation.
- Ideally, the unchecked list is empty after some manipulation.
- You can export a list of entities to be inserted and one of entities to be updated with
- You can export a list of entities to be inserted and one of entities to be updated with
export_record_lists.
export_record_lists.
Last review by Alexander Schlemmer on 2024-05-24.
"""
"""
def
__init__
(
self
,
entities
:
list
[
db
.
Entity
],
identifiableAdapter
:
IdentifiableAdapter
):
def
__init__
(
self
,
entities
:
list
[
db
.
Entity
],
identifiableAdapter
:
IdentifiableAdapter
):
...
@@ -168,8 +172,9 @@ class SyncGraph():
...
@@ -168,8 +172,9 @@ class SyncGraph():
if
self
.
_identifiable_is_needed
(
node
):
if
self
.
_identifiable_is_needed
(
node
):
self
.
_set_identifiable_of_node
(
node
)
self
.
_set_identifiable_of_node
(
node
)
# everything in unchecked has no ID nor path. Thus, it must be possible to create an
# everything in unchecked neither das have an ID nor a path.
# identifiable.
# Thus, it must be possible to create an
# identifiable which is checked using the following function:
for
node
in
self
.
unchecked
:
for
node
in
self
.
unchecked
:
self
.
identifiableAdapter
.
check_identifying_props
(
node
)
self
.
identifiableAdapter
.
check_identifying_props
(
node
)
...
...
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