Vida: OLAC Virtual Data Provider


Vida (for "Virtual data provider") was a service developed by OLAC in late 2001 to implement the OAI protocol (version 1.1) for metadata harvesting on a static XML document describing the holdings of an archive. In the meantime, the OAI (as part of its version 2.0 family of guidelines) has developed a standard for encoding static repositories and for harvesting them through a gateway service. The original Vida service has been made obsolete by this new OAI standard. This page is maintained to give historical documentation of the Vida service. If you are interested in using the service, go to the OLAC Static Repository Gateway which has replaced it.


Description:

The virtual data provider is a PHP script to make metadata available for service providers using the OAI or OLAC metadata harvesting protocol. It applies an XSL stylesheet to the xml document given in the PATHINFO (appended to the base url of the script) using the Xalan java XSLT processor. The xml file that it takes as an argument has to conform to the oryx schema.

Usage:

append the URL of the mini repository xml file to the url of the virtual data provider then add cgi parameters.

Example:

The base url of virtual data provider is:

Given a url of a mini repository xml file (for example:http://www.ldc.upenn.edu/Projects/OLAC/ldc.xml), the full url for the data provider is:

And it can be harvested using the OAI metadata harvesting protocol, e.g.:

The data provider can be tested with the repository explorer:

   http://oai.dlib.vt.edu/~oai/cgi-bin/Explorer/oai1.1/testoai?archive=$baseURL/your/server/xmlfile.xml

E.g.:

   http://oai.dlib.vt.edu/~oai/cgi-bin/Explorer/oai1.1/testoai?archive=$baseURL/www.language-archives.org/data/ldc.xml




olac-admin@language-archives.org
2002.07.15
END; } # end of function document() function archive_document() { $metadata_formats = array(); $metadata_formats['oai_dc'] = 'http://www.openarchives.org/OAI/dc.xsd'; $metadata_formats['olac'] = 'http://www.language-archives.org/OLAC/0.4/olac.xsd'; $namespace = array(); $namespace['oai_dc'] = 'http://purl.org/dc/elements/1.1/'; $namespace['olac'] = 'http://www.language-archives.org/OLAC/0.4/'; $protocol_version = '1.1'; global $baseURL; $xmlns = "http://www.openarchives.org/OAI/1.1"; $longdate = strftime("%A, %D %T"); $mdf_section = ""; while (list($name,$schema) = each($metadata_formats)) $mdf_section .= "

  • prefix = $name" . "
    schema = $schema"; $mdf_section = ""; print <<< END OAI interface documentation

    OAI interface documentation

    Protocol version: $protocol_version
    BASE-URL: $baseURL

    Verbs

    For arguments (O) indicates optional, (M) indicates mandatory, and (E) indicates exclusive (ie. that parameter and no others may be specified, otherwise that parameter may no be specified).

    Metadata formats

    $mdf_section See output from verb=ListMetadataFormats



    Output from Document verb on $longdate END; } function request_syntax_check() { global $verb, $identifier, $metadataPrefix; switch ($verb) { case "GetRecord": # check if identifier and # metadataPrefix are supplied. $missied = ""; if ($identifier == "") $missed = "identifier"; if ($metadataPrefix == "") { if ($missed) $missed .= " and "; $missed = "metadataPrefix"; } if ($missed) { $message = "HTTP/1.0 400 Malformed request. Missing $missed"; header($message); print $message; exit; } break; case "ListRecords": # check if metadataPrefix is supplied. if ($metadataPrefix == "") { $message = "HTTP/1.0 400 Malformed request. Missing metadataPrefix"; header($message); print $message; exit; } break; case "Identify": case "ListIdentifiers": case "ListMetadataFormats": case "ListSets": break; case "": $message = "HTTP/1.0 400 Malformed request. No verb is given."; header($message); print $message; exit; default: $message = "HTTP/1.0 400 Malformed request. Verb '$verb' not supported."; header($message); print $message; exit; } } ############################ # Main routine starts here # ############################ ### ### Preliminary checks ### # no $PATH_INFO # -- show introduction. if ($PATH_INFO == "" || $PATH_INFO == "/") { document(); exit; } # set up some URL's $baseURL .= $PATH_INFO; # vida url $xmlURL = "http:/$PATH_INFO"; # repository url # check if the repository exists $mask = error_reporting(0); # don't want to show users annoying warning if (! fopen($xmlURL,'r')) { print "

    VIDA Error: Repositoy '$xmlURL' not found."; exit; } error_reporting($mask); # restore error reporting # no OAI verb # -- show OAI interface if ($verb == "Document" || $verb == "") { archive_document(); exit; } ### ### OAI service starts ### # check if the OAI request is well-formed (protocol version 1.1) request_syntax_check(); # if not ok, exit # prepare xalan call $param_string = "&$QUERY_STRING"; $param_string = str_replace("=", " ", $param_string); $param_string = str_replace("&", " -param ", $param_string); $param_string .= " -param baseURL $baseURL "; $command = "$xslt -in $xmlURL $param_string"; exec($command, $result); header("Content-Type: text/xml"); print join("\n", $result); ?>