ucd-library / ezid

Bash client Script for ezid identifier management
MIT License
0 stars 2 forks source link

Get an example of about 100 records with complete schema.org metadata #9

Closed qjhart closed 5 years ago

qjhart commented 5 years ago

CDL would like a larger set of arks with associated jsonld metadata. I proposed to do this with about 100 records. This is the way that I will create these.

DAMS micro-service

There are lots of ways to create the metadata that we need. I've created a new micro-service for our DAMS to standardize that creation. So, you can go to any record in our dams, and retrieive an appropriate JSON-LD metadata entry from the DAMS. For example

ark=ark:/87287/d71941
http -P b --follow https://next.dams.library.ucdavis.edu/$ark/svc:ezid 

responds with:

{
  "@id": "/collection/amerine-menus/items/d71941",
  "@type": [
    "http://www.w3.org/ns/ldp#Container",
    "http://fedora.info/definitions/v4/repository#Resource",
    "http://schema.org/CreativeWork",
    "http://www.w3.org/ns/ldp#RDFSource",
    "http://fedora.info/definitions/v4/repository#Container",
    "http://schema.org/Menu"
  ],
  "name": "\"An Autumn Afternoon at the Bucks\" (Ross, California)",
  "identifier": [
    "D-060 Box:83, Folder:27",
    "Digitized File Numbers:3886-3888",
    "ark:/87287/d71941"
  ],
  "datePublished": [
    "1946",
    "1946-09-21"
  ],
  "license": {
    "@id": "http://rightsstatements.org/vocab/CNE/1.0/"
  },
  "sdLicense": {
    "@id": "http://rightsstatements.org/vocab/CNE/1.0/"
  },
  "about": [
    {
      "@id": "http://id.worldcat.org/fast/893952",
      "name": "Dinners and dining"
    },
    {
      "@id": "http://id.worldcat.org/fast/1424061",
      "name": "Menus"
    }
  ],
  "yearPublished": 1946
}

Example Temporary creations

Once we have this in place we can quickly use this service to create test versions of this setup. In this case we will be using the schema.org attribute to store this. Here's the way to create a new example, using ezid We will copy over the erc.* values

ezid login --auth=ucd-qjhart
dams=https://next.dams.library.ucdavis.edu
ark=ark:/87287/d71941
eval $(ezid get --array $i); anvl[schema.org]="$(http -P b --follow $dams/$i/svc:ezid | jq -c .)"; 
ezid mint erc.who:${anvl[erc.who]} erc.when:${anvl[erc.when]} erc.what:"${anvl[erc.what]}" schema.org:"${anvl[schema.org]}"
# Responds with ark:/99999/fk4rz0hk0v

Then you can verify that json is all fine, with this

tmp=ark:/99999/fk4rz0hk0v
eval $(ezid get --array $tmp); echo ${anvl[schema.org]} | jq .

20 random versions

From a download of an ezid CSV dump of my records, I can get 20 random examples with

csv=a1a3bbac81.csv
cnt=20
random=$(for i in $(csvtool col 3 $csv | grep 87287); do echo $RANDOM,$i; done | sort -n | head -$cnt | csvtool col 2 -)

And then create the temporary records with:

dams=https://next.dams.library.ucdavis.edu

for ark in $random; do 
  eval $(ezid get --array $i); anvl[schema.org]="$(http -P b --follow $dams/$i/svc:ezid | jq -c .)"; 
  ezid mint erc.who:"${anvl[erc.who]}" erc.when:"${anvl[erc.when]}" erc.what:"${anvl[erc.what]}" schema.org:"${anvl[schema.org]}" | tee --append random.tmp
done

Example

Here is an example of running the above scripts to create 20 example schema.org entries.

random='ark:/87287/d7z630 ark:/87287/d7nm1k ark:/87287/d77s7v ark:/87287/d7mm2n ark:/87287/d7t89q ark:/87287/d7p59f ark:/87287/d7fk7n ark:/87287/d7zs8r ark:/87287/d7406m ark:/87287/d7dg8p ark:/87287/d7q345 ark:/87287/d7934f ark:/87287/d7gc7w ark:/87287/d7qg9v ark:/87287/d73896 ark:/87287/d7c36t ark:/87287/d7h89x ark:/87287/d76w4f ark:/87287/d7bg9f ark:/87287/d7km1z'

tmp='ark:/99999/fk4vh6sq0z ark:/99999/fk4qv4s86c ark:/99999/fk4m342g3x ark:/99999/fk4gb3bn9w ark:/99999/fk4bk2mv55 ark:/99999/fk46t1x22d ark:/99999/fk43216763 ark:/99999/fk4z90gm18 ark:/99999/fk4tm8g63v ark:/99999/fk4pv7rc9t ark:/99999/fk4k371k29 ark:/99999/fk4fb69r7r ark:/99999/fk49k5kz52 ark:/99999/fk45t4w508 ark:/99999/fk42245b7h ark:/99999/fk4xd25345 ark:/99999/fk4sn1f91z ark:/99999/fk4nw0qg6d ark:/99999/fk4j400p2f ark:/99999/fk4db98w0h'