subugoe / oai-model
OAI-PMH 模型
0.1.2
2024-01-08 16:39 UTC
Requires
- php: ^8.1
- doctrine/collections: ^2.0
- jms/serializer: ^3.17
- subugoe/iiif-model: ^0.2.4
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.8
- phpstan/phpstan: ^1.7
- rector/rector: ^0.15.23
README
这个库定义了用于通过HTTP接口检索OAI数据的OAI-PMH模型。
在Symfony应用程序中,模型可以通过以下方式程序化填充,例如用于Identify
动词:
// assume we injected some service at $this->oaiService $identify = new new \Subugoe\OaiModel\Model\Identify\Identify(); $identification = new \Subugoe\OaiModel\Model\Identify\Identification(); $description = new \Subugoe\OaiModel\Model\Identify\Description(); $oaiIdentifier = new \Subugoe\OaiModel\Model\Identify\OaiIdentifier(); $oaiIdentifierTags = $oaiConfiguration['oai_identifier']; $oaiIdentifier ->setNamespace($oaiIdentifierTags['xmlns']) ->setXsi($oaiIdentifierTags['xmlns:xsi']) ->setSchemaLocation($oaiIdentifierTags['xsi:schemaLocation']) ->setScheme($oaiIdentifierTags['scheme']) ->setDelimiter($oaiIdentifierTags['delimiter']) ->setRepositoryIdentifier($oaiIdentifierTags['repositoryIdentifier']) ->setSampleIdentifier($oaiIdentifierTags['sampleIdentifier']); $description->setOaiIdentifier($oaiIdentifier); $identificationTags = $oaiConfiguration['identification_tags']; $oaiRequest = (new \Subugoe\OaiModel\Model\Request()) ->setUrl($url) ->setVerb('Identify'); $identify ->setDate(new DateTimeImmutable()) ->setRequest($oaiRequest); $identification ->setAdminEmail($identificationTags['admin_email']) ->setBaseUrl($identificationTags['base_url']) ->setDeletedRecord($identificationTags['deleted_record']) ->setGranularity($identificationTags['granularity']) ->setProtocolVersion($identificationTags['protocol_version']) ->setRepositoryName($identificationTags['repository_name']) ->setEarliestDatestamp(new DateTimeImmutable('1998-03-01T00:00:00Z')) ->setDescription($description); $identify->setIdentify($identification); $xml = $this->serializer->serialize($identify, 'xml');