first test datacite schema

This commit is contained in:
Arno Kaimbacher 2018-12-10 17:26:57 +01:00
parent d0ed3e9105
commit 3c50618c8a
8 changed files with 411 additions and 99 deletions

View File

@ -7,7 +7,8 @@ use App\Models\Dataset;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use App\Exceptions\OaiModelException; use App\Exceptions\OaiModelException;
use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Database\Eloquent\ModelNotFoundException;
use App\Models\OaiModelError; use App\Models\Oai\OaiModelError;
use App\Models\Oai\ResumptionToken;
class RequestController extends Controller class RequestController extends Controller
{ {
@ -18,6 +19,7 @@ class RequestController extends Controller
* @var array * @var array
*/ */
private $deliveringDocumentStates = array('published', 'deleted'); // maybe deleted documents too private $deliveringDocumentStates = array('published', 'deleted'); // maybe deleted documents too
private $xMetaDissRestriction = array('doctoralthesis', 'habilitation');
const SET_SPEC_PATTERN = '[A-Za-z0-9\-_\.!~\*\'\(\)]+'; const SET_SPEC_PATTERN = '[A-Za-z0-9\-_\.!~\*\'\(\)]+';
@ -102,7 +104,7 @@ class RequestController extends Controller
private function __handleRequest(array $oaiRequest) private function __handleRequest(array $oaiRequest)
{ {
// Setup stylesheet // Setup stylesheet
$this->loadStyleSheet('oai-pmh.xslt'); $this->loadStyleSheet('datasetxml2oai-pmh.xslt');
// Set response time // Set response time
$this->_proc->setParameter('', 'responseDate', date("Y-m-d\TH:i:s\Z")); $this->_proc->setParameter('', 'responseDate', date("Y-m-d\TH:i:s\Z"));
@ -143,18 +145,18 @@ class RequestController extends Controller
private function handleIdentify() private function handleIdentify()
{ {
$email = "repository@geologie.ac.at"; $email = "repository@geologie.ac.at";
$repositoryName = "Data Research Repository"; $repositoryName = "RDR - Data Research Repository";
$repIdentifier = "rdr.gba.ac.at"; $repIdentifier = "rdr.gba.ac.at";
//$sampleIdentifier = $this->_configuration->getSampleIdentifier(); $sampleIdentifier = "oai:" . $repIdentifier . ":27";//$this->_configuration->getSampleIdentifier();
$earliestDateFromDb = Dataset::earliestPublicationDate(); $earliestDateFromDb = Dataset::earliestPublicationDate();
// set parameters for oai-pmh.xslt // set parameters for oai-pmh.xslt
$this->_proc->setParameter('', 'email', $email); $this->_proc->setParameter('', 'email', $email);
$this->_proc->setParameter('', 'repositoryName', $repositoryName); $this->_proc->setParameter('', 'repositoryName', $repositoryName);
$this->_proc->setParameter('', 'repIdentifier', $repIdentifier); $this->_proc->setParameter('', 'repIdentifier', $repIdentifier);
//$this->_proc->setParameter('', 'sampleIdentifier', $sampleIdentifier); $this->_proc->setParameter('', 'sampleIdentifier', $sampleIdentifier);
$this->_proc->setParameter('', 'earliestDatestamp', $earliestDateFromDb); $this->_proc->setParameter('', 'earliestDatestamp', $earliestDateFromDb);
$this->_xml->appendChild($this->_xml->createElement('Documents')); $this->_xml->appendChild($this->_xml->createElement('Datasets'));
} }
/** /**
@ -186,13 +188,11 @@ class RequestController extends Controller
if (is_null($dataset) if (is_null($dataset)
//or (false === in_array($dataset->getServerState(), $this->_deliveringDocumentStates)) //or (false === in_array($dataset->getServerState(), $this->_deliveringDocumentStates))
or (false === $dataset->whereIn('server_state', $this->deliveringDocumentStates)) or (false === $dataset->whereIn('server_state', $this->deliveringDocumentStates))
or (false === $dataset->hasEmbargoPassed())) { or (false === $dataset->hasEmbargoPassed())) {
throw new OaiModelException('Document is not available for OAI export!', OaiModelError::NORECORDSMATCH); throw new OaiModelException('Document is not available for OAI export!', OaiModelError::NORECORDSMATCH);
} }
$this->_xml->appendChild($this->_xml->createElement('Documents')); $this->_xml->appendChild($this->_xml->createElement('Datasets'));
$this->createXmlRecord($dataset); $this->createXmlRecord($dataset);
} }
@ -208,15 +208,6 @@ class RequestController extends Controller
$dataId = null; $dataId = null;
switch ($identifierParts[0]) { switch ($identifierParts[0]) {
// case 'urn':
// //$finder = new Opus_DocumentFinder();
// $finder = Dataset::query();
// // $finder->setIdentifierTypeValue('urn', $oaiIdentifier);
// // $finder->setServerStateInList($this->_deliveringDocumentStates);
// $finder->whereIn('server_state', $this->deliveringDocumentStates);
// $docIds = $finder->ids();
// $docId = $docIds[0];
// break;
case 'oai': case 'oai':
if (isset($identifierParts[2])) { if (isset($identifierParts[2])) {
$dataId = $identifierParts[2]; $dataId = $identifierParts[2];
@ -251,7 +242,7 @@ class RequestController extends Controller
*/ */
private function handleListMetadataFormats() private function handleListMetadataFormats()
{ {
$this->_xml->appendChild($this->_xml->createElement('Documents')); $this->_xml->appendChild($this->_xml->createElement('Datasets'));
} }
/** /**
@ -274,7 +265,7 @@ class RequestController extends Controller
*/ */
private function handleListIdentifiers(array &$oaiRequest) private function handleListIdentifiers(array &$oaiRequest)
{ {
$maxIdentifier = 20;//$this->_configuration->getMaxListIdentifiers(); $maxIdentifier = 5;//$this->_configuration->getMaxListIdentifiers();
$this->handlingOfLists($oaiRequest, $maxIdentifier); $this->handlingOfLists($oaiRequest, $maxIdentifier);
} }
@ -288,7 +279,7 @@ class RequestController extends Controller
{ {
$repIdentifier = "rdr.gba.ac.at"; $repIdentifier = "rdr.gba.ac.at";
$this->_proc->setParameter('', 'repIdentifier', $repIdentifier); $this->_proc->setParameter('', 'repIdentifier', $repIdentifier);
$this->_xml->appendChild($this->_xml->createElement('Documents')); $this->_xml->appendChild($this->_xml->createElement('Datasets'));
//$oaiSets = new Oai_Model_Sets(); //$oaiSets = new Oai_Model_Sets();
$sets = array( $sets = array(
@ -336,9 +327,12 @@ class RequestController extends Controller
if (true === empty($maxRecords)) { if (true === empty($maxRecords)) {
$maxRecords = 100; $maxRecords = 100;
} }
$repIdentifier = "rdr.gba.ac.at"; $repIdentifier = "rdr.gba.ac.at";
$tokenTempPath = storage_path('app/resumption'); //$this->_configuration->getResumptionTokenPath();
$this->_proc->setParameter('', 'repIdentifier', $repIdentifier); $this->_proc->setParameter('', 'repIdentifier', $repIdentifier);
$this->_xml->appendChild($this->_xml->createElement('Documents')); $this->_xml->appendChild($this->_xml->createElement('Datasets'));
// do some initialisation // do some initialisation
$cursor = 0; $cursor = 0;
@ -352,21 +346,27 @@ class RequestController extends Controller
} }
$this->_proc->setParameter('', 'oai_metadataPrefix', $metadataPrefix); $this->_proc->setParameter('', 'oai_metadataPrefix', $metadataPrefix);
// parameter resumptionToken is given
if (false === empty($oaiRequest['resumptionToken'])) {
$tokenWorker = new ResumptionToken();
$resParam = $oaiRequest['resumptionToken'];
} else {
// no resumptionToken is given // no resumptionToken is given
$finder = Dataset::query(); $finder = Dataset::query();
// add server state restrictions // add server state restrictions
$finder->whereIn('server_state', $this->deliveringDocumentStates); $finder->whereIn('server_state', $this->deliveringDocumentStates);
if (array_key_exists('set', $oaiRequest)) { if (array_key_exists('set', $oaiRequest)) {
$setarray = explode(':', $oaiRequest['set']); $setarray = explode(':', $oaiRequest['set']);
if ($setarray[0] == 'doc-type') { if ($setarray[0] == 'data-type') {
if (count($setarray) === 2 and !empty($setarray[1])) { if (count($setarray) === 2 and !empty($setarray[1])) {
$finder->where('type', $setarray[1]); $finder->where('type', $setarray[1]);
} }
} }
} }
$totalIds = $finder->count(); $totalIds = $finder->count();
$reldocIds = $finder->pluck('id')->toArray(); $reldocIds = $finder->pluck('id')->toArray();
}
// handling of document ids // handling of document ids
$restIds = $reldocIds; $restIds = $reldocIds;
@ -401,7 +401,7 @@ class RequestController extends Controller
//$node->appendChild($child); //$node->appendChild($child);
//$type = $dataset->type; //$type = $dataset->type;
$this->addSpecInformation($node, 'doc-type:' . $dataset->type); $this->addSpecInformation($node, 'data-type:' . $dataset->type);
//$this->addSpecInformation($node, 'bibliography:' . 'false'); //$this->addSpecInformation($node, 'bibliography:' . 'false');
$this->_xml->documentElement->appendChild($node); $this->_xml->documentElement->appendChild($node);
@ -472,7 +472,7 @@ class RequestController extends Controller
continue; continue;
} }
$setSpec = 'doc-type:' . $doctype; $setSpec = 'data-type:' . $doctype;
// $count = $row['count']; // $count = $row['count'];
$sets[$setSpec] = "Set for document type '$doctype'"; $sets[$setSpec] = "Set for document type '$doctype'";
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Models; namespace App\Models\Oai;
class OaiModelError class OaiModelError
{ {

View File

@ -0,0 +1,152 @@
<?php
namespace App\Models\Oai;
/**
* Contains content and structure of a resumption token
*/
class ResumptionToken
{
/**
* Holds dataset ids
*
* @var array
*/
private $datasetIds = array();
/**
* Holds metadata prefix information
*
* @var string
*/
private $metadataPrefix = null;
/**
* Holds resumption id (only if token is stored)
*
* @var string
*/
private $resumptionId = null;
/**
* Holds start postion
*
* @var integer
*/
private $startPostition = 0;
/**
* Holds total amount of document ids
*
* @var integer
*/
private $totalIds = 0;
/**
* Returns current holded document ids.
*
* @return array
*/
public function getDocumentIds()
{
return $this->_documentIds;
}
/**
* Returns metadata prefix information.
*
* @return string
*/
public function getMetadataPrefix()
{
return $this->_metadataPrefix;
}
/**
* Return setted resumption id after successful storing of resumption token.
*
* @return string Returns resumption id
*/
public function getResumptionId()
{
return $this->_resumptionId;
}
/**
* Returns start position.
*
* @return in
*/
public function getStartPosition()
{
return $this->_startPosition;
}
/**
* Returns total number of document ids for this request
*
* @return int
*/
public function getTotalIds()
{
return $this->_totalIds;
}
/**
* Set document ids for this token.
*
* @param $idsToStore Set of document ids to store.
* @return void
*/
public function setDocumentIds($idsToStore)
{
if (false === is_array($idsToStore)) {
$idsToStore = array($idsToStore);
}
$this->_documentIds = $idsToStore;
}
/**
* Set metadata prefix information.
*
* @param string $prefix
* @return void
*/
public function setMetadataPrefix($prefix)
{
$this->_metadataPrefix = $prefix;
}
/**
* Set resumption id
*
* @return void
*/
public function setResumptionId($resumptionId)
{
$this->_resumptionId = $resumptionId;
}
/**
* Set postion where to start on next request.
*
* @param $startPostion Positon where to start on next request
* @return void
*/
public function setStartPosition($startPosition)
{
$this->_startPosition = (int) $startPosition;
}
/**
* Set count of document ids for this request.
*
* @return void
*/
public function setTotalIds($totalIds)
{
$this->_totalIds = (int) $totalIds;
}
}

View File

@ -15,6 +15,7 @@ class Person extends Model
'email', 'email',
'identifier_orcid', 'identifier_orcid',
'status', 'status',
'name_type'
]; ];
protected $table = 'persons'; protected $table = 'persons';
public $timestamps = false; public $timestamps = false;

100
composer.lock generated
View File

@ -1815,17 +1815,85 @@
"time": "2018-11-26T12:48:07+00:00" "time": "2018-11-26T12:48:07+00:00"
}, },
{ {
"name": "symfony/css-selector", "name": "symfony/contracts",
"version": "v4.1.8", "version": "v1.0.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/css-selector.git", "url": "https://github.com/symfony/contracts.git",
"reference": "9e4dc57949853315561f0cd5eb84d0707465502a" "reference": "3edf0ab943d1985a356721952cba36ff31bd6e5f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/9e4dc57949853315561f0cd5eb84d0707465502a", "url": "https://api.github.com/repos/symfony/contracts/zipball/3edf0ab943d1985a356721952cba36ff31bd6e5f",
"reference": "9e4dc57949853315561f0cd5eb84d0707465502a", "reference": "3edf0ab943d1985a356721952cba36ff31bd6e5f",
"shasum": ""
},
"require": {
"php": "^7.1.3"
},
"require-dev": {
"psr/cache": "^1.0",
"psr/container": "^1.0"
},
"suggest": {
"psr/cache": "When using the Cache contracts",
"psr/container": "When using the Service contracts",
"symfony/cache-contracts-implementation": "",
"symfony/service-contracts-implementation": "",
"symfony/translation-contracts-implementation": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Contracts\\": ""
},
"exclude-from-classmap": [
"**/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "A set of abstractions extracted out of the Symfony components",
"homepage": "https://symfony.com",
"keywords": [
"abstractions",
"contracts",
"decoupling",
"interfaces",
"interoperability",
"standards"
],
"time": "2018-11-24T09:35:08+00:00"
},
{
"name": "symfony/css-selector",
"version": "v4.2.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
"reference": "aa9fa526ba1b2ec087ffdfb32753803d999fcfcd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/aa9fa526ba1b2ec087ffdfb32753803d999fcfcd",
"reference": "aa9fa526ba1b2ec087ffdfb32753803d999fcfcd",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1834,7 +1902,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "4.1-dev" "dev-master": "4.2-dev"
} }
}, },
"autoload": { "autoload": {
@ -1865,7 +1933,7 @@
], ],
"description": "Symfony CssSelector Component", "description": "Symfony CssSelector Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2018-11-11T19:51:29+00:00" "time": "2018-11-11T19:52:12+00:00"
}, },
{ {
"name": "symfony/debug", "name": "symfony/debug",
@ -2482,20 +2550,21 @@
}, },
{ {
"name": "symfony/translation", "name": "symfony/translation",
"version": "v4.1.8", "version": "v4.2.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/translation.git", "url": "https://github.com/symfony/translation.git",
"reference": "615e3cf75d00a7d6788316d9631957991ba9c26a" "reference": "ff9a878c9b8f8bcd4d9138e2d32f508c942773d9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/615e3cf75d00a7d6788316d9631957991ba9c26a", "url": "https://api.github.com/repos/symfony/translation/zipball/ff9a878c9b8f8bcd4d9138e2d32f508c942773d9",
"reference": "615e3cf75d00a7d6788316d9631957991ba9c26a", "reference": "ff9a878c9b8f8bcd4d9138e2d32f508c942773d9",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.1.3", "php": "^7.1.3",
"symfony/contracts": "^1.0",
"symfony/polyfill-mbstring": "~1.0" "symfony/polyfill-mbstring": "~1.0"
}, },
"conflict": { "conflict": {
@ -2503,6 +2572,9 @@
"symfony/dependency-injection": "<3.4", "symfony/dependency-injection": "<3.4",
"symfony/yaml": "<3.4" "symfony/yaml": "<3.4"
}, },
"provide": {
"symfony/translation-contracts-implementation": "1.0"
},
"require-dev": { "require-dev": {
"psr/log": "~1.0", "psr/log": "~1.0",
"symfony/config": "~3.4|~4.0", "symfony/config": "~3.4|~4.0",
@ -2520,7 +2592,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "4.1-dev" "dev-master": "4.2-dev"
} }
}, },
"autoload": { "autoload": {
@ -2547,7 +2619,7 @@
], ],
"description": "Symfony Translation Component", "description": "Symfony Translation Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2018-11-26T10:26:29+00:00" "time": "2018-11-27T07:20:32+00:00"
}, },
{ {
"name": "symfony/var-dumper", "name": "symfony/var-dumper",

View File

@ -43,7 +43,7 @@
<xsl:template match="/"> <xsl:template match="/">
<!-- stylesheet for browser --> <!-- stylesheet for browser -->
<xsl:processing-instruction name="xml-stylesheet"> <xsl:processing-instruction name="xml-stylesheet">
<xsl:text>type="text/xsl" href="xsl/oai2.xslt"</xsl:text> <xsl:text>type="text/xsl" href="xsl/oai2_style.xslt"</xsl:text>
</xsl:processing-instruction> </xsl:processing-instruction>
<OAI-PMH xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.openarchives.org/OAI/2.0/" <OAI-PMH xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.openarchives.org/OAI/2.0/"
@ -57,17 +57,13 @@
<xsl:value-of select="$oai_verb" /> <xsl:value-of select="$oai_verb" />
</xsl:attribute> </xsl:attribute>
</xsl:if> </xsl:if>
<xsl:if test="$oai_metadataPrefix != ''"> <xsl:if test="$oai_metadataPrefix != ''">
<xsl:attribute name="metadataPrefix"> <xsl:attribute name="metadataPrefix">
<xsl:value-of select="$oai_metadataPrefix" /> <xsl:value-of select="$oai_metadataPrefix" />
</xsl:attribute> </xsl:attribute>
</xsl:if> </xsl:if>
<xsl:value-of select="$baseURL" /> <xsl:value-of select="$baseURL" />
</request> </request>
<xsl:if test="$oai_error_code!=''"> <xsl:if test="$oai_error_code!=''">
<error> <error>
<xsl:attribute name="code"> <xsl:attribute name="code">
@ -80,22 +76,22 @@
<!--create the rest of oai response depending on oai_verb --> <!--create the rest of oai response depending on oai_verb -->
<xsl:choose> <xsl:choose>
<xsl:when test="$oai_verb='GetRecord'"> <xsl:when test="$oai_verb='GetRecord'">
<xsl:apply-templates select="Documents" mode="GetRecord" /> <xsl:apply-templates select="Datasets" mode="GetRecord" />
</xsl:when> </xsl:when>
<xsl:when test="$oai_verb='Identify'"> <xsl:when test="$oai_verb='Identify'">
<xsl:apply-templates select="Documents" mode="Identify" /> <xsl:apply-templates select="Datasets" mode="Identify" />
</xsl:when> </xsl:when>
<xsl:when test="$oai_verb='ListIdentifiers'"> <xsl:when test="$oai_verb='ListIdentifiers'">
<xsl:apply-templates select="Documents" mode="ListIdentifiers" /> <xsl:apply-templates select="Datasets" mode="ListIdentifiers" />
</xsl:when> </xsl:when>
<xsl:when test="$oai_verb='ListMetadataFormats'"> <xsl:when test="$oai_verb='ListMetadataFormats'">
<xsl:apply-templates select="Documents" mode="ListMetadataFormats" /> <xsl:apply-templates select="Datasets" mode="ListMetadataFormats" />
</xsl:when> </xsl:when>
<xsl:when test="$oai_verb='ListRecords'"> <xsl:when test="$oai_verb='ListRecords'">
<xsl:apply-templates select="Documents" mode="ListRecords" /> <xsl:apply-templates select="Datasets" mode="ListRecords" />
</xsl:when> </xsl:when>
<xsl:when test="$oai_verb='ListSets'"> <xsl:when test="$oai_verb='ListSets'">
<xsl:apply-templates select="Documents" mode="ListSets" /> <xsl:apply-templates select="Datasets" mode="ListSets" />
</xsl:when> </xsl:when>
</xsl:choose> </xsl:choose>
</OAI-PMH> </OAI-PMH>
@ -103,7 +99,7 @@
<!-- template for Identiy --> <!-- template for Identiy -->
<xsl:template match="Documents" mode="Identify"> <xsl:template match="Datasets" mode="Identify">
<Identify> <Identify>
<repositoryName> <repositoryName>
<xsl:value-of select="$repositoryName"/> <xsl:value-of select="$repositoryName"/>
@ -148,7 +144,7 @@
<!-- template for ListMetadataFormats --> <!-- template for ListMetadataFormats -->
<xsl:template match="Documents" mode="ListMetadataFormats"> <xsl:template match="Datasets" mode="ListMetadataFormats">
<ListMetadataFormats> <ListMetadataFormats>
<metadataFormat> <metadataFormat>
<metadataPrefix> <metadataPrefix>
@ -161,14 +157,28 @@
<xsl:text>http://www.openarchives.org/OAI/2.0/oai_dc/</xsl:text> <xsl:text>http://www.openarchives.org/OAI/2.0/oai_dc/</xsl:text>
</metadataNamespace> </metadataNamespace>
</metadataFormat> </metadataFormat>
<metadataFormat>
<metadataPrefix>
<xsl:text>oai_datacite</xsl:text>
</metadataPrefix>
<schema>
http://schema.datacite.org/meta/kernel-4.1/metadata.xsd
</schema>
<metadataNamespace>
http://datacite.org/schema/kernel-4
</metadataNamespace>
</metadataFormat>
</ListMetadataFormats> </ListMetadataFormats>
</xsl:template> </xsl:template>
<xsl:template match="Documents" mode="ListSets"> <xsl:template match="Datasets" mode="ListSets">
<ListSets> <ListSets>
<xsl:apply-templates select="Rdr_Sets" /> <xsl:apply-templates select="Rdr_Sets" />
</ListSets> </ListSets>
</xsl:template> </xsl:template>
<xsl:template match="Rdr_Sets"> <xsl:template match="Rdr_Sets">
<set> <set>
<setSpec><xsl:value-of select="@Type"/></setSpec> <setSpec><xsl:value-of select="@Type"/></setSpec>
@ -176,7 +186,7 @@
</set> </set>
</xsl:template> </xsl:template>
<xsl:template match="Documents" mode="ListIdentifiers"> <xsl:template match="Datasets" mode="ListIdentifiers">
<xsl:if test="count(Rdr_Dataset) > 0"> <xsl:if test="count(Rdr_Dataset) > 0">
<ListIdentifiers> <ListIdentifiers>
<xsl:apply-templates select="Rdr_Dataset" /> <xsl:apply-templates select="Rdr_Dataset" />
@ -198,23 +208,23 @@
</xsl:if> </xsl:if>
</xsl:template> </xsl:template>
<xsl:template match="Documents" mode="ListRecords"> <xsl:template match="Datasets" mode="ListRecords">
<xsl:if test="count(Rdr_Dataset) > 0"> <xsl:if test="count(Rdr_Dataset) > 0">
<ListRecords> <ListRecords>
<xsl:apply-templates select="Rdr_Dataset" /> <xsl:apply-templates select="Rdr_Dataset" />
<!--<xsl:if test="$totalIds > 0"> <xsl:if test="$totalIds > 0">
<resumptionToken> <resumptionToken>
<xsl:attribute name="expirationDate"><xsl:value-of select="$dateDelete"/></xsl:attribute> <xsl:attribute name="expirationDate"><xsl:value-of select="$dateDelete"/></xsl:attribute>
<xsl:attribute name="completeListSize"><xsl:value-of select="$totalIds"/></xsl:attribute> <xsl:attribute name="completeListSize"><xsl:value-of select="$totalIds"/></xsl:attribute>
<xsl:attribute name="cursor"><xsl:value-of select="$cursor"/></xsl:attribute> <xsl:attribute name="cursor"><xsl:value-of select="$cursor"/></xsl:attribute>
<xsl:value-of select="$res"/> <xsl:value-of select="$res"/>
</resumptionToken> </resumptionToken>
</xsl:if>--> </xsl:if>
</ListRecords> </ListRecords>
</xsl:if> </xsl:if>
</xsl:template> </xsl:template>
<xsl:template match="Documents" mode="GetRecord"> <xsl:template match="Datasets" mode="GetRecord">
<GetRecord> <GetRecord>
<xsl:apply-templates select="Rdr_Dataset" /> <xsl:apply-templates select="Rdr_Dataset" />
</GetRecord> </GetRecord>
@ -275,6 +285,9 @@
<xsl:when test="$oai_metadataPrefix='oai_dc'"> <xsl:when test="$oai_metadataPrefix='oai_dc'">
<xsl:apply-templates select="." mode="oai_dc" /> <xsl:apply-templates select="." mode="oai_dc" />
</xsl:when> </xsl:when>
<xsl:when test="$oai_metadataPrefix='oai_datacite'">
<xsl:apply-templates select="." mode="oai_datacite" />
</xsl:when>
</xsl:choose> </xsl:choose>
</metadata> </metadata>
@ -282,14 +295,65 @@
</xsl:choose> </xsl:choose>
</xsl:template> </xsl:template>
<xsl:template match="SetSpec"> <xsl:template match="SetSpec">
<setSpec> <setSpec>
<xsl:value-of select="@Value"/> <xsl:value-of select="@Value"/>
</setSpec> </setSpec>
</xsl:template> </xsl:template>
<xsl:template match="Rdr_Dataset" mode="oai_datacite">
<resource xmlns="http://datacite.org/schema/kernel-4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4.1/metadata.xsd">
<!-- <isReferenceQuality>true</isReferenceQuality>
<schemaVersion>4.1</schemaVersion>
<datacentreSymbol>RDR.GBA</datacentreSymbol> -->
<identifier>
<xsl:text>oai:</xsl:text>
<xsl:value-of select="$repIdentifier" />
<xsl:text>:</xsl:text>
<xsl:value-of select="@Id" />
</identifier>
<!--<datacite:creator>-->
<creators>
<xsl:apply-templates select="PersonAuthor" mode="oai_datacite" />
</creators>
<publicationYear><xsl:value-of select="@PublishedYear" /></publicationYear>
</resource>
</xsl:template>
<xsl:template match="PersonAuthor" mode="oai_datacite">
<creator>
<creatorName>
<xsl:if test="@NameType != ''" >
<xsl:attribute name="nameType">
<xsl:value-of select="@NameType" />
</xsl:attribute>
</xsl:if>
<xsl:value-of select="@LastName" />
<xsl:if test="@FirstName != ''" >
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:value-of select="@FirstName" />
<xsl:if test="@AcademicTitle != ''" >
<xsl:text> (</xsl:text>
<xsl:value-of select="@AcademicTitle" />
<xsl:text>)</xsl:text>
</xsl:if>
</creatorName>
<givenName><xsl:value-of select="@FirstName" /></givenName>
<familyName><xsl:value-of select="@LastName" /></familyName>
<xsl:if test="@IdentifierOrcid != ''" >
<nameIdentifier schemeURI="http://orcid.org/" nameIdentifierScheme="ORCID" ><xsl:value-of select="@IdentifierOrcid" /></nameIdentifier>
</xsl:if>
<!--
<nameType><xsl:value-of select="@NameType" /></nameType>
</xsl:if> -->
<affiliation>GBA</affiliation>
</creator>
</xsl:template>
<xsl:template match="Rdr_Dataset" mode="oai_dc"> <xsl:template match="Rdr_Dataset" mode="oai_dc">
<oai_dc:dc xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd"> <oai_dc:dc xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
<!-- dc:title --> <!-- dc:title -->
@ -389,12 +453,13 @@
</dc:date> </dc:date>
</xsl:template> </xsl:template>
<!-- für ListRecords -->
<xsl:template match="@Type" mode="oai_dc"> <xsl:template match="@Type" mode="oai_dc">
<dc:type> <dc:type>
<xsl:value-of select="." /> <xsl:value-of select="." />
</dc:type> </dc:type>
<dc:type> <dc:type>
<xsl:text>doc-type:</xsl:text> <xsl:text>data-type:</xsl:text>
<xsl:value-of select="." /> <xsl:value-of select="." />
</dc:type> </dc:type>
</xsl:template> </xsl:template>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
http://ws.pangaea.de/oai/oai2.xsl
XSL Transform to convert OAI 2.0 responses into XHTML XSL Transform to convert OAI 2.0 responses into XHTML
@ -55,13 +56,16 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
<xsl:template name="style"> <xsl:template name="style">
html, button, input, select, textarea, .pure-g [class *= "pure-u"] {
font-family: 'Open Sans', sans-serif;
}
td.value { td.value {
vertical-align: top; vertical-align: top;
padding-left: 1em; padding-left: 1em;
padding: 3px; padding: 3px;
} }
td.key { td.key {
background-color: #e0e0ff; background-color: #3abac4;
padding: 3px; padding: 3px;
text-align: right; text-align: right;
border: 1px solid #c0c0c0; border: 1px solid #c0c0c0;
@ -109,16 +113,17 @@ h3 {
background-color: #a0a0df; background-color: #a0a0df;
} }
.oaiRecord, .oaiRecordTitle { .oaiRecord, .oaiRecordTitle {
background-color: #f0f0ff; background-color: #eee;
border-style: solid; border-style: solid;
border-color: #d0d0d0; border-color: #d0d0d0;
} }
h2.oaiRecordTitle { h2.oaiRecordTitle {
background-color: #e0e0ff; background-color: #51565c;
color: #fff;
font-size: medium; font-size: medium;
font-weight: bold; font-weight: bold;
padding: 10px; padding: 10px;
border-width: 2px 2px 0px 2px; border-width: 0px 0px 0px 0px;
margin: 0px; margin: 0px;
} }
.oaiRecord { .oaiRecord {
@ -456,12 +461,21 @@ p.intro {
<xsl:template match="oai:metadataFormat"> <xsl:template match="oai:metadataFormat">
<h2>Metadata Format</h2> <h2>Metadata Format</h2>
<table class="values"> <table class="values">
<tr><td class="key">metadataPrefix</td> <tr>
<td class="value"><xsl:value-of select="oai:metadataPrefix"/></td></tr> <td class="key">metadataPrefix</td>
<tr><td class="key">metadataNamespace</td> <!-- <td class="value"><xsl:value-of select="oai:metadataPrefix"/></td> -->
<td class="value"><xsl:value-of select="oai:metadataNamespace"/></td></tr> <td class="value">
<tr><td class="key">schema</td> <a class="link" href="?verb=ListRecords&amp;metadataPrefix={oai:metadataPrefix}"><xsl:value-of select="oai:metadataPrefix"/></a>
<td class="value"><a href="{oai:schema}"><xsl:value-of select="oai:schema"/></a></td></tr> </td>
</tr>
<tr>
<td class="key">metadataNamespace</td>
<td class="value"><xsl:value-of select="oai:metadataNamespace"/></td>
</tr>
<tr>
<td class="key">schema</td>
<td class="value"><a href="{oai:schema}"><xsl:value-of select="oai:schema"/></a></td>
</tr>
</table> </table>
</xsl:template> </xsl:template>

View File

@ -37,6 +37,14 @@
<small id="orcidHelp" class="pure-form-message-inline">orcid is optional.</small> <small id="orcidHelp" class="pure-form-message-inline">orcid is optional.</small>
</div> </div>
<div class="pure-control-group">
{!! Form::label('name_type', 'Name Type') !!}
<div class="select form-control">
{!! Form::select('name_type', ['personal' => 'personal', 'organizational' => 'organizational'], null, ['id' => 'name_type', 'placeholder' => '-- no name type --']) !!}
</div>
<small id="nameTypeHelp" class="pure-form-message-inline">name type is optional</small>
</div>
<h5><b>Status of person</b></h5> <h5><b>Status of person</b></h5>
<div class="pure-control-group checkboxlist"> <div class="pure-control-group checkboxlist">
<label for="status" class="pure-checkbox"> <label for="status" class="pure-checkbox">