From 995967b734a3fb825625c499e8a26f6b109db0b3 Mon Sep 17 00:00:00 2001 From: Arno Kaimbacher Date: Tue, 25 Jan 2022 15:00:42 +0100 Subject: [PATCH] - oai: add open_access set - datasetxml2oai-pmh.xslt: remove file downloads from dataset identifier - composer updates --- .../Controllers/Oai/RequestController.php | 18 +++++-- composer.lock | 48 +++++++++---------- public/datasetxml2oai-pmh.xslt | 6 +-- 3 files changed, 41 insertions(+), 31 deletions(-) diff --git a/app/Http/Controllers/Oai/RequestController.php b/app/Http/Controllers/Oai/RequestController.php index b30de8f..36ad97a 100644 --- a/app/Http/Controllers/Oai/RequestController.php +++ b/app/Http/Controllers/Oai/RequestController.php @@ -26,7 +26,7 @@ class RequestController extends Controller */ 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-zäöüÄÖÜß0-9\-_\.!~\*\'\(\)]+'; /** * Holds xml representation of document information to be processed. @@ -323,6 +323,7 @@ class RequestController extends Controller //$oaiSets = new Oai_Model_Sets(); $sets = array( + 'open_access' => 'Set for open access licenses', // 'bibliography:true' => 'Set for bibliographic entries', // 'bibliography:false' => 'Set for non-bibliographic entries', ); @@ -435,6 +436,13 @@ class RequestController extends Controller $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) ->where('server_date_published', '<=', $untilDate); - $test = $finder->toSql(); + // $test = $finder->toSql(); } elseif (array_key_exists('until', $oaiRequest) && !array_key_exists('from', $oaiRequest)) { $until = $oaiRequest['until']; try { @@ -467,7 +475,8 @@ class RequestController extends Controller $earliestPublicationDate = Dataset::earliestPublicationDate()->server_date_published; if ($earliestPublicationDate->gt($untilDate)) { 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 ); } else { @@ -476,7 +485,8 @@ class RequestController extends Controller } } catch (OaiModelException $e) { 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 ); } catch (\Exception $e) { diff --git a/composer.lock b/composer.lock index cebd1b3..5ac6bc0 100755 --- a/composer.lock +++ b/composer.lock @@ -2282,16 +2282,16 @@ }, { "name": "nesbot/carbon", - "version": "2.55.2", + "version": "2.56.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "8c2a18ce3e67c34efc1b29f64fe61304368259a2" + "reference": "626ec8cbb724cd3c3400c3ed8f730545b744e3f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/8c2a18ce3e67c34efc1b29f64fe61304368259a2", - "reference": "8c2a18ce3e67c34efc1b29f64fe61304368259a2", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/626ec8cbb724cd3c3400c3ed8f730545b744e3f4", + "reference": "626ec8cbb724cd3c3400c3ed8f730545b744e3f4", "shasum": "" }, "require": { @@ -2308,7 +2308,7 @@ "kylekatarnls/multi-tester": "^2.0", "phpmd/phpmd": "^2.9", "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", "squizlabs/php_codesniffer": "^3.4" }, @@ -2374,7 +2374,7 @@ "type": "tidelift" } ], - "time": "2021-12-03T14:59:52+00:00" + "time": "2022-01-21T17:08:38+00:00" }, { "name": "nikic/php-parser", @@ -3225,16 +3225,16 @@ }, { "name": "solarium/solarium", - "version": "6.2.1", + "version": "6.2.2", "source": { "type": "git", "url": "https://github.com/solariumphp/solarium.git", - "reference": "3c13804d3e12b2783ca450a4e8a6d759e496d651" + "reference": "0f5c81eee5529556f349eaacfbf5ce3cfbb2be47" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/solariumphp/solarium/zipball/3c13804d3e12b2783ca450a4e8a6d759e496d651", - "reference": "3c13804d3e12b2783ca450a4e8a6d759e496d651", + "url": "https://api.github.com/repos/solariumphp/solarium/zipball/0f5c81eee5529556f349eaacfbf5ce3cfbb2be47", + "reference": "0f5c81eee5529556f349eaacfbf5ce3cfbb2be47", "shasum": "" }, "require": { @@ -3282,9 +3282,9 @@ ], "support": { "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", @@ -5695,16 +5695,16 @@ }, { "name": "voku/portable-ascii", - "version": "1.5.6", + "version": "1.6.1", "source": { "type": "git", "url": "https://github.com/voku/portable-ascii.git", - "reference": "80953678b19901e5165c56752d087fc11526017c" + "reference": "87337c91b9dfacee02452244ee14ab3c43bc485a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/voku/portable-ascii/zipball/80953678b19901e5165c56752d087fc11526017c", - "reference": "80953678b19901e5165c56752d087fc11526017c", + "url": "https://api.github.com/repos/voku/portable-ascii/zipball/87337c91b9dfacee02452244ee14ab3c43bc485a", + "reference": "87337c91b9dfacee02452244ee14ab3c43bc485a", "shasum": "" }, "require": { @@ -5741,7 +5741,7 @@ ], "support": { "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": [ { @@ -5765,7 +5765,7 @@ "type": "tidelift" } ], - "time": "2020-11-12T00:07:28+00:00" + "time": "2022-01-24T18:55:24+00:00" }, { "name": "yajra/laravel-datatables-oracle", @@ -6636,16 +6636,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.11", + "version": "9.5.13", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "2406855036db1102126125537adb1406f7242fdd" + "reference": "597cb647654ede35e43b137926dfdfef0fb11743" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2406855036db1102126125537adb1406f7242fdd", - "reference": "2406855036db1102126125537adb1406f7242fdd", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/597cb647654ede35e43b137926dfdfef0fb11743", + "reference": "597cb647654ede35e43b137926dfdfef0fb11743", "shasum": "" }, "require": { @@ -6723,7 +6723,7 @@ ], "support": { "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": [ { @@ -6735,7 +6735,7 @@ "type": "github" } ], - "time": "2021-12-25T07:07:57+00:00" + "time": "2022-01-24T07:33:35+00:00" }, { "name": "sebastian/cli-parser", diff --git a/public/datasetxml2oai-pmh.xslt b/public/datasetxml2oai-pmh.xslt index 1dc1f8c..68bcba1 100644 --- a/public/datasetxml2oai-pmh.xslt +++ b/public/datasetxml2oai-pmh.xslt @@ -564,12 +564,12 @@ - + + - + -->