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
d3e673d7
Commit
d3e673d7
authored
3 years ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
WIP
parent
be7f26b1
No related branches found
No related tags found
Loading
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/newcrawler/identifiable_adapters.py
+3
-22
3 additions, 22 deletions
src/newcrawler/identifiable_adapters.py
with
3 additions
and
22 deletions
src/newcrawler/identifiable_adapters.py
+
3
−
22
View file @
d3e673d7
...
@@ -121,10 +121,6 @@ class IdentifiableAdapter(object):
...
@@ -121,10 +121,6 @@ class IdentifiableAdapter(object):
"""
"""
pass
pass
@abstractmethod
def
resolve_reference
(
self
,
record
:
db
.
Record
):
pass
def
get_identifiable
(
self
,
record
:
db
.
Record
):
def
get_identifiable
(
self
,
record
:
db
.
Record
):
"""
"""
retrieve the registred identifiable and fill the property values to create an
retrieve the registred identifiable and fill the property values to create an
...
@@ -223,8 +219,9 @@ class LocalStorageIdentifiableAdapter(IdentifiableAdapter):
...
@@ -223,8 +219,9 @@ class LocalStorageIdentifiableAdapter(IdentifiableAdapter):
with
open
(
filename
,
"
r
"
)
as
f
:
with
open
(
filename
,
"
r
"
)
as
f
:
self
.
_records
=
db
.
Container
().
from_xml
(
f
.
read
())
self
.
_records
=
db
.
Container
().
from_xml
(
f
.
read
())
# TODO: move to super class?
def
is_identifiable_for_record
(
self
,
def
is_identifiable_for_record
(
self
,
registered_identifiable
:
db
.
RecordType
,
record
:
db
.
Record
):
registered_identifiable
:
db
.
RecordType
,
record
:
db
.
Record
):
"""
"""
Check whether this registered_identifiable is an identifiable for the record.
Check whether this registered_identifiable is an identifiable for the record.
...
@@ -301,22 +298,6 @@ class LocalStorageIdentifiableAdapter(IdentifiableAdapter):
...
@@ -301,22 +298,6 @@ class LocalStorageIdentifiableAdapter(IdentifiableAdapter):
return
None
return
None
return
candidates
[
0
]
return
candidates
[
0
]
def
resolve_reference
(
self
,
value
:
db
.
Record
):
if
self
.
get_registered_identifiable
(
value
)
is
None
:
raise
NotImplementedError
(
"
Non-identifiable references cannot
"
"
be used as properties in identifiables.
"
)
# TODO: just resolve the entity
value_identifiable
=
self
.
retrieve_identified_record
(
value
)
if
value_identifiable
is
None
:
raise
RuntimeError
(
"
The identifiable which is used as property
"
"
here has to be inserted first.
"
)
if
value_identifiable
.
id
is
None
:
raise
RuntimeError
(
"
The entity has not been assigned an ID.
"
)
return
value_identifiable
.
id
class
CaosDBIdentifiableAdapter
(
IdentifiableAdapter
):
class
CaosDBIdentifiableAdapter
(
IdentifiableAdapter
):
"""
"""
...
...
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