X-Git-Url: http://git.kpe.io/?p=pubmed.git;a=blobdiff_plain;f=pubmed-src.lisp;h=e53057a716d70c9f7d7935e6bf9eec5ebe42cf56;hp=a2e832adf321ca31dbb07b257a94a83b3b8ece0d;hb=103ec67276ac3769e7adbb51736ba382cc906127;hpb=53c9df7bcfe5a22f23531e55672dac868a20225c diff --git a/pubmed-src.lisp b/pubmed-src.lisp index a2e832a..e53057a 100644 --- a/pubmed-src.lisp +++ b/pubmed-src.lisp @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Jun 2001 ;;;; -;;;; $Id: pubmed-src.lisp,v 1.1 2003/06/06 22:04:05 kevin Exp $ +;;;; $Id$ ;;;; ;;;; This file, part of cl-pubmed, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; @@ -22,6 +22,7 @@ (defparameter +pubmed-host+ "www.ncbi.nlm.nih.gov") (defparameter +pubmed-query-url+ "/entrez/utils/pmqty.fcgi") (defparameter +pubmed-fetch-url+ "/entrez/utils/pmfetch.fcgi") +(defparameter +proxy-host+ nil) (define-condition pubmed-condition () @@ -31,19 +32,19 @@ (define-condition pubmed-server-error (error pubmed-condition) ((response :initarg :response :initform nil - :reader pubmed-server-error-response)) + :reader pubmed-condition-response)) (:report (lambda (c stream) (format stream "A PubMed server error occurred.") - (awhen (pubmed-server-error-response c) + (awhen (pubmed-condition-response c) (format stream " The server response was:~&~S" it))))) (define-condition pubmed-query-error (error pubmed-condition) ((response :initarg :response :initform nil - :reader pubmed-query-error-response)) + :reader pubmed-condition-response)) (:report (lambda (c stream) (format stream "A PubMed server error occurred.") - (awhen (pubmed-query-error-response c) + (awhen (pubmed-condition-response c) (format stream " The server response was:~&~S" it))))) ;;; Article-Set and Article Classes @@ -104,16 +105,18 @@ (string-append ref (format nil ":~a" it))) ref)) -(defmethod print-article-set ((artset pm-article-set) &key (os *standard-output*) (format :text) - (complete nil) (print-link t)) +(defmethod print-article-set ((artset pm-article-set) + &key (os *standard-output*) (format :text) + (complete nil) (print-link nil)) "Display an article set to specified stream in specified format" - (dotimes (i (articles-count artset)) - (print-article (nth i (articles artset)) :os os :format format - :complete complete :print-link print-link)) - artset) + (dotimes (i (articles-count artset) artset) + (if (nth i (articles artset)) + (print-article (nth i (articles artset)) :os os :format format + :complete complete :print-link print-link) + (princ "NULL Article" os)))) (defmethod print-article ((art pm-article) &key (os *standard-output*) - (format :text) (complete nil) (print-link t)) + (format :text) (complete nil) (print-link nil)) "Display an article" (ecase format (:text @@ -133,8 +136,10 @@ (:html (let ((has-link (or (article-abstract art) (article-mesh-headings art)))) (when (and print-link has-link) - (format os "" (make-url "print-article") (article-pmid art))) - (format os "
~a
~%" (article-title art)) + (format os "
" (funcall print-link + (article-pmid art)))) + (format os "
~a
~%" + (article-title art)) (when (and print-link has-link) (format os "
")) (format os "
~a
~%" @@ -218,7 +223,8 @@ XML string of PubMed search results and XML search status" (net.aserve.client:do-http-request (format nil "http://~a~a" +pubmed-host+ +pubmed-query-url+) :method :get - :query query-alist))) + :query query-alist + :proxy *proxy-host*))) (defun pubmed-fetch-pmids-xml (pmids) "Fetch articles for a list of PubMed ID's and return XML string" @@ -229,7 +235,8 @@ XML string of PubMed search results and XML search status" :method :get :query `(("db" . "PubMed") ("report" . "xml") ("mode" . "text") - ("id" . ,(list-to-delimited-string pmids #\,)))))) + ("id" . ,(list-to-delimited-string pmids #\,))) + :proxy *proxy-host*))) ;;; XML Extraction Routines