some-things/code/mk_bibo_classes.sh

16 lines
506 B
Shell

#!/bin/bash
set -e -u -o pipefail
src_url="https://www.dublincore.org/specifications/bibo/bibo/bibo.rdf.xml"
# - download
# - fix XML snytax issues
# - convert to JSON
# - filter and construct records with jq
# - remove undesired base class definition
curl -s "$src_url" \
| sed -e 's/&\([a-z]\+\);/\1:/g' \
| xq -j \
| jq -c '.RDF.Class[] | select(.["@about"] | contains("bibo:")) | {pid: .["@about"], description: .comment.["#text"], display_label: .label.["#text"]}' \
| grep -v 'bibo:Event'