Browse Source

refactors metadata handling

pull/58/head
Martin Monperrus 10 years ago
parent
commit
214d4eca78
  1. 66
      bibtexbrowser.php

66
bibtexbrowser.php

@ -3211,6 +3211,37 @@ class BibEntryDisplay {
} }
if (METADATA_GS) { if (METADATA_GS) {
$result = $this->metadata_google_scholar($result);
} // end Google Scholar
// a fallback to essential dublin core
if (METADATA_DC) {
$result = $this->metadata_dublin_core($result);
}
if (METADATA_EPRINTS) {
$result = $this->metadata_eprints($result);
}
return $result;
} // end function metadata
function metadata_dublin_core($result) {
// Dublin Core should not be used for bibliographic metadata
// according to several sources
// * Google Scholar: "Use Dublin Core tags (e.g., DC.title) as a last resort - they work poorly for journal papers"
// * http://reprog.wordpress.com/2010/09/03/bibliographic-data-part-2-dublin-cores-dirty-little-secret/
// however it seems that Google Scholar needs at least DC.Title to trigger referencing
// reference documentation: http://dublincore.org/documents/dc-citation-guidelines/
$result[] = array('DC.Title',$this->bib->getTitle());
foreach($this->bib->getArrayOfCommaSeparatedAuthors() as $author) {
$result[] = array('DC.Creator',$author);
}
$result[] = array('DC.Issued',$this->bib->getYear());
return $result;
}
function metadata_google_scholar($result) {
// the description may mix with the Google Scholar tags // the description may mix with the Google Scholar tags
// we remove it // we remove it
// $result[] = array('description',trim(strip_tags(str_replace('"','',bib2html($this->bib))))); // $result[] = array('description',trim(strip_tags(str_replace('"','',bib2html($this->bib)))));
@ -3290,33 +3321,10 @@ class BibEntryDisplay {
} }
} }
} // end Google Scholar
// we don't introduce yet another kind of bibliographic metadata
// the core bibtex metadata will simply be available as json
// now adding the pure bibtex with no translation
//foreach ($this->bib->getFields() as $k => $v) {
// if (!preg_match("/^_/",$k)) {
// $result[] = array("bibtex:".$k,$v);
// }
//}
// a fallback to essential dublin core
// Dublin Core should not be used for bibliographic metadata
// according to several sources
// * Google Scholar: "Use Dublin Core tags (e.g., DC.title) as a last resort - they work poorly for journal papers"
// * http://reprog.wordpress.com/2010/09/03/bibliographic-data-part-2-dublin-cores-dirty-little-secret/
// however it seems that Google Scholar needs at least DC.Title to trigger referencing
// reference documentation: http://dublincore.org/documents/dc-citation-guidelines/
if (METADATA_DC) {
$result[] = array('DC.Title',$this->bib->getTitle());
foreach($this->bib->getArrayOfCommaSeparatedAuthors() as $author) {
$result[] = array('DC.Creator',$author);
}
$result[] = array('DC.Issued',$this->bib->getYear());
return $result;
} }
function metadata_eprints($result) {
// --------------------------------- BEGIN METADATA EPRINTS // --------------------------------- BEGIN METADATA EPRINTS
// and now adding eprints metadata // and now adding eprints metadata
// why adding eprints metadata? // why adding eprints metadata?
@ -3326,7 +3334,6 @@ class BibEntryDisplay {
// reference documentation: the eprints source code (./perl_lib/EPrints/Plugin/Export/Simple.pm) // reference documentation: the eprints source code (./perl_lib/EPrints/Plugin/Export/Simple.pm)
// examples: conference paper: http://tubiblio.ulb.tu-darmstadt.de/44344/ // examples: conference paper: http://tubiblio.ulb.tu-darmstadt.de/44344/
// journal paper: http://tubiblio.ulb.tu-darmstadt.de/44344/ // journal paper: http://tubiblio.ulb.tu-darmstadt.de/44344/
if (METADATA_EPRINTS) {
$result[] = array('eprints.title',$this->bib->getTitle()); $result[] = array('eprints.title',$this->bib->getTitle());
$authors = $this->bib->getArrayOfCommaSeparatedAuthors(); $authors = $this->bib->getArrayOfCommaSeparatedAuthors();
foreach($authors as $author) { foreach($authors as $author) {
@ -3379,13 +3386,10 @@ class BibEntryDisplay {
if ($this->bib->hasField('url')) { if ($this->bib->hasField('url')) {
$result[] = array('eprints.official_url',$this->bib->getField('url')); $result[] = array('eprints.official_url',$this->bib->getField('url'));
} }
}
// --------------------------------- END METADATA EPRINTS // --------------------------------- END METADATA EPRINTS
return $result; return $result;
}
}
} // end method metatada_eprints;
} // end class BibEntryDisplay
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------

Loading…
Cancel
Save