Example #1
0
<?php

##########################################################
# Testeley - Testing the Mendeley API
#
# Script: sim.php
#
# Shows the contents of the similarity table in the
# local database.
#
# HS 2011-07-06
##########################################################
require_once 'config.inc.php';
require_once 'functions.inc.php';
require_once 'LitDb.php';
$db = new LitDb(DB_PATH);
$sims = $db->get_all_sim();
if (isset($_GET['format']) && $_GET['format'] == "tsv") {
    header('Content-type: text/plain');
    //header('Content-Disposition: attachment; filename="edges.txt"');
    foreach ($sims as $s) {
        echo $s[0] . "\t" . $s[1] . "\n";
    }
} else {
    html_header();
    link_home();
    if (count($sims) > 0) {
        echo '<h3>Similarity relations in local database: ' . count($sims) . '</h3>';
        foreach ($sims as $s) {
            $u1 = $s[0];
            $u2 = $s[1];
Example #2
0
#
# HS 2011-06-15
##########################################################
require_once 'config.inc.php';
require_once 'functions.inc.php';
require_once 'Mendeley.php';
require_once 'LitDb.php';
$mendeley = new Mendeley(API_KEY);
if (isset($_GET['uuid']) && $_GET['uuid'] != "") {
    $uuid = $_GET['uuid'];
    is_uuid($uuid) or die('invalid uuid');
    if (isset($_GET['format']) && $_GET['format'] == "raw") {
        $json = $mendeley->fetch_details($uuid);
        format_json($json);
    } else {
        html_header();
        link_home();
        $paper = $mendeley->get_document($uuid);
        $paper->format_html();
        $db = new LitDb(DB_PATH);
        if ($db->in_db($paper->uuid)) {
            echo '</p>Paper already in DB</p>';
        } else {
            $db->to_db($paper);
            echo '<p>Paper added to DB</p>';
        }
        html_footer();
    }
} else {
    echo 'No UUID given.';
}
Example #3
0
$mendeley = new Mendeley(API_KEY);
if (isset($_GET['uuid']) && $_GET['uuid'] != "") {
    $uuid = $_GET['uuid'];
    is_uuid($uuid) or die('invalid uuid');
    if (isset($_GET['format']) && $_GET['format'] == "raw") {
        $json = $mendeley->fetch_related($uuid);
        format_json($json);
    } else {
        html_header();
        $uuids = $mendeley->get_related_uuids($uuid);
        if (count($uuids) == 0) {
            echo 'No documents found';
            link_home();
        } else {
            $paper = $mendeley->get_document($uuid);
            $db = new LitDb(DB_PATH);
            if (!$db->in_db($uuid)) {
                $db->to_db($paper);
            }
            link_home();
            echo '<h3>Related documents for ' . $uuid . '</h3>';
            foreach ($uuids as $uuid2) {
                $paper2 = $mendeley->get_document($uuid2);
                if (!$db->in_db($uuid2)) {
                    $db->to_db($paper2);
                }
                if (!$db->sim_in_db($uuid, $uuid2)) {
                    $db->sim_to_db($uuid, $uuid2);
                }
                echo '<P>';
                $paper2->format_html();
Example #4
0
<?php

##########################################################
# Testeley - Testing the Mendeley API
#
# Script: expand.php
#
# Find for all papers in the local database the related
# papers via the Mendeley API.
#
# HS 2011-06-15
##########################################################
require_once 'config.inc.php';
require_once 'functions.inc.php';
require_once 'LitDb.php';
apache_setenv('no-gzip', '1');
html_header();
link_home();
$db = new LitDb(DB_PATH);
?>
<h3>Before</h3>
<?php 
$db->print_db_stats();
$db->expand();
?>
<h3>After</h3>
<?php 
$db->print_db_stats();
html_footer();
Example #5
0
<head>
<link href="main.css" media="all" rel="stylesheet" type="text/css" />
<title>Testeley</title>
</head>
<body>
<?php 
echo "<h1>Testeley - Testing the Mendeley API</h1>";
echo '<h2>Group Functions</h2>';
echo '<p>';
echo '<a href="http://www.bifx.de/testeley/group.php?gid=', AGLAPPE, '">Papers in group AGLappe</a><br>';
echo '<a href="http://www.bifx.de/testeley/group.php?gid=', BIOWIKI, '">Papers in group BioWiki</a><br>';
echo '<a href="http://www.bifx.de/testeley/group.php?gid=', TESTELEY, '">Papers in group Testeley</a><br>';
echo '</p>';
echo '<h2>Local Database</h2>';
try {
    $db = new LitDb(DB_PATH);
    echo '<p>';
    $db->print_db_stats();
    echo '</p>';
} catch (Exception $e) {
}
echo '<p>';
echo '<a href="http://www.bifx.de/testeley/db.php">Papers in local database</a> (<a href="http://www.bifx.de/testeley/db.php?format=tsv">Download as tsv</a>)<br />';
echo '<a href="http://www.bifx.de/testeley/sim.php">Similarities in local database</a> (<a href="http://www.bifx.de/testeley/sim.php?format=tsv">Download as tsv</a>)<br />';
echo '<a href="http://www.bifx.de/testeley/expand.php">Find related for all papers</a> (fetch related articles for all papers in <i>documents</i> table)<br />';
echo '<a href="http://www.bifx.de/testeley/db.php?action=delete">Reset database</a> (deletes all entries)';
echo '<br />';
echo '</p>';
echo '<h2>Help</h2>';
echo '<ul class="help">';
echo '<li>To get started, choose one of the groups under <i>Group Functions</i>';
Example #6
0
<?php

##########################################################
# Testeley - Testing the Mendeley API
#
# Script: db.php
#
# Shows the contents of the literature database. If the
# database does not already exist, it is created.
#
# HS 2011-06-29
##########################################################
require_once 'config.inc.php';
require_once 'functions.inc.php';
require_once 'LitDb.php';
$db = new LitDb(DB_PATH);
if (isset($_GET['action']) && $_GET['action'] == "create") {
    html_header();
    link_home();
    $db->create();
    html_footer();
} elseif (isset($_GET['action']) && $_GET['action'] == "delete") {
    html_header();
    link_home();
    $db->delete();
    html_footer();
} else {
    $papers = $db->get_all_papers();
    if (isset($_GET['format']) && $_GET['format'] == "tsv") {
        header('Content-type: text/plain');
        //header('Content-Disposition: attachment; filename="nodes.txt"');