Skip to content
Kyle Huynh edited this page Aug 27, 2024 · 70 revisions

What are ARK Identifiers ?

https://wiki.lyrasis.org/display/ARKs/ARK+Identifiers+FAQ

Base Projects:

https://github.com/Daniel-KM/Noid4Php
https://github.com/AkioUnity/Noid4Php

DSU Implementation of ARKs

Github Repo:


Deployment:

In Ansible playbook (for demo):


In an Apache server (for production's deployment)

  1. Follow this guide to install the LAMP stack to your server. Please note:
    • In STEP 4, follow this step exactly replacing your_domain with ark-services
    • Then, open the terminal and change the current directory by running cd /var/www,
    • Then download the source code by running git clone https://github.com/digitalutsc/ark-services.git
  2. Follow this guide to install phpMyAdmin on your server.
  3. Use phpMyAdmin to create an user, a database. Then, assign that user to the database with the privileges as in the screenshot below:

image

  1. Create the config directory, mkdir -p /var/www/ark-services/config

  2. In your terminal, run sudo nano /var/www/ark-services/config/MysqlArkConf.php, and paste the following code. Set the name of variables you created in the previous step, then save it.

<?php

namespace Noid\Config;

class MysqlArkConf
{
    static public $mysql_host = ''; // host of your server
    static public $mysql_user = ''; // your MYSQL username
    static public $mysql_passwd = ''; // your MYSQL password
    static public $mysql_dbname = ''; // please enter the name of database which you have just created.  
    static public $mysql_port = 3306;
   
    // backup
    static public $backup_method = 2; // can be 1 -> php or 2-> mysqldump
    static public $path_db_backup = "/var/www/ark-services/db/backup/"; // backup directory for database snapshot
    static public $mysqldump = ""; // path to mysqldump for database backup
}

Installation

  • After you have installed the code in the server, visit: https://yoursite/admin (Note that the first time you visit this url, it will redirect to https://yoursite/admin/install.php).
  • Fill out your Organization information.
  • Enter your System Administrator login credentials (The Password you enter will be encrypted and saved in the MYSQL database).
  • IMPORTANT: Make sure the directory in arks-service/admin/db exists and permission is 777, if not, run:
    • mkdir -p /your-path/arks-service/admin/db
    • then, chmod -R 777 /your-path/arks-service/admin/db,

ARK_openingscreen


To reset the application

  • Access the ARK database in PHPMyAdmin, and drop only two tables: “system” and “user”, then refresh the webpage to visit https://yoursite/admin/admin.php. The installation step above will be repeated.
    • Note: the minted ARK IDs won’t be effected

Usage

Request your NAAN:

Create a collection of ARK IDs

  • Visit: https://yoursite/admin/admin.php
  • Fill out the “Create Database” form, then click Create.
    • Note: To ensure the sufficient of the Ark ID lookup for redirection, the prefix must be unique (already enforced) among multiple databases.
Create a collection of ARKS

Select a Template:

  • .rddd: to mint random 3-digit numbers, stopping after 1000th
  • .sdddddd: to mint sequential 6-digit numbers, stopping after millionth
  • .zd: sequential numbers without limit, adding new digits as needed
  • bc.rdddd: random 4-digit numbers with constant prefix bc
  • 8rf.sdd: sequential 2-digit numbers with constant prefix 8rf
  • .se: sequential extended-digits (from 0123456789bcdfghjkmnpqrstvwxz)
  • h9.reee: random 3-extended-digit numbers with constant prefix h9
  • .zeee: unlimited sequential numbers with at least 3 extended-digits
  • .rdedeedd : random 7-char numbers, extended-digits at chars 2, 4, and 5
  • .zededede: unlimited mixed digits, adding new extended-digits as needed
  • sdd.sdede : sequential 4-mixed-digit numbers with constant prefix sdd
  • .rdedk : random 3 mixed digits plus final (4th) computed check character
  • .sdeeedk : 5 sequential mixed digits plus final extended-digit check char
  • .zdeek : sequential digits plus check char, new digits added as needed
  • 63q.redek : prefix plus random 4 mixed digits, one of them a check char

ARK URL structure:

https://wiki.lyrasis.org/display/ARKs/ARK+Identifiers+FAQ


Minting

image


Binding an ARK ID

  • Video: How to bind

    • Click the dropdown menu on top of the Bound Arks Table and select either the Binding an Ark option
    • Paste the Ark you would like to bind into the Ark ID field and then type in the metadata field and value you want bind to it
binding-step-1 binding-step-2

Unbinding ARK ID

unbinding-step1 unbinding-step2

Bulk Bind (for new arks and updating existing Ark IDs)

Workflow:

  1. Mint ARK ID(s)
  2. Download template.csv(https://yoursite/admin/template.csv), place the above minted ARK IDs (if binding new ARKs) or an existing list of ARK IDs (if changing metadata bound to ARKs) into the ARK_ID column.
  3. There no limitation of data field(s) to be bound with an ARK ID. For UTSC only, highly recommend to have the below essential columns which are already included in the template CSVs above and add more column(s) if needed for other metadata.
    1. ARK_ID: MANDATORY for binding.
    2. URL: MANDATORY will be redirected to after ARK ID’s URL Resolver.
    3. LOCAL_ID: Object’s unique ID in the repository.
    4. PID: persistent Identifiers
    5. COLLECTION (Optional): to assist on searching in the table.
  4. Check "Replace existing metadata for each Arks" box if the metadata being bound is meant to wholecloth replace any field that are already bound to the ARK IDs.
  5. Upload the CSV to start the process.
BulkBinding Screen 1 BulkBinding Screen 2

Generate reports

image


Rest API

Structure: https://yoursite/admin/rest.php?db=DB_NAME&op=OP_NAME (optional: &ark_ID={{Ark ID}})

Example:

$.post("https://yoursite/admin/rest.php?db=DB_NAME&op=bulkbind&stage=upload", {data: pdata, security: password})
.done(function (data) {
    var result =  JSON.parse(data);
    if (result.success == 401) {
          // add a UI handle when REST return unauthorized (code:401), it happens when System Admin's password above are not matched
    }
    else {
        // add a UI handle when REST return success (code: 1)
    }

})
.fail(function () {
    // add a UI handle when POST request failed
});

Resolver

Workflow:

  • Step 1. Catch coming traffic and detect ARK URL. In .htaccess at the root directory, obtain ARK ID information and redirect to resolver.php:
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI}  ^/ark:/.*$
RewriteRule ^(.*)$ /resolver.php?q=$1 [L]

  • Step 2. Captured ARK ID from URL. ie. https://yoursite/ark:/61220/utsc6 (which is 61220/utsc6)
  • Step 3, Get prefix (‘utsc’ from example above), from this prefix, identify which database to lookup the object bound to this ARK ID (This is why the prefix need to be unique)
  • Step 4. Look for field URL first, if URL is valid, redirect to that URL
  • Step 5. If field URL is not available, use PID instead, establishing the URL by combine https + NAA + PID (coded exclusively for UTSC-DSU usage)

Code can be found at resolver.php: (https://github.com/digitalutsc/ark-services/blob/master/resolver.php)


Maintenance

Database backup

Each time of mining, (bulk) binding ARK ID (s), the system will automatically take a snapshot of the database and store it under the directory /var/www/ark-services/db/backup which can be preset or changed to the $path_db_backup in MyslqArkConf.php file:

    <?php
    
    class MysqlArkConf{
        static public $mysql_host = '';
        static public $mysql_user = '';
        static public $mysql_passwd = '';
        static public $mysql_dbname = '';
        static public $mysql_port = 3306;
        static public $path_db_backup = "/var/www/ark-services/db/backup";
    }