Ejemplo n.º 1
0
<?php

/**
 * @file zotero.php
 *
 * Explain how to use with Zotero
 *
 */
require_once '../config.inc.php';
require_once dirname(__FILE__) . '/html.php';
global $config;
header("Content-type: text/html; charset=utf-8\n\n");
echo html_html_open();
echo html_head_open();
echo html_title('Zotero - ' . $config['site_name']);
echo html_head_close();
echo html_body_open();
echo html_page_header(false);
?>
<div style="float:right;padding:10px;"><img src="static/zotero_z_32px.png" alt="zotero logo"/></div>
<h1>Using BioStor with Zotero</h1>


<p><a href="http://www.zotero.org">Zotero</a> is a Firefox extension for collecting and managing bibliographic references. You can use Zotero to capture citations from BioStor, and you can also link to references in BioStor from within Zotero using OpenURL. Note that the instructions below assume that you are using version 2.0 or Zotero.</p>

<h2>Storing citations</h2>
<p>Zotero can detect when a BioStor page contains bibliograpic information, and you can import that information into you Zotero library in the normal way (see the Zotero page <a href="http://www.zotero.org/support/getting_stuff_into_your_library">Getting stuff into your library</a>).</p>

<h2>Set up OpenURL linking</h2>
<p>To enable OpenURL linking go the <b>Actions</b> button in Zotero and click 
on the <b>Preferences</b> command:</p>
Ejemplo n.º 2
0
function display_bhl_result_html($referent, $hits)
{
    global $config;
    header("Content-type: text/html; charset=utf-8\n\n");
    echo html_html_open();
    echo html_head_open();
    echo html_title('Reference Finder - ' . $config['site_name']);
    echo html_include_css('css/main.css');
    echo html_include_css('css/lightbox.css');
    echo html_include_script('js/fadeup.js');
    echo html_include_script('js/prototype.js');
    echo html_include_script('js/scriptaculous.js?load=effects,builder');
    echo html_include_script('js/lightbox.js');
    // Handle user accepting a hit
    echo '<script type="text/javascript">';
    echo 'function store(form_id, page_id)
{
var form = $(form_id);
//alert($(form).serialize());

// Update database
var success	= function(t){updateSuccess(t);}
var failure	= function(t){updateFailure(t);}

var url = "update.php";
var pars = $(form).serialize() + "&PageID=" + page_id;
var myAjax = new Ajax.Request(url, {method:"post", postBody:pars, onSuccess:success, onFailure:failure});
}

function updateSuccess (t)
{
var s = t.responseText.evalJSON();
//alert(t.responseText);
if (s.is_valid)
{
// we\'ve stored reference, so reload page, which will redirect us to page for reference
window.location.reload(true);
}
else
{
// User did not pass recaptcha so refresh it
Recaptcha.create("' . $config['recaptcha_publickey'] . '",
	"recaptcha_div", {
	theme: "clean",
	callback: Recaptcha.focus_response_field
});
//fadeUp($(recaptcha_div),255,255,153);
}
}

function updateFailure (t)
{
	var s = t.responseText.evalJSON();
	alert("Badness happened:\\n" + t.responseText);
}';
    // Based on http://ne0phyte.com/blog/2008/09/02/javascript-keypress-event/
    // and http://blog.evandavey.com/2008/02/how-to-capture-return-key-from-field.html
    // I want to capture enter key press in recaptcha to avoid submitting the form (user must click
    // on button for that). We listen for keypress and eat it. Note that we attach the listener after
    // the window has loaded.
    echo 'function onMyTextKeypress(event)
{
if (Event.KEY_RETURN == event.keyCode) 
{
// do something usefull
//alert(\'Enter key was pressed.\');		
Event.stop(event);
}
return;
}
Event.observe(window, \'load\', function() {
Event.observe(\'recaptcha_response_field\', \'keypress\', onMyTextKeypress);
});';
    echo '</script>';
    echo html_head_close();
    echo html_body_open();
    echo html_page_header(false);
    echo '<h1>Reference Finder results</h1>';
    if (count($hits) != 0) {
        echo '<form id="metadata_form" action=\'#\'>';
        // referent metadata (hidden). By populating form we can pass metadata to
        // update.php via Ajax call
        echo reference_hidden_form($referent);
        echo '<table border="0" cellpadding="10">';
        foreach ($hits as $hit) {
            echo '<tr>';
            // Thumbnail of page
            echo '<td valign="top">';
            echo '<a href="bhl_image.php?PageID=' . $hit->PageID . '" rel="lightbox">';
            echo '<img style="border:1px solid rgb(128,128,128);" src="bhl_image.php?PageID=' . $hit->PageID . '&amp;thumbnail" alt="page thumbnail"/>';
            echo '</a>';
            echo '</td>';
            // Details of match
            echo '<td valign="top">';
            echo '<div style="margin-bottom:4px;">' . $hit->snippet . '</div>';
            echo "<div><span>Title match score = " . $hit->score . "</span></div>";
            echo '<div><span>BHL PageID </span><a href="http://www.biodiversitylibrary.org/page/' . $hit->PageID . '">' . $hit->PageID . '</a></div>';
            // Action
            echo '<br/><span style="padding:2px;cursor:pointer;background-color:#2D7BB2;color:white;font-size:18px;font-family:Arial;text-align:center" onclick="store(\'metadata_form\', \'' . $hit->PageID . '\');">&nbsp;Click here to accept this match&nbsp;</span>';
            echo '</td>';
            echo '</tr>';
        }
        echo '</table>';
        // Recaptcha
        $recaptcha = !user_is_logged_in();
        if ($recaptcha) {
            echo '<script type="text/javascript">';
            echo 'var RecaptchaOptions = ';
            echo '{';
            echo 'theme: \'white\',';
            echo 'tabindex: 2';
            echo '};';
            echo '</script>';
            echo '<div id="recaptcha_div">';
            //			echo '<script type="text/javascript" src="http://api.recaptcha.net/challenge?k=' . $config['recaptcha_publickey'] . '"></script>';
            // https://groups.google.com/forum/?fromgroups#!topic/recaptcha/V7qswqBnA1o
            echo '<script type="text/javascript" src="https://www.google.com/recaptcha/api/challenge?k=' . $config['recaptcha_publickey'] . '"></script>';
            echo '</div>';
        }
        echo '</form>';
    } else {
        echo '<p>No matching article found</p>';
        echo '<ul>';
        echo '<li><a href="openurl.php">Return to Reference Finder</a></li>';
        echo '<li><a href="http://biodiversitylibrary.org/openurl?' . $_SERVER['QUERY_STRING'] . '" target= "_new">Try to find using BHL OpenURL resolver</a></li>';
        echo '<li><a href="http://bioguid.info/openurl.php?' . $_SERVER['QUERY_STRING'] . '" target= "_new">Try to find using bioGUID OpenURL resolver</a></li>';
        echo '</ul>';
    }
    echo html_body_close();
    echo html_html_close();
}
Ejemplo n.º 3
0
function main($uri)
{
    global $config;
    // Triple store
    global $store_config;
    global $store;
    $uri = urldecode($uri);
    $ntriples = get_canonical_uri($uri);
    //echo $ntriples; exit();
    if ($ntriples == 0) {
        // Fetch URI
        echo '<html>';
        echo '<body>';
        echo 'Sorry, don\'t have this URI <b>' . $uri . '</b>, trying to fetch it...';
        $uri_to_fetch = $uri;
        if (preg_match('/^urn:lsid:/', $uri_to_fetch)) {
            $uri_to_fetch = 'http://bioguid.info/' . $uri_to_fetch;
        }
        echo $uri_to_fetch;
        // can we get it, if so redirect...
        $query = "LOAD <" . $uri_to_fetch . ">";
        $r = $store->query($query);
        /*echo $query;
        		
        		echo '<pre>';
        		print_r($r);
        		echo '</pre>';
        		exit(); */
        if ($r['result']['t_count'] > 0) {
            // Got it, redirect to web page for this URI
            echo '<script type="text/javascript">';
            echo 'document.location="' . $config['web_root'] . 'uri/' . $uri . '";';
            echo '</script>';
        } else {
            // Bugger...
            echo "Badness happened";
        }
        echo '</body>';
        echo '</html>';
    } else {
        // Display info about this object (having issues with CONSTRUCT not returning language codes!?)
        $sparql = "\nCONSTRUCT\n{\n\t<{$uri}> ?o ?p\n}\n\nWHERE \n{ \n\t<{$uri}> ?o ?p\n}\n";
        $sparql = "DESCRIBE <{$uri}>";
        //echo $sparql . "\n";
        // get object
        $r = $store->query($sparql);
        $index = $r['result'];
        $parser = ARC2::getRDFParser();
        $rdfxml_doc = $parser->toRDFXML($index);
        //echo $rdfxml_doc;
        // What type if this?
        $dom = new DOMDocument();
        $dom->loadXML($rdfxml_doc);
        $xpath = new DOMXPath($dom);
        $xpath->registerNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
        $xpath->registerNamespace("dcterms", "http://purl.org/dc/terms/");
        $type = array();
        $xsl_filename = '';
        $html = '';
        $topic_title = '';
        //------------------------------------------------------------------------------------------
        // Get type(s) of objects
        $name = '';
        $nodeCollection = $xpath->query('//rdf:type/@rdf:resource');
        foreach ($nodeCollection as $node) {
            $type[] = $node->firstChild->nodeValue;
        }
        //------------------------------------------------------------------------------------------
        // Post process objects...
        // Publication add sequences...
        // possibe relations are isReferencedBy (stated in GenBank record) and references
        // which is stated in publication if we have links via PubMed.
        if (in_array('http://purl.org/ontology/bibo/Article', $type)) {
            $topic_title = get_title($uri);
            // Sequences
            $xml = query_sequences_from_publication($uri);
            append_xml($dom, $xml);
            // Taxa
            // Geography
            $xml = query_localities_from_publication($uri);
            append_xml($dom, $xml);
        }
        // Journal
        if (in_array('http://purl.org/ontology/bibo/Journal', $type)) {
            $topic_title = get_title($uri);
            $xml = query_articles_from_journal($uri);
            append_xml($dom, $xml);
        }
        // Collection
        if (in_array('http://rs.tdwg.org/ontology/voc/Collection#Collection', $type)) {
            $topic_title = get_title($uri);
            $xml = query_specimens_from_collection($uri);
            append_xml($dom, $xml);
        }
        // GenBank: Add specimen if we have it...
        if (in_array('http://purl.uniprot.org/core/Molecule', $type)) {
            $topic_title = get_title($uri);
            $specimen_uri = '';
            $nodeCollection = $xpath->query('//dcterms:relation/@rdf:resource');
            foreach ($nodeCollection as $node) {
                $specimen_uri = $node->firstChild->nodeValue;
            }
            if ($specimen_uri != '') {
                // Fetch RDF
                $r = describe($specimen_uri);
                $index = $r['result'];
                $extraXml = $parser->toRDFXML($index);
                // Load into current DOM
                $extraDom = new DOMDocument();
                $extraDom->loadXML($extraXml);
                $n = $dom->importNode($extraDom->documentElement, true);
                // Append to root node
                $dom->documentElement->appendChild($n);
            }
        }
        // Specimen
        if (in_array('http://rs.tdwg.org/ontology/voc/TaxonOccurrence#TaxonOccurrence', $type)) {
            // Get sequences from this specimen
            $xml = query_sequences_from_specimen($uri);
            append_xml($dom, $xml);
            $xml = query_publications_from_specimen($uri);
            append_xml($dom, $xml);
        }
        // NCBI taxon
        if (in_array('http://rs.tdwg.org/ontology/voc/TaxonConcept#TaxonConcept', $type)) {
            $topic_title = get_title($uri, '<http://rs.tdwg.org/ontology/voc/TaxonConcept#nameString>');
            // Get sequences from this specimen
            $xml = query_sequences_from_taxon($uri);
            append_xml($dom, $xml);
            $xml = query_localities_from_taxon($uri);
            append_xml($dom, $xml);
            $xml = query_publications_from_taxon($uri);
            append_xml($dom, $xml);
        }
        // Dbpedia
        if (in_array('http://www.opengis.net/gml/_Feature', $type)) {
            $topic_title = get_title($uri, 'rdfs:label', 'en');
        }
        if (in_array('http://www.w3.org/2002/07/owl#Thing', $type)) {
            $topic_title = get_title($uri, 'rdfs:label', 'en');
        }
        //print_r($type);
        //------------------------------------------------------------------------------------------
        // Display
        // Article
        if (in_array('http://purl.org/ontology/bibo/Article', $type)) {
            $xsl_filename = 'xsl/article.xsl';
        }
        // Journal
        if (in_array('http://purl.org/ontology/bibo/Journal', $type)) {
            $xsl_filename = 'xsl/journal.xsl';
        }
        // Dbpedia thing
        if (in_array('http://www.w3.org/2002/07/owl#Thing', $type)) {
            $xsl_filename = 'xsl/dbpedia.xsl';
        }
        // Dbpedia feature
        if (in_array('http://www.opengis.net/gml/_Feature', $type)) {
            $xsl_filename = 'xsl/dbpedia.xsl';
        }
        // genbank sequence
        if (in_array('http://purl.uniprot.org/core/Molecule', $type)) {
            $xsl_filename = 'xsl/genbank.xsl';
        }
        // taxon concept
        if (in_array('http://rs.tdwg.org/ontology/voc/TaxonConcept#TaxonConcept', $type)) {
            $xsl_filename = 'xsl/taxonomy.xsl';
        }
        // Collection
        if (in_array('http://rs.tdwg.org/ontology/voc/Collection#Collection', $type)) {
            $xsl_filename = 'xsl/collection.xsl';
        }
        // Specimen (by itself)
        if (in_array('http://rs.tdwg.org/ontology/voc/TaxonOccurrence#TaxonOccurrence', $type) && !in_array('http://purl.uniprot.org/core/Molecule', $type)) {
            $xsl_filename = 'xsl/occurrence.xsl';
        }
        //------------------------------------------------------------------------------------------
        if ($xsl_filename != '') {
            $xp = new XsltProcessor();
            $xsl = new DomDocument();
            $xsl->load($xsl_filename);
            $xp->importStylesheet($xsl);
            $html = $xp->transformToXML($dom);
        } else {
            $html .= '<p/>';
            $html .= '<div style="padding:10px;background:white;-webkit-border-radius:10px;">';
            $html .= '<pre class="brush:xml">' . htmlentities($dom->saveXML(), ENT_COMPAT, 'UTF-8') . '</pre>';
            $html .= '</div>';
        }
        // Display...
        header("Content-type: text/html; charset=utf-8\n\n");
        echo html_html_open();
        echo html_head_open();
        echo html_title($topic_title);
        echo html_include_css('css/main.css');
        echo html_include_script('js/prototype.js');
        echo html_include_script('js/lookahead.js');
        echo html_include_script('js/browse.js');
        // RDF display
        echo html_include_script('js/shCore.js');
        echo html_include_script('js/shBrushXml.js');
        echo html_include_css('css/shCore.css');
        echo html_include_css('css/shThemeDefault.css');
        echo html_head_close();
        echo html_body_open();
        //echo html_page_header(true, $uri);
        echo '<div id="container">' . "\n";
        echo '   <div id="banner">' . "\n";
        echo html_page_header(true, $uri);
        echo '   </div>' . "\n";
        /*echo '<div id="nav">';
        		echo '   </div>' . "\n";
        		echo '<div id="content">';
        		echo 'xxxxxx';
        		echo '   </div>' . "\n"; */
        /*		echo '<div class="main">';
        		
        		echo '<div class="maincontent">';
        		echo '<div class="maincontent_border">'; */
        if (1) {
            echo $html;
        } else {
            ?>
<div id="nav">
  <div>
    <b>On the Web</b>
    <br>
    <ul type="square">
      <li>
        <a href="http://dx.doi.org/10.1073/pnas.0907926106" target="_new">doi:10.1073/pnas.0907926106</a>
      </li>
    </ul>
    <b>Post to:</b>
    <br>
    <ul type="square">
      <li>Citeulike</li>
      <li>Connotea</li>
      <li>Mendeley</li>
    </ul>
  </div>
</div>
<div id="content">
  <h1>[Article] Bacterial gut symbionts are tightly linked with the evolution of herbivory in ants.</h1>
  <h2>Jacob A Russell, Corrie S Moreau, Benjamin Goldman-Huertas, Mikiko Fujiwara, David J Lohman, Naomi E Pierce</h2>
  <div><span class="internal_link" onclick="lookahead('http://bioguid.info/issn:0027-8424')">Proceedings of the National Academy of Sciences of the United States of America</span> 106: 21236 (2009) doi:10.1073/pnas.0907926106</div>
  <div class="abstract">Ants are a dominant feature of terrestrial ecosystems, yet we know little about the forces that drive their evolution. Recent findings illustrate that their diets range from herbivorous to predaceous, with &amp;quot;herbivores&amp;quot; feeding primarily on exudates from plants and sap-feeding insects. Persistence on these nitrogen-poor food sources raises the question of how ants obtain sufficient nutrition. To investigate the potential role of symbiotic microbes, we have surveyed 283 species from 18 of the 21 ant subfamilies using molecular techniques. Our findings uncovered a wealth of bacteria from across the ants. Notable among the surveyed hosts were herbivorous &amp;quot;turtle ants&amp;quot; from the related genera Cephalotes and Procryptocerus (tribe Cephalotini). These commonly harbored bacteria from ant-specific clades within the Burkholderiales, Pseudomonadales, Rhizobiales, Verrucomicrobiales, and Xanthomonadales, and studies of lab-reared Cephalotes varians characterized these microbes as symbiotic residents of ant guts. Although most of these symbionts were confined to turtle ants, bacteria from an ant-specific clade of Rhizobiales were more broadly distributed. Statistical analyses revealed a strong relationship between herbivory and the prevalence of Rhizobiales gut symbionts within ant genera. Furthermore, a consideration of the ant phylogeny identified at least five independent origins of symbioses between herbivorous ants and related Rhizobiales. Combined with previous findings and the potential for symbiotic nitrogen fixation, our results strongly support the hypothesis that bacteria have facilitated convergent evolution of herbivory across the ants, further implicating symbiosis as a major force in ant evolution.</div>
  <div>
    <ul type="square">
      <li><span class="internal_link" onclick="lookahead('http://bioguid.info/genbank:AF465438')">AF465438</span></li>
    </ul>
  </div>
</div>

	<?php 
        }
        echo '   <div id="footer">' . "\n";
        echo '     <p>About:</p>' . "\n";
        echo '   </div>' . "\n";
        echo '</div>' . "\n";
        // container
        echo '	
<div id="horizon">
	<div id="progress" style="display:none">
        <p>Hello</p>
	</div>
</div>';
        echo '
<script type="text/javascript">
	SyntaxHighlighter.all()
</script>';
        // footer
        echo html_body_close();
        echo html_html_close();
    }
}
Ejemplo n.º 4
0
 function DisplayHtml()
 {
     global $config;
     header("Content-type: text/html; charset=utf-8\n\n");
     echo html_html_open();
     echo html_head_open();
     echo html_title($this->GetTitle() . ' - ' . $config['site_name']);
     $this->DisplayHtmlHead();
     echo html_head_close();
     $this->DisplayBodyOpen();
     $this->DisplayMicroformat();
     $this->DisplayHtmlContent();
     echo html_body_close($this->display_disqus);
     // true to show Disqus comments
     echo html_html_close();
 }
Ejemplo n.º 5
0
function display_form()
{
    global $config;
    header("Content-type: text/html; charset=utf-8\n\n");
    echo html_html_open();
    echo html_head_open();
    echo html_title($config['site_name']);
    echo html_include_css('css/main.css');
    echo html_head_close();
    echo html_body_open();
    echo '<div style="padding:10px;">';
    echo '<h1>OpenURL resolver</h1>';
    // Stuff to go here...
    echo '<h1>' . $config['site_name'] . '</h1>';
    echo '<p>This is a simple OpenURL resolver for </p>';
    echo '<h2>COinS support</h2>';
    echo '<p>If you have a web browser that has extensions that support COinS (e.g., Chrome, Firefox) then set the OpenURL resolver to <b>' . $config['web_server'] . $config['web_root'] . 'openurl' . '</b></p>';
    echo '<p>Otherwise you can drag this bookmarklet ';
    echo '<a href="' . "javascript:(function(){var%20co_d=document;var%20co_s=co_d.getElementsByTagName('span');for(i%20in%20co_s){var%20co_c=co_s[i];var%20co_n=co_c.className;if(co_n%20&&%20co_n.indexOf('Z3988')!=-1){var%20co_a=co_d.createElement('a');co_a.setAttribute('href','http://iphylo.org/~rpage/afd/openurl?'+co_c.getAttribute('title'));co_text=co_d.createTextNode('OpenURL');co_a.appendChild(co_text);co_c.appendChild(co_a);}}})();" . '">AFD OpenURL</a>';
    echo ' to your bookmarks:</p>';
    echo '</div>';
    echo html_body_close(true);
    echo html_html_close();
}
Ejemplo n.º 6
0
function display_outlet($outlet)
{
    global $couch;
    global $config;
    // clean
    $outlet = stripcslashes($outlet);
    echo html_html_open();
    echo html_head_open();
    echo html_title($outlet . ' - ' . $config['site_name']);
    echo html_include_css('css/main.css');
    echo html_include_script('js/jquery-1.4.4.min.js');
    echo html_head_close();
    echo html_body_open();
    echo '<div style="padding:10px;">';
    //----------------------------------------------------------------------------------------------
    // Home
    echo '<span><a href="' . $config['web_root'] . '">' . $config['site_name'] . '</a></span>';
    echo html_search_box();
    //----------------------------------------------------------------------------------------------
    // Outlet
    echo '<h1>' . $outlet . '</h1>';
    //http://localhost:5984/afd/_design/publication/_view/outlet_year_volume?startkey=[%22Annals%20And%20Magazine%20of%20Natural%20History%22]&endkey=[%22Annals%20And%20Magazine%20of%20Natural%20History\ufff0%22]
    $startkey = array($outlet);
    $endkey = array($outlet . '\\ufff0');
    $resp = $couch->send("GET", "/" . $config['couchdb'] . "/_design/publication/_view/outlet_year_volume?startkey=" . urlencode(json_encode($startkey)) . "&endkey=" . urlencode(json_encode($endkey)));
    $articles = json_decode($resp);
    //print_r($articles);
    $num_articles = count($articles->rows);
    if (count($articles) == 0) {
    } else {
        echo '<h2>Articles in this publication (' . $num_articles . ')</h2>';
        if ($num_articles < 20) {
            // list view
            echo '<ul>';
            foreach ($articles->rows as $row) {
                $resp = $couch->send("GET", "/" . $config['couchdb'] . "/" . $row->value);
                $publication = json_decode($resp);
                if (isset($publication->error)) {
                    // We don't have this reference
                } else {
                    echo '<li style="list-style-type:none;">' . display_one_publication($publication) . '</li>';
                }
            }
            echo '</ul>';
        } else {
            // treemap view (should do this with a CouchDB index...)
            $years = array();
            foreach ($articles->rows as $row) {
                $resp = $couch->send("GET", "/" . $config['couchdb'] . "/" . $row->value);
                $publication = json_decode($resp);
                if (isset($publication->error)) {
                    // We don't have this reference
                } else {
                    $year = 'YYYY';
                    if (isset($publication->year)) {
                        $year = $publication->year;
                    }
                    if (!isset($years[$publication->year])) {
                        $years[$publication->year] = array();
                    }
                    $years[$publication->year][] = $row->value;
                }
            }
            // Get sizes of categories
            $size = array();
            foreach ($years as $p) {
                $sizes[] = count($p);
            }
            // Get size of rectangle we want to draw this in
            $r = new Rectangle(0, 0, 400, 500);
            // Construct quantum treemap
            $qt = new QuantumTreemap($sizes, 1.0, $r);
            $qt->quantumLayout();
            $json = $qt->export2json();
            $obj = json_decode($json);
            // Add category labels and list of object ids to each cell in treemap
            $i = 0;
            foreach ($years as $k => $v) {
                $obj->rects[$i]->label = $k;
                $obj->rects[$i]->ids = array();
                foreach ($v as $id) {
                    $obj->rects[$i]->ids[] = $id;
                }
                $i++;
            }
            // Treemap
            echo "\n";
            echo '<div style="position:relative">';
            draw($obj);
            echo '</div>' . "\n";
        }
    }
    echo '<div>';
    echo html_body_close(false);
    echo html_html_close();
}