| 1 | [[TracNav(OntocatGuide)]] |
| 2 | |
| 3 | = Installation = |
| 4 | |
| 5 | Javadoc for OntoCAT can be found [http://ontocat.sourceforge.net/doc/index.html here] (Note that javadoc is also included with the release). |
| 6 | |
| 7 | 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. |
| 8 | |
| 9 | = Getting started = |
| 10 | |
| 11 | Below are step-by-step instructions on how to get started with OntoCAT. |
| 12 | |
| 13 | If you're a proficient Java programmer you may consider skipping to step 4. |
| 14 | |
| 15 | 1. Download and install [http://www.eclipse.org/downloads/ Eclipse IDE for Java Developers].[[BR]]Although any other IDE supporting Java will do, the following steps are based on Eclipse.[[BR]][[BR]][[Image(docs_step1.png, link=, 400px, align=center, border=1)]][[BR]][[BR]] |
| 16 | 1. Create a new Java project: [[BR]][[BR]][[Image(docs_step2.png, link=, 400px, align=center, border=1)]][[BR]][[BR]] |
| 17 | 1. In your new project, lets call it '''Using OntoCAT''', add a '''Lib''' folder to store external libraries: [[BR]][[BR]][[Image(docs_step3.png, link=, 400px, align=center, border=1)]][[BR]][[BR]] |
| 18 | 1. Add all the required libraries to your newly created lib folder.[[BR]]An up-to-date list of required external libraries is available from [http://www.ontocat.org/browser/trunk/ontoCAT/lib here].[[BR]]Alternatively you can use the ontocat_with_deps.jar included in the release that has all the dependencies re-packed.[[BR]][[BR]]Don't forget to add the [http://sourceforge.net/projects/ontocat/files/ latest version] of OntoCAT in there as well.[[BR]][[BR]][[Image(docs_step4.png, link=, 400px, align=center, border=1)]][[BR]][[BR]] |
| 19 | 1. Right click on the project folder and select properties. |
| 20 | a. Go to '''Java Build Path''' section. |
| 21 | a. Select '''Libraries''' tab. |
| 22 | a. Click '''Add JARs....''' |
| 23 | a. Navigate to your project's lib folder and select all the newly copied libraries and click '''OK'''.[[BR]][[BR]][[Image(docs_step5.png, link=, 400px, align=center, border=1)]][[BR]][[BR]] |
| 24 | a. If all went well, you should see all the added jars under a new section '''Referenced Libraries''' on the left side in Package Explorer. |
| 25 | 1. Add a new class to your project and call it Example: [[BR]][[BR]][[Image(docs_step6.png, link=, 400px, align=center, border=1)]][[BR]][[BR]] |
| 26 | 1. Copy the following example code or use any other example provided on the [OntocatGuide Examples] page to test-drive your installation:[[BR]] |
| 27 | {{{ |
| 28 | #!java |
| 29 | import uk.ac.ebi.ontocat.Ontology; |
| 30 | import uk.ac.ebi.ontocat.OntologyService; |
| 31 | import uk.ac.ebi.ontocat.OntologyServiceException; |
| 32 | import uk.ac.ebi.ontocat.ols.OlsOntologyService; |
| 33 | |
| 34 | /** |
| 35 | * Example 1 |
| 36 | * |
| 37 | * Shows how to list all the available ontologies in OLS |
| 38 | * |
| 39 | */ |
| 40 | public class Example { |
| 41 | |
| 42 | public static void main(String[] args) throws OntologyServiceException { |
| 43 | // Instantiate OLS service |
| 44 | OntologyService os = new OlsOntologyService(); |
| 45 | |
| 46 | // For all ontologies in OLS print their |
| 47 | // full label and abbreviation |
| 48 | for (Ontology o : os.getOntologies()) { |
| 49 | StringBuilder sb = new StringBuilder(); |
| 50 | sb.append(o.getAbbreviation()); |
| 51 | sb.append("\t"); |
| 52 | sb.append(o.getLabel()); |
| 53 | System.out.println(sb.toString()); |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | }}} |
| 58 | 1. Right click on the Example class in Package Explorer and select '''Run as Java Application'''. |
| 59 | 1. All done! You're ready to use OntoCAT. |