In simple terms understanding structure of Gene ontology is all about comprehending the Schema of particular Ontology database. Schema of database gives us clear view of how information are stored, tables, fields and their relationship.
Schema Link
In above figure you can see some parts of database where there are tables, fields, attributes, relationship and along with primary ID. Now programming with the GeneOntology is all about knowing how information are stored and way of querying it in Ontology database.
MySql connection parameters for the GO database mirror at the EBI
Parameter Value
host mysql.ebi.ac.uk
user go_select
password amigo
database go_latest
port 4085
Similarly you can manipulate ontology with perl, python, R, Ruby or whatever language you know if you go through documentation.
I strongly believe R is the best choice for programatic manipulation of GO, there are several Bioconductor packages like topGO, GOstats. Further excellent tutorial at Blue Collar Bioinformatics, R & Bioconductor Manual, GO related libraries and more teaching resources
Hope it helps
Edit - Previous Schema image updated!
Thaman, while the answers below are very interesting I wonder what it is you really want to do through "programmatic manipulation of ontologies".
Ethan, while the answers below are very interesting I wonder what it is you really want to do through "programmatic manipulation of ontologies".
i agree with chris - we need a specific example of what you want to achieve