1 /* 2 * Copyright (c) 2006 Genome Research Limited. 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Library General Public License as published 6 * by the Free Software Foundation; either version 2 of the License or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, but 10 * WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU Library General Public License for more details. 13 * 14 * You should have received a copy of the GNU Library General Public License 15 * along with this program; see the file COPYING.LIB. If not, write to 16 * the Free Software Foundation Inc., 59 Temple Place - Suite 330, 17 * Boston, MA 02111-1307 USA 18 */ 19 20 package org.gmod.schema.dao; 21 22 23 import org.gmod.schema.cv.Cv; 24 import org.gmod.schema.cv.CvTerm; 25 import org.gmod.schema.general.DbXRef; 26 import org.gmod.schema.utils.CountedName; 27 28 import java.util.List; 29 30 public interface CvDaoI extends BaseDaoI { 31 32 /** 33 * Get a CV by id 34 * 35 * @param id the cv id (primary key) 36 * @return the corresponding Cv, or null 37 */ getCvById(int id)38 public abstract Cv getCvById(int id); 39 40 // TODO Should this return a list or just one? 41 /** 42 * Retrieve a controlled vocabulary by its name 43 * 44 * @param name the name to lookup 45 * @return the List<Cv> of matches, or null 46 */ getCvByName(String name)47 public abstract List<Cv> getCvByName(String name); 48 49 /** 50 * Retrieve a CvTerm by id 51 * 52 * @param id then cvterm id (primary key) 53 * @return the corresponding CvTerm, or null 54 */ getCvTermById(int id)55 public abstract CvTerm getCvTermById(int id); 56 57 58 // TODO Should this return a list or just one? 59 /** 60 * Retrieve a named CvTerm from a given Cv 61 * 62 * @param cvTermName the name of the cvterm 63 * @param cv the controlled vocabulary this cvterm is part of 64 * @return a (possibly empty) list of matching cvterms 65 */ getCvTermByNameInCv(String cvTermName, Cv cv)66 public abstract List<CvTerm> getCvTermByNameInCv(String cvTermName, Cv cv); 67 68 69 /** 70 * Retrieve a CvTerm from the Gene Ontology 71 * 72 * @param value the 73 * @return the corresponding CvTerm, or null 74 */ getGoCvTermByAcc(String value)75 public abstract CvTerm getGoCvTermByAcc(String value); 76 77 78 /** 79 * Retrieve a CvTerm from the Gene Ontology via it's database entry 80 * 81 * @param id the database name eg GO:123456 82 * @return the corresponding CvTerm, or null 83 */ getGoCvTermByAccViaDb(final String id)84 public abstract CvTerm getGoCvTermByAccViaDb(final String id); 85 86 87 /** 88 * Retrieve all CvTerms 89 * @return a list of all cvterms 90 */ getCvTerms()91 public abstract List<CvTerm> getCvTerms(); 92 93 /** 94 * Retrieve a named CvTerm from a given Cv 95 * 96 * @param cvTermName the name of the cvterm 97 * @param name the controlled vocabulary name this cvterm could be part of 98 * @return a (possibly empty) cvterm 99 */ getCvTermByNameAndCvName(String cvTermName, String name)100 public abstract CvTerm getCvTermByNameAndCvName(String cvTermName, String name); 101 102 /** 103 * Get a CvTerm by DbXRef 104 * 105 * @param dbXRef the DbXRef 106 * @return the corresponding CvTerm, or null 107 */ getCvTermByDbXRef(DbXRef dbXRef)108 public abstract CvTerm getCvTermByDbXRef(DbXRef dbXRef); 109 existsNameInOntology(String name, Cv ontology)110 public boolean existsNameInOntology(String name, Cv ontology); 111 112 getPossibleMatches(String search, Cv cv, int limit)113 public List<String> getPossibleMatches(String search, Cv cv, int limit); 114 getAllTermsInCvWithCount(Cv cv)115 public List<CountedName> getAllTermsInCvWithCount(Cv cv); 116 117 } 118