Hello!

To see the file structure, click on "tree".

Note that updates take place every 10 minutes, commits may not be seen immediately.
svn path=/; revision=95
authorpreecej <preecej@localhost>
Mon, 23 May 2011 22:08:16 +0000 (22:08 +0000)
committerpreecej <preecej@localhost>
Mon, 23 May 2011 22:08:16 +0000 (22:08 +0000)
preecej/semantic_wiki/prototyping/NCBI_eDocSummary.php [new file with mode: 0644]

diff --git a/preecej/semantic_wiki/prototyping/NCBI_eDocSummary.php b/preecej/semantic_wiki/prototyping/NCBI_eDocSummary.php
new file mode 100644 (file)
index 0000000..7e38a66
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+$pub_id = $_GET["pub_id"];
+$url = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi/?db=pubmed&id=" . $pub_id;
+$response = file_get_contents($url);
+
+$NCBI_doc = new SimpleXMLElement($response); // inst. NCBI eDocSummary as xml
+$xml_out = new SimpleXMLElement("<eSummaryResult/>"); // inst. new xml doc for output
+
+// build xml doc with NCBI data
+$DocSum = $xml_out->addChild("DocSum");
+$DocSum->addChild("Id",$NCBI_doc->DocSum->Id);
+
+foreach ($NCBI_doc->xpath("//Item") as $item) {
+    switch((string) $item["Name"]) { // Get attributes as element indices
+    case "PubDate":
+        $DocSum->addChild("PubDate",$item);
+        break;
+    case "Author":
+        $authorList[] = $item;
+        break;
+    case "LastAuthor":
+        $DocSum->addChild("LastAuthor",$item);
+        break;
+    case "Title":
+        $DocSum->addChild("Title",$item);
+        break;
+    case "Volume":
+        $DocSum->addChild("Volume",$item);
+        break;
+    case "Pages":
+        $DocSum->addChild("Pages",$item);
+        break;
+    case "FullJournalName":
+        $DocSum->addChild("FullJournalName",$item);
+        break;
+    }
+}
+
+$author_list = "";
+foreach ($authorList as $author) {
+    $author_list = $author_list . $author . ", ";
+}
+$DocSum->addChild("AuthorList",rtrim($author_list,", "));
+
+
+header('Content-Type: text/xml'); // output xml doctype in your response
+echo $xml_out->asXML(); 
+?>
+