当前位置: 首页>>代码示例>>PHP>>正文


PHP MetadataDescription::getMetadataSchema方法代码示例

本文整理汇总了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);
//.........这里部分代码省略.........
开发者ID:EreminDm,项目名称:water-cao,代码行数:101,代码来源:Nlm30CitationSchemaOpenurl10CrosswalkFilter.inc.php


注:本文中的MetadataDescription::getMetadataSchema方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。