From 4be1ec0cdb382d7b545eeb4c451cc123d9199d95 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 23 Jun 2020 20:10:46 -0700 Subject: commit notes and issnl_prefix.py helper script --- extra/issnl_prefix.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 extra/issnl_prefix.py (limited to 'extra') 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)))) -- cgit v1.2.3