NAME
Graph::Reader::OID - Perl class for reading a graph from OID format.
SYNOPSIS
use Graph::Reader::OID;
my $obj = Graph::Reader::OID->new;
my $graph = $obj->read_graph($oid_file);
METHODS
new()
-
Constructor. This doesn't take any arguments. Returns Graph::Reader::OID object.
read_graph($tgf_file)
-
Read a graph from the specified file. The argument can either be a filename, or a filehandle for a previously opened file. Returns Graph object.
OID FILE FORMAT
File format with OID list.
For OID (Object identifier) see L<Object identifier|https://en.wikipedia.org/wiki/Object_identifier>
Example:
1.2.410.200047.11.2013.10234913023321120142141561581 Label #1
1.2.276.0.7230010.3.0.3.6.1 Label #2
EXAMPLE
use strict;
use warnings;
use Graph::Reader::OID;
use IO::Barf qw(barf);
use File::Temp qw(tempfile);
# Example data.
my $data = <<'END';
1.2.410.200047.11.2013.10234913023321120142141561581 Label #1
1.2.276.0.7230010.3.0.3.6.1 Label #2
END
# Temporary file.
my (undef, $tempfile) = tempfile();
# Save data to temp file.
barf($tempfile, $data);
# Reader object.
my $obj = Graph::Reader::OID->new;
# Get graph from file.
my $g = $obj->read_graph($tempfile);
# Print to output.
print $g."\n";
# Clean temporary file.
unlink $tempfile;
# Output:
# 1-1.2,1.2-1.2.276,1.2-1.2.410,1.2.276-1.2.276.0,1.2.276.0-1.2.276.0.7230010,1.2.276.0.7230010-1.2.276.0.7230010.3,1.2.276.0.7230010.3-1.2.276.0.7230010.3.0,1.2.276.0.7230010.3.0-1.2.276.0.7230010.3.0.3,1.2.276.0.7230010.3.0.3-1.2.276.0.7230010.3.0.3.6,1.2.276.0.7230010.3.0.3.6-1.2.276.0.7230010.3.0.3.6.1,1.2.410-1.2.410.200047,1.2.410.200047-1.2.410.200047.11,1.2.410.200047.11-1.2.410.200047.11.2013,1.2.410.200047.11.2013-1.2.410.200047.11.2013.10234913023321120142141561581
DEPENDENCIES
SEE ALSO
- Graph::Reader
-
base class for Graph file format readers
- Task::Graph::Reader
-
Install the Graph::Reader modules.
- Task::Graph::Writer
-
Install the Graph::Writer modules.
REPOSITORY
https://github.com/michal-josef-spacek/Graph-Reader-OID
AUTHOR
Michal Josef Špaček mailto:skim@cpan.org
LICENSE AND COPYRIGHT
© 2014-2023 Michal Josef Špaček
BSD 2-Clause License
VERSION
0.05