Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
catalogue
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository 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
labs-team
catalogue
Commits
77f54621
Commit
77f54621
authored
6 years ago
by
gabriele-h
Browse files
Options
Downloads
Patches
Plain Diff
onbsru: Split regex for pid url
parent
e3da1db8
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
sru/onbsru.py
+6
-9
6 additions, 9 deletions
sru/onbsru.py
with
6 additions
and
9 deletions
sru/onbsru.py
+
6
−
9
View file @
77f54621
...
@@ -6,8 +6,6 @@ from . import almasru
...
@@ -6,8 +6,6 @@ from . import almasru
class
OnbRecordRetriever
(
almasru
.
RecordRetriever
):
class
OnbRecordRetriever
(
almasru
.
RecordRetriever
):
dtl_re
=
re
.
compile
(
r
'
dtl\/\d*
'
)
pid_re
=
re
.
compile
(
r
'
\d+
'
)
def
__init__
(
self
,
def
__init__
(
self
,
subdomain
:
str
=
'
obv-at-oenb
'
,
subdomain
:
str
=
'
obv-at-oenb
'
,
...
@@ -21,6 +19,9 @@ class OnbRecordRetriever(almasru.RecordRetriever):
...
@@ -21,6 +19,9 @@ class OnbRecordRetriever(almasru.RecordRetriever):
'
marc
'
:
'
http://www.loc.gov/MARC21/slim
'
'
marc
'
:
'
http://www.loc.gov/MARC21/slim
'
}
}
self
.
dtl_re
=
re
.
compile
(
r
'
dtl\/\d*
'
)
self
.
pid_re
=
re
.
compile
(
r
'
\d+
'
)
# Create alias for querying AC-numbers
# Create alias for querying AC-numbers
def
by_ac_num
(
self
,
ac_num
:
str
):
def
by_ac_num
(
self
,
ac_num
:
str
):
return
self
.
by_marc_009
(
ac_num
)
return
self
.
by_marc_009
(
ac_num
)
...
@@ -41,16 +42,12 @@ class OnbRecordRetriever(almasru.RecordRetriever):
...
@@ -41,16 +42,12 @@ class OnbRecordRetriever(almasru.RecordRetriever):
for
datafield
in
datafields
:
for
datafield
in
datafields
:
if
datafield
.
attrib
==
{
'
tag
'
:
'
856
'
,
'
ind1
'
:
'
4
'
,
'
ind2
'
:
'
2
'
}:
if
datafield
.
attrib
==
{
'
tag
'
:
'
856
'
,
'
ind1
'
:
'
4
'
,
'
ind2
'
:
'
2
'
}:
marc_856_u
=
self
.
_get_subfield
(
datafield
,
'
u
'
)
marc_856_url
=
self
.
_get_subfield
(
datafield
,
'
u
'
).
text
marc_856_url
=
marc_856_u
.
text
marc_856_note
=
self
.
_get_subfield
(
datafield
,
'
x
'
).
text
marc_856_x
=
self
.
_get_subfield
(
datafield
,
'
x
'
)
marc_856_note
=
marc_856_x
.
text
if
'
ONB-DTL
'
in
marc_856_note
:
if
'
ONB-DTL
'
in
marc_856_note
:
dtl_suffix
=
self
.
dtl_re
.
findall
(
marc_856_url
)[
0
]
dtl_suffix
=
self
.
dtl_re
.
findall
(
marc_856_url
)[
0
]
print
(
dtl_suffix
)
pids
.
append
(
self
.
pid_re
.
findall
(
dtl_suffix
)[
-
1
])
pids
.
append
(
self
.
pid_re
.
findall
(
dtl_suffix
))
return
pids
return
pids
...
...
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