12 lines
662 B
Shell
Executable file
12 lines
662 B
Shell
Executable file
#!/bin/bash
|
|
# returns JSON lines formatted records
|
|
set -e -u -o pipefail
|
|
|
|
jq -c '
|
|
.[]
|
|
| select((.types[] | contains("education") or contains("facility"))) | select(.links[].type | contains("wikipedia")) | select(.external_ids != [])
|
|
| {pid: "geodata:\(.locations[0].geonames_id)",
|
|
at_location: .locations[0].geonames_details.country_code,
|
|
display_label: "\(.locations[0].geonames_details.name) (\([.locations[0].geonames_details.country_subdivision_name, .locations[0].geonames_details.country_code] | map(select(. != null)) | join(", ")))",
|
|
attributes: [{"predicate": "dcterms:title", "value": .locations[0].geonames_details.name}]}
|
|
' < "$1"
|