aboutsummaryrefslogtreecommitdiffstats
path: root/extra
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-06-23 20:10:46 -0700
committerBryan Newbold <bnewbold@archive.org>2020-06-23 20:10:46 -0700
commit4be1ec0cdb382d7b545eeb4c451cc123d9199d95 (patch)
treee1e8131e2caef749496dbda8b83f355ac296d6ce /extra
parent05f6a1b143a521688ccb3a59f300b44f5c04c6be (diff)
downloadchocula-4be1ec0cdb382d7b545eeb4c451cc123d9199d95.tar.gz
chocula-4be1ec0cdb382d7b545eeb4c451cc123d9199d95.zip
commit notes and issnl_prefix.py helper script
Diffstat (limited to 'extra')
-rw-r--r--extra/issnl_prefix.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/extra/issnl_prefix.py b/extra/issnl_prefix.py
new file mode 100644
index 0000000..4118921
--- /dev/null
+++ b/extra/issnl_prefix.py
@@ -0,0 +1,14 @@
+import sys
+import json
+
+for line in sys.stdin:
+ if not line.strip():
+ continue
+ record = json.loads(line)["@graph"]
+ issnl = None
+ for el in record:
+ if el.get("@type") == "http://id.loc.gov/ontologies/bibframe/IssnL":
+ issnl = el["value"]
+ break
+ if issnl:
+ print("\t".join((issnl, json.dumps(record, sort_keys=True))))