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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
CaosDB Crawler
Commits
5dc4bcd7
Commit
5dc4bcd7
authored
1 year ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
DOC: add docstring
parent
ab1d4796
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!160
STY: styling
,
!142
ENH: add utility function that replaces name strings in values of reference properties with IDs
Pipeline
#46348
failed
1 year ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/caoscrawler/crawl.py
+10
-0
10 additions, 0 deletions
src/caoscrawler/crawl.py
with
10 additions
and
0 deletions
src/caoscrawler/crawl.py
+
10
−
0
View file @
5dc4bcd7
...
...
@@ -831,6 +831,16 @@ class Crawler(object):
@staticmethod
def
replace_name_with_referenced_entity_id
(
prop
:
db
.
Property
):
"""
changes the given property in place if it is a reference property that has a name as
value
If the Property has a List datatype, each element is treated separately.
If the datatype is generic, i.e. FILE or REFERENCE, values stay unchanged.
If the value is not a string, the value stays unchanged.
If the query using the datatype and the string value does not uniquely identify an Entity,
the value stays unchanged.
If an Entity is identified, then the string value is replaced by the ID.
"""
if
get_list_datatype
(
prop
.
datatype
)
is
None
:
# not a list
if
(
isinstance
(
prop
.
value
,
str
)
and
is_reference
(
prop
.
datatype
)
and
prop
.
datatype
!=
db
.
FILE
and
prop
.
datatype
!=
db
.
REFERENCE
):
# datatype is a non-generic reference and value is a string
...
...
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