NAME

Net::GraphSpace - API bindings for GraphSpace

VERSION

version 0.0001

SYNOPSIS

use Net::GraphSpace;
use JSON qw(decode_json);

my $client = Net::GraphSpace->new(
    user     => 'bob',
    password => 'secret',
    server   => 'http://foo.com'
);
my $graph = Net::GraphSpace::Graph->new(name => 'yeast ppi');
my $node1 = Net::GraphSpace::Node->new(id => 1, label => 'A');
my $node2 = Net::GraphSpace::Node->new(id => 2, label => 'B');
my $edge = Net::GraphSpace::Edge->new(
    id => '1-2', source => 1, target => 2);
$graph->add_nodes([$node1, $node2]);
$graph->add_edge($edge);
$graph->add_node(Net::GraphSpace::Node->new(id => 3, label => 'C'));

# Upload graph to server
my $data = $client->add_graph($graph);
my $graph_id = $data->{id};
my $url = $data->{url};
print "Your graph (id: $graph_id) can be viewed at $url\n";

# Get and update a graph
$graph = $clent->get_graph($graph_id);
$graph->tags(['foo', 'bar']);
$client->update_graph($graph_id, $graph);

# Delete a graph
$client->delete_graph($graph_id);

DESCRIPTION

Net::GraphSpace provides bindings for the GraphSpace API.

ATTRIBUTES

Required:

user
password
server

The url of the server where GraphSpace is hosted.

name

METHODS

new(%params)

Takes key/value arguments corresponding to the attributes above.

add_graph($graph)

Takes a Net::GraphSpace::Graph object and uploads it. Returns a hashref of the form:

{
    id => 1,
    url => 'http://...',
}

The url is the location where the graph can be viewed.

get_graph($graph_id)

Returns a Net::GraphSpace::Graph object for the given $graph_id.

update_graph($graph_id, $graph)

Updates the graph on the server with id $graph_id by replacing it with $graph.

delete_graph($graph_id)

AUTHOR

Naveed Massjouni <naveedm9@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Naveed Massjouni.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.