aboutsummaryrefslogtreecommitdiffstats
path: root/extra/issnl_prefix.py
blob: 41189217ae1561b561555a5fe7b5b3622e3ad4b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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))))