GO::IO::go_assoc(3pm)

πŸ“¦
version 0.15 Β· 2 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– GO::IO::go_assoc β€” it's in the 3pm perl manual bestie πŸ’–

okay so you found the GO::IO::go_assoc page in your perl docs and you're like "what is this" β€” don't worry, I got you. User Contributed Perl Documentation, and honestly? iconic of them.


✨ NAME ✨

GO::IO::go_assoc β€” dump GO terms as OBD XML 🫢


🌸 SYNOPSIS 🌸

my $apph = GO::AppHandle->connect(-d=>$go, -dbhost=>$dbhost);
my $term = $apph->get_term({acc=>00003677});

#### ">-" is STDOUT
my $out = new FileHandle(">-");

my $ga_out = GO::IO::go_assoc->new(-output=>$out);
$ga_out->write_term($term);

OR, if you're feeling a lil extra πŸ’…:

my $apph = GO::AppHandle->connect(-d=>$go, -dbhost=>$dbhost);
my $graph = $apph->get_node_graph(-acc=>00003677, -depth=>2);
my $out = new FileHandle(">-");

my $ga_out = GO::IO::go_assoc->new(-output=>$out);
$ga_out->write_graph($graph);

πŸ¦‹ DESCRIPTION πŸ¦‹

It's a utility class, bestie. Its whole job is dumping GO terms as OBD XML. Currently, the whole flow is literally: you call start_document, then write_term for each term, then end_document. That's the vibe. That's the whole routine. periodt. ✨

πŸŽ€ new πŸŽ€

Usage   - my $ga_out = new GO::IO::go_assoc(-output=>$out);
Returns - Output emitter.
Args    - Output FileHandle

Bestie this initializes the writer object. And listen β€” if you wanna write to standard out, do exactly this:

my $out = new FileHandle(">-"); my $ga_out = new GO::IO::go_assoc($out);

πŸŽ€ cgi_header πŸŽ€

Usage   - $ga_out->cgi_header;
Returns - None
Args    - None

cgi_header prints the "Content-type: text/plain" statement. no cap. If you're creating a CGI script, you should call this before further action β€” like, before you do literally anything else. respect the order. πŸ™ˆ

πŸŽ€ write_graph πŸŽ€

Usage   - $ga_out->write_graph(-graph=>$graph);
Returns - None
Args    -graph=>$graph,
        -deep=>1 or 0,           # optional, default 0.
        -qualifier=>1 or 0,      # optional, default 1.
        -with=>1 or 0,           # optional, default 1.
        -object_name=>1 or 0,    # optional, default 1.
        -object_synonym=>1 or 0, # optional, default 1.

gives nothing back (None), takes all the flags above. note the defaults, they're sneaky: -deep defaults to 0, and -qualifier, -with, -object_name, and -object_synonym all default to 1. πŸ‘‘

πŸŽ€ write_term_list πŸŽ€

Usage   - $ga_out->write_term_list();
Returns - None
Args    -term_listref=>$term_listref,
        -deep=>1 or 0,           # optional, default 0.
        -qualifier=>1 or 0,      # optional, default 1.
        -with=>1 or 0,           # optional, default 1.
        -object_name=>1 or 0,    # optional, default 1.
        -object_synonym=>1 or 0, # optional, default 1.

same deal, but you're handing it a -term_listref instead. Returns - None, args are the same lil family of flags with the exact same defaults. πŸ“

πŸŽ€ write_term πŸŽ€

Usage   - $ga_out->write_term();
Returns - None
Args    -term=>$term,
        -deep=>1 or 0,           # optional, default 0.
        -qualifier=>1 or 0,      # optional, default 1.
        -with=>1 or 0,           # optional, default 1.
        -object_name=>1 or 0,    # optional, default 1.
        -object_synonym=>1 or 0, # optional, default 1.

and finally the one you'll probably use every single time: -term=>$term, plus that same iconic squad of optional flags. -deep = 0, everything else = 1. returns None. that's it, that's the whole function. slay. πŸ’…


🫢 quick reminder bestie: -- no wait. just remember -deep defaults to 0 and the other four default to 1. iykyk. don't come for me if you flip one and your XML looks different.

πŸ’– that's the whole page!! πŸ’– this gem came to you via perl v5.36.0, dated 2023-12-18, and it lives under GO::IO::go_assoc(3pm). go forth and dump those GO terms, main character. ✨🌷🧚

πŸ“¦ where this page comes from