- oai: add open_access set

- datasetxml2oai-pmh.xslt: remove file downloads from dataset identifier
- composer updates
This commit is contained in:
Arno Kaimbacher 2022-01-25 15:00:42 +01:00
parent 4fc8661a00
commit 995967b734
3 changed files with 41 additions and 31 deletions

View File

@ -26,7 +26,7 @@ class RequestController extends Controller
*/ */
private $deliveringDocumentStates = array('published', 'deleted'); // maybe deleted documents too private $deliveringDocumentStates = array('published', 'deleted'); // maybe deleted documents too
//private $xMetaDissRestriction = array('doctoralthesis', 'habilitation'); //private $xMetaDissRestriction = array('doctoralthesis', 'habilitation');
const SET_SPEC_PATTERN = '[A-Za-z0-9\-_\.!~\*\'\(\)]+'; const SET_SPEC_PATTERN = '[A-Za-zäöüÄÖÜß0-9\-_\.!~\*\'\(\)]+';
/** /**
* Holds xml representation of document information to be processed. * Holds xml representation of document information to be processed.
@ -323,6 +323,7 @@ class RequestController extends Controller
//$oaiSets = new Oai_Model_Sets(); //$oaiSets = new Oai_Model_Sets();
$sets = array( $sets = array(
'open_access' => 'Set for open access licenses',
// 'bibliography:true' => 'Set for bibliographic entries', // 'bibliography:true' => 'Set for bibliographic entries',
// 'bibliography:false' => 'Set for non-bibliographic entries', // 'bibliography:false' => 'Set for non-bibliographic entries',
); );
@ -435,6 +436,13 @@ class RequestController extends Controller
$q->where('label', $setarray[1]); $q->where('label', $setarray[1]);
}); });
} }
} elseif (!empty($setarray[0]) && $setarray[0] == 'open_access') {
$openAccessLicences = ["CC-BY-4.0", "CC-BY-SA-4.0"];
$finder->whereHas('licenses', function ($q) use ($openAccessLicences) {
$q->whereIn('name', $openAccessLicences);
// $q->where('name', '=', "CC-BY-4.0")->orWhere('name', '=',"CC-BY-SA-4.0");
});
//$test = $finder->toSql();
} }
} }
@ -455,7 +463,7 @@ class RequestController extends Controller
} }
$finder->where('server_date_published', '>=', $fromDate) $finder->where('server_date_published', '>=', $fromDate)
->where('server_date_published', '<=', $untilDate); ->where('server_date_published', '<=', $untilDate);
$test = $finder->toSql(); // $test = $finder->toSql();
} elseif (array_key_exists('until', $oaiRequest) && !array_key_exists('from', $oaiRequest)) { } elseif (array_key_exists('until', $oaiRequest) && !array_key_exists('from', $oaiRequest)) {
$until = $oaiRequest['until']; $until = $oaiRequest['until'];
try { try {
@ -467,7 +475,8 @@ class RequestController extends Controller
$earliestPublicationDate = Dataset::earliestPublicationDate()->server_date_published; $earliestPublicationDate = Dataset::earliestPublicationDate()->server_date_published;
if ($earliestPublicationDate->gt($untilDate)) { if ($earliestPublicationDate->gt($untilDate)) {
throw new OaiModelException( throw new OaiModelException(
"earliestDatestamp is greater than given until date. The given values results in an empty list.", "earliestDatestamp is greater than given until date.
The given values results in an empty list.",
OaiModelError::NORECORDSMATCH OaiModelError::NORECORDSMATCH
); );
} else { } else {
@ -476,7 +485,8 @@ class RequestController extends Controller
} }
} catch (OaiModelException $e) { } catch (OaiModelException $e) {
throw new OaiModelException( throw new OaiModelException(
"earliestDatestamp is greater than given until date. The given values results in an empty list.", "earliestDatestamp is greater than given until date.
The given values results in an empty list.",
OaiModelError::NORECORDSMATCH OaiModelError::NORECORDSMATCH
); );
} catch (\Exception $e) { } catch (\Exception $e) {

48
composer.lock generated
View File

@ -2282,16 +2282,16 @@
}, },
{ {
"name": "nesbot/carbon", "name": "nesbot/carbon",
"version": "2.55.2", "version": "2.56.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/briannesbitt/Carbon.git", "url": "https://github.com/briannesbitt/Carbon.git",
"reference": "8c2a18ce3e67c34efc1b29f64fe61304368259a2" "reference": "626ec8cbb724cd3c3400c3ed8f730545b744e3f4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/8c2a18ce3e67c34efc1b29f64fe61304368259a2", "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/626ec8cbb724cd3c3400c3ed8f730545b744e3f4",
"reference": "8c2a18ce3e67c34efc1b29f64fe61304368259a2", "reference": "626ec8cbb724cd3c3400c3ed8f730545b744e3f4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2308,7 +2308,7 @@
"kylekatarnls/multi-tester": "^2.0", "kylekatarnls/multi-tester": "^2.0",
"phpmd/phpmd": "^2.9", "phpmd/phpmd": "^2.9",
"phpstan/extension-installer": "^1.0", "phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^0.12.54", "phpstan/phpstan": "^0.12.54 || ^1.0",
"phpunit/phpunit": "^7.5.20 || ^8.5.14", "phpunit/phpunit": "^7.5.20 || ^8.5.14",
"squizlabs/php_codesniffer": "^3.4" "squizlabs/php_codesniffer": "^3.4"
}, },
@ -2374,7 +2374,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-12-03T14:59:52+00:00" "time": "2022-01-21T17:08:38+00:00"
}, },
{ {
"name": "nikic/php-parser", "name": "nikic/php-parser",
@ -3225,16 +3225,16 @@
}, },
{ {
"name": "solarium/solarium", "name": "solarium/solarium",
"version": "6.2.1", "version": "6.2.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/solariumphp/solarium.git", "url": "https://github.com/solariumphp/solarium.git",
"reference": "3c13804d3e12b2783ca450a4e8a6d759e496d651" "reference": "0f5c81eee5529556f349eaacfbf5ce3cfbb2be47"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/solariumphp/solarium/zipball/3c13804d3e12b2783ca450a4e8a6d759e496d651", "url": "https://api.github.com/repos/solariumphp/solarium/zipball/0f5c81eee5529556f349eaacfbf5ce3cfbb2be47",
"reference": "3c13804d3e12b2783ca450a4e8a6d759e496d651", "reference": "0f5c81eee5529556f349eaacfbf5ce3cfbb2be47",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3282,9 +3282,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/solariumphp/solarium/issues", "issues": "https://github.com/solariumphp/solarium/issues",
"source": "https://github.com/solariumphp/solarium/tree/6.2.1" "source": "https://github.com/solariumphp/solarium/tree/6.2.2"
}, },
"time": "2021-12-26T10:15:52+00:00" "time": "2022-01-20T17:45:10+00:00"
}, },
{ {
"name": "swiftmailer/swiftmailer", "name": "swiftmailer/swiftmailer",
@ -5695,16 +5695,16 @@
}, },
{ {
"name": "voku/portable-ascii", "name": "voku/portable-ascii",
"version": "1.5.6", "version": "1.6.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/voku/portable-ascii.git", "url": "https://github.com/voku/portable-ascii.git",
"reference": "80953678b19901e5165c56752d087fc11526017c" "reference": "87337c91b9dfacee02452244ee14ab3c43bc485a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/voku/portable-ascii/zipball/80953678b19901e5165c56752d087fc11526017c", "url": "https://api.github.com/repos/voku/portable-ascii/zipball/87337c91b9dfacee02452244ee14ab3c43bc485a",
"reference": "80953678b19901e5165c56752d087fc11526017c", "reference": "87337c91b9dfacee02452244ee14ab3c43bc485a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -5741,7 +5741,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/voku/portable-ascii/issues", "issues": "https://github.com/voku/portable-ascii/issues",
"source": "https://github.com/voku/portable-ascii/tree/1.5.6" "source": "https://github.com/voku/portable-ascii/tree/1.6.1"
}, },
"funding": [ "funding": [
{ {
@ -5765,7 +5765,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2020-11-12T00:07:28+00:00" "time": "2022-01-24T18:55:24+00:00"
}, },
{ {
"name": "yajra/laravel-datatables-oracle", "name": "yajra/laravel-datatables-oracle",
@ -6636,16 +6636,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "9.5.11", "version": "9.5.13",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "2406855036db1102126125537adb1406f7242fdd" "reference": "597cb647654ede35e43b137926dfdfef0fb11743"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2406855036db1102126125537adb1406f7242fdd", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/597cb647654ede35e43b137926dfdfef0fb11743",
"reference": "2406855036db1102126125537adb1406f7242fdd", "reference": "597cb647654ede35e43b137926dfdfef0fb11743",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -6723,7 +6723,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues", "issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.11" "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.13"
}, },
"funding": [ "funding": [
{ {
@ -6735,7 +6735,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2021-12-25T07:07:57+00:00" "time": "2022-01-24T07:33:35+00:00"
}, },
{ {
"name": "sebastian/cli-parser", "name": "sebastian/cli-parser",

View File

@ -564,12 +564,12 @@
</dc:format> </dc:format>
</xsl:template> </xsl:template>
<xsl:template match="File" mode="oai_dc"> <!-- <xsl:template match="File" mode="oai_dc">
<dc:identifier> <dc:identifier>
<!-- <xsl:value-of select="@PathName" /> --> <xsl:value-of select="@PathName" />
<xsl:value-of select="concat($downloadLink, @Id)" /> <xsl:value-of select="concat($downloadLink, @Id)" />
</dc:identifier> </dc:identifier>
</xsl:template> </xsl:template> -->
<xsl:template match="Identifier" mode="oai_dc"> <xsl:template match="Identifier" mode="oai_dc">
<dc:identifier> <dc:identifier>