NAME
Net::GraphSpace - API bindings for GraphSpace
VERSION
version 0.0005
SYNOPSIS
use Net::GraphSpace;
use JSON qw(decode_json);
my $client = Net::GraphSpace->new(
user => 'bob',
password => 'secret',
host => 'graphspace.org'
);
my $graph = Net::GraphSpace::Graph->new(name => 'yeast ppi');
my $node1 = Net::GraphSpace::Node->new(id => 'node-a', label => 'A');
my $node2 = Net::GraphSpace::Node->new(id => 'node-b', label => 'B');
my $edge = Net::GraphSpace::Edge->new(
id => 'a-b', source => 'node-a', target => 'node-b');
$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. GraphSpace is a web based graph/network visualization tool and data store. See http://graphspace.org for more information.
ATTRIBUTES
Required:
- user
- password
- host
Optional:
- port
-
Defaults to 80.
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)
SEE ALSO
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.