Created
March 15, 2012 11:06
-
-
Save hubgit/2043680 to your computer and use it in GitHub Desktop.
Metadata returned for DOIs from CrossRef and DataCite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'arc/ARC2.php'; | |
$dois = array('10.1126/science.1157784', '10.5524/100005'); | |
foreach ($dois as $doi) { | |
$url = "http://dx.doi.org/$doi"; | |
print "$url:\n"; | |
$headers = array('Accept: text/turtle'); | |
$context = stream_context_create(array('http' => array('header' => $headers))); | |
$data = file_get_contents($url, false, $context); | |
$parser = ARC2::getTurtleParser(); | |
$parser->parse($url, $data); | |
$index = $parser->getSimpleIndex(); | |
$metadata = $index[$url]; | |
if (!$metadata) $metadata = $index["http://dx.doi.org/\n$doi\n"]; // DataCite RDF is dodgy | |
ksort($metadata); | |
foreach ($metadata as $field => $value) { | |
$value = str_replace("\n", '', $value[0]); // DataCite RDF is dodgy | |
printf("\t<%s> %s\n", $field, $value); | |
} | |
} | |
/* | |
http://dx.doi.org/10.1126/science.1157784: | |
<http://prismstandard.org/namespaces/basic/2.1/doi> 10.1126/science.1157784 | |
<http://prismstandard.org/namespaces/basic/2.1/endingPage> 832 | |
<http://prismstandard.org/namespaces/basic/2.1/startingPage> 828 | |
<http://prismstandard.org/namespaces/basic/2.1/volume> 325 | |
<http://purl.org/dc/terms/creator> http://id.crossref.org/contributor/a-h-renear-1z0zrfd0bp2b7 | |
<http://purl.org/dc/terms/date> 2009-08-13Z | |
<http://purl.org/dc/terms/identifier> 10.1126/science.1157784 | |
<http://purl.org/dc/terms/isPartOf> http://id.crossref.org/issn/0036-8075 | |
<http://purl.org/dc/terms/title> Strategic Reading, Ontologies, and the Future of Scientific Publishing | |
<http://purl.org/ontology/bibo/doi> 10.1126/science.1157784 | |
<http://purl.org/ontology/bibo/pageEnd> 832 | |
<http://purl.org/ontology/bibo/pageStart> 828 | |
<http://purl.org/ontology/bibo/volume> 325 | |
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> http://purl.org/ontology/bibo/Article | |
<http://www.w3.org/2002/07/owl#sameAs> info:doi/10.1126/science.1157784 | |
http://dx.doi.org/10.5524/100005: | |
<http://purl.org/dc/terms/creator> Lambert, D | |
<http://purl.org/dc/terms/date> 2011 | |
<http://purl.org/dc/terms/identifier> 10.5524/100005 | |
<http://purl.org/dc/terms/publisher> GigaScience | |
<http://purl.org/dc/terms/title> Genomic data from the Emperor penguin (Aptenodytes forsteri) | |
<http://www.w3.org/2002/07/owl#sameAs> doi:10.5524/100005 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment