wiki:OntocatInstallation

Version 1 (modified by Morris Swertz, 9 years ago) (diff)

--

TracNav(OntocatGuide)?

Installation

Javadoc for OntoCAT can be found here (Note that javadoc is also included with the release).

In order to use OntoCAT in your own applications, you should download the latest binary release and ensure that all of the jar files are in the application class path. Please see the next section for detailed instructions.

Getting started

Below are step-by-step instructions on how to get started with OntoCAT.

If you're a proficient Java programmer you may consider skipping to step 4.

  1. Download and install Eclipse IDE for Java Developers.
    Although any other IDE supporting Java will do, the following steps are based on Eclipse.



  2. Create a new Java project:



  3. In your new project, lets call it Using OntoCAT, add a Lib folder to store external libraries:



  4. Add all the required libraries to your newly created lib folder.
    An up-to-date list of required external libraries is available from here.
    Alternatively you can use the ontocat_with_deps.jar included in the release that has all the dependencies re-packed.

    Don't forget to add the latest version of OntoCAT in there as well.



  5. Right click on the project folder and select properties.
    1. Go to Java Build Path section.
    2. Select Libraries tab.
    3. Click Add JARs....
    4. Navigate to your project's lib folder and select all the newly copied libraries and click OK.



    5. If all went well, you should see all the added jars under a new section Referenced Libraries on the left side in Package Explorer.
  6. Add a new class to your project and call it Example:



  7. Copy the following example code or use any other example provided on the Examples page to test-drive your installation:
    import uk.ac.ebi.ontocat.Ontology;
    import uk.ac.ebi.ontocat.OntologyService;
    import uk.ac.ebi.ontocat.OntologyServiceException;
    import uk.ac.ebi.ontocat.ols.OlsOntologyService;
    
    /**
    * Example 1
    * 
    * Shows how to list all the available ontologies in OLS
    * 
    */
    public class Example {
    
      public static void main(String[] args) throws OntologyServiceException {
            // Instantiate OLS service
            OntologyService os = new OlsOntologyService();
    
            // For all ontologies in OLS print their
            // full label and abbreviation
            for (Ontology o : os.getOntologies()) {
                    StringBuilder sb = new StringBuilder();
                    sb.append(o.getAbbreviation());
                    sb.append("\t");
                    sb.append(o.getLabel());
                    System.out.println(sb.toString());
            }
      }
    }
    
  8. Right click on the Example class in Package Explorer and select Run as Java Application.
  9. All done! You're ready to use OntoCAT.

Attachments (6)

Download all attachments as: .zip