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
77577f96
Commit
77577f96
authored
1 year ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
wip
parent
10b02c15
No related branches found
No related tags found
2 merge requests
!178
FIX: #96 Better error output for crawl.py script.
,
!167
Sync Graph
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/caoscrawler/sync_graph.py
+15
-17
15 additions, 17 deletions
src/caoscrawler/sync_graph.py
with
15 additions
and
17 deletions
src/caoscrawler/sync_graph.py
+
15
−
17
View file @
77577f96
...
@@ -150,7 +150,7 @@ class SyncGraph():
...
@@ -150,7 +150,7 @@ class SyncGraph():
self
.
backward_id_referenced_by
,
self
.
backward_id_referenced_by
,
)
=
self
.
_create_reference_mapping
(
self
.
nodes
)
)
=
self
.
_create_reference_mapping
(
self
.
nodes
)
#
self._mark_entities_with_path_or_id()
self
.
_mark_entities_with_path_or_id
()
def
set_id_of_node
(
self
,
se
:
SyncNode
,
node_id
:
Optional
[
str
]):
def
set_id_of_node
(
self
,
se
:
SyncNode
,
node_id
:
Optional
[
str
]):
"""
sets the ID attribute of the given SyncNode. If node_id is None, a negative Id will be
"""
sets the ID attribute of the given SyncNode. If node_id is None, a negative Id will be
...
@@ -407,37 +407,35 @@ class SyncGraph():
...
@@ -407,37 +407,35 @@ class SyncGraph():
def
_mark_entities_with_path_or_id
(
self
):
def
_mark_entities_with_path_or_id
(
self
):
"""
A path or an ID is sufficiently identifying. Thus, those entities can be marked as
"""
A path or an ID is sufficiently identifying. Thus, those entities can be marked as
checked
"""
checked
"""
for
semantic_entity
in
list
(
self
.
nodes
[::
-
1
]):
for
node
in
list
(
self
.
nodes
[::
-
1
]):
assert
len
(
semantic_entity
.
fragments
)
==
1
if
node
.
id
is
None
and
node
.
path
is
None
:
entity
=
semantic_entity
.
fragments
[
0
]
if
entity
.
id
is
None
and
entity
.
path
is
None
:
continue
continue
if
entity
.
path
is
not
None
:
if
node
.
path
is
not
None
:
try
:
try
:
existing
=
cached_get_entity_by
(
path
=
entity
.
path
)
existing
=
cached_get_entity_by
(
path
=
node
.
path
)
except
EmptyUniqueQueryError
:
except
EmptyUniqueQueryError
:
existing
=
None
existing
=
None
if
existing
is
not
None
:
if
existing
is
not
None
:
semantic_entity
.
identify_with
(
existing
)
node
.
identify_with
(
existing
)
# at this point,
semantic_entity
has an ID if it is existing
# at this point,
node
has an ID if it is existing
treated_before
=
self
.
get_equivalent
(
semantic_entity
)
treated_before
=
self
.
get_equivalent
(
node
)
if
treated_before
is
None
:
if
treated_before
is
None
:
if
semantic_entity
.
id
is
None
or
semantic_entity
.
id
<
0
:
if
node
.
id
is
None
or
node
.
id
<
0
:
self
.
set_missing
(
semantic_entity
)
self
.
set_missing
(
node
)
else
:
else
:
self
.
set_existing
(
semantic_entity
)
self
.
set_existing
(
node
)
else
:
else
:
self
.
_merge_into
(
semantic_entity
,
treated_before
)
self
.
_merge_into
(
node
,
treated_before
)
def
_remove_non_identifiables
(
self
):
def
_remove_non_identifiables
(
self
):
"""
A path or an ID is sufficiently identifying. Thus, those entities can be marked as
"""
A path or an ID is sufficiently identifying. Thus, those entities can be marked as
checked
"""
checked
"""
for
semantic_entity
in
list
(
self
.
nodes
[::
-
1
]):
for
node
in
list
(
self
.
nodes
[::
-
1
]):
if
"
nonidentifiable
"
in
[
p
.
name
for
p
in
if
"
nonidentifiable
"
in
[
p
.
name
for
p
in
semantic_entity
.
registered_identifiable
.
properties
]:
node
.
registered_identifiable
.
properties
]:
self
.
unchecked
.
remove
(
semantic_entity
)
self
.
unchecked
.
remove
(
node
)
def
_add_any
(
self
,
entity
:
SyncNode
,
lookup
):
def
_add_any
(
self
,
entity
:
SyncNode
,
lookup
):
"""
Add ``entity`` to this SemanticTarget and store in ``lookup`` cache.
"""
Add ``entity`` to this SemanticTarget and store in ``lookup`` cache.
...
...
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