Stable collection identifiers Code
persistent identifiers for collection objects
Brought to you by:
droepert
-----------------
----- NOTES -----
-----------------
These PHP scripts provide stable identifier redirection for a herbarium
collection according to the advices of the W3C (http://www.w3.org/TR/cooluris/).
An URI is used as a name for a real object, so a client can request an object by
that URI over HTTP to receive the a new URI refering to the metadata about that
object. The following lines explain the communication for short by example:
client request:
GET http://collection.example.com/object/ID
Accept:application/rdf+xml
server response:
303 See Other
Location: http://collection.example.com/data/rdf/ID
client request:
GET http://collection.example.com/data/rdf/ID
Accept:application/rdf+xml
server response:
200 OK
...
Using nginx as web server an incomming request has to be handled by this server.
According to the URI (/data/rdf/ID, /data/page/ID, /object/ID, ...) the web
server calls the correct PHP script which handles the request:
redirection.php: redirection to other URIs
rdf.php: deliver metadata as RDF document
Note that there is no PHP script generating an HTML representation of the
metadata, which is fetched from an MSSQL server from a single table named
'rdf_view' (see section "Database Table Fields" for some details).
Unfortunately the regular expressions used to validate the ID and some URIs for
redirection are hardcoded into the PHP code. In addition there is no central
configuration file.
Addtitional comments
--------------------
dependencies:
The PHP library 'conneg' (version 2.0.4) is used for content negotiation.
(HTTP header fields: Accept, Content-Type)
source: http://ptlis.net/source/php/content-negotiation/#downloads
RDF mapping:
dwc:Collector replaced by dwc:recordedBy
http://rs.tdwg.org/dwc/2009-12-07/terms/history/index.htm#Collector-2003-06-13
usage of redirection.php and rdf.php:
Every request on a URI like /data/rdf/.*
is passed to rdf.php or redirection.php (no .php appears in the URI).
See nginx configuration file for details (collection.example.com.conf).
examples commands for a request:
$ curl -iH "Accept:application/rdf+xml" http://collection.example.com/object/B100000003
$ curl -iH "Accept:text/html" http://collection.example.com/object/B100000003
Database Table Fields
---------------------
The following fields are used by the PHP scripts:
HerbariumID
RdfUri
ObjectUri
Title
TitleDescription
Collector
CollectionDate
ObjectURI
modified
BaseOfRecords
InstitutionCode
CollectionCode
CatalogNumber
ScientificName
Family
Genus
SpecificEpithet
HigherGeography
Country
Locality
CollectionDate
Collector
Image
File Overview (additional comments)
-----------------------------------
rdf.php:
returns HTTP status code 404 if barcode doesn't exists
returns 406 in case of wrong content-type: ex. "Accept: text/html"
rdf-template.inc.php:
very simple template based on RDF data generated by Edinburgh's webservice
redirection.php:
returns HTTP status code 404 if barcode doesn't exists in DB
redirection-404.inc.php:
simple 404 error page (barcode not found)
sitemap.php:
generates a catalog/sitemap of database records
CMD: $ php sitemap.php > index-test.xml