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
794cc096
Commit
794cc096
authored
3 years ago
by
Alexander Schlemmer
Browse files
Options
Downloads
Patches
Plain Diff
FIX: variable precedence for structure elements and regexp matches clarified
parent
e6958c63
No related branches found
No related tags found
1 merge request
!53
Release 0.1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
integrationtests/test.py
+0
-1
0 additions, 1 deletion
integrationtests/test.py
src/doc/index.rst
+31
-0
31 additions, 0 deletions
src/doc/index.rst
src/newcrawler/crawl.py
+4
-6
4 additions, 6 deletions
src/newcrawler/crawl.py
with
35 additions
and
7 deletions
integrationtests/test.py
+
0
−
1
View file @
794cc096
...
...
@@ -153,7 +153,6 @@ def test_insertion_and_update(clear_database, usemodel, ident, crawler):
# cr.save_debug_data(rfp("provenance.yml"))
assert
len
(
cr
.
updateList
)
==
3
ins
,
ups
=
cr
.
synchronize
()
# breakpoint()
assert
len
(
ins
)
==
0
assert
len
(
ups
)
==
1
...
...
This diff is collapsed.
Click to expand it.
src/doc/index.rst
+
31
−
0
View file @
794cc096
...
...
@@ -153,3 +153,34 @@ The crawler can be considered the main program doing the synchronization in basi
Relevant sources in:
src/crawl.py
Special Cases
=============
Variable Precedence
++++++++++++
Let's assume the following situation
.. code-block:: yaml
description:
type: DictTextElement
match_value: (?P<description>.*)
match_name: description
Making use of the $description variable could refer to two different variables created here:
1. The structure element path.
2. The value of the matched expression.
The matched expression does take precedence over the structure element path and shadows it.
Make sure, that if you want to be able to use the structure element path, to give unique names
to the variables like:
.. code-block:: yaml
description_text_block:
type: DictTextElement
match_value: (?P<description>.*)
match_name: description
This diff is collapsed.
Click to expand it.
src/newcrawler/crawl.py
+
4
−
6
View file @
794cc096
...
...
@@ -590,16 +590,14 @@ class Crawler(object):
converter
.
match
(
element
)
is
not
None
):
generalStore_copy
=
generalStore
.
create_scoped_copy
()
recordStore_copy
=
recordStore
.
create_scoped_copy
()
# extracts values from structure element and stores them in the converter
# this could e.g. be the storage of a variable from the regexp in the
# converter object or the extraction from values from a file and storage
# in the converter object
# -> rather store it in the variable storage than in the converter?
converter
.
create_values
(
generalStore_copy
,
element
)
# Create an entry for this matched structure element:
generalStore_copy
[
converter
.
name
]
=
(
os
.
path
.
join
(
*
(
structure_elements_path
+
[
element
.
get_name
()])))
# extracts values from structure element and stores them in the
# variable store
converter
.
create_values
(
generalStore_copy
,
element
)
keys_modified
=
converter
.
create_records
(
generalStore_copy
,
recordStore_copy
,
element
)
...
...
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