本文整理汇总了PHP中MetadataDescription::getMetadataSchema方法的典型用法代码示例。如果您正苦于以下问题:PHP MetadataDescription::getMetadataSchema方法的具体用法?PHP MetadataDescription::getMetadataSchema怎么用?PHP MetadataDescription::getMetadataSchema使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MetadataDescription
的用法示例。
在下文中一共展示了MetadataDescription::getMetadataSchema方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switch
/**
* Map NLM properties to OpenURL properties.
* NB: OpenURL has no i18n so we use the default
* locale when mapping.
* @see Filter::process()
* @param $input MetadataDescription
* @return MetadataDescription
*/
function &process(&$input)
{
$nullVar = null;
// Identify the genre of the target record and
// instantiate the target description.
$publicationType = $input->getStatement('[@publication-type]');
switch ($publicationType) {
case NLM30_PUBLICATION_TYPE_JOURNAL:
case NLM30_PUBLICATION_TYPE_CONFPROC:
$outputSchemaName = 'lib.pkp.plugins.metadata.openurl10.schema.Openurl10JournalSchema';
break;
case NLM30_PUBLICATION_TYPE_BOOK:
$outputSchemaName = 'lib.pkp.plugins.metadata.openurl10.schema.Openurl10BookSchema';
break;
case NLM30_PUBLICATION_TYPE_THESIS:
$outputSchemaName = 'lib.pkp.plugins.metadata.openurl10.schema.Openurl10DissertationSchema';
break;
default:
// Unsupported type
return $nullVar;
}
// Create the target description
$output = new MetadataDescription($outputSchemaName, $input->getAssocType());
// Transform authors
import('lib.pkp.plugins.metadata.nlm30.filter.Nlm30NameSchemaPersonStringFilter');
$personStringFilter = new Nlm30NameSchemaPersonStringFilter();
$authors =& $input->getStatement('person-group[@person-group-type="author"]');
if (is_array($authors) && count($authors)) {
$aulast = $authors[0]->hasStatement('prefix') ? $authors[0]->getStatement('prefix') . ' ' : '';
$aulast .= $authors[0]->getStatement('surname');
if (!empty($aulast)) {
$success = $output->addStatement('aulast', $aulast);
assert($success);
}
$givenNames = $authors[0]->getStatement('given-names');
if (is_array($givenNames) && count($givenNames)) {
$aufirst = implode(' ', $givenNames);
if (!empty($aufirst)) {
$success = $output->addStatement('aufirst', $aufirst);
assert($success);
}
$initials = array();
foreach ($givenNames as $givenName) {
$initials[] = substr($givenName, 0, 1);
}
$auinit1 = array_shift($initials);
if (!empty($auinit1)) {
$success = $output->addStatement('auinit1', $auinit1);
assert($success);
}
$auinitm = implode('', $initials);
if (!empty($auinitm)) {
$success = $output->addStatement('auinitm', $auinitm);
assert($success);
}
$auinit = $auinit1 . $auinitm;
if (!empty($auinit)) {
$success = $output->addStatement('auinit', $auinit);
assert($success);
}
}
$ausuffix = $authors[0]->getStatement('suffix');
if (!empty($ausuffix)) {
$success = $output->addStatement('ausuffix', $ausuffix);
assert($success);
}
foreach ($authors as $author) {
if ($author == PERSON_STRING_FILTER_ETAL) {
$au = $author;
} else {
$au = $personStringFilter->execute($author);
}
$success = $output->addStatement('au', $au);
assert($success);
unset($au);
}
}
// Genre: Guesswork
if (is_a($output->getMetadataSchema(), 'Openurl10JournalBookBaseSchema')) {
switch ($publicationType) {
case NLM30_PUBLICATION_TYPE_JOURNAL:
$genre = $input->hasProperty('article-title') ? OPENURL10_GENRE_ARTICLE : OPENURL10_GENRE_JOURNAL;
break;
case NLM30_PUBLICATION_TYPE_CONFPROC:
$genre = $input->hasProperty('article-title') ? OPENURL10_GENRE_PROCEEDING : OPENURL10_GENRE_CONFERENCE;
break;
case NLM30_PUBLICATION_TYPE_BOOK:
$genre = $input->hasProperty('article-title') ? OPENURL10_GENRE_BOOKITEM : OPENURL10_GENRE_BOOK;
break;
}
assert(!empty($genre));
$success = $output->addStatement('genre', $genre);
//.........这里部分代码省略.........