Edit this page on GitHub

OBD API Documentation

This section is to document the inherited (and sometimes modified) code in Java, Perl, and SQL, that downloads the ontologies and data from various repositories and locations online, and finally reasons with (as in infers implicit knowledge from) the downloaded data.

WARNING: This section will probably never be properly formatted. It is meant mainly to be a breadcrumb trail for the author (Cartik).

OBD Data Model Entities

**DataAdapter ** *\<org.bbop.dataadapter\>*

**DataAdapterUI ** *\<org.bbop.dataadapter\>*

**Namespace ** *\<org.obo.datamodel\>*

**IdentifiableObject ** *\<org.obo.datamodel\>*

**NestedValue ** *\<org.obo.datamodel\>*

**PropertyValue ** *\<org.obo.datamodel\>*

**NamespacedObject ** *\<org.obo.datamodel\>*

**IdentifiedObject ** *\<org.obo.datamodel\>*

**Relationship ** *\<org.obo.datamodel\>*

**Link ** *\<org.obo.datamodel\>*

**LinkedObject ** *\<org.obo.datamodel\>*

**DefinedObject ** *\<org.obo.datamodel\>*

**DbXref ** *\<org.obo.datamodel\>*

**DataType ** *\<org.obo.datamodel\>*

StringRelationship <org.obo.dataadapter>

**HistoryItem ** *\<org.obo.history\>*

Ontology Loader Entities

obd-create-db.pl

obd-load-db-from-obo.pl

*# Each ontology is downloaded using the ‘wget’ method from Perl

*# After download, the ‘obo2database” Shell script is invoked from the “../launch_scripts” directory for each ontology

obo2database

This is a wrapper shell script for the ‘OBO2Database’ Java class in the ‘<org.oboedit.launcher>’ package. This script:

  1. Gathers all the required library (JAR file) locations on the file system and puts them together in a command line CLASSPATH argument
  2. The name of the ontology file (download location), and name of the database to load the definitions into are assembled as command line arguments. IN addition to these, the command line argument also includes options for ‘allowdangling’ and ‘o’
  3. VM options are assembled from the obo2database.vmoptions file in the “/launch_scripts” directory. Typically, this file specifies the memory usage requirements for the Java class as 1024 Kb (‘-Xmx1024m’)
  4. The OBO2Database class is now invoked with the assembled class path and command line arguments to start loading the ontology terms into the database

OBO2Database <org.oboedit.launcher>

This class does two things in order: reads in definitions from an OBO ontology and loads them into an OBOSession object, and then reads out from the OBOSession object and loads them into a relational database. To read in the OBO ontology, it uses an OBOFileAdapter <org.obo.dataadapter.OBOFileAdapter> object with a ReadConfiguration object. To write to the database, it uses an OBDSQLDatabaseAdapter <org,obo.dataadapter.OBDSQLDatabaseAdapter> with a WriteConfiguration object.

The key method in this class is the convertFiles() method which has the OBOFileAdapter and OBDSQLDatabaseAdapter objects with all the attendant configuration parameters set to appropriate values (‘setBasicSave’ is false, -allowdangling’ is read in from the command line, the ‘-o’ option creates a FilteredPath object with a SessionReasoner parameter set to false, etc), as arguments. The converFiles() method first calls the doOperation() method of the OBOFileAdapter class.

Here is an outline of the flow of command

1. OBO2Database -> convertFiles(OBOFileAdapter.OBOAdapterConfiguration, OBDSQLDatabaseAdapter.OBDSQLDatabaseAdapterConfiguration, false, false, false, null)

calls

1.1 OBOFileAdapter -> doOperation(OBOAdapter.READ_ONTOLOGY, OBOFileAdapter.OBOAdapterConfiguration, null)

In this method, a OBOSimpleParser <org.obo.dataadapter.OBOSimpleParser> object is created and all the read configuration parameters are set. This OBOSimpleParserObject is then used to create an OBOParseEngine <org.obo.dataadapter.OBOParseEngine> object. The parse() method of this OBOParseEngine object is now invoked. The method is defined in the AbstractParseEngine class <org.obo.dataadapter.AbstractParseEngine>

1.1 OBOFileAdapter -> doOperation(OBOAdapter.READ_ONTOLOGY, OBOFileAdapter.OBOAdapterConfiguration, null)

calls

1.1.1 AbstractParseEngine -> parse();

After a slew of method calls that initialize instance variables across OBOParseEngine, and SimpleOBOParser instances, this method (1.1.1) calls

OBOParseEngine -> doParse(String path)

This is the method which actually READS the ontology file

Line by line, this method invokes OBOParseEngine -> parseTag() which invokes OBOParseEngine -> parseTagValue() methods to work with the name-value definitions in the input OBO file

OBOParseEngine -> parseTagValue()

In this method, depending on what tag is being processed, different methods are invoked to store the value of the tag.

All these method definitions are in DefaultOBOParser class

After all the definitions are stored in the “OBOSession” instance (which is what OBOFileAdapter -> doOperation(OBOAdapter.READ_ONTOLOGY, OBOFileAdapter.OBOAdapterConfiguration, null) essentially does

1. OBO2Database -> convertFiles(OBOFileAdapter.OBOAdapterConfiguration, OBDSQLDatabaseAdapter.OBDSQLDatabaseAdapterConfiguration, false, false, false, null)

calls

1.2 OBDSQLDatabaseAdapter -> doOperation(OBDSQLDatabaseAdapter.WRITE_ONTOLOGY, OBDSQLDatabaseAdapter.OBDSQLDatabaseAdapterConfiguration, OBOSession)

which starts to load in all the objects stored in OBOSession into the relational database

1.2 OBDSQLDatabaseAdapter -> doOperation(OBDSQLDatabaseAdapter.WRITE_ONTOLOGY, OBDSQLDatabaseAdapter.OBDSQLDatabaseAdapterConfiguration, OBOSession)

calls

OBDSQLDatabaseAdapter -> storeAll(OBOSession, LinkDatabase)

This method gets the connection to the database and starts to write to the database. First the subset categories such as “attribute_slim” etc are written in. Then the objects are cycled through.

If object is not an annotation,

OBDSQLDatabaseAdapter -> saveObject(IdentifiedObject) is invoked.

In this method, various stored procedures from ‘../sql/api/obd-mutable-api.plpgsql’ PLPGSQL script file are invoked to store the nodes and defined links from each node. DbXRef, subset, and various other links are entered into the database in this method.