Import relevant MARC relators as instances of Role #1

Closed
opened 2025-02-09 10:37:34 +00:00 by mih · 0 comments
Owner

Bulk download: https://id.loc.gov/download/vocabulary/relators.skosrdf.jsonld.gz

Convert to minimal Role record (JSON lines):

zcat /tmp/relators.skosrdf.jsonld.gz | jq -c '.["@graph"].[0] | {"id": ("marcrel:" + .["skos:notation"]), "description": .["skos:definition"].["@value"], "preferred_label": .["skos:prefLabel"]}' | grep -v null > /tmp/marcrel_roles.jsonlines

Filter file by hand...

...and then convert JSON lines to one record per file, stored under the right ID name:

cat /tmp/marcrel_roles.jsonlines | while read line; do fbase=$(tools/digest-sha1-p3 "$(echo "$line" | jq -r '.id')"); fname="metadata/base-unreleased/Role/${fbase}.yaml"; mkdir -p $(dirname $fname); echo "$line" | yq -y > "$fname"; done

Not elegant, but functional ;-)

Bulk download: https://id.loc.gov/download/vocabulary/relators.skosrdf.jsonld.gz Convert to minimal `Role` record (JSON lines): ``` zcat /tmp/relators.skosrdf.jsonld.gz | jq -c '.["@graph"].[0] | {"id": ("marcrel:" + .["skos:notation"]), "description": .["skos:definition"].["@value"], "preferred_label": .["skos:prefLabel"]}' | grep -v null > /tmp/marcrel_roles.jsonlines ``` Filter file by hand... ...and then convert JSON lines to one record per file, stored under the right ID name: ``` cat /tmp/marcrel_roles.jsonlines | while read line; do fbase=$(tools/digest-sha1-p3 "$(echo "$line" | jq -r '.id')"); fname="metadata/base-unreleased/Role/${fbase}.yaml"; mkdir -p $(dirname $fname); echo "$line" | yq -y > "$fname"; done ``` Not elegant, but functional ;-)
mih closed this issue 2025-02-09 12:56:38 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
q02/trr379-knowledge#1
No description provided.