import uk.ac.ebi.sbo.sbows.SBOProvider; import uk.ac.ebi.sbo.sbows.SBOProviderServiceLocator; import java.io.PrintWriter; /** * Copyright (C) Melanie Courtot 2006 * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more * details. http://www.gnu.org/licenses/gpl.txt * Melanie Courtot * Computational Neurobiology, EMBL-EBI, Wellcome-Trust Genome Campus. Hinxton CB10 1SD, UK. courtot@ebi.ac.uk */ public class TermOWLClient { public static void main(String [] args) { try { SBOProviderServiceLocator service = new SBOProviderServiceLocator(); //set endpoint adress service.setSBOQueryEndpointAddress("http://www.ebi.ac.uk/compneur-srv/sbo-main/services/SBOQuery"); SBOProvider port = service.getSBOQuery(); PrintWriter out = new PrintWriter(System.out); /** * say hi! */ System.out.println(port.sayHi("hi")); /** * get term by its accession number * SBO:0000144 => client sends 144 */ String term1 = port.getTermByIdOWL(144); System.out.println(term1); /** * get terms which names complete the string parameter * eg "hill" gets back Hill coefficient, Hill constant, Hill equation, Hill equation microscopic form * and Hill equation reduced form * the search is case insensitive but ONLY on the beginning of the name */ String terms1 = port.searchPossibleCompletionsOWL("hill"); System.out.println(terms1); /** * get subtree of a given term * eg SBO:0000055 third order irreversible mass action kinetics * will send back * SBO:0000055 third order irreversible mass action kinetics * SBO:0000056 third order irreversible mass action kinetics, one reactant * SBO:0000057 third order irreversible mass action kinetics, one reactant, continuous scheme * SBO:0000144 third order irreversible mass action kinetics, one reactant, discrete scheme * SBO:0000058 third order irreversible mass action kinetics, two reactants * SBO:0000059 third order irreversible mass action kinetics, two reactants, continuous scheme * SBO:0000145 third order irreversible mass action kinetics, two reactants, discrete scheme * SBO:0000060 third order irreversible mass action kinetics, three reactants * SBO:0000061 third order irreversible mass action kinetics, three reactants, continuous scheme * SBO:0000146 third order irreversible mass action kinetics, three reactants, discrete scheme */ String terms2 = port.getTreeOWL(55); System.out.println(terms2); /** * Example subtree * SBO:0000041 irreversible mass action kinetics is parent of * SBO:0000043 zeroth order irreversible mass action kinetics is parent of * SBO:0000047 zeroth order irreversible mass action kinetics, continuous scheme * * the following should print out: * is SBO:0000043 direct child of SBO:0000041 true * is SBO:0000047 direct child of SBO:0000041 false * is SBO:0000043 child of SBO:0000041 true * is SBO:0000047 child of SBO:0000041 true * * works also with relationship partOf: * is SBO:0000002 direct child of SBO:0000000 true * is SBO:0000009 direct child of SBO:0000000 false * is SBO:0000002 child of SBO:0000000 true * is SBO:0000009 child of SBO:0000000 true */ /** * is SBO:0000043 direct child of SBO:0000041 =>true */ boolean isDirectChildOf1 = port.isDirectChildOf(43,41); System.out.println("is SBO:0000043 direct child of SBO:0000041 "+isDirectChildOf1); /** * is SBO:0000047 direct child of SBO:0000041 =>false */ boolean isDirectChildOf2 = port.isDirectChildOf(47,41); System.out.println("is SBO:0000047 direct child of SBO:0000041 "+isDirectChildOf2); /** * is SBO:0000043 child of SBO:0000041 =>true */ boolean isChildOf1 = port.isChildOf(43,41); System.out.println("is SBO:0000043 child of SBO:0000041 "+isChildOf1); /** * is SBO:0000047 direct child of SBO:0000041 =>true */ boolean isChildOf2 = port.isChildOf(47,41); System.out.println("is SBO:0000047 child of SBO:0000041 "+isChildOf2); /** * We give an array of SBOIds and we want to get the corresponding terms back */ int[] sboIdsInput = {144, 55, 2, 9, 43}; String terms3 = port.getTermsByIdsOWL(sboIdsInput); System.out.println(terms3); } catch (Exception e) { System.out.println(e.toString()); } } }