aboutsummaryrefslogtreecommitdiffstats
path: root/extra
diff options
context:
space:
mode:
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))))