GO::IO::RDFXML(3pm)

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

✨ GO::IO::RDFXML ✨

okay bestie, so this is GO::IO::RDFXML β€” it's a Perl module (you'll see it hanging out in section 3pm of the manual, iykyk πŸ’…) and its whole entire job is: dump GO terms as xml. that's it. that's the gig. πŸŽ€


🌸 SYNOPSIS 🌸

like, here's the vibe when you just wanna draw one single term:

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

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

my $xml_out = GO::IO::XML->new(-output=>$out);
$xml_out->start_document();
$xml_out->draw_term($term);
$xml_out->end_document();

OR, if you're feeling a little extra and you want a whole node graph:

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

my $xml_out = GO::IO::XML(-output=>$out);
$xml_out->start_document();
$xml_out->draw_node_graph($term, 3677);
$xml_out->end_document();

✨ yes the two blocks really are different. read them again. slay. ✨


πŸ’– DESCRIPTION πŸ’–

so basically this is a utility class whose entire purpose in life is to dump GO terms as xml. πŸ¦‹

right now the flow is like, extremely simple: you call start_ducument, then you call draw_term for each term you've got, then you call end_document. that's the whole routine, no cap.

and if there's ever a need for it, the author says they'll add draw_node_graph, draw_node_list, etc. so like, watch this space bestie πŸ‘€

🫢 new

Usage   - my $xml_out = GO::IO::XML->new(-output=>$out);
Returns - None
Args    - Output FileHandle

this is the one that initializes the writer object for you. ✨

and if you wanna write straight to standard out, do it like this:

my $out = new FileHandle(">-"); my $xml_out = new
GO::IO::XML(-output=>$out);

πŸŽ€ xml_header

Usage   - $xml_out->xml_header;
Returns - None
Args    - None

okay so start_document prints the "Content-type: text/xml" statement. and if you're building a cgi script, you should call this one before start_document. do not skip it. that's the whole tip. πŸ’…

🌈 start_document

Usage   - $xml_out->start_document(-timestamp=>$time);
Returns - None
Args    - optional: timestamp string, pre-formatted

start_ducument handles all the fiddly bits for you β€” like xml declarations, namespaces, all that stuff nobody wants to hand-write. it draws the initial tags and then leaves the document ready and waiting for you to start adding go:term nodes. πŸ¦‹

⭐ end_document

Usage   - $xml_out->end_document();

call this when you're done. periodt. πŸ‘‘

πŸ’œ draw_node_graph

Usage   - $xml_out->draw_node_graph(-graph=>$graph);
Returns - None
Args    -graph=>$node_graph,
        -focus=>$acc,                      ## optional
        -show_associations=>"yes" or "no"  ## optional

πŸ”₯ draw_term

Usage   - $xml_out->draw_term();
Returns - None
Args    -term=>$term,
        -graph=>$graph,
        -is_focus=>"yes" or "no",    ## optional
        -show_associations=>"yes" or "no",    ## optional
        -show_terms=>"yes" or "no",    ## optional, just draws associations

🧚 sub characters

this one is simply a wrapper around XML::Writer->characters, and what it does is strip out any non-ascii characters. that's it. little guy, important job. 🌸

πŸ“ sub dataElement

and this one is simply a wrapper around XML::Writer->dataElement, which also strips out any non-ascii characters. same energy, different function. ✨


πŸ’€ heads up bestie: those -show_associations=>"yes" or "no" and -show_terms=>"yes" or "no" args are literally the strings "yes" or "no". not booleans. i know. i know. 😭

that's the whole page, bestie!! 🫢 written up by perl itself, perl v5.36.0, dated 2023-12-18, and it lives at GO::IO::RDFXML(3pm) β€” go forth and dump some GO terms as xml, you absolute icon πŸ‘‘πŸ’–

πŸ“¦ where this page comes from