source: trunk/ontoCAT/src/uk/ac/ebi/ontocat/examples/Example1.java @ 483

Revision 483, 1.8 KB checked in by tadamusiak, 9 months ago (diff)

added one line descriptions to top of example source files for more descriptive google sitelinks

Line 
1// List all ontologies available through OLS
2/**
3 * Copyright (c) 2010 - 2011 European Molecular Biology Laboratory and University of Groningen
4 *
5 * Contact: ontocat-users@lists.sourceforge.net
6 *
7 * This file is part of OntoCAT
8 *
9 * OntoCAT is free software: you can redistribute it and/or modify it under
10 * the terms of the GNU Lesser General Public License as published by the Free
11 * Software Foundation; either version 3 of the License, or (at your option) any
12 * later version.
13 *
14 * OntoCAT is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU Lesser General Public License along
20 * with OntoCAT. If not, see <http://www.gnu.org/licenses/>.
21 */
22package uk.ac.ebi.ontocat.examples;
23
24import uk.ac.ebi.ontocat.Ontology;
25import uk.ac.ebi.ontocat.OntologyService;
26import uk.ac.ebi.ontocat.OntologyService.SearchOptions;
27import uk.ac.ebi.ontocat.OntologyServiceException;
28import uk.ac.ebi.ontocat.OntologyTerm;
29import uk.ac.ebi.ontocat.ols.OlsOntologyService;
30
31/**
32 * Example 1
33 *
34 * Shows how to list all ontologies available through OLS
35 *
36 */
37public class Example1 {
38        public static void main(String[] args) throws OntologyServiceException {
39                // Instantiate OLS service
40                OntologyService os = new OlsOntologyService();
41
42                // List all available ontologies
43                for (Ontology o : os.getOntologies()) {
44                        System.out.println(o);
45                }
46
47                // Find all terms containing string thymus
48                for (OntologyTerm ot : os.searchAll("thymus", SearchOptions.EXACT,
49                                SearchOptions.INCLUDE_PROPERTIES)) {
50                        System.out.println(ot);
51                }
52        }
53}
Note: See TracBrowser for help on using the repository browser.